Tuesday, November 30, 2010

1:40 AM
I've seen many articles around the internet from JavaScript fundamentalists that advocate writing your own JavaScript code instead of using JavaScript frameworks like MooToolsPrototype / Scriptaculous,jQueryMochiKitYUI Library, and Dojo Toolkit, and I just cannot agree with their reasons for not using these spectacular frameworks.

Among other reasons, fundamentalists state:
  • You don't learn the deep-down JavaScript code because you're using shortcut functions within the framework
  • Javascript frameworks are bloated and contain a great amount of code you will never use
  • You shouldn't make users download more than what's needed
  • You shouldn't trust the code of others for your purposes (if you want it done right, do it yourself mentality)

Ridiculous. Don't listen to elitists! You SHOULD use JavaScript frameworks for the most important reasons.

Don't Reinvent The Wheel


Why write code that's already been written (better)? A good programmer is a lazy programmer, so be lazy. The tools are there — use them.

Do More With Less Code


Most JavaScript frameworks provide function "chaining." Chaining allows you to do more with less code. Less code means less maintenance time, less download time, and less coding time. Check out MooTools chaining.

Save Time — You Don't Code Your Own OS, Do You?


I love JavaScript as much as the next guy, but some programmers REALLY love developing JavaScript. Let the experts do the tough part, you take their work and make what you'd like of it.


Chances Are, You Aren't The Expert


As big as any programmer's ego is, there are people out there that are smarter, more inventive than you. Most Web Developers need to be a jack of all trades and it's difficult to keep up with every language when you're needed in every facet of a website's construction and launch. The minds behind the frameworks have their eyes on JavaScript daily — trust in them.

Speed Thrills


The creators of these JavaScript frameworks have their own private pissing contest when it comes to JavaScript speed put a lot of effort into making sure their frameworks are fast. The first job of JavaScript for mass web visitor usage is to be fast — users expect accuracy, speed is the most important part. Who's fastest today? Check out SlickSpeed.


Avoid Cryptic JavaScript Base Code


Why use JavaScript's default functions when you can use a framework's English-named functions? For example:
//standard JavaScript
document.getElementbyId('mydiv').style.color = '#f00'; // camel-case the style!

//mootools JavaScript
$('mydiv').setStyle('color','#foo');

These are the reasons I use JavaScript frameworks. Need I say more?
Do you have more reasons? Please share them!

0 comments: