Main Content

JavaScript Modules & Testing

A talk by Dustin Hoffman

About the Talk

January 23, 2013 12:30 PM

Dublin Community Recreation Center, Dublin , OH

Dublin Community Recreation Center, Dublin , OH

In this age of web-based applications, JavaScript has become a major asset for developers. Utilizing this widely-adopted scripting language, and combining it with the plethora of frameworks and tools freely available today, we can breathe new life into an existing application and give users the experience of working natively on their device, all from a web browser. By adding a little technological “magic” into our web pages with tools such as AJAX and jQuery, we can provide an easy-to-learn and easy-to-understand user experience that not only benefits the end-user, but minimizes an application’s resource consumption and improves performance. It quickly becomes a “win-win” for the developers and the users of the applications they develop.

By “standing on the shoulders of giants”, we can learn from the research and experience of others who have gone before us, finding the best ways to use a certain tool in our developer toolbox. One technology that has been around long enough to have been put through its paces, and provided with many supporting tools, is JavaScript. Many times, and in many systems, you will find islands of JavaScript scattered throughout the code. Script embedded right there in the markup either at the top or bottom of the page. This makes it harder to debug, test and maintain the script being used in your application. One very popular approach to better organizing JavaScript is through the use of the Module Pattern. This pattern allows you to organize your script more similarly to how you would organize blocks of compiled code, like C#. It gives us namespaces to make it easier to avoid naming collisions, prevents us from relying too much on the global scope, and makes it much easier to find, maintain, debug and test our script logic. And it eliminates those large islands of script logic from your pages.

We will review the ways that we can start organizing and namespacing our script using the Module Pattern. We will then discuss how it provides us the means to more easily test our scripts and explain how we can debug our scripts in much the same way we would debug compiled code. We'll review all of the different approaches we can utilize to achieve these goals, and you just might be surprised at how much more efficient a system could be if these strategies are properly implemented. Be prepared to gain a new understanding of how JavaScript can be developed cleanly and effectively in new projects, and better managed in existing projects. This presentation will be beneficial to anyone working on web-based solutions.

Ratings and Recommendations

This Talk hasn't been rated yet. Sign In to rate Talks.

comments powered by Disqus