BusinessRx Community

Dedicated to the advancement of software, technology and the people who devote their lives to it.

Welcome to BusinessRx Community Sign in | Join | Help
in Search

BusinessRx Reading List

These blog entries are written by industry experts and leaders. We consider this content to be a good read for any software developer or web technologist.

Signs That Your JavaScript Skills Need Updating

JavaScript has made some improvements in its “state of the art” over the last several years, despite your best attempts to ignore the language.

Yes, you.

The language hasn’t changed, but the tools, practices, runtimes, and general body of knowledge have all grown and matured. Yes, it’s still a dynamic language, and we all know that you think dynamic languages are more dangerous than a loaded gun, but you can’t ignore the language any longer. JavaScript is everywhere. Why, just the other day I turned on “Who Wants To Be A Millionaire?”, and what did I see?

javascript millionaire

Here are some signs that you might be behind the times.

1. If you still mix JavaScript and markup …

<head>
    <script type="text/javascript">
        function doStuff() {
            alert("boo");
        }    
    </script>
</head>

<html>
 <body onload="BLOCKED SCRIPTdoStuff();">
    ...
 </body> 
</html>

… you should read up about unobtrusive JavaScript. In addition to the performance benefits of keeping script in a .js file that a browser can cache, you also separate your presentation concerns from script behavior and allow yourself to focus on writing better script.

2. If you still use document.getElementById and assign functions to onclick …

var header = document.getElementById("header");
header.onclick = headerClick;

… then you really need to start using one or more JavaScript libraries. There are many great libraries available – just look around. They help isolate you from variations in the browser environments, increase your productivity, and allow you to write more maintainable code.

Other obsolete patterns:

3. Using document.all or document.write

4. Using global variables and global functions

5. Rolling your own browser detection code

6. Debugging with alert messages

Once you learn modern JavaScript idioms and tools, you’ll never look back at these old anti-patterns.

Published Tuesday, March 17, 2009 8:11 PM by OdeToCode Blogs

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit

This Blog

Syndication

Powered by Community Server, by Telligent Systems
'