Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ralph Johnson - University of Illinois1 Patterns: What They Are, and How to Write Them Ralph Johnson University of Illinois at Urbana-Champaign

Similar presentations


Presentation on theme: "Ralph Johnson - University of Illinois1 Patterns: What They Are, and How to Write Them Ralph Johnson University of Illinois at Urbana-Champaign"— Presentation transcript:

1 Ralph Johnson - University of Illinois1 Patterns: What They Are, and How to Write Them Ralph Johnson University of Illinois at Urbana-Champaign johnson@cs.uiuc.edu 217-244-0093 http://st-www.cs.uiuc.edu/users/johnson

2 Ralph Johnson - University of Illinois2 Pattern (OED) l An example or model deserving imitation; an example or model of a particular excellence. l An example, an instance; esp. a typical, model, or representative instance, a signal example l An arrangement or order of things or activity in abstract senses; order or form discernible in things, actions, ideas, situations, etc.

3 Ralph Johnson - University of Illinois3 Design l Good design comes as much from following good patterns as by following good principles l Document the patterns of successful software developers »widely used is better »simple is better »old is better

4 Ralph Johnson - University of Illinois4 What are Patterns? l recurring solutions to problems l literature l not a new technology, but a new way of communicating technology Finding them is hard, following them should be easy.

5 Ralph Johnson - University of Illinois5 Patterns Patterns in solutions come from patterns in problems. "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 the same way twice." Christopher Alexander -- A Pattern Language

6 Ralph Johnson - University of Illinois6 Learning from Patterns l Reading it and discussing it l Trying it on a problem l Reading it again l Trying it again

7 Ralph Johnson - University of Illinois7 Pattern Catalogs l Many patterns have similar context, solve similar problems l Need to categorize problems »Idioms, design patterns, architectural patterns »Structural, behavioral, creational »Process patterns, analysis patterns, …

8 Ralph Johnson - University of Illinois8 Object-Oriented Design Patterns Design Patterns: Elements of Reusable Object-Oriented Design, Gamma, Helms, Johnson, Vlissides l catalog of 23 patterns l common in reusable OO software l not widely known beforehand l improves design, communication

9 Ralph Johnson - University of Illinois9 Design Patterns l Not novel l Concrete examples of abstract principles l Uses catalog format l Require a year or two of OO experience to appreciate l Describe tradeoffs

10 Ralph Johnson - University of Illinois10 Benefits of Patterns l Help novices learn faster l Help teachers teach better l Provide vocabulary for experts l Make experts more helpful l Make it easier to discuss tradeoffs l Help us collect data for science

11 Ralph Johnson - University of Illinois11 Other Patterns l Analysis patterns (Martin Fowler) l Coding patterns (Kent Beck: Smalltalk Best Practice) l Distributed programming & concurrent programming (Doug Schmidt) l Process patterns (James Coplien) l Architectural patterns...

12 Ralph Johnson - University of Illinois12 Real-time System Design “Patterns for Generating a Layered Architecture”, Barry Rubin, Pattern Languages of Program Design, Addison-Wesley, 1995. Layered architecture of real-time systems with an operator interface

13 Ralph Johnson - University of Illinois13 A Typical CMA System Operator Interface Tool Control Mechanical process Hardware Interface Health and Status feedback status, alarms status commands controlfeedback status control

14 Ralph Johnson - University of Illinois14 A CMA Architecture Mechanical entitiesActuators, solenoid, sensors, etc Layer 1 - Physical layerPhysical hardware or simulator Layer 2 - Access layerModel of the EE domain (I/O ports) Layer 3 - Modeling layerModel of the mechanical domain (actuator, solenoid, sensor) Layer 4 - Application layerModel system behavior Layer 5 - Operator interface axis of symmetry

15 Ralph Johnson - University of Illinois15 How to Write a Pattern l Get an idea for a pattern »Should be a pattern you know »It is OK if someone else has documented it already, but you need to have an idea how you can describe it better l What is the problem that it solves? l When is it a good idea? (What is its context?) l What are the forces? (When is it a bad idea?) l Pick a name

16 Ralph Johnson - University of Illinois16 How to Write a Pattern l Write an example or two l How does this pattern relate to others? l Have people read it l Have it read by a “writers’ workshop” l Revise, revise, revise

17 Ralph Johnson - University of Illinois17 How to Write a Pattern http://hillside.net/patterns/writing/writingpa tterns.htm Pick a form »GOF »POSA »PLoP style »Alexanderian

18 Ralph Johnson - University of Illinois18 Alexanderian style l “Big Ball of Mud” is an example l No headings, uses fonts to demark sections l Well defined style, but not obvious l Hard to write, but effective

19 Ralph Johnson - University of Illinois19 l Title, picture, context, bullets l Problem summary in bold, problem, “Therefore:” l Solution summary in bold as a command, diagram, l Bullets, next patterns

20 Ralph Johnson - University of Illinois20 Write a pattern l Or a pattern language l At least 3 pages l Pick something you know l It is best if it hasn’t been documented well.


Download ppt "Ralph Johnson - University of Illinois1 Patterns: What They Are, and How to Write Them Ralph Johnson University of Illinois at Urbana-Champaign"

Similar presentations


Ads by Google