Think In Geek

In geek we trust

Developing Javascript involved web applications with Firebug

If you’ve been assigned to a new web application project lately, you’ll probably have had to deal with this [not] new AJAX technology. To be honest, AJAX is good, and websites like Google Mail and Flickr are good examples of that. But remember something: it’s always bad to abuse of something. It’s always bad to abuse AJAX. Don’t use it if it doesn’t really make sense to do it, and if your boss insists on it, ask him if he would use truck wheels on his BMW.

And using AJAX means Javascript, which is an interpreted, weakly typed programming language ran by the browser where the web page containing it executes. And believe me, Javascript is not easy. It’s not similar to Java, it’s not similar to C++ and it’s not similar to C#. To learn the tricks and tips of Javascript I recommend you start by reading this article from the MSDN: Create Advanced Web Applications With Object-Oriented Techniques. It’s a very good introduction for people used to program with more typical object oriented programming languages.

And on top of that, Javascript is not easy to debug either, because you don’t have a compiler to test your code correctness (and I am not talking about syntax, for that you can use a specific editor like Aptana or any other free Javascript parser like JSLint), and because power is always dangerous, and Javascript is a very powerful tool which allows you to do some really dangerous things that can overcome you if not used wisely. Also, the fact that the client actually executing Javascript code is the browser makes things tricky, because you need to have some help from those programs to actually be able to access the execution of that code. Both Microsoft and Firefox have those tools. Unfortunately, the Microsoft ones are either crappy (like Microsoft Script Editor) or you have to pay a lot of money for them (either third party applications or Visual Studio). Fortunately, once more the Open Source community comes to our rescue. It’s name: Firebug.

Actually Firebug is much more than just a Javascript Debugger, it’s more like a mini web development suite for Firefox. It allows you to view and edit HTML and CSS in a fancy way and on the fly, you can naviagate through the DOM model of the web page in a fancy and easy way, it has a network monitoring feature to see how much bandwith is used on the web navigation and on the asynchonous callbacks, and most importantly, it has a Javascript debugger and profiler which has most of the features you might expect from another programming language debugger: inspects, flow control, breakpoints and so on. It has also a console which will tell you the errors encountered on your code and will point you exactly to the file and line of code that produced it. In a few words: it makes web and Javascript development a lot easier than it was before.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

, , ,

Leave a Reply

Your email address will not be published. Required fields are marked *