understanding and using patterns in software development eel 6883 software engineering vol. 1...

21
Understanding and using Understanding and using patterns in software patterns in software development development EEL 6883 EEL 6883 Software Engineering Vol. 1 Software Engineering Vol. 1 Chapter 4 pp.235-248 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei Presenter: Sorosh Olamaei

Upload: lee-atkins

Post on 05-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

Understanding and using Understanding and using patterns in software patterns in software

developmentdevelopment

EEL 6883EEL 6883Software Engineering Vol. 1 Software Engineering Vol. 1

Chapter 4 pp.235-248Chapter 4 pp.235-248Presenter: Sorosh OlamaeiPresenter: Sorosh Olamaei

Page 2: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

IntroductionIntroduction

Patterns are effective means of Patterns are effective means of capturing and communicating capturing and communicating experience.experience.

Patterns work for software Patterns work for software development on several levels.development on several levels.

Different pattern types and their Different pattern types and their relationship with models built during relationship with models built during software developmentsoftware development

Page 3: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

2.1 Pattern definitions2.1 Pattern definitions

A pattern is the abstraction from a A pattern is the abstraction from a concrete form which keeps recurring in concrete form which keeps recurring in specific non-arbitrary context.specific non-arbitrary context.

A solution to a recurring problem in a A solution to a recurring problem in a contextcontext

Christopher Alexander :Pattern is a Christopher Alexander :Pattern is a relationship between forces that keep relationship between forces that keep recurring in a specific context and a recurring in a specific context and a configuration which resolves these forces.configuration which resolves these forces.

Pattern as a rulePattern as a rule

Page 4: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

2.2 Form and Context2.2 Form and Context

The form of a pattern consists of a finite number The form of a pattern consists of a finite number of visible and distinguishable components and of visible and distinguishable components and their relationshipstheir relationships

Structural and dynamic propertiesStructural and dynamic properties Technical or non-technical entitiesTechnical or non-technical entities Pattern of the Distinction of Tools and MaterialsPattern of the Distinction of Tools and Materials Concrete instances of the patternConcrete instances of the pattern Form of the pattern as a template helps us to Form of the pattern as a template helps us to

identify and compare concrete instances of it identify and compare concrete instances of it which helps with better understanding of an which helps with better understanding of an application domain.application domain.

Page 5: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

Form and ContextForm and Context A pattern is used to create, identify and compare A pattern is used to create, identify and compare

instances of this patterninstances of this pattern Pattern instances appear only in specific contexts Pattern instances appear only in specific contexts

which raise and constrain the forces that give which raise and constrain the forces that give birth to the concrete formbirth to the concrete form

The form of a pattern is finite but the form of its The form of a pattern is finite but the form of its instances need not to be finite. The context is instances need not to be finite. The context is potentially infinite.potentially infinite.

Example: Chain of responsibility consist of the Example: Chain of responsibility consist of the roles :Client, handler and successor.roles :Client, handler and successor.

A pattern can only be understood and properly A pattern can only be understood and properly used with respect to the background of used with respect to the background of experience and reflection in the domain of its experience and reflection in the domain of its contextcontext

Page 6: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

Form and ContextForm and Context

Transferring patterns to a new context Transferring patterns to a new context requires experience and insight into both requires experience and insight into both its original and new contextits original and new context

The form describing a pattern can be The form describing a pattern can be formalized but not its contextformalized but not its context

A pattern must be presented in such a way A pattern must be presented in such a way that can be understood and properly used that can be understood and properly used by others in their work and professional by others in their work and professional languagelanguage

2.3 Consolidated example (the distinction 2.3 Consolidated example (the distinction of Tools and Materials)of Tools and Materials)

Page 7: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

3 Patterns and Models3 Patterns and Models

Software engineering main models:Software engineering main models: Application domain modelApplication domain model Software design modelSoftware design model Implementation modelImplementation model

Relate pattern types to modelsRelate pattern types to models Conceptual PatternsConceptual Patterns Design Patterns Design Patterns Programming PatternProgramming Pattern

Page 8: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

3.1 Conceptual Patterns3.1 Conceptual Patterns Conceptual model of the application domainConceptual model of the application domain Viewpoints of the stakeholdersViewpoints of the stakeholders A conceptual pattern is a pattern whose form is A conceptual pattern is a pattern whose form is

described by means of the terms and concepts described by means of the terms and concepts from an application domainfrom an application domain

Conceptual patterns should be based on Conceptual patterns should be based on metaphors rooted in the application domainmetaphors rooted in the application domain

Linking metaphors to a certain pattern helps to Linking metaphors to a certain pattern helps to bridge the gap between application domain and bridge the gap between application domain and software designsoftware design

Conceptual patterns should be geared towards a Conceptual patterns should be geared towards a restricted application domain ( not too generic or restricted application domain ( not too generic or too concrete: ex. The Distinction of Tools and too concrete: ex. The Distinction of Tools and Materials)Materials)

Page 9: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

3.2 Design Patterns 3.2 Design Patterns

A design pattern is a pattern whose form is A design pattern is a pattern whose form is described by means of software design described by means of software design constructs such as objects, classes, constructs such as objects, classes, inheritance, aggregation and use-relationshipinheritance, aggregation and use-relationship

It reformulates the conceptual model in terms It reformulates the conceptual model in terms of the formal restrictions of a software systemof the formal restrictions of a software system

Design patterns should fit or complement Design patterns should fit or complement conceptual space opened by conceptual conceptual space opened by conceptual patterns.patterns.

Page 10: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

Design PatternsDesign Patterns

Creational PatternsCreational Patterns Singleton: Ensure a class only has on instance Singleton: Ensure a class only has on instance

and provide a global point of access to itand provide a global point of access to it Structural Patterns Structural Patterns

Proxy: Provide a placeholder for another object Proxy: Provide a placeholder for another object to control access to it to control access to it

Behavioral PatternsBehavioral Patterns State: Allow an object to alter its behavior State: Allow an object to alter its behavior

when its internal state changes. The object will when its internal state changes. The object will appear to change its classappear to change its class

Page 11: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

3.3 Programming Patterns3.3 Programming Patterns

Are patterns whose forms are Are patterns whose forms are described by means of programming described by means of programming language constructs.language constructs.

Example: for loopExample: for loop

Page 12: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

3.4 Model and pattern 3.4 Model and pattern interrelationshipinterrelationship

All 3 pattern types should be brought All 3 pattern types should be brought together in a coherent approachtogether in a coherent approach

Ex: Ex: Conceptual pattern: the Distinction of Tools Conceptual pattern: the Distinction of Tools

and Materialsand Materials Design Pattern: Tools and Material CouplingDesign Pattern: Tools and Material Coupling Fig 2 on page 241 VOL 1: use of aspect class Fig 2 on page 241 VOL 1: use of aspect class

Page 13: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

4 Pattern Description Forms4 Pattern Description Forms

Every abstraction needs a notation to Every abstraction needs a notation to give it a formgive it a form

The best way to describe a pattern The best way to describe a pattern depends on the intended usage of depends on the intended usage of the patternthe pattern The Alexandrian formThe Alexandrian form The design pattern catalog form The design pattern catalog form A general formA general form

Page 14: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

Pattern Description FormsPattern Description Forms 4.1 The Alexandrian form : In Coplien & 4.1 The Alexandrian form : In Coplien &

Schmidt (1995) ;form of presentation Schmidt (1995) ;form of presentation consisting of at least 3 sections: consisting of at least 3 sections: Problem, Context and SolutionProblem, Context and Solution Emphasis on when to apply the patternEmphasis on when to apply the pattern

4.2 The design pattern catalog form: 4.2 The design pattern catalog form: Gamma et al. (1995); template with Gamma et al. (1995); template with number of sections number of sections Emphasis on static and dynamic aspect of Emphasis on static and dynamic aspect of

the pattern; descriptive rather than the pattern; descriptive rather than generativegenerative

Best for OOD, well understood, stand alone Best for OOD, well understood, stand alone

Page 15: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

4.3 A general form4.3 A general form Two section: Context, PatternTwo section: Context, Pattern The intended use of this description form is to The intended use of this description form is to

discuss the structure and dynamics of the discuss the structure and dynamics of the recurring form and its context without recurring form and its context without promoting a specific way of using the patternpromoting a specific way of using the pattern

4.4 Comparison and discussion4.4 Comparison and discussion Alexandrian form: matching problems with solutions Alexandrian form: matching problems with solutions Design Pattern Catalog: OODDesign Pattern Catalog: OOD Pattern/context: general presentation in which a Pattern/context: general presentation in which a

pattern description core is to adapted to different pattern description core is to adapted to different use situations: additional sections can be added use situations: additional sections can be added (how to use)(how to use)

Page 16: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

5 Pattern Sets5 Pattern Sets

Aim is to:Aim is to: Ease understanding and usability of patternsEase understanding and usability of patterns Restrict design space for the various types of Restrict design space for the various types of

software systemssoftware systems Pattern ordering into sets, background and Pattern ordering into sets, background and

leitmotif for software developmentleitmotif for software development Pattern emerges from “background” which Pattern emerges from “background” which

is captured by “leitmotif”is captured by “leitmotif” A shared vision incorporating the views, A shared vision incorporating the views,

believes and values of software developers believes and values of software developers that shape a software system as a wholethat shape a software system as a whole

Page 17: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

5.1 Ordering patterns5.1 Ordering patterns

Pattern/Context pairPattern/Context pair Each pattern/context pair is preceded Each pattern/context pair is preceded

by all pattern/context pairs that are by all pattern/context pairs that are needed to understand it needed to understand it

Conceptual patterns logically precede Conceptual patterns logically precede design patterns which logically design patterns which logically precede programming patternsprecede programming patterns

Fig 3 on page 243 VOL 1Fig 3 on page 243 VOL 1

Page 18: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

5.2 Pattern Background5.2 Pattern Background

Infinite embedded contextsInfinite embedded contexts Context of the first pattern/contact Context of the first pattern/contact

pair in the directed graphpair in the directed graph Must be sufficiently understood by Must be sufficiently understood by

authors and readers to be authors and readers to be communicated (it is the problem communicated (it is the problem domain)domain)

Page 19: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

5.3 Leitmotif for software 5.3 Leitmotif for software developmentdevelopment

A leitmotif is a general principle that A leitmotif is a general principle that guides software development. It is the guides software development. It is the broad picture which can evoke a vision broad picture which can evoke a vision of the future system. It makes the of the future system. It makes the underlying beliefs and values explicit underlying beliefs and values explicit that drive software design as a wholethat drive software design as a whole

Personal beliefs and values are driving Personal beliefs and values are driving forces for application design. They forces for application design. They have significant impact on the form have significant impact on the form and content of a patternand content of a pattern

Page 20: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

My thoughts on the paperMy thoughts on the paper

Later definitions of concepts Later definitions of concepts introduced earlier in the paper. (ex: introduced earlier in the paper. (ex: form and context)form and context)

Not a good coverage on design Not a good coverage on design patterns patterns

Page 21: Understanding and using patterns in software development EEL 6883 Software Engineering Vol. 1 Chapter 4 pp.235-248 Presenter: Sorosh Olamaei

Question !?Question !?