Build your professional network on facebook via our app Go to app
 
 
Posted in Community :

Lightweight JavaScript

 
Industry : IT Products Functional Area : Programming Languages
Activity:  0 comments  183 views  last activity : 07 06 2010 20:18:04 +0000
Share
 
 
 

With the advent of so many different JavaScript libraries, the question often arises, "is there one library that will meet all of my needs?" I can tell you from personal experience, the answer is almost always, "no". At some point in a full Web site or Web application build, you will need to add custom functionality.

You need only to look as far as your preferred JavaScript library to get an indication of how much JavaScript has evolved over the years. As you mature in your JavaScript knowledge, you may find yourself not only wanting to use, but also wanting to understand the core functionality inherent to each library. Deconstructing the source, you will discover common threads running through each line of code. If you can learn to imitate and manipulate these patterns to your benefit, then you will find that you have reached an important milestone.

How will you start to develop your desired features, and how will you integrate them into a production environment? If you want to gain efficiencies, then you will want to reuse code gleaned throughout aging tutorials (in Web years). This can require refactoring a fair amount of JavaScript, so that you can take advantage of fresh design patterns, evolving programming techniques, and general best practices.

In recent years, many helpful browser-based tools have hit the scene, the most popular of which are the Web Developer Toolbar and Firebug add-on extensions for Firefox. While these are indeed invaluable, the JavaScript tool I find myself using the most is Douglas Crockford’s JSLin.

JSLint after seeing numerous developers frustrated with the inherent fluidity of the syntax. Coupled with inconsistencies in browser interpretation, this loosely typed methodology can often be difficult to master. Yet, properly understood, JavaScript can be quite a powerful language.

In a nutshell, JSLint is to JavaScript what the W3C’s validators are for HTML and CSS. By cutting and pasting JavaScript code into JSLint, you can check not only for outright errors, but also for scripting best practices. Additionally, when declaring variables, JavaScript will let you get away with lazy declarations like: foobar = value. This is a bad habit, because it leaves the variable exposed in the global scope, allowing all functions have access to it. Unless that is your intention, the best way to declare a variable would be: var foobar = value.


A huge passive benefit of JSLint is that it basically forces you to write well structured code. Much like XHTML requires tighter adherence to best practices than HTML, JavaScript that passes JSLint is nearly 100% perfect. Since JavaScript is interpreted by the browser at runtime (not compiled beforehand), every last bit of optimization counts. In no other programming language is the impact on user experience so immediate.

Whether you are a JavaScript newbie or guru, I think you will agree that JSLint is a valuable weapon in any scripter’s arsenal.
Once you make JSLint a regular part of your development process, you will wonder how you ever did without.

 
TrackBack URL:
0 comments on "JSLint"
Add your comment on "JSLint"

Rate:
Submit
 Found the article "JSLint"  interesting ?  Share with your connections and communities  
Post Your Resume Now !
  • Create a confidential Career Profile and Resume/C.V. online
  • Get advice for planning their career and for marketing of experience and skills
  • Maximize awareness of and access to the best career opportunities
Viewers also viewed
Recent Knowledge (62)
Go to http://www.php.net/downloads.php and download the current version. PECL modules :...
40 referals 14 comments, 1003 views
I found this while I was checking a friends blog and accidently bumped in to this..  ...
 
2903 referals 32 comments, 754 views
Many of us use facebook. Job hhunting on facebook does not look much believable and we are...
 
2409 referals 27 comments, 592 views
more...  
More From Author
They should be punished.. yes .. but who will punish them.. big question isn't it.. let us stand up and go against them.. create an Egypt in India.. Will we do that?? No we will wait for world cup and than T20 to end and then something else...
May be, but I don't think they would fit into corporate field. Corporate workplace is very different for what they have worked. So fitting into it is very difficult. 
Gone are the days when students used to sit in a class and a teacher used to take a class which consisted of nearly 50 people in it, irrespective of what students learned after each hour a new teacher would come and take a different subject....
more...