Lianko

Coding: Who Cares?!

Why bother if it works? But does it REALLY work? Does it really pay to have one site declare it valid? This article explains you WHY it is important to code correctly, as well as truly understand the code you type.

Why Validate?

An increasing number of webmasters get angry when told, that their coding is invalid. After all who cares if it is valid or not as long as it works, right? Theoretically speaking, this is true: random visitors won’t start checking your coding, just to see whether you’ve managed to comply to the W3C standards. Then why DO reviewers insist on it?

To better understand this, let’s take an example:

You have to write a letter. What do you do?

  1. think about the topic
  2. maybe make a rough sketch
  3. proceed to write it down.

I assume that you don’t read it over due to various reasons.

If the recipient of the letter is fluent in said language, chances are that he/she won’t have big problems understanding the content.

On the other hand, if the recipient’s grasp on afore-mentioned language is not very good, he/she might understand something completely different from what you’ve intended to tell him/her, in which case you realize that a spell-check would’ve been handy, afterall.

Now imagine that this foreign friend of yours is represented by the browser. The latter is a program which has been ‘told’ by its creator how to display a certain coding. If it is a well-thought out program, then chances are that the creator has also implemented some error handling methods into the browser’s code. In other words, the software was told to act one way or another should it receive incorrect data.

All fine and nice until now, you only care that the browser of your choice displays things correctly. However, you DO realize that this browser is not the only one avaliable. All these browsers were made by different people, thus their error handling methods are bound to be different as well: where your browser might ignore certain faulty coding, other browsers will not.

Solution: use valid coding. Browsers are designed to display (X)HTML and CSS according to the W3C standards. In other words, they all abide by the same rules, when the coding is correct.

Incorrect? But It’s Valid!

This is one of the most annoying remarks most reviewers come accross. After spending AGES validating their coding (a highly commendable effort), the reviewer ruthlessly dismisses this by telling them: this is incorrect. Is the latter right? Can he/she check your page better than the W3C‘s validating service? The answer lies somewhere in the middle.

NO the reviewer can’t ‘validate’ your site better than a software.

Let’s assume that both reviewer and software know every rule they should check for.

The reviewer is human, thus might have been tired, cranky, unattentive, lazy, you-name-it while looking through your code. As such, he/she may have over-looked certain errors, especially if said code is not very well aligned.

The validator, on the other hand, is a software that doesn’t suffer of tiredness, sadness, lack of attention, and (for the time being) we assume that it is working correctly.

Keeping these in mind, we can agree that chances of success on the validator’s side are significantly higher, than on the reviewer’s side.

YES the reviewer can ‘validate’ the site better.

The validator works after a well defined template, from which it cannot deviate. Why? Because it cannot think on its own. A reviewer, on the other hand, (ideally) possesses the ability to think beyond this template: the reviewer can spot logical errors. He/she can anticipate your intentions, while the validator can’t.

Let’s make a parallelism with spell-checking again. We have the sentence:

I’ve just tested there computer.

Meaning that they own a computer which I have tested. The above sentence is, of course incorrect, as there is an adverb showing a direction. In its place I should’ve used the possesive pronoun their. If you run this sentence through the spell-check, you won’t get any errors. Reason: each word has been spelled correctly. Its meaning doesn’t make sense, though. The spell-checker does not possess the ability to analyze a sentence’s meaning.

Returning to the reviewer and the validator, the former can realize if you have mistakenly made use of a certain tag, while the validator can only check if your way of writing it is in accordance with the set of rules specified by its creator.

Frequent Issues With Validation

In light of the two paragraphs displayed above, many webmasters get rather confused, having to change their way of coding. Here are their most frequent issues, along with possible solutions.

  • Which browser to code in?

    You DO NOT code in a browser, you code in a programming language, namely (X)HTML. The browser is simply the tool used to interpret said language.
  • I tell visitors to use *insert name* browser

    Why would anyone change their favourite way of browsing just to view one single site? What is it so great here that they wouldn’t get elsewhere? Or maybe they don’t have said browser installed on their PC, do you honestly think ANYONE would go through the trouble of downloading and installing a new software simply to see YOUR site? Wake up: no one cares about you THAT much!
  • I need leftmargin=”left-value” and topmargin=”top-value” in the body tag, but it won’t validate

    There are NO leftmargin and topmargin attributes, which is why the validator doesn’t recognize them. Here are your alternatives:

    1. attributes inside (X)HTML tags
      1
      
           <body style="margin-left:left-value; margin-top:top-value;">
    2. OR using embedded CSS
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      
            <head>
            ...
            <style type="text/css">
                 body{
                   margin-left: left-value;<br/>
                   margin-top: top-value;<br/>
                  ...
                 }
       
                 ....
            </style>
            ...
            </head>
    3. OR using external CSS
      1
      2
      3
      4
      5
      
           body{
           margin-left: left-value;
           margin-top: top-value;
           ...
           }

    Just change left-value and top-value with the apropriate values. Additinally, you can also make use of margin-right and margin-bottom. All these also work for other (X)HTML tags.

  • My colored scrollbars won’t validate

    They don’t validate, because there is no such code. Why DO you need colored scrollbars, anyway? Do you honestly think visitors will stay at your site more if their scrollbar changes its color? Let’s analyze the following:

    1. They’re more interesting

      Colored scrollbars can only be seen in Internet Explorer, whose creators have come up with said
      CSS code. None of the other browsers display them as such.
    2. The standard scrollbars are booooooring

      You can always change your window’s appearance. Right-click on the Desktop -> Properties -> Appearance tab. Now
      change the settings and see what you get. Or better yet: get “Windows XP Style”.
    3. Standard scrollbars are amateurish

      As a matter of fact, COLORED SCROLLBARS are amateurish. The browser is NOT meant to be adapted to a site, it is
      the site that should adapt to the browser, not the other way round.

    4. I only want the arrows showing

      ‘Invisible’ scrollbars are highly impractical, especially when the visitor doesn’t realize that the page SHOULD
      actually be scrolling. They will click on the scrollbar accidentally and then get very confused about the change
      in the page.
  • My transparent I-Frames won’t validate

    Because you most probably haven’t defined them correctly. Check the code below:

    1
    
      <iframe src="page.htm" allowtransparency="yes"></iframe>

    AND inside page.htm

    1
    2
    3
    4
    5
    6
    7
    8
    
    ...
    <head>
     
          <style type="text/css">
             body { background: transparent;}
         </style>
    </head>
    ...