130 likes | 261 Vues
Understand the concept of patterns, with examples from fast food to software culture. Learn the importance of naming patterns and the impact on software architecture. Engage in pattern exercises to enhance problem-solving skills.
E N D
About patterns Outline • What’s a pattern? • An example from fast food • Comments on the “definition” • Patterns and software development culture • Pattern definition exercises Pattern-Oriented Cluster: Comp 630/650/655
What’s a pattern? Alexander’s characterization (quoted by Fowler) • Recurring problem • Environment in which it occurs • Core of a solution • Has been used successfully multiple times • Can be used many times without ever doing it the same way twice Pattern-Oriented Cluster: Comp 630/650/655
Example: fast food pattern • Problem: people getting burned on hot drinks • Environment: fast food restaurants • Solution: print warnings on packaging • Name: Achtung - Heiss Pattern-Oriented Cluster: Comp 630/650/655
Other solutions • Solution: make in advance, heat to safe temperature when serving • Name: Heat-n-Serve • Solution: make drinks at safe temperatures • Name: Low-Temperature Recipe Pattern-Oriented Cluster: Comp 630/650/655
What’s the real problem? • Heat-n-Serve and Low-Temperature Recipe are about preventing burns • Achtung-Heiss is about preventing lawsuits Pattern-Oriented Cluster: Comp 630/650/655
Definition vs Characterization Definition: Duck • Any of numerous relatively small and short-necked web-footed swimming birds of the family Anatidae. Characterization: Duck • Walk: waddle • Sound: quack Patterns characterize more than they define Pattern-Oriented Cluster: Comp 630/650/655
Comments on the characterization • Patterns have consequences • Some patterns go together Class Table Inheritance (285) usually implies Domain Model (116) • Using a pattern can introduce other problems Developers often have trouble getting comfortable with Domain Model (116) • Architecture patterns differ from GOF • It’s all Indirection … Pattern-Oriented Cluster: Comp 630/650/655
Patterns and software culture • At best: gray heads use patterns to help younger people without being dogmatic • At worst: pattern writers kill lots of trees • At best: patterns make communication more efficient • Huffman codes for architecture/design descriptions • Can save effort in project design documentation • At worst: patterns add confusion • People may have different understandings of a pattern Pattern-Oriented Cluster: Comp 630/650/655
More on patterns and culture • Naming patterns is • Really important • Really hard • Patterns are owned by the community • Nobody invents patterns • You can’t patent a pattern • Patterns are “identified” or “discovered” • Pattern writers depend on feedback • Especially about naming, applicability, consequences Pattern-Oriented Cluster: Comp 630/650/655
One more comment … • The analogy between building architecture and software architecture • Can be helpful • Can be over-used Pattern-Oriented Cluster: Comp 630/650/655
Pattern definition exercises • Environment given, or picked as first step • Brainstorm recurring problems in the environment • Pick a recurring problem to work on • Identify the core of a solution • Not (on purpose) a Fowler pattern • Pick a name • Present to the class Pattern-Oriented Cluster: Comp 630/650/655
Pattern exercise 1 • Environment: group project • Note: this is not necessarily a software project Pattern-Oriented Cluster: Comp 630/650/655
Pattern exercise 2 • This one is about software • Environments to choose from: • Database • Web presentation • Performance/capacity • Source code control/configuration management • Or, brainstorm some other environment Pattern-Oriented Cluster: Comp 630/650/655