Monday, September 11, 2006

Building good websites is not easy

.. but it can be learned

Recently there have been some discussions on various sites about the flaws or irrelevance of CSS and XHTML. John Dvorak started with his article against CSS. Many others have reacted to that and so did I. More recently Emil Stenström started with an article titled 'Why XHTML is a bad idea'. Now all we need is an article that says that JavaScript is a big nono.

Even though I think that the current W3C standards for XHTML and CSS are not perfect and totally not up to date I feel that we just have to work with the tools at hand. And we should also strive to get better tools, better standards.

That's all very well

But my main problem with the two articles is that I sense that both writers come up with the objections against CSS and XHTML because they have (had) difficulty learning it. Using CSS and XHTML is too close to programming, in their opinion. Therefore we shouldn't use it. Therefore it is flawed.

Huh?

Well, maybe we should call it programming after all. I mean, using CSS is implementing a bunch of rules that say when a page element with this type of tag or this ID or that class it must be floated to the left or it has a blue background. In a very concise format every rule in CSS is a IF THEN statement. In XHTML we give meaning to the content by wrapping it up in tags and adding classes or IDs.

When one has a look at CSS Zen Garden one can see what is possible by changing the IF THEN rules, the CSS. If you take step back you are basically looking at a different presentation of the same data (= the content of the page). Continuing along these lines: every different design can be seen as a different report based on the same data.

And building reports is also close to programming IMHO.

My point

To further clarify my issue with both these articles the following quote.

Emil Stenström
Still the W3C pushes for XHTML as the new standard for the web. Despite how hard it will be for beginners to get things right.

I see writing XHTML and CSS as writing code (and I am not the only one) and I see it as part of my job as web developer. (I also code in C# and JavaScript.) Writing code or programming means that there are rules that apply. There is syntax you must adhere to. If you don't follow the rules then the results are hard to predict.

In the early days of the Internet the rules for HTML were not as strict as now and you didn't have to close all the tags like in XHTML. Browsers were and still are helpful and forgiven with broken HTML. Internet Explorer is very friendly in that respect.

But because there are rules (for XHTML and CSS) does not mean that that is bad. The rules are there to provide the same set of tools for browsers developers and web developers. So that I can expect my code to be presented in the way I intend in any browser. If it doesn't the usually I made a mistake or the browser in question interpret these rules different.

You need to know the rules to play the game

These rules, the standards are what you need to know to use the tools correctly. That takes some learning. Learning takes time and you need to invest in that. Sometimes it can be frustrating when things don't seem to work in the way you want. When this happens lean back and think of another way to do what you want.

But you must be willing to learn and keep learning. That is the point. Nobody says it easy or that will be easier. It may very well become more difficult when more and more things are added to the standard.

Like going to school again and again

Working in this profession means learning, learning and learning. Every day. So, if you want to survive you will have to invest, you must be willing to learn. Over the door of my old primary school it said (roughly translated):

He who wants can.

I think the aspect of learning almost every day is one of the things that keep my job and life interesting. Also the more I learn the better I understand that there much more to learn. In the last years I have been working more and more with object orientation and design patterns. I start to recognize this within the web stuff as well (Model View Control = Content Style Behavior = HTML CSS JavaScript). And with that recognition I start to see where I have done things in an awkward way. In short the more I learn the more I know that what I have done in the past was not done in the best possible way. I would do things different now. I think I am improving always. Slowly but surely, by learning new stuff and learning how to use that the right way.

Simply saying that the old stuff is enough to do what you want is not enough for me. When I feel that there is potential for improvement of my product in some new technology then I think it is justifiable to invest time to learn it. If it turns out that it does not help to improve the product or makes it even worse then still I have learned something: not to use it in this situation.

Finally

I am moving away from the start of this post. Returning to it now quickly.

The articles I mentioned and the following discussions where mainly about technologies being flawed because they were difficult to learn and implement. I think this the wrong way of looking at them. CSS and XHTML are powerful tools despite relative little available syntax and commands (compared to something like C#). Putting them to use requires quite a bit of knowledge. Especially if you want to use it to its full potential.

The hurdles you have to overcome along the way (like the browser issues) are not a ground for stating that the CSS and XHTML are flawed or just sticking with the old stuff. The world is changing so change along with it and yes that requires learning new stuff. Every day a little bit.