• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Analyzability and Changeability in Design Patterns
 

Analyzability and Changeability in Design Patterns

on

  • 676 views

Speech at SugarLoafPLoP Brasil 2002 (SugarLoafPLoP is the Latin American Conference on Pattern Languages of Programming)

Speech at SugarLoafPLoP Brasil 2002 (SugarLoafPLoP is the Latin American Conference on Pattern Languages of Programming)

Statistics

Views

Total Views
676
Views on SlideShare
674
Embed Views
2

Actions

Likes
0
Downloads
0
Comments
0

2 Embeds 2

https://twitter.com 1
http://www.slashdocs.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Analyzability and Changeability in Design Patterns Analyzability and Changeability in Design Patterns Presentation Transcript

    • Analyzability and Changeability in Design Patterns JAVIER GARZÁS MARIO PIATTINI ALTRAN SDB Senior Consultant Alarcos Research Group Projects Engineering Research Group Escuela Superior de Informática ALTRAN SDB University of Castilla-La Mancha C/ Ramírez de Arellano, 15. 28043, Ronda de Calatrava, s/n. 13071, Madrid - SPAIN Ciudad Real - SPAIN jgarzas@altransdb.com mpiattini@inf-cr.uclm.es
    • IntroductionDue to experience acquired during years of investigation and development of OO systemsnumerous techniques and methods that facilitate their design are available. But...Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Introduction•  Serious difficulties are still encountered. •  When patterns are used, several types of problems may occur: •  Difficult Application •  Difficult Learning •  Temptation to recast everything as a pattern •  Pattern overload •  Deficiencies in catalogues: Search, Application, Dependence of the Programming Language, etc.Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Metrics, Design Quality and Patterns Design quality can be measured by Design patterns increments design quality metrics and the use of design quality. patterns should lead to better measurements. However, if we apply OO design metrics to designs, these metrics tell us that a design without patterns is better (because it has less classes, operations, inheritance, associations, etc.) (Reibing, 2001) Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Maintenance and Design ISO 9126 “Software Product Quality” MAINTENABILITY Analyzability Changeability Stability Testability Compliance Important parameters for quality maintenance of Object Oriented Design (patterns)Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Maintenance and Design ISO 9126 “Software Product Quality” MAINTENABILITY Analyzability Changeability Stability Testability Compliance Allows us to understand the design. This is an essential requisite in order to be able to modify the design in a realistic period of timeJavier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Maintenance and Design ISO 9126 “Software Product Quality” MAINTENABILITY Analyzability Changeability Stability Testability Compliance Allows a design to be able to change easily, an important requirement at the time of extended functionality into an existing codeJavier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Maintenance and Design Patterns + Changeability Breaking Point Quantity Optimal Patterns Number Analyzability Maintainability - - + Number of Patterns Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Analyzability Issues Accumulated Knowledge•  Designers have accumulated a body of knowledge.•  This knowledge was totally implicit. We classify the OOD knowledge in: •  Principles, Heuristics, Patterns and Refactoring. The difference between these concepts is generally unclear Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Difficult Management How to articulate all this explicit knowledge??? How apply this???Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • OOD Principles Set of proposals or truths based on experience that form the foundation of OOD and whose purpose is to control this processJavier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Some Principles§  Open-Closed Principle (OCP): A module should be open for its extension and closed for its modification§  Substitution Principle (SP): The subclasses must be substitutable by their base classes.§  Dependency Inversion Principle (DIP): Depend upon abstractions. Do not depend upon specifications§  Interface Segregation Principle (ISP): Many client specific interfaces are better than one general purpose interface. Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Some Principles§  Default Abstraction Principle (DAP): Introduces an abstract class that makes the implementation in default of most of the interface operations between the interface and the class that implements it.§  Interface Design Principle (IDP): “Program” an interface, not an implementation§  Black Box Principle (BBP): Favour the object composition over class inheritance§  Don’t Concrete Superclass Principle (DCSP): Avoid maintaining concrete superclasses Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Relationship Principles - Patterns •  For an OO design to be of a certain quality this shouldn’t violate any principles •  Patterns contribute to an efficient design In general the exact relationship between principles and patterns is unknown Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Example Principle Level 1 The class B has a high probability Low Quality to change Problem Dimension Class A Class B This Design break the DIP Principle 2 Introducing an abstraction we Class A Abstract B can resolve the problem of DIP Problem Now the problem is that A can’t Solution Dimension Class B create to class B Pattern Level 3 Solution Structure Class A Abstract B At last, A creational Pattern resolve the violation of DIP Creational Class B PatternJavier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • With a Good Relationship•  Patterns could be classified according to the principles.•  The principles would even enable us to create a different catalogue of patterns•  Checklists of principles could also be drawn up which assess the design and offer us solutions patternsJavier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Type of Principles We may specify more and consider their relationship with the patterns, so that the principles can be one or several of the following typesType 1, Implicate Type 2, Intrinsic Type 3, implicated The pattern contributes The pattern completes The principle canto a good solution to the or contains the improve a solution to resulting model of the principle. which a pattern has application of the previously been applied principle (“from the (“from the pattern principle towards the towards the principle”). pattern”). Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Principles and PatternsJavier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Analogies We can observe that Abstract Factory, Builder, Factory Method and Prototype maintain an identical kernel of principles. They are Creational PatternsJavier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Creational Patterns This has the same character as the previous ones but by means of a composition strategyJavier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Singleton Topic Singleton does not complete any principle. Singleton is not a micro architecture We are according to Buschmann et al. (1996) whereon this pattern is an IdiomJavier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Considerations, Uses and Investigations•  Break down each pattern, facilitating the study of common elements: “patterns in the patterns” or “meta-patterns”•  Guide the use of patterns, since it is easier to know how to apply in a correct way a principle that a pattern•  Once applied the principle is easy to arrive to the pattern•  Facilitates the patterns good use.•  A formal study of micro architectures•  Obtain the forces (principles) that conform the pattern Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Considerations, Uses and Investigations •  Any micro architecture with some hierarchy that we want to consider as a design pattern should complete (type 2), at least, the following principles: OCP, SP, DIP, IDP and DCSP. •  Patterns structurally identical as State and Strategy fulfill the same principles and with the same type •  All pattern that completes OCP, SP, DIP, IDP and DCSP in type 2, ISP and DAP in type 3 and dont fulfill the BBP are classified as of behavior. Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Considerations, Uses and Investigations We will be able to look for and/or to validate new design patterns observing if they complete some meta-patterns Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Changeability Issues•  The element that provides changeability to the pattern is what it is called indirection•  “At the heart of many design patterns is an indirection between service provider and service consumer. With objects the indirection is generally via an abstract interface” (Nordberg, 2001) Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Indirection Effects•  Every time that a pattern is introduced at least one indirection appears in the design and these elements are not of dominion or business logic, such as notifications, observer classes, updates methods, etc.•  Every time that we add an indirection the software moves around further away form the analysis. Upon adding indirections or design classes the design becomes less semantic, less comprehensible or less analyzable.•  Every time that an indirection is added it increases the design changeability. Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Quantify Impact of Patterns + Changeability Quanty Optimal Patterns Number Analizabilidad How much Changeability can we apply in order Mantenibilidad - not to lose the designs Analyzability? - + Number of PatternsJavier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Quantify Changeability •  We can define a parameter that quantifies how changeable a design is in relation to indirections:Changeability Number (CN) = Indirection Classes Number (ICN) Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Quantify Analyzability•  A value that measures the designs analyzability must consider the number of design classes introduced: •  These are classes that simplify, reusing (such as the subject class into observer pattern) or indirection (such as the observer class into observer pattern). Analyzability Number (AN) = Domain Classes Number (DCN) –Indirection Classes Number (ICN) – Simplify Classes Number (SCN)Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Optimal Patterns Number Changeability Number (CN) = Analyzability Number (AN)Indirection Classes Number (ICN) = [ Domain Classes Number (DCN) – Simplify Classes Number (SCN) ] / 2 Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Example CN = 0a) D1 D2 D3 AN = 3-0-0 =3 Observer Subjectb) CN = 1 D1 D2 D3 AN = 3-1-1 =1 Observer Subject CN = 2 c) D1 D2 D3 AN = 3-2-3 =-2 State StateA StateBJavier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Conclusions and Future Work•  Although over recent years, different areas of knowledge related to the construction of OO system have been consolidated•  We believe that there is a lot of work still to be done in order to systematize and offer this knowledge to OO designers•  The patterns are useful elements but there are still many elements to be studied if we want to apply them in a rational mannerJavier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil
    • Conclusions and Future Work•  The first thing that we must make clear is the word quality for design patterns; this word must be used with great care when we apply it to patterns. In maintenance quality two appropriate views could be changeability and analyzability.•  More knowledge exists apart from that related to patterns, although it would be true to say that this other knowledge is frequently “hidden” Our final aim is to offer a detailed systematization of principles, heuristics, patterns and refactoring techniques Javier Garzás & Mario Piattini, Analyzability and Changeability in Design Patterns, August 2002, Itaipava, Rio de Janeiro, Brazil