My Humble Abode

The illustrious ramblings of an idiosyncratic fellow (Man of Feeling, perhaps?), complete with nonsensical tintinabulations

Thursday, October 12, 2006

Tight code = tighter content

I had a revelation. I knew the coding on my site could use a bit of an overhaul. I had a simple plan: I wanted to embed a list file so that the table of contents on my page would not necessarily need to be updated per page, but rather by updating one file.

As I took a look at the coding involved, I dived, rambo-style, into the javascript. I wrote miles upon miles of document.writeln's, clumbed in a handful of 'if' statements. And then it hit me: this was not only clunky, but it would possibly make a slow-ass program. I doubt it would have significantly slowed things down, but still... a good programmer should code smart and have coding practices that can be easily transferred into different scenarios. And my code would never have made the transfer to larger programs.

So now, my coding plan will be to make functions and use them in terms of obect-oriented programming, so that I can make function calls based on the specific link-type (an active link versus inactive). Though this still is a relatively clunky bit of code, it is an organized clunk, and should (in theory) only take the objects it needs, rather than having the objects contained within each if-statement.

The implications for the website are simple: more updates. This is because, instead of updating each page, I will only have to update the toc (table of contents) file.

I might be learning slowly... but I'm learning.

(props goes out to Special Edition: Using Javascript for giving me the easy reference I need to learn javascript)

0 Comments:

Post a Comment

<< Home