Archive for March, 2010

The Power of the Prototype

The Power of the Prototype

I have been studying JavaScript a bit lately and thought I would take some time to post on the power of prototype-based programming. JavaScript is an object-oriented language, but uses prototypes rather than classes to achieve this. It can be a little confusing for those coming from a traditional objected-oriented language and many JavaScript frameworks offer more familiar interfaces for dealing with the difference.

To demonstrate some of the interesting aspects of prototype-based programming in JavaScript, I thought I would create implementations of three well known data structures: stacks, queues, and deques.

A stack is a LIFO (last in first out) data structure where elements are added and removed from the top.

A queue is a FIFO (first in first out) data structure where elements are added to the back and removed from the front. The queues functionality for adding and removing items is different than a stack’s, but the functionality for resetting and checking to see if it is empty are the same, so I was able to copy the methods from the stack implementation right over. The scope of the methods change when used in this context, so the this.items and this.length now refer to the queue’s properties rather than the stack’s.

A deque is a combination of a stack and a queue. Elements may be added and removed from either the front or back of the data structure. Since this data structure’s functionality is fully implemented by the stack and queue code above, I was able to simple “inherit” the methods from these data structures and not worry about creating any new code.

If you are like me, JavaScript seemed like a quirky language that was hard to use and understand and was only useful for some client-side processing on web pages. The trend in perception has been slowly changing over the past few years thanks to web applications that rely heavily on JavaScript for functionality and now new server side software like CouchDB and Node.js that use JavaScript on the server (CouchDB using SpiderMonkey for views and Node.js using Google’s V8 to provide an evented framework for building web applications in JavaScript.)

Southern Pest Control Redesign

Southern Pest Control Redesign

So now that we’ve completed the newly redesigned website for Southern Pest Control, we can use it as a “what not to do” case study. We aren’t poking fun at our client, but would like to make a valid point in why most businesses should take the time and revisit their websites. From our experience, small businesses have a hard time understanding the importance of investing in a professional, well functioning website. It may seem like an overwhelming project, but from a business perspective, it could mean the difference between survival. The days of doing it yourself may be over if you want potential clients to reach out to you. So forget what your mother told you, looks (along with brains) do matter.

Southern Pest Control and its sister company Sovereign Pest Control provide quality termite and pest control services to over 27,000 homeowners in Virginia, Maryland, Georgia, and Texas each year. When they approached us a few months ago, we were surprised to discover how big they really were as far as customer base. The reality is that all we had to go on before our kick-off meeting was their website.

Southern Pest Control Before the Redesign

They compete with some of the nationally-recognized pest control companies and desperately needed a makeover. We delivered them a clean, easy-to-navigate site that will help them retain their current customers and welcome new ones.

www.southernpestcontrol.com

New web site for Noah’s Children

New web site for Noah’s Children

This month we launched a cosmetic redesign for a Richmond based children’s hospice service, Noah’s Children. Subtlety was key here with this very sensitive topic, and our hats go off here at Launch to those who professions touch people so personally as hospice care does.