Pattern-Oriented Cluster: Comp 630/650/655 About patterns Outline What’s a pattern? An example from fast food Comments on the “definition” Patterns and software development culture Pattern definition exercises 12/1/2018 Pattern-Oriented Cluster: Comp 630/650/655
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 Christopher Alexander wrote about patterns in building architecture His ideas have proved very popular among software developers Like all good ideas, the building architecture/software architecture analogy has been taken too far 12/1/2018 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 12/1/2018 Pattern-Oriented Cluster: Comp 630/650/655
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 12/1/2018 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 12/1/2018 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 12/1/2018 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 … GOF (Gang of Four == Gamma, Helm, Johnson, Vlissides) are OO Design patterns that (mostly) address recurring problems of implementing architecture patterns such as Fowler’s Domain Model (116) 12/1/2018 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 12/1/2018 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 12/1/2018 Pattern-Oriented Cluster: Comp 630/650/655
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 12/1/2018 Pattern-Oriented Cluster: Comp 630/650/655