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

Simulating Gravitational Forces in AS3

So, I may have bitten off a bit more than I could chew in this post, but it is something that has been an intriguing thought to me for some time: how can I simulate the effect, or pull, of gravitational forces between different objects on my stage? Obviously, if you read my previous post, you know that I have had some fascination with orbits and circular motions, but I am much more interested in paths that appear to be natural — almost evolving, if you will.

This got me to contemplating that, in our universe, every object acts upon every other in some way: keeping our planets in orbit around the sun while helping each other to retain their individual satellites and keep from hurtling into outer space. Embodying the interactions of the various bodies on one another and trying to come up with a simple enough algorithm that will simulate a fluid motion while not overloading the Flash player with unnecessary overhead was my goal. I have some work yet to do, but I thought I would at least share my concepts with you and see what improvements can be made whilst still keeping things lightweight.
Continue reading

Tower Defense in AS3 – Part III

I decided to take a slightly different approach to Phase III of this series than I had initially intended, since there was a little restructuring that needed to be done in order to support a cleaner and more efficient system. The intent was to have this post cover the basic solution to the towers themselves, but after getting back into the code, it made more sense to discuss stage structure, wave management and creep variety first. This way, we will actually have something on which to test our towers when we make them.

When you finish reading this post, you will have the ability to customize your waves via an XML file along with defining the path of the road — and therefore the creeps — in the same XML document. Allowing for customization in this way will pave the way for building a framework that can be enhanced for many different uses.
Continue reading

Happy New Year!

Well, I suppose it is high time to write my next entry. I never intended to take a two month lapse in writing, but then again, when does anyone plan to leave their blog unmanned for that length of time? Holidays, children and work all combined over the new year to make for a rather hectic time. I’ll address each of these throughout this post, so if it gets to be a rather lengthy read, I apologize in advance.
Continue reading

Reasons not to upgrade to PHP5

Some of you may not immediately catch the sarcasm intended to be portrayed by the title of this post, but anyone who knows my coding preferences or has heard me complain (in a good way, of course) about the server structure with which we are currently stuck with at work, you will have no issue with understanding the tongue in cheek nature of this post. I have actually been amazed at how many times in the last week I have run into servers that have yet to offer PHP5 in their configuration settings, even as an option.

I have had the privilege to make the aquaintence of a few new friends and work with them on a project, which I will cover in depth in another post, and through some web work I’ve done for the project, I’ve been made aware of three separate hosting companies (which shall remain nameless) that still do not have PHP5 installed on their servers. What’s more, after some checking, some of them apparently do not even offer it as an option. This has made me appreciate my current hosting company that much more, for they not only offer a choice between stable versions of PHP on my account, but they go to the extreme of allowing me to declare a PHP version for each individual domain or sub-domain that I wish to set up. As a developer, this sort of flexibility is invaluable. Continue reading