Apr 28 2009

IE6 has already fulfilled its destiny, it’s time to upgrade!

One of the most annoying thing I did during the development of our web projects was to keep our apps running smooth in a wide range of old browsers. Not too many years ago, there was only one "king" in the browser's kingdom: Microsoft Internet Explorer. King is a little bit unappropriated, however on February, 2005, IE 6 was pumping the web engines with a market share of 82.79%, what is a quite impressive number.

Excluding the security problems, the non W3C compliant behavior and other issues, IE6 as the only major browser would be a great deal to all web developers. The existence of  just one browser means few environments to test and few compatibility if/elses. The web-developers burden, however, was far from being released.

In 1996, Opera was first released publicly with version 2.0. Coming next, Apple first released Safari as a public beta on January 7, 2003. Following the flow, in November 9, 2004, Mozilla came up with Firefox 1.0. The last one to join the party was Google Chrome, released as a public beta on September 2, 2008. With the built-in markup madness that HTML allows and with no clear rules for how a browser should behave, the web development became a nightmare.

Luckly things got better and the development of major browsers started to have its foundations over W3C standards and performance worries. Every new version of each browser introduced a set of brand new stuffs, including security improvements and higher Acid scores. Everything would be great, except for one huge problem: IE6, an old and obsolete browser, is still widely used!

That problem drastically increases the complexity of web apps, because developers, in order to ensure the website will look fine, have to workaround all the stupid things IE6 does. As the Wordpress guys usually say, "code is poetry"; in my opinion IE6 compatibility code is classified as a bunch of ugly words within a rhyme. It's time to move on, let IE6 go!

To tell that to your users, a good approach is the ie6 upgrade warning. It is a little script (7.9kb) that displays a warning message politely informing the user to upgrade the browser to a newer version (links to newest IE, Firefox, Opera, Safari, Chrome are provided).

Make the Internet a better place, let old things in the past and move on to the new ones. Upgrade your browser.


Apr 26 2009

Profiling and debugging PHP

Reviewing the code is an important task every programmer must (or should) perform. Sometimes the program you have just coded looks nice and fast, because all the tests you have performed using your well-controlled devel0pment sandbox showed no errors.

Unless you are a god when programming, you may have left some little performance tweaks behind. Most of the time you can replace several method calls with the returned value stored in a variable, or avoiding nested for/whiles, or freeing a result set in order to save some memory, etc. In the end, all those tweaks can make the difference between a smooth user experience and an extremely painful development problem.

If you are a PHP developer, you can use the free PHP Quick Profiler (PQP) to help profiling and debugging your code. No more echoing vars, objects or queries in order to find performance mistakes. Using an automated tool to show you what is going on, you can save a lot of time and ensure your app is stable and fast. I read about PQP at WebAppers these days. They also have a screenshot (below) and a link for a demo.

PHP Profiler

If you want more options for profiling and debugging, I recommend Xdebug, which is a very powerful tool. We have been using it at Decadium for a long time.  Some of the features include stack traces and function traces in error messages (with full parameter display, function/file name and line indications), information about memory allocation and protection for infinite recursions.

Xdebug is also free and has support for Windows and Linux.