OOP with Dojo

The very essence of a design pattern is a beautiful thing: it empowers you with a well-tested and well-understood generic approach that you can apply to your own specific problem if the coupling between the two is suitable. Even if the problem you’re solving isn’t an exact fit for a particular design pattern, the time spent examining design patterns that are anywhere near the ballpark you’re working in can still be very fruitful. If you’ve ever spent any amount of time on a whiteboard with colleagues working out a solution to a problem, only to discover in the end that you’ve basically reinvented a well-known approach, the value of having an elementary familiarity with design patterns should be especially poignant.

Designing solutions to problems with Dojo is no different from any other discipline. Dojo lends itself to particular patterns and styles, and understanding these things before you start hacking away on a solution can save you a tremendous amount of time and energy over the course of an endeavor. Of course, that’s not to say that you may not have to break some old habits or invest a modest amount of time getting with the new groove of things, but hey—that’s hopefully why you’re reading this document in the first place!

As it turns out, a brief summary of OOP design patterns that you’re already familiar with goes a long way with Dojo. If you have any experience with OOP principles from a language such as Java or C++, you’ll have no problem picking up Dojo’s ...

Get Dojo Fundamentals: Creating Object-Oriented Widgets now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.