design patterns and frameworks introduction - tu · pdf filedesign patterns and frameworks...

55
1 Design Patterns and Frameworks Introduction Prof. Dr. U. Aßmann Chair for Software Engineering Faculty of Informatics Dresden University of Technology

Upload: truongkien

Post on 07-Feb-2018

239 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

1

Design Patterns and FrameworksIntroduction

Prof. Dr. U. Aßmann

Chair for Software Engineering

Faculty of Informatics

Dresden University of Technology

Page 2: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

2

Literature (To Be Read)

► Start here: A. Tesanovic. What is a pattern? Paper in Design Pattern seminar, IDA, 2001. Available at course home page.

► Alternatively: GOF: Introduction.► Brad Appleton. Patterns and Software: Essential Concepts

and terminology. http://www.cmcrossroads.com/bradapp/docs/patterns-intro.html Compact introduction into patterns.

Page 3: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

3

Secondary Reading

► D. Riehle, H. Zülinghoven, Understanding and Using Patterns in Software Development. Theory and Practice of Object Systems 2 (1), 1996. Explains different kinds of patterns. http://citeseer.nj.nec.com/riehle96understanding.html

Page 4: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

4

History

► Beginning of the 70s: the window and desktop metaphors (conceptual patterns) are discovered by the Smalltalk group in Xerox Parc, Palo Alto

► 1978/79: Goldberg and Reenskaug develop the MVC pattern for user Smalltalk interfaces at Xerox Parc

► During porting Smalltalk-78 for Norway in the Eureka Software Factory project [Reenskaug]

► Alexander's Timeless Way of Building appears 1979► Introduces the notion of a pattern and a pattern language

► W. Cunningham, K. Beck OOPSLA 1987 paper “Using Pattern Languages for Object-Oriented Programs”

► Discovered Alexander's work for software engineers by applying 5 patterns in Smalltalk

Page 5: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

5

► Erich Gamma. Design Patterns. PhD Thesis 1991► Working with ET++, one of the first window frameworks of C++► At the same time, Vlissides works on InterViews (part of Athena)

► Pattern workshop at OOPSLA 91, organized by B. Anderson► E. Gamma, R. Helm, R. Johnson, J. Vlissides. Design

Patterns: Abstraction and Reuse of Object-Oriented Design. ECOOP 97 LNCS 707, Springer, 1993.

► First PLOP conference (Pattern Languages Of Programming) 1994

► GOF book 1995.► Riehle on role models and design patterns 1997

Page 6: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

6

Alexander’s Laws on Beauty

► Christopher Alexander. “The timeless way of building” . Oxford Press 1977.

► Hunting for the “Quality without a name”► When are things "beautiful"?► When do things “live”?

► Patterns grasp centers of beauty► You have a language for beauty, consisting of patterns (a

pattern language)► Dependent on culture

► Beauty cannot be invented ► but must be combined/generated by patterns from a pattern language

► The “quality without a name” can be reached by pattern composition in pattern languages

Page 7: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

7

The Most Popular Definition

► A Design Pattern is ► A description of a standard solution for ► A standard design problem ► In a certain context

► Goal: Reuse of design information► A pattern must not be “new”!

► A pattern writer must have a “aggressive disregard for originality”

► In this sense, patterns are well-known in every engineering discipline

► Mechanical engineering► Electrical engineering► Architecture

Page 8: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

8

Example: Model/View/Controller (MVC)

► MVC is a agglomeration of classes to control a user interface and a data structure (from Smalltalk)

► MVC is a complex design pattern and combines the simpler ones compositum, strategy, observer.

► Ingredients:► Model: Data structure or object, invisible► View: Representation(s) on the screen► Controller: Encapsulates reactions on inputs of

users, couples model and views► Developed by Goldberg/Reenskaug 1978

Page 9: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

9

Views as Observer

a=50%b=30%c=20%

Window

a

30

30

10

20

10

b c

10

60

50

80

x

y

z

WindowWindow

a b c

Model

Views

Page 10: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

10

Pattern 1: Observer

► Relation between model and views is grasped by the design pattern Observer.

► Views may register at the model (observers). ► They are notified if the model changes. Then, every view

updates itself by accessing the data of the model.► Views are independent of each other. The model does not

know how views visualize it.► Observer decouples strongly.

Page 11: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

11

Pattern 2: Compositum

Views may be nested. (Compositum)► Example: object inspector in debuggers► Compositum represents trees► For a client class, Compositum unifies the access to root,

inner nodes, and leaves► The MVC pattern additionally requires that

► There is an abstract superclass View► The class CompositeView is a subclass of View

► And can be used in the same way as View

Page 12: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

12

Pattern 3: Strategy

The relation between controller and view is a Strategy pattern.

► There may be different control strategies► Lazy or eager update of views► Menu or keyboard input

► A view may select subclasses of Controller, even dynamically

► No other class changes

Page 13: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

13

What Does a Design Pattern Contain?

► A part with a “bad smell”► A structure with a bad smell► A query that proved a bad smell► A graph parse that recognized a bad smell

► A part with a “good smell” (standard solution)► A structure with a good smell► A query that proves a good smell► A graph parse that proves a good smell

► A part with “forces”► The context, rationale, and pragmatics► The needs and constraints

“bad smell” “good smell”

forces

Page 14: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

14

Structure for Design Pattern Description (GOF Form)

► Name (incl. Synonyms) (also known as)► Motivation (purpose)

► also “bad smells” to be avoided► Employment► Solution (the “good smell”)

► Structure (Classes, abstract classes, relations): UML class or object diagram

► Participants: textual details of classes► Interactions: interaction diagrams (MSC, statecharts, collaboration

diagrams)► Consequences: advantages and disadvantages (pragmatics)► Implementation: variants of the design pattern► Code examples

► Known Uses► Related Patterns

Page 15: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

15

Purpose Design Pattern

► Improve communication in teams► Between clients and programmers► Between designers, implementers and testers► For designers, to understand good design concepts

► Design patterns create an “ontology of software design”► Improvement of the state of the art of software engineering► Fix a glossary for software engineering► A “software engineer” without the knowledge of patterns is a programmer► Prevent re-invention of well-known solutions

► Design patterns document abstract design concepts ► Patterns are “mini-frameworks”► Documentation, In particular frameworks are documented by design

patterns► May be used to capture information in reverse engineering► Improve code structure and hence, code quality

Page 16: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

16

Standard Incentives For Using Patterns

► Easy System► System structure► Easy communication► Easy protocols

► Easy Testability► Null object► Static preprocessing

► Easy Evolution► Easy Documentation

Page 17: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

17

The Structure of the Course

Page 18: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

18

Standard Problems to Be Solved By Design Patterns

► Variability► Exchanging parts easily► Variation, complex parameterization► Static and dynamic► For product lines, framework-based development

► Extensibility► Software must change

► Overcoming architectural mismatches (bridging, adaptation, connection)

► Coupling software that was not built for each other

► Others:► Optimization: making things more efficient

► Antagonistic to flexibility

► Structuring of interactive applications► Grasping common patterns of flow in software systems

Page 19: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

19

Variability (Variation, Exchange, Parameterization)

► For expressing commonality and variability► We fix a common part (a framework) and parameterize it at variation

points (variability)► Framework instantiation patterns describe variation of frameworks

► Variability design patterns and frameworks are related► Variability concerns

► Exchange of communication► Dynamic call (e.g., ChainOfResponsibility)

► Exchange of policy► Exchange of material in data-based applications

Page 20: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

20

Extensibility

► For new, unforeseen product variants ► For evolution► For dynamic change► Mainly, the old code skeletons are extended at hooks

► Frameworks can have hooks that can be extended (beyond variation)

Page 21: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

21

Overcoming Architectural Mismatches (Connection)

► Adaptation, bridging, connections► Of communication protocols ► Between heterogeneous components (different representations, different

locations, different control flow structure)

► Layering► Isolating certain components into layers

► Anonymous communication► For exchange of commmunicators

► Scalable communication► At runtime, in distributed systems

Page 22: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

22

Others

► Optimization (antagonistic to flexibility)► Space and time ► Examples: Flyweight, Memento, Command

► Workarounds deal with different abstraction levels in modelling

► ... will be very short...

Page 23: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

23

A Basic Tool: Role Modelling

► For all of that, a basic tool set is role modelling► Which roles does an object play in the application?

► It tells how design patterns occur in applications► Invented by Reenskaug. Summarized in the book “Working

with Objects”, 1995

Page 24: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

24

Frameworks and Patterns

► Patterns document frameworks► Patterns play an important role on how a framework is

instantiated► Whitebox, blackbox, layered, T&H framework ► All these forms have variation points that are describe by

framework instantiation patterns► They determine how the framework should be instantiated

Page 25: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

25

Structuring Interactive Applications with Tools&Materials

► Interactive applications can be pretty complex► TAM (tools-and-materials, Werkzeug-Automat-Material,

WAM) is a pattern language for interactive applications► Nice metaphors that help thinking, constructing,

maintaining interactive applications

Page 26: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

26

Overview of the Course

Intro

Variability Patterns Extensibility Patterns Connection Patterns

Metapatternsand Framework patterns

Role Models

Composite Patterns

Layered Frameworks

Tools & Materials

Employment and Usage

Patterns and Frameworks

Basic Patterns

Pattern Languages

Page 27: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

27

Different Kinds of Patterns

Page 28: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

28

What is a Pattern?

► There is no “the pattern”► At least, research is done in the following areas:

► Conceptual patterns► Design Patterns

► Different forms

► Antipatterns► Implementation patterns (programming patterns, idioms, workarounds)► Process patterns

► Reengineering patterns

► Organizational patterns

► General definition:► A pattern is the abstraction from a concrete form which

keeps recurring in specific non-arbitrary contexts [Riehle/Zülinghoven, Understanding and Using Patterns in Software Development]

Page 29: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

29

Conceptual Patterns

► A conceptual pattern is a pattern whose form is described by means of the terms and concepts from an application domain

► Based on metaphors in the application domain

► Example: conceptual pattern “desktop”► Invented in Xerox Parc from A. Kay and others

► Folders, icons, TrashCan ► Drag&Drop as move actions on the screen

► Basic pattern for all windowing systems► Also for many CASE tools for visual programming► Question: what is here the “abstraction from the concrete form”?

► We will revisit in the TAM method► It works on conceptual patterns such as “Tool”, “Material”, “Automaton”

Page 30: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

30

What is a Design Pattern?

► “A design pattern superimposes a simple structure of a relation in the static or dynamic semantics of a system”

► Relations, interactions, collaborations► Nodes: objects, classes, packages

► “A design pattern is a named nugget of insight which conveys the essence of a proven solution to a recurring problem within a certain context amidst competing concerns” [Appleton]

► Question: what is here the “abstraction from the concrete form”? (in terms of Riehle/Züllighoven)

Page 31: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

31

Different Types of Design Patterns

► Fundamental Design Pattern (FDP) ► A pattern that cannot be expressed as language construct

► Programming Pattern, Language Dependent Design Pattern (LDDP)

► A pattern that exists as language construct in another programming language, but is not available in general

► Architectural style (architectural pattern)► A design pattern that describes the coarse-grain structure of a (sub)

system► A design pattern on a larger scale, for coarse-grain structure (macro

structure)

Page 32: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

32

Different Kinds of Design Patterns

► Framework Instantiation Patterns► Some design patterns couple framework variation points and application

code (framework instantiation patterns)

► Design patterns are “mini-frameworks” themselves► Since they contain common structure for many applications► Design patterns are used in frameworks (that's how they originated)► Hence, this course must also say many things about frameworks

Page 33: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

33

Antipatterns (Defect Patterns)

► Software can contain bad structure

Defect pattern(Bad smell)

Analysis 1 Analysis 2 Analysis 3

Software with unknown structure

Page 34: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

34

Examples of Antipatterns

► No modular structure, only procedure calls► If-cascades instead of polymorphism► Casts everywhere► Spaghetti code (no reducible control flow graphs)► Cohesion vs Coupling (McCabe) Lab 2

► Question: what is here the “abstraction from the concrete form”?

Page 35: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

35

Refactorings Transform Antipatterns Into Design Patterns

► A DP can be a goal of a refactoring

Defect pattern(Bad smell)

Design pattern(good smell)

Step 1Refactoring 1 Refactoring 2 Refactoring 3

Page 36: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

36

Structurally, A Refactoring is An Operator On the Code

► Semi-formal► Fowler's book on refactorings uses graph rewrite rules to indicate what

the refactorings do

► Formal► Refactorings can be realized in program transformation and

metaprogramming libraries and tools► Recoder (recoder.sf.net) is such a tool► Eclipse, Netbeans contain refactorings

Page 37: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

37

Programming Pattern (Idiom, LDDP)

► An idiom is a pattern whose form is described by means of programming language constructs.

► Example: The C idiom of check-and-returns for contract checking

public void processIt (Document doc) { // check all contracts of processIt if (doc == null) return; if (doc.notReady()) return; if (internalDoc == doc) return; // now the document seems ok internalProcessIt(doc);}

private void internalProcessIt (Document doc) { // no contract checking anymore // process the document immediately walk(doc); print(doc);}

Page 38: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

38

► The first book on idioms was Coplien's Advanced C++ Programming Styles and Idioms (1992), Addison-Wesley

► Contains also some GOF patterns

Page 39: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

39

Workaround

► A workaround is an idiom that works around a language construct that is not available in a language

► Example: Simulating polymorphism by if-cascades

public void processIt (Document doc) { // Analyze type of document if (doc->type == Text)

processText((Text)doc); else i f (doc->type == Figure) processFigure((Figure)doc); else printf(“unknown subtype of document”); }

void processText(Text t) {..}void process Figure(Figure f) {..}

Page 40: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

40

Process Patterns

► Process patterns are in the process of making something

State A State B

Step 1Process pattern 1

Processpattern 2

Process pattern 3

Page 41: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

41

Process Patterns

► When process patterns are automized, they are called workflows

► Workflow management systems enable us to capture and design processes

► ARIS on SAP► Intentia► FlowMark (IBM) ► and many others

► Examples: ► “Work-and-Let-Be-Granted”► “Delegate-Task-And-Resources-Together”

► Question: what is here the “abstraction from the concrete form”?

Page 42: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

42

Reengineering Patterns

► Also in the software reengineering process, common (process) patterns can be identified

► Examples► “Read-All-Code-In-One-Hour”► “Write-Tests-To-Understand”

► S. Demeyer, S. Ducasse, O. Nierstrasz. Object-oriented Reengineering Patterns. Morgan-Kaufmann, 2003

► Question: what is here the “abstraction from the concrete form”?

Page 43: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

43

Organizational Patterns

► Two well-known organizational patterns are ► Hierarchical management

► In which all communication can be described by the organizational hierarchy

► Matrix organization► In which functional and organizational units talk to each other

► Question: what is here the “abstraction from the concrete form”?

Page 44: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

44

In This Course

► We will mainly treat design patterns► Very few LDDP and workarounds► Basic ones► Framework instantiation patterns

Page 45: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

45

Pattern Languages: Patterns in Context

► According to Alexander, patterns occur in pattern languages

► A set of related patterns for a set of related problems in a domain► Similar to a natural language, the pattern language contains a vocabulary

for building artefacts

► A structured collection of patterns that build on each other to transform forces (needs and constraints) into an architecture [Coplien]

► Patterns rarely stand alone. Each pattern works in a context, and transforms the system in that context to produce a new system in a new context.

► New problems arise in the new system and context, and the next “layer” of patterns can be applied.

► We will treat one larger example, the TAM pattern language

Page 46: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

46

Where do Patterns Occur in Software Development?

Page 47: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

47

Software Construction By Forward Engineering

Rk

Dk

Ik

Rk+1

Dk+1

Ik+1

Changed Requirements

Changed Design

ChangedCode

Evolution

Forward Engineering

Page 48: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

48

Automated Design (CASE)

Rk

Dk

Ik

Rk+1

Dk+1

Ik+1

Requirements

AutomatedDesign

AutomatedCode

Support by CASE tools to a limited extend possibleTools generate structure of design patterns into the code (e.g., Together)

Page 49: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

49

Program Refinement

Rk

Dk

Ik

Rk+1

Dk+1

Ik+1

Same semantics, but new non-functional requirements

ChangedDesign

ChangedCode

Needs new non-functional requirements. For instance, optimization patterns speed applications up; adapters and bridges can be used for checking consistency

Page 50: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

50

Automated Software Evolution (XP-like)

Rk

Dk

Ik

Rk+1

Dk+1

Ik+1

In XP, many adaptations can be automized by employing refactoring tools

ChangedRequirements

ChangedDesign

ChangedCode

Page 51: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

51

Reengineering

Rk

Dk

Ik

Rk+1

Dk+1

Ik+1

ChangedRequirements

GainedDesign

Automatic and semi-automatic recognition of design patterns is a hot research topic

ChangedCode

LostRequirements

Page 52: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

52

Standard Basic Solution Strategies

Page 53: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

53

Basic Solution Strategies

► The basic solution strategy of a design pattern is factoring

a*b + a*d = a * (b+d)

► Design patterns are the “binomial formulas” of software engineering!

Page 54: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

54

Basic Solution Strategies

► Relational Orthogonalization (relation factoring)► Goal: reduction of the number of dependencies ► Factoring dependencies without interfaces (transitive reduction)► Factoring dependencies with interfaces and information hiding► Dependencies on standard items instead of non-standard ones

► Node-based Orthogonalization, entity based orthogonalization (entity factoring)

► Separation of concerns

► More at the end of the course...

Page 55: Design Patterns and Frameworks Introduction - TU  · PDF fileDesign Patterns and Frameworks Introduction ... UML class or object diagram ... Netbeans contain refactorings. 37

55

The End