Lecture Software construction - Lecture 16: Software design patterns. In this chapter students will be able to: Search for recurring successful designs – emergent designs from practice (via trial and error); supporting higher levels of reuse (., reuse of designs) is quite challenging; described in Gama, Helm, Johnson, Vlissides 1995 (., “gang of 4 book”); based on work by Christopher Alexander (an Architect) on building homes, buildings and towns. | Software Construction Lecture 16 Software Design Patterns Background1 Search for recurring successful designs – emergent designs from practice (via trial and error) Supporting higher levels of reuse (., reuse of designs) is quite challenging Described in Gama, Helm, Johnson, Vlissides 1995 (., “gang of 4 book”) Based on work by Christopher Alexander (an Architect) on building homes, buildings and towns. Background2 Design patterns represent solutions to problems that arise when developing software within a particular context. ., problem/solution pairs within a given context Describes recurring design structures Describes the context of usage Background3 Patterns capture the static and dynamic structure and collaboration among key participants in software designs Especially good for describing how and why to resolve nonfunctional issues Patterns facilitate reuse of successful software architectures and designs. Origins of Design Patterns “Each pattern describes a problem which | Software Construction Lecture 16 Software Design Patterns Background1 Search for recurring successful designs – emergent designs from practice (via trial and error) Supporting higher levels of reuse (., reuse of designs) is quite challenging Described in Gama, Helm, Johnson, Vlissides 1995 (., “gang of 4 book”) Based on work by Christopher Alexander (an Architect) on building homes, buildings and towns. Background2 Design patterns represent solutions to problems that arise when developing software within a particular context. ., problem/solution pairs within a given context Describes recurring design structures Describes the context of usage Background3 Patterns capture the static and dynamic structure and collaboration among key participants in software designs Especially good for describing how and why to resolve nonfunctional issues Patterns facilitate reuse of successful software architectures and designs. Origins of Design Patterns “Each pattern describes a problem which occurs over and over again in our environment and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it in the same way twice” Christopher Alexander, A Pattern Language, 1977 Context: City Planning and Building architectures Elements of Design Patterns Design patterns have four essential elements: Pattern name Problem Solution Consequences Pattern Name A handle used to describe: a design problem its solutions its consequences Increases design vocabulary Makes it possible to design at a higher level of abstraction Enhances communication “The Hardest part of programming is coming up with good variable [function, and type] names.” Problem Describes when to apply the pattern Explains the problem and its context May describe specific design problems and/or object structures May contain a list of preconditions that must be met before it makes sense to apply the pattern Solution Describes the elements