Syntax, syntax, syntax – A Web Designer’s rant

One of the biggest pains about web programming is syntax. With scripting languages, you either get it right and everything works like planned, or you spend hours upon hours getting it wrong and begin to lose your mind. I’ve done both in my couple of years as a web developer. The former is wonderful and makes you feel great. The later is more frequent, less desirable, and plenty of reason to never design anything ever again.

With that said, I should give clarification and justification for
proper syntax and proper, well-formed, standards based web design. When
I’m talking about syntax, I’m talking about the proper language or
order of the code that runs behind a more complex website that allows
the site to function properly. It could be something simple, like this:

    <?php
       header(‘Location: http://sethjames.blogs.com’);
    ?>

which would simple redirect whatever page I’m working on to my
blog’s home page. Simple right? It could also be complex, like this, or
worse:

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

This mess above (along with a bit more code) preloads images on a
particular page so that if you mouse over an image, it will swap it
seamlessly with another image and not take forever to clunkily load.

Cool huh? Nerdy, yes, but cool. So, what’s my deal with syntax then?
Well, obviously from the examples above, there is a bit of complexity
going into making things happen on a web page. In order to make things
work properly, you have to make sure every { is closed } and every ; is in the right place ();
or it will mess you up. And more often than not, as a beginning web
developer, these seemingly simple mistakes happen and through off your
entire development plan. It takes longer to code a website, longer to
test and tweak, and therefore longer for your client or your boss or
who ever you are trying to help out.

I’ve done a bit of web design work over the last couple years, both
corporately and on my own and by far, little syntax mistakes are the
thing that pulls me down the most. One of the best things about working
as an ASP programmer with Emergency Reporting was that I worked
alongside other, more experienced programmers, who could help me easily
spot my mistakes and keep me moving along. I learned a ton in the short
time I was there and I know it has helped me on my way to being a
better developer.

Finally, why bother to code correctly? Well, the obvious reason is
so that your pages work correctly. But along with that, there is a lot
to be said for developing properly written, clean, easy-to-read code,
whether it’s server-side code like PHP or ASP, or simply the HTML
markup that makes the page display properly and quickly. By doing it
well, you take pride in your work and you develop faster, cleaner, more
standardized web sites that make your client happy and your resume look
decent.

This entry was written by Seth , posted on Friday February 02 2007at 08:02 am , filed under Web Design . Bookmark the permalink . Post a comment below or leave a trackback: Trackback URL.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>