Design Patterns

The Mudbug Media programming team regularly meets for “study hall” sessions in which we review important programming techniques and practices. Recently, we discussed the classic Design Patterns approach to software engineering. Design patterns are flexible templates for solving common problems in software design.
Many patterns are easily implemented thanks to standard code libraries, such as the JavaScript library jQuery, which we use frequently. The lazy initialization pattern, for example, is standard via jQuery’s $(document).ready() function—it delays the process of running the enclosed code until necessary. The observer pattern is made trivial thanks to .bind(), allowing objects to be notified automatically of changes in state. And the .each() method implements the iterator pattern, accessing every element of an aggregate object in turn.