This is the title of a paper I'm delivering at the 2007 Microsoft Academic Days. The focus for this year's conference is Game Development in Computer Science Education. This paper describes how game development can be used to successfully teach design patterns to undergraduate computer science students.
Abstract
This paper describes how game development can be used to successfully teach design patterns to undergraduate computer science students. The abstract nature of design patterns can make them difficult for students to fully comprehend and successfully integrate into their applications. The familiarity of games along with their flexibility provides an ideal context for making the abstract patterns more concrete and understandable. Three different game projects are described along with several of the design patterns implemented within these games.
Introduction
"The mark of our time is its revulsion against imposed patterns."
-- Marshall McLuhan
McLuhan’s assertion about a revulsion against patterns may indeed have been true when he wrote those words in the early 1960s, but they very much appear to be false when it comes to contemporary thinking in software design. Since 1995, the software design field has been great enhanced by a burgeoning literature in the area of software design patterns. This literature very much tends to be oriented towards the experienced software development practitioner. Less experienced developers, such as undergraduate computer science students, generally however find design patterns to be too abstract and their development experience too limited to find the same joy and attraction to patterns. We might say then that students very often do in fact have a sense of revulsion against the patterns that are imposed by their instructors!
A design pattern is a description of a class-level solution to a common generalized design problem. In the key text in the field, the so-called Gang of Four book, 23 patterns are described at a relatively abstract level and are related using examples which are usually unfamiliar to typical student readers. Other authors have endeavored to teach design patterns by using more approachable language and examples.
Yet despite these much more approachable texts, this author has often struggled to find appropriate contexts and examples for teaching design patterns. Students typically were able to parrot the description of the covered patterns in examinations but generally struggled to implement them and almost always completely failed to see the point of these patterns. (It should be noted that some researchers in contrast have had some success introducing design patterns into entry-level CS courses). To this author’s students, design patterns almost always seemed an unnecessary and painful complication. Students often solved a problem their own way and then tried at the last moment to hammer the square peg of the design pattern into the round hole of their solution after it was already working. It is no wonder then that the students often felt a revulsion against design patterns. This experience, however, changed quite substantially once design patterns were taught using game development projects.
This paper describes the author’s relatively successful experiences teaching revulsion-free design patterns to third-year undergraduate students by using game development projects. It provides an overview of these games and then illustrates some of the design patterns that were introduced as solution mechanisms within these projects.