Brandon Quintana

Brandon Quintana

Web Developer

Getting pet supplies. » 3 hours ago

The Vitamin has an article on the importance of maintainable JavaScript. Since I have been doing more and more AJAX web applications for clients this has becoming such an important point especially as web applications become larger and larger and more dependent on JavaScript to create its function.

As it states in the article many of the open source scripts are unobtrusive to outer code and are written pretty cleanly. If you have to choose between scripts the one that is easier to read and written better will save you a lot of hassle in later stages of your project.

Now on to their eight step plan. I will go over these steps and give my insight on each one.

Keep Your Syntax and Structure Clean and Logical. This seems like it seems pretty obvious, but a lot of times during crunch time people will use band aids to meet deadlines. It’s always good to make the extra effort to keep it clean and logical in order to update or version your code. It also makes it easier for someone else taking over the project to pick up where you left off.

Use clever variable and function names. I’ve always done this in any programming language I write. It makes more sense to me and saves a lot of time. The only reason I see not to do this is if you are trying to hide the code or make it impossible for someone else to update your code. Sometimes its even hard for you to come back to it.

Comment your code. This is very important, but I have to say I code a lot without comments. I know its bad practice and it’s something that I have to work on. It really does help especially if you are working on multiple projects at once which I find myself doing more and more now.

Keep your scripts self-contained. Almost all my code is object oriented now. This makes it easy to reuse code. Also when using multiple objects it keeps things clean and there won’t usually be errors of functions already being declared.

Keep maintained variables separate and test dependencies. As far as set variables I like to keep them outside the object and set them when the object is initialized. This saves time if those names change.

Separate and communicate the visuals. A good rule of thumb is to keep design separate from data. This is the case of XHTML separate from CSS. Sometimes this is easy to do. Other times it’s not as easy as it sounds, but whenever possible its probably a good idea.

Separate textual content and code. This falls back a few steps ago but is mored tied into text that does not change throughout the code. Keeping it separate keeps it all in one place. It keeps the other code clean and you will have a central location to change text.

Document your code. This is probably the step that many people fail to do even myself. A lot of my applications are small and I feel that they are self explanatory. I think that CVS systems for code is a good idea no matter how large or how small. It’s just the idea of getting into the routine and actually doing this in practice. It will really save a lot of time later.

This was a great tutorial on the Vitamin. Hopefully my insight will help some and maybe give myself more motivation to follow all these steps. Keep these in mind on your next project.

Your Ad Here
Related Posts

Leave a Reply

© 2008 brandon quintana. all rights reserved.