PaperKingdoms

July 13, 2007

coding habits

Filed under: actionscript, blog, musings, program, software, tech, web development — bardicknowledge @ 1:10 pm

so I’ve been thinking about my coding habits lately, mainly because I am going to shortly leap into a rather large project: scripting a web based game by my lonesome. and as I was thinking about my technique, I started to think about the web development course I just finished a few months ago.

thinking back, if I  had the chance I would have pushed my teacher more to teach how to properly create code. every time we started a new project I would pester the teacher to explain how I could write code once and have it work. basically, though I didn’t know at the time, I was asking him to teach me how to make functions and classes that could be used and  reused.

this stems from my thoughts that code should only need to be written once for maximum speed/efficiency. and I still think this after scripting tight out for the last four months for a small web development company. you may be thinking well I can write that code with more ease if I just use a lot of if’s or repetition. but you’re wrong my fine friends who believe this. after you learn to write code using functions (I haven’t learned classes yet :S ) your productivity, ease of maintenance and overall better code levels will increase.

you should also not forget includes! for instance this morning I had 8 files to edit a script to that would read children from a XML file, turn them into links and spit em on the page. Then on click bring up a corresponding child. I wrote a 50 line script and saved it three times.  I could have done it the once, but that could have meant ripping someone else’s FLA apart and would have taken about another hour or two. So instead I edited 1 number in each of the external AS scripts and included them into the fla they related to. And done.

far easier than and faster than writing the same thing without a loop or without the includes.

so if you  have the time, and if you don’t I suggest you make it, go and spend some time learning to make coding reusable and more efficient. It will make you far more productive in the long run.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: