If ever a few words could strike fear into the heart of web developers, they would be “object-oriented programming” (OOP). With online coding traditionally seen as more of a scripting endeavor, the application of OOP principles has been deemed as best applied on the server-side, where all the serious coding happens.
As AJAX-based applications have become more common, though, the client-side has become increasingly more complex, requiring more thoughtful design on the part of the developer, and OOP plays an important part there. It’s too much to say that all your code should be written in an OOP style, but it’s definitely true to say that OOP should be a tool in the box, and when designing a large application, or one likely to have a substantial lifespan, it’s usually the best tool.
Classes and inheritance
Although making use of libraries such as jQuery to write code is straightforward, it becomes clear quickly to even a novice that writing procedural code—a series of bare statements on the page—doesn’t get you very far. The first tool in the toolbox ...