Her Realm

Coding Sensibly and Validation

Disclaimer or something

I don’t know everything about coding/webdesigning/what-have-you and I might not even know more than you do, but I may know it in a better way, so to speak. I am not an expert and can recognize that I have a lot to learn but I have made a conscious decision to learn correctly and it’s with that decision that I have gained the knowledge I have and wish to share with you. If you are already knowledgeable with the subject at hand, hopefully this will make sense to you and you will agree. Otherwise, enjoy this thoroughly insane analogy.

Coding Sensibly and Validation

Coding incorrectly is a lot like going outside in the middle of winter in nothing but a coat; even if it is your best winter coat, it will be ineffective and cause more problems in the future.
People will have different reactions to this. Some will not notice because they, too, are wearing nothing but a winter coat and think nothing of it. Others will notice but do nothing but roll their eyes or chuckle at your antics, either because they figure you a lost cause or just don’t care enough because it doesn’t personally affect them. Still others will take notice and take it upon themselves to gossip about you with their friends who will, of course, agree but neither will discuss it with you. These people will dismiss anything which you have to offer as insignificant or unimportant simply because you appear silly.
The fourth group of people are the ones who will look down upon you and openly lecture you, but probably won’t be of much help, anyway. Lastly, there are the grandmothers who will tell you how you’re catch yourself a death of cold if you don’t put something on under your coat. Consider me Grandma Code; here are your pants.
Many personal sites do not use what I will refer to as sensible coding: coding which is used correctly, complete, legible, nested correctly, and put together well enough to appear decent in most, but hopefully all, browsers. To obtain sensible coding you need to be sensible about it; that’s all.

The reason this analogy works to well, to me, is that many sites appear to have only a winter coat on. There’s something relatively advanced, which the owner doesn’t really understand, and the owner lacks a basic knowledge of HTML, which is a must.
For instance, most know that the basic HTML document looks similar to this:

<html>

<head>

<title></title>

</head>

<body>

</body>

</html>

But how many people don’t? And how many of you who know that a page should look like this, know that all CSS and javascript should go in the head or that there should only be one body tag? There’s a million different examples I could give here which just don’t make sense, if you know what you’re doing and those of you who wind up naked, except for that winter coat, probably just don’t know any better because so many sources are willing to supply you with ‘quick fixes’ and tricks which skip right over the basics.

Let’s continue with this analogy. Let’s say that this is the underwear (bra/socks/underwear) of a document because it is absolutely essential. Each of these items is something of which you only wear one, so your should never repeat any of these HTML tags. Additionally, each of these pieces if made for a specific body part just as each code has it’s own place in your document.

<html>
<head>
<title></title>
</head>
<body>
</body>
</html>

And most know that you need some suitable clothing (shirt/pants/shoes) over the underwear but under the coat. For instance, you can’t wear your shirt beneath your underwear, so what are you doing putting any content code before the body tag?
The ‘clothing’ of coding will be all the content; what you see. Underwear, just like the basics of an HTML document, isn’t really something you see: the content is. You haven’t reached the fine tuning point, yet, so your clothing might not be the most presentable but it should be functional.

<html>
<head>
<title></title>
</head>
<body>
<img src=”images/image.gif” alt=”Welcome” />
<p>Hi! Welcome to my site. Check out these cool links!></p>
<p><a href=”http://google.com” rel=”external”>Google</a></p>
</body>
</html>

At this point, we have on our underwear and the clothes which are visible over it and now would be a good time to put on that coat. Essentially, the winter coat is what you need when it’s too cold to wear just your clothes but warm enough that it’s all you need. With the coat you could be considered dressed and the site could be considered finished.
We’re heading in the direction of fine tuning/style but are still focusing on functionality. Perhaps it’s just a javascript or something along that line, but your site (and apparel) are a little more unified and are beginning to take a sensible shape.

<html>
<head>
<script language=”JavaScript”>
<!–

//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com

var message=”;
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function(“return false”)
// –>
</script>

<title>My Site</title>
</head>
<body>
Hi! Welcome to my site. Check out these cool links!
<p><a href=”http://google.com” rel=”external”>Google</a></p>
</body>
</html>

Let us discuss the idea of nesting: using HTML tags inside of tags. You have to button your shirt before you button your coat. IE, whenever you start a tag within a tag, it must close within the tag. An example of proper nesting is:

<p><a href=”http://google.com” rel=”external”>Google</a></p>

Whereas improper nesting might look something like this:.

<p><a href=”http://google.com” rel=”external”>Google</p></a>W

Take a look in the mirror; you’re dressedand you’ve made sure that you have the proper garments on beneath your coat and that you buttoned your shirt before buttoning your coat.Your site utilizes the basic and essential HTML tags.
Now you might be ready to add some fine tuning. Most would consider you sensibly dressed but, perhaps, you want a scarf, ear muffs, or mittens, got warmth or style, or you need to upgrade your coat or boots to something more stylish. Validating your site is the fine tuning, without which you might be fine, but it really ties everything together and makes it sleek.
Your site might work fine in most browsers without validating and you may be aware of this but there could be a few tiny errors (or a repeated error) which causes enough of a malfunction to be an issue. This may only affect a certain browser, OS or type of browser or OS but that means that your site is not functional for everyone. That may be okay by you, or maybe you want to have the largest possible demographic; if so, validation will show you those little errors which will help you to optimize your site for all possible visitors.

If you’ve made the decision to validate your site, hop on over to The W3 Validator. You may find out that your site is riddled with errors which are all extremely simple. You might find yourself having to go through every document to close every paragraph. Things like that are a hassle so you might find a tool like HTML Tidy to be useful in fixing those little errors.

You may find that you’ve been doing something incorrectly all along. For instance, I never knew that one must use Alternate text when using images. Since I had used IE as my main browser, I only knew that it showed hover text which, coincidentally, is an error on IE’s part. You might have to edit all of your documents which contain images or something along those lines.
Unforunately, you may find that you have many larger errors which will take a stronger grasp of HTML to remedy. Perhaps your entire site will need a major overhaul in order to validate. There’s potential that you’ll find out a certain effect will not work in order for your site to validate. IE incorporates CSS filters and others elements which often will not validate so you might have to do away with them, or find a route around.
Or, perhaps, you are missing a quotation mark and the validator will tell you there are more errors than there really are because of this. (Using a text editor which utilizes colours for different HTML document elements might help with this one).

Additionally, you might be like me and find that the way the Validator spells out your erros isn’t as helpful as you’d like it to be. Head over to W3schools for helpful tutorials.
Validating can be extremely difficult and time consuming. It may make you extremely frustrated and for you site, it might just not be worth it. If you’re willing to lose some hits or listen to lectures from those who are fighting for validation, then maybe all you need is your coat and you can stick your hands in your pockets instead of buying purple glittery mittens.