I didn’t get to post yesterday, so I’m trying to catch up today. As promised, I’m going to write about various tools and libraries I use which help me with JavaScript development. I might even get wild and get to the part where I discuss how I’m doing the actual development.
For starters I should probably point out that I’m using Test Driven Development methodology, a.k.a. TDD. I go through all the trouble of writing automatic tests before writing the actual code that passes those tests, and often test code ends up being of the same size as the production code. Nevertheless, I can’t imagine writing code any other way now. I know it’s possible, I used to do it in the past, but it’s much harder without tests. They are especially helpful in verifying that everything works in both Mozilla and IE. The actual framework I use to run tests in is JSUnit. It is nice and out of all JavaScript Unit Testing frameworks I’ve looked at this one provides the best features. For example, it supports running tests from Ant which makes it possible to test websites using continuous integration.
I like it when the code is easy to write, as it usually means it will be easy to read the code as well. Unfortunately, JavaScript does not look well when one attempts to write Object Oriented code. Messing around with prototype produces counter-intuitive code. In addition to that, JavaScript has limited support for such essential features of OO as inheritance. It can be done, but it's not a trivial task. So to overcome some of those problems I settled on using JSOLait as a foundation library to enhance JavaScript functionality. It makes it much easier to overcome aforementioned problems. In addition, it allows creation of modules that can be loaded on the fly. That means that the user of the library can only load one component that he wants to use, and all other components that the first component relies on can be loaded automatically from inside of it.
JSOLait provides couple of components to work with strings, XML, encoding, encryption, XML RPC, HTTP requests, etc. What I’m doing is writing modules to work with browser DOM directly, as well as modules that allow creation of common visual controls.
Writing code is not enough. It is also important to have documentation for it, especially if it is to be used by other people. I’m using NaturalDocs to help me generate documentation for the script files I create. I’ve looked at several documentation generation tools and this one provides the most satisfying features. The tool parses script files, pulls out all comments entered in a certain format and automatically generates documentation. This results in documentation, which makes it easy to look at the API of the library. At the same time, the comments in the code for the NaturalDocs to extract are very friendly and easy to read. I have C++ and .NET development background and so I’m not used to the format used by other JavaScript documentation tools, which are based on JavaDoc. This makes NaturalDocs comments look much nicer to me. NaturalDocs also relies completely on parsing of the comments and doesn’t look at the actual code. Because of that, it doesn't matter how the the function is declared in JavaScript.
I hope you might find these tools useful if you do any kind of web development. Tomorrow I will write more about what I’m using.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5