Old Coding Habits Die Hard
August 28, 2003 |
5 Comments
Or, The Tale of The Table.
Here is a real world example of how traditional Web developers think. I’m guilty of this and I imagine many of us who’ve been building Web sites for a long time are as well.
I’m currently working on a huge redesign project and I’m doing my best to develop this site in such a way that it’s forward-thinking, standard, semantically correct, easy to use, easy to maintain, and the list goes on.
There are many, many challenges in our way with this site. It was designed by consultants, it’s got multiple audiences, an immense IA, multiple developers, CMS integration (not standards there) and again, the list goes on.
Well, the other day I’m working on some of the pages, which for the most part are simple text based content. I’ve coded these pages in such a way that they will be as future-proof as possible given some design and legacy code challenges. I’m using semantic code, standards, etc. To be honest this was the easiest part going forward — don’t even ask about our CMS. Anyway, the content just begs to be coded this way. Semantic, standard code makes sense.
On a few of the pages we have lists, and two column tables containing various information and a small few forms. One of these was a simple e-mail subscription type form. You know, “enter your email to be updated…” A text field with a “submit” button. Simple.
There was a need to set this apart on the page a bit, so there’d been a background and border added. Just for kicks I checked the code. I noticed that a table was being used for the layout of this simple form, complete with it’s own inline styles. Looked like a Dreamweaver job.
I thought to myself, hmm, do we need all this? Nope. In a matter of about 2 minutes I’d removed the style, placed it into the style sheet attached it to the form element. Now all that is in my code was a form with an CLASS attribute that contained a text field and submit button. Clean, clear, easy. It looked exactly the same to the user, yet I had eliminated quite a bit of extraneous tags. Plus now I had a style I could easily hook in to other, similar forms on the site.
Why was it done this way? It’s all about mindset. This is how we think at times. “Forms need a table to lay them out.” Period. We don’t even think about using CSS at first, because standards, semantic coding, etc. are not yet second nature to many developers and designers, even those who “get” it. Some times we choose old methods because they are simply more comfortable, or more predictable. Sometimes we’re too busy to even realize what we’re doing.
I mean if you’ve been doing something the same way for years and it works the same every time it can be a hard habit to break. I’d bet even the most forward-thinking designers and developers revert back to old habits now and then.
The point here is the more comfortable, old second nature way of doing this was actually much more complex than the new way I did it. And like I said, there is the added benefit of never having to do it again. Next time I can just attach the style to the form. It didn’t really take any more knowledge of CSS or XHTML or anything. All it took was looking at things with a different mindset. You know, “work smarter, not harder.”
I hate to say “think outside the box” but in this case it literally makes sense.
Filed under: Web Development
Comments
1. Submunition said:
Good points sir. One thing that I notice when working with other developers is a certain reluctance to move to CSS/XHTML layout and development.
It’s a true case of old habits die hard, and some people cannot be bothered to navigate a relatively slight learning curve in order to understand a more efficient and powerful technique.
It’s often hard to outline these benefits without sounding like some standards zealot(which I am not necessarily), but when they see how much more efficient, how much more elegant, it all is, they see that this how it should have been done from day one.
I am just trying to figure out how to inform and convince my colleagues to work with CSS/XHTML code. I am often surprised at the resistance.
Posted on August 28, 2003 02:37 PM | #
2. Peter said:
It’s a mindset for sure. But there’s some inherent laziness as well…it’s so much easier to simply lay out the form with a table than try to think through a style that may need to be reused in the future.
Posted on August 28, 2003 05:51 PM | #
3. Sam Newman said:
Speaking as someone whose day job is that of a J2EE developer, the world of XHTML/CSS makes a whole lot of sense to me. I deal with the seperation of data and presentation day in, day out with JSP/Struts etc. Once I’d got back into the swing of doing webpages again as I did for my blog (I used to make beer money as a student doing webpages) I was impressed with how far CSS and browser support had come since my days dealing with IE3. It encouraged me to make my blog a tableless XHTML/CSS compliant site, and I must say after the initial learing curve the time savings are huge.
At work I am now in the process of moving a huge amount of code in JSP’s into CSS giving us 3 parts of our presentation logic (CSS for the bulk, JSP to pull it together, Struts forms to validate data entry and pass the data up) with a Struts action/EJB backend. keeps me busy :-)
Posted on August 29, 2003 03:46 AM | #
4. Neil Whittle said:
Testing testing 1 2 3
Posted on October 3, 2003 04:51 AM | #
5. Peter Goddard said:
Exellent article, and it hits the nail on the head.
Now, it might be stating the obvious, but I was under the impression that there are a lot of ‘skilled’ web developers from the browser war years driving taxis (sic) for a living. We work in IT. Wake up those who haven’t got this straight yet! Read (Zeldman, Meyer et al) take note of the refinements in Dreamweaver MX 2004 for CSS support. Grow up, move forward, learn this stuff. There are enough taxi drivers around as it is (until you want one at 4:00am!) … at a time you could be coding!
I don’t mind being branded an evangelist!
Posted on October 16, 2003 01:28 AM | #
Comments are now closed