JavaScript EditorFree JavaScript Editor     Ajax Editor 

Main Page
  Previous Section Next Section

Design Patterns Defined

Design patterns (DPs) are proven solutions to well-established software engineering problems. As computer science has evolved, some problems have become classic and tend to appear frequently in many different contexts. As the years have gone by, different solutions have been proposed, and some of them have finally been accepted as optimal for their efficiency, elegance, and robustness.

A DP is one of these solutions. Specifically, a DP is a complete description of the problem and its respective solution both in terms of macro level design and implementation, so a programmer can read the pattern and solve the problem by using the optimal solution. Obviously, many man-hours can be saved this way. But there is more to a DP than coding faster. By using a well-known DP, a complete section of the application's code (often comprising many classes) is substituted with the recommended implementation of the pattern, thus becoming a black box that we can trust, and to a certain extent, forget about.

So, DPs are an entity of higher abstraction than simple classes or even the STL. They are complete subsystems, sometimes composed of several classes ready and tuned for a specific use. It all boils down to having an eye for detecting these classic problems in your code and being able to solve them accordingly.

DPs are often presented in listings, so the application analyst can browse and search for a pattern for whichever problem he or she might be facing. Some patterns are of very general use, whereas others are more restrictive. Some of them are even designed for common problems regarding computer game coding, and these are the ones we will be emphasizing for the rest of this chapter. However, let's not forget that games are just software applications, and sometimes they are not that different from other applications like spreadsheets or drawing programs.

There are many types of DPs. The two that are most useful to game developers are programming patterns, which describe specific coding problems and their standard solutions, and usability patterns, which deal with interface design, human-computer interaction, and related concepts. Now we will review some of the most popular patterns in both classes, so you can take advantage of them when coding games.

      Previous Section Next Section

    JavaScript EditorAjax Editor     JavaScript Editor