Page 1 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Chapter 7 Role-Based Component Engineering.

Slides:



Advertisements
Similar presentations
Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Advertisements

Software Metrics for Object Oriented Design
Architecture Representation
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
OOP - Object Oriented Programming Object Oriented Programming is an approach to programming that was developed to make large programs easier to manage.
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System modeling 2.
Figures – Chapter 24.
Metrics for Object Oriented Design Shyam R. Chidamber Chris F. Kemerer Presented by Ambikadevi Damodaran.
Basic Concepts in Component-Based Software Engineering
Object-Oriented Analysis and Design
Object Oriented Design
Object-Oriented Metrics. Characteristics of OO ● Localization ● Encapsulation ● Information hiding ● Inheritence ● Object abstraction.
Design Metrics Software Engineering Fall 2003 Aditya P. Mathur Last update: October 28, 2003.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 8 Slide 1 System models.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Slide 1 Systems Analysis & Design CS183 Spring Semester 2008 Dr. Jonathan Y. Clark Course Website:
Object-Oriented Metrics
March R. McFadyen1 Software Metrics Software metrics help evaluate development and testing efforts needed, understandability, maintainability.
HAS. Patterns The use of patterns is essentially the reuse of well established good ideas. A pattern is a named well understood good solution to a common.
© Copyright Eliyahu Brutman Programming Techniques Course.
Predicting Class Testability using Object-Oriented Metrics M. Bruntink and A. van Deursen Presented by Tom Chappell.
1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.
1 CS1001 Lecture Overview Object Oriented Design Object Oriented Design.
Reuse Activities Selecting Design Patterns and Components
The chapter will address the following questions:
OO Analysis and Design CMPS OOA/OOD Cursory explanation of OOP emphasizes ▫ Syntax  classes, inheritance, message passing, virtual, static Most.
Chapter 13 Starting Design: Logical Architecture and UML Package Diagrams.
An Object-Oriented Approach to Programming Logic and Design
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 1 System models l Abstract descriptions of systems whose requirements are being.
Chapter 4 System Models A description of the various models that can be used to specify software systems.
An Introduction to Software Architecture
CSE 303 – Software Design and Architecture
Paradigm Independent Software Complexity Metrics Dr. Zoltán Porkoláb Department of Programming Languages and Compilers Eötvös Loránd University, Faculty.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Software Design Deriving a solution which satisfies software requirements.
The CK Metrics Suite. Weighted Methods Per Class b To use this metric, the software engineer must repeat this process n times, where n is the number of.
The CK Metrics Suite. Weighted Methods Per Class b To use this metric, the software engineer must repeat this process n times, where n is the number of.
Chapter 7 System models.
Sommerville 2004,Mejia-Alvarez 2009Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
CSC480 Software Engineering Lecture 11 September 30, 2002.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
Object-Oriented Analysis and Design. Lesson 1: Introduction to Software Engineering.
1 Metrics and lessons learned for OO projects Kan Ch 12 Steve Chenoweth, RHIT Above – New chapter, same Halstead. He also predicted various other project.
An Automatic Software Quality Measurement System.
Part VII: Design Continuous
CSc 461/561 Information Systems Engineering Lecture 5 – Software Metrics.
OBJECT ORIENTED AND FUNCTION ORIENTED DESIGN 1 Chapter 6.
Measurement and quality assessment Framework for product metrics – Measure, measurement, and metrics – Formulation, collection, analysis, interpretation,
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 19: Interfaces and Components [Arlow and Neustadt, 2005] University of Nevada, Reno Department of Computer Science & Engineering.
TK2023 Object-Oriented Software Engineering CHAPTER 8 LOGICAL ARCHITECTURE.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
Ontology Support for Abstraction Layer Modularization Hyun Cho, Jeff Gray Department of Computer Science University of Alabama
Object Oriented Metrics
1 OO Technical Metrics CIS 375 Bruce R. Maxim UM-Dearborn.
Software Engineering Object Oriented Metrics. Objectives 1.To describe the distinguishing characteristics of Object-Oriented Metrics. 2.To introduce metrics.
OBJECT-ORIENTED DESIGN JEAN SIMILIEN. WHAT IS OBJECT-ORIENTED DESIGN? Object-oriented design is the process of planning a system of interacting objects.
Basic Characteristics of Object-Oriented Systems
Design Metrics CS 406 Software Engineering I Fall 2001 Aditya P. Mathur Last update: October 23, 2001.
OOP - Object Oriented Programming
Course Notes Set 12: Object-Oriented Metrics
Towards a Multi-paradigm Complexity Measure
Object-Oriented Metrics
Design Metrics Software Engineering Fall 2003
Design Metrics Software Engineering Fall 2003
Chapter 19: Interfaces and Components
Chapter 19: Interfaces and Components
Software Metrics SAD ::: Fall 2015 Sabbir Muhammad Saleh.
Presentation transcript:

Page 1 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Chapter 7 Role-Based Component Engineering

Page 2 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Overview qRole-based components qMotivating the use of roles qRole technology qFrameworks and roles

Page 3 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Role-based Components q Focusing on the following aspects of object-oriented components: l The interface l The size or granularity l Encapsulation l Composition mechanisms

Page 4 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Components q The interface of a component defines the syntax of how to use a component. The semantics of the interface are usually implicit. q Reusability q Plug-ability

Page 5 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Concept of Roles q Components may have several different uses in a system that are dependent on the different roles a component can play in the various component collaborations in the system. l With role-based components is that the public interface is separated into smaller interfaces, which model these different roles.

Page 6 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Kemerer and Chidamber’s Six Metrics q WMC: Weighted Methods per Class q DIT: Depth of Inheritance Tree q NOC: Number Of Children q CBO: Coupling Between Object classes q RFC: Response For a Class q LCOM: Lack of COhesiveness in Methods

Page 7 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering WMC - Weighted Methods per Class qIn terms of classes: l This metric reflects the notion that a complex class has a larger influence on its subclasses than a small class. qIn terms of roles: l Roles model only a small part of a class interface. l The amount of WMC of a role is typically less than that of a class. l Components are accessed using the role interfaces. l A smaller part of the interface must be understood than when the same component is addressed using its full interface.

Page 8 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering DIT - Depth of Inheritance Tree qIn terms of classes: l This metric reflects the notion that a deep inheritance hierarchy constitutes a more complex design. qIn terms of roles: l The DIT value will increase since inheritance is the mechanism for imposing roles on a component. l It should be noted however that roles only define the interface, not the implementation. l Thus while the DIT increases, the distribution of implementation throughout the inheritance hierarchy is not affected.

Page 9 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering NOC - Number Of Children qIn terms of classes: l This metric reflects the notion that classes with many subclasses are important classes in a design. qIn terms of roles: l Since role interfaces are typically located at the top of the hierarchy, the NOC metric will typically be high. l In a conventional class hierarchy, a high NOC for a class expresses that that class is important in the hierarchy. l Similarly, roles with a high NOC are important and have a high cohesiveness value.

Page 10 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering CBO - Coupling Between Object classes qIn terms of classes: l This reflects that excessive coupling inhibits reuse and that limiting the number of relations between classes helps to increase their reuse potential. qIn terms of roles: l The CBO metric will decrease since implementation dependencies can be avoided by only referring to role interfaces rather than by using classes as types.

Page 11 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering RFC - Response For a Class qIn terms of classes: l This metric measures the number of methods, which can be executed in response to a message. qIn terms of roles: l Since roles do not provide any implementation, the RFC value will not increase in implementation classes. l It may even decrease because class inheritance will be necessary to inherit implementation only, interfaces no longer.

Page 12 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering LCOM - Lack of COhesiveness in Methods qIn terms of classes: l This metric reflects the notion that non-cohesive classes should probably be separated into two classes and that classes with a low degree of cohesiveness are more complex. qIn terms of roles: l Roles typically are very cohesive in the sense that the methods for a particular role are closely related and roles will thus, typically, have a lower LCOM value.

Page 13 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Transformation Conclusions qRoles reduce complexity (improvement in CBO, RFC and LCOM metrics). q Roles increase complexity in the upper half of the inheritance hierarchy (Higher DIT and NOC values).

Page 14 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Role Technology qUsing roles at the design level qUsing roles at the implementation level

Page 15 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Using Roles at the Design Level q Reenskaug proposes an extension to UML: l General way to express object collaborations l Not too general (class diagrams) l Not too specific (object diagrams) l Uses classifier ­roles to denote the position an object holds in an object structure.

Page 16 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Catalysis q Catalysis: l Is a very extensive methodology based on UML, using the concepts of frameworks to model component interactions. l It includes a notion of types and type models. l A type corresponds to a role. l A type model describes typical collaborations between objects of that type.

Page 17 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Using Roles at the Implementation Level q Implementation languages: l Are typically on a lower abstraction level than the design. l Relations between classes in UML are commonly translated to pointers and references when a UML class diagram is implemented in, for example, C++. l With roles, a similar loss of information occurs. q The advantage of expressing roles in this way is that references to other classes can be typed using the interfaces.

Page 18 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Mixing Classes q Interfaces can be simulated by using abstract classes containing only virtual methods without implementation. l Since C++ supports multiple inheritance, these abstract classes can be combined as in Java. l This style of programming is often referred to as using mixing classes.

Page 19 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Using Multiple Languages q Roles can also be mapped to IDL interfaces, which makes it possible to use multiple languages (even those not object-oriented) in one system.

Page 20 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Using Multiple Languages: Example q According to the API Documentation, the JButton class in the Swing Framework implements the following Java interfaces: l Accessible, ImageObserver, ItemSelectable, MenuContainer, Serializable, SwingConstants. l These interfaces can be seen as roles, which this class can play in various collaborations. l The Serializable interface, for example, makes it possible to write objects of the JButton class to a binary stream.

Page 21 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Frameworks and Roles q Using roles together with object-oriented frameworks is useful. l Object- oriented frameworks are partial designs and implementations for applications in a particular domain. l By using a framework, the repeated re-implementation of the same behaviour is avoided and much of the complexity of the interactions between objects can be hidden by the framework. l An example of this is the Hollywood principle ("don't call us, we'll call you") often used in frameworks.

Page 22 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Black-box and White-box Frameworks Classes Components Abstract classes Interfaces Design documents Are a part of Inherit Implement Partially implement Reflect

Page 23 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Framework Elements q Design documents q Role Interfaces q Abstract classes q Components q Classes

Page 24 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering A Model for Frameworks qIn this section we will do so by specifying the general structure of a framework and comparing this with some existing ideas on this topic. l Composition of framework control l Composition with legacy code l Framework gap l Overlap of framework functionality

Page 25 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Dealing With Coupling q More coupling between components means higher maintenance costs (McCabe’s cyclomatic complexity).

Page 26 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Strategies for Dealing With Coupling qThat which they have in common is that for component X to use component Y, X will need a reference to Y. l Y is created by X and then discarded. l Y is a property of X. l Y is passed to X as a parameter of some method. l Y is retrieved by requesting it from a third object.

Page 27 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Dependencies Between Components q Regardless of how the reference is obtained, there are two types of dependencies between components: l Implementation dependencies: The references used in the relations between components are typed using concrete classes or abstract classes. l Interface dependencies: The references used in the relations between components are typed using only interfaces.

Page 28 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Dependency Considerations q Disadvantage of implementation dependencies l It is more difficult to replace the objects to which the component delegates. q When interface dependencies are used, the object can be replaced with any other object implementing the same interface. l Interface dependencies are thus more flexible and should always be preferred to implementation dependencies. qIn the model presented in this section, all components implement interfaces from role models making the use implementation dependencies in the implementation of these components unnecessary.