We've been conducting several interviews lately for our programmer position. Though the position doesn't specifically mention it, any Web Application Programmer has to be familiar with Javascript. So, one of the questions I have been asking applicants is if they have ever used a javascript framework. If so, which one have they used, and what made them decide on that specific framework. To my surprise, not one applicant answered that they had used a javascript framework.
Wow. If you aren't using a javascript framework, and you have to do any work with javascript at all, you really should consider giving them a try. But let me back up and start out with explaining what a javascript framework is. A framework is essentially a collection of code (library) you can use to make development easier. If you've ever dealt with javascript before, then you are familiar with how difficult it can be to work with, especially when you need to make sure the code is cross-browser capable. A javascript framework can do some of this "heavy lifting" for you and allow you to focus on the actual code design, instead of having to worry about browser-specific quirks. Essentially, javascript frameworks allows you to be more efficient when coding javascript.
Now, you shouldn't go out and grab a framework and start building a site if you aren't familiar with Javascript. Knowing the underlying language will make your code better, and there's a good chance, that at some point, something is going to break. If you don't understand how the framework works, then it's going to be just about impossible to troubleshoot.
There are numerous javascript frameworks available to choose from (this is NOT a complete list!):
All of them have their strengths and weaknesses. The one you go with should be the one that best fits what you are trying to accomplish, has the feature sets you need, and provides the level of documentation that you require.
But that really doesnt help you decide which one to use now does it? Here are the things that I thought about when researching which framework to use:
1. Does it add code bloat to the user's download?
For some of our projects, the page itself was going to be fairly simple. I didnt want to add a 100K javascript file just to be able to add a nice effect. I wanted the framework to be small enough that the majority of our users would not notice the additional download at all.
2. Will it work with all browsers?
We have to support ALL of the major browsers in use, and a good portion of all of those browsers' various versions. So the framework I chose had to have built-in support for as many browsers as possible.
3. Does it have solid documentation?
I do a lot of php development, and php has some of the best documentation available. In some ways, this has spoiled me when working in other languages. I want to be able to quickly look up a function, see a brief description of its purpose and quickly and easily be able to tell what the function expects and what it will return. I also expect a small code sample of the function in use.
4. Does it support code reuse (is it extensible)?
Part of this is dependent on the developer, but I wanted a framework that easily lends itself to building code classes that can be quickly and efficiently reused.
5. Is it unobtrusive and will it support graceful degradation?
Our sites and applications have to be accessible. This means that there is a good chance that some of our users will be using browsers or other technologies that do not use javascript, or might not have javascript available. So I wanted a framework that didn't require me to litter the HTML with javascript everywhere. I wanted to make sure that if javascript wasn't available, the page would quietly degrade back to pure HTML while still providing the user with all functionality and information necessary.
6. Does it have an active community?
No matter how good you are in a language, at some point, you're going to get stuck. I wanted to make sure that the framework I chose had an active, supportive community behind it where I could get some help if I needed it.
7. Does it play nice with others?
I didn't want a framework that pollutes the global namespace and makes it difficult or impossible to use additional javascript libraries on a page. So the framework needs to use a methodology that encapsulates itself from other script on the page, or provides me a method to allow it to be used with other libraries.
In my next post, I'll discuss which framework I'm using now and how it addressed each of my concerns.
Wow. If you aren't using a javascript framework, and you have to do any work with javascript at all, you really should consider giving them a try. But let me back up and start out with explaining what a javascript framework is. A framework is essentially a collection of code (library) you can use to make development easier. If you've ever dealt with javascript before, then you are familiar with how difficult it can be to work with, especially when you need to make sure the code is cross-browser capable. A javascript framework can do some of this "heavy lifting" for you and allow you to focus on the actual code design, instead of having to worry about browser-specific quirks. Essentially, javascript frameworks allows you to be more efficient when coding javascript.
Now, you shouldn't go out and grab a framework and start building a site if you aren't familiar with Javascript. Knowing the underlying language will make your code better, and there's a good chance, that at some point, something is going to break. If you don't understand how the framework works, then it's going to be just about impossible to troubleshoot.
There are numerous javascript frameworks available to choose from (this is NOT a complete list!):
All of them have their strengths and weaknesses. The one you go with should be the one that best fits what you are trying to accomplish, has the feature sets you need, and provides the level of documentation that you require.
But that really doesnt help you decide which one to use now does it? Here are the things that I thought about when researching which framework to use:
1. Does it add code bloat to the user's download?
For some of our projects, the page itself was going to be fairly simple. I didnt want to add a 100K javascript file just to be able to add a nice effect. I wanted the framework to be small enough that the majority of our users would not notice the additional download at all.
2. Will it work with all browsers?
We have to support ALL of the major browsers in use, and a good portion of all of those browsers' various versions. So the framework I chose had to have built-in support for as many browsers as possible.
3. Does it have solid documentation?
I do a lot of php development, and php has some of the best documentation available. In some ways, this has spoiled me when working in other languages. I want to be able to quickly look up a function, see a brief description of its purpose and quickly and easily be able to tell what the function expects and what it will return. I also expect a small code sample of the function in use.
4. Does it support code reuse (is it extensible)?
Part of this is dependent on the developer, but I wanted a framework that easily lends itself to building code classes that can be quickly and efficiently reused.
5. Is it unobtrusive and will it support graceful degradation?
Our sites and applications have to be accessible. This means that there is a good chance that some of our users will be using browsers or other technologies that do not use javascript, or might not have javascript available. So I wanted a framework that didn't require me to litter the HTML with javascript everywhere. I wanted to make sure that if javascript wasn't available, the page would quietly degrade back to pure HTML while still providing the user with all functionality and information necessary.
6. Does it have an active community?
No matter how good you are in a language, at some point, you're going to get stuck. I wanted to make sure that the framework I chose had an active, supportive community behind it where I could get some help if I needed it.
7. Does it play nice with others?
I didn't want a framework that pollutes the global namespace and makes it difficult or impossible to use additional javascript libraries on a page. So the framework needs to use a methodology that encapsulates itself from other script on the page, or provides me a method to allow it to be used with other libraries.
In my next post, I'll discuss which framework I'm using now and how it addressed each of my concerns.
Leave a comment
Note: Comments are moderated. If published, comments may be edited for length, style and clarity.