Optional Config Objects in JavaScript OOP

Well, one of the challenges in writing our custom JavaScript library for this next release of our CMS at work has been to come up with a modularized approach to our objects that can be followed precisely while still allowing a measure of flexibility to the end developer (Imagine that! Actually trying to support some framework style design principles in JavaScript!). Anyway, what has been one of the most challenging pieces to the puzzle has been to appropriately handle configuration objects passed to constructors that override specific, default behavior of the object.

No, the challenge was not so much handling a config object proper — that is relatively easy. Where the challenge began to really take shape was in allowing a user to provide specific pieces of optional data and only use the valid pieces of the config object to override existing default values while ignoring the rest so as not to cause any JavaScript errors to be thrown elsewhere in the script. For a quick example, let’s say we have the following data object that loads itself up using an Ajax call (NOTE: all examples in this post are using the ExtJS lib).
Continue reading

The Importance of a First Impression in Web

We all have heard the saying that You never get a second chance to make a first impression, and just as much as in our personal relationships, the brutal force of this statement shows itself true in the web world as well. I cannot count the number of times I have visited a website to glean information about a particular topic only to be immediately bombarded with any number of issues: from broken links to JavaScript errors, layout issues due to lack of attention given to cross browser compatibility, and even, in some cases, the dreaded 404 error right from the home page. Now, none of these issues is a deal breaker to me; I mean, come on, we’re all human, right?

Well, what if that website happens to be for a company or product that is in a technology industry to some varying degree? Does that make a difference? Based on some feelers I’ve put out over the years both with clients and customers for many of the projects of which I have been part, this can indeed make all the difference in the world. Whether or not your organization or product is web related, the average user hints at the fact that, if your content is perceived to be technology based in any form, these small faux pas mentioned above take on an impact of much greater magnitude.
Continue reading

Writing a Reusable AJAX Handler

Due to the number of questions I receive on various forums as well as the number of times I have run into the need for an AJAX response handler in my own work, I decided I would share one of my solutions in the hopes that it will save someone else some time as well. I assume, if you are reading this, that you have a basic knowledge of AJAX and the principles guiding the technology. In addition, basic understanding of how libraries such as jQuery perform AJAX queries and callback functions in JavaScript is a plus. For further reading on these prerequisites, check out this Google search and the jQuery docs.

After manually handling my responses in multiple projects, I finally decided to write a JavaScript object that could handle the XML responses for me and return me a usable object to my callback function. Enter the AJAX Handler object. I decided to let jQuery handle the actual requests for me, but I wanted a way to easily parse out my response, checking for errors and handle them accordingly. The result was something I have been able to use numerous times in different projects. To simplify things, let’s look at the code a piece at a time. At the bottom of this post, you will find the entire code. Continue reading

Google Resources Abound!

I have always been a fan of Google’s products as I have been made aware of them, and on very few occasions have I had anything negative to say about them. I recently have started using yet another assistance provided by Google that is, in my opinion, one of the single most helpful and creative tools to be offered free of charge to the development community. I speak of none other than the Google Web Toolkit. This Java application allows you to build quite extensive AJAX utilities from within the tool itself. What I find very interesting about it is that you literally write your application in Java (using a GUI that is provided with the Toolkit, if you choose), and the Toolkit then generates your markup and JavaScript for the final product.

Continue reading

On Internet and Gaming

Well, those of you who know me in the least are aware of my passion for video games. I have, quite literally, been a fan of console and PC gaming for as long as I can remember. My parents will vouch for the fact that, on my fifth birthday — before I could read — I was situated in front of our living room TV set with our TI-99/4A on my lap, an open code book next to me, pecking character by character until I had basic animations appearing on the screen. I vaguely remember those details, although I can remember playing games like Parsec and Hunt the Wumpus, but the passion for gaming is still there to this day.

My focus, however, has shifted from simply being a placid gamer to wanting to delve more into the inner workings of the game development process and the gaming industry in general. Choosing web development as a career path has given me more of an insight into the principles that make games work, and I greatly admire those with the knowledge and fortitude to stick with it during the grueling development process, but I still have that burning desire to be more actively involved in the industry in some way.
Continue reading

JavaScript Libs and OOP

Those of you who work on client side scripting to any degree (XHTML, CSS, JavaScript, etc) are probably well familiar with some of the more common JavaScript libraries available. I have looked into different ones to some degree, and I have used a handful of them extensively before settling on one that best fits my needs. You see, as a developer, I love to conceive of my own patterns and objects to do things within my page, but I also don’t like having to delve into the innermost workings of the DOM unless absolutely necessary for optimization. This being said, for large scale applications like Content Management Systems (CMS) or administration panels, I like to use a themed, all inclusive solution like the Yahoo! User Interface Library (YUI) or ExtJS (an extension of YUI); however, when working with basic DOM manipulation or personal projects that require a lightweight solution, I have become enamored with the jQuery library.
Continue reading