wiki.chadlindstrom.ca

Web Development Best Practices and Design Patterns




JavaScript

Contents

What you will find here

Most of you reading this are probably coming here from some google search. Coming as a result of some - desperate or not - scramble to fix, curiosity to learn or simply roaming the neighborhood.

You're in luck.

What I have tried to do here is compile a collection of JavaScript resources with the intention of making it easier to learn new and improve existing skills.

I've compiled them for me, I've compiled them for you. I hope we all find them useful and handy.

What is JavaScript?

Ok, most of you that are here reading this already know what JavaScript is right? ... It's probable.

For those still here, JavaScript is a client-side scripting language.

Taken directly from w3schools.com:

JavaScript is the scripting language of the Web!

JavaScript is used in millions of Web pages to improve the design, validate forms, detect browsers, create cookies, and much more.

JavaScript is the most popular scripting language on the internet.

What tools are available for a JavaScript Developer?

All kinds of great and evolving tools. In no particular order:

What techniques should I use to do X with JavaScript?

There are a number of best practices I consider with JavaScript. I have listed several below:

Namespaces
JavaScript, like PHP doesn't officially support [[JavaScript Namespaces| namespaces]. Not at least like Java, C#, XML and those sorts do. However, there are techniques available to us that help us keep our code collision-free. Just one of those techniques is JSON.
JSUnit
As more and more website features move into client-side, the need to test these front-end scripts emerges. JSUnit is a great start at testing your JavaScript automatically.
JSDoc
Again, JavaScript is emerging as a significant technology to develop in. The more code you write, the bigger your application gets. The bigger it gets, no doubt you will need to start managing your documentation in a more formalized manner. This is where JSDoc comes in to facilitate your documentation needs in JavaScript.
Progressive Enhancement
A method where you develop your web application first without the use of JavaScript. Then later enhance it with scripting.
Unobtrusive JavaScript
Used to describe a technique to separating out behavior from markup

Should you use a JavaScript Library?

This depends on your resources, your market, your need and of course your expertise. As a general rule, if you are just starting out it might be a good idea to jump in using the YUI library. They have great documentation and a very powerful set of widgets built on a complete library.

If you are more advanced, you may feel the urge to roll your own. I would suggest you take a good look at the benefits to that. I suspect you would be better off picking up a small library like jQuery or Prototype instead. It's not likely many of us could get the same utility with our own home-brewed library as you could get with jQuery or Prototype. Once you pack up the javascript, I doubt the difference between 5K and 15K is worth several weeks or months of development (not to mention maintenance) of your home-brewed library.

While the learning curve may prove touch for some libraries, I encourage you to invest the time. It will likely result in a significant time savings later on. Trust me.

More to come...

I'm doing this on my spare time, so please be patient while this document grows.

Other Resources

Retrieved from "http://wiki.chadlindstrom.ca/index.php/JavaScript"

This page has been accessed 2,891 times. This page was last modified 07:45, 12 January 2007.


This page has been accessed 2,891 times. This page was last modified 07:45, 12 January 2007.