Progettazione Dettagliata delle Componenti. Tipologie di Componente Componenti convenzionali (funzioni, procedure, programmi…) Componenti OO (classi,

Slides:



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

Chapter 11 Component-Level Design
Object-Oriented Analysis and Design
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Jump to first page 1 System Design (Finalizing Design Specifications) Chapter 3d.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Criteria for good design. aim to appreciate the proper and improper uses of inheritance and appreciate the concepts of coupling and cohesion.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Developed by Reneta Barneva, SUNY Fredonia Component Level Design.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Systems Analysis and Design in a Changing World, Fifth Edition
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
1 COSC 4406 Software Engineering COSC 4406 Software Engineering Haibin Zhu, Ph.D. Dept. of Computer Science and mathematics, Nipissing University, 100.
Coupling and Cohesion Pfleeger, S., Software Engineering Theory and Practice. Prentice Hall, 2001.
Ch:10 Component Level Design Unit 4. What is Component? A component is a modular building block for computer software Because components reside within.
 2004 by SEC Chapter 4 Software Design. 2  2004 by SEC Chapter 4 Software Design 4.1 Design Fundamentals 4.2 Design Method 4.3 Architecture Design
SOFTWARE DESIGN (SWD) Instructor: Dr. Hany H. Ammar
SOFTWARE DESIGN.
1 Software Design Reference: Software Engineering, by Ian Sommerville, Ch. 12 & 13, 5 th edition and Ch. 10, 6 th edition.
SOFTWARE DESIGN Design Concepts Design is a meaningful engineering representation of something that is to be built It can be traced to a customer’s requirements.
Design engineering Vilnius The goal of design engineering is to produce a model that exhibits: firmness – a program should not have bugs that inhibit.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Software Design Deriving a solution which satisfies software requirements.
SE: CHAPTER 7 Writing The Program
Cohesion and Coupling CS 4311
Systems Analysis and Design in a Changing World, 3rd Edition
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 11 Slide 1 Design.
1 Chapter 9 Design Engineering. 2 Analysis Model -> Design Model.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Computing and SE II Chapter 9: Design Methods and Design Models Er-Yu Ding Software Institute, NJU.
CCSB223/SAD/CHAPTER131 Chapter 13 Designing the System Internals.
Software Design: Principles, Process, and Concepts Getting Started with Design.
CS 3610: Software Engineering – Spring 2009 Dr. Hisham Haddad – CSIS Dept. Chapter 9 Design Engineering Highlights of Software Design Concepts and Principles.
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 11a: Component-Level Design Software Engineering: A Practitioner’s Approach, 6/e Chapter.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 9: Design Engineering Software Engineering: A Practitioner’s Approach, 6/e Chapter.
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
Design Reuse Earlier we have covered the re-usable Architectural Styles as design patterns for High-Level Design. At mid-level and low-level, design patterns.
CHAPTER 3 MODELING COMPONENT-LEVEL DESIGN.
CS 8532: Adv. Software Eng. – Spring 2007 Dr. Hisham Haddad Chapter 9 Class will start momentarily. Please Stand By … CS 8532: Advanced Software Engineering.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Week 6: Software Design HNDIT Software Engineering Software Design Learning Outcomes  Understand the activities involved in the Design process.
Rohini Sharma Roll No. RA1809A01 Regd. No M.Tech.(CSE) Part Time 3 rd Semester.
CS 3610: Software Engineering – Fall 2009 Dr. Hisham Haddad – CSIS Dept. Chapter 9 Design Engineering Highlights of Software Design Concepts and Principles.
Basic Characteristics of Object-Oriented Systems
SOFTWARE DESIGN & SOFTWARE ENGINEERING Software design is a process in which data, program structure, interface and their details are represented by well.
11 Systems Analysis and Design in a Changing World, Fifth Edition.
Coupling and Cohesion Pfleeger, S., Software Engineering Theory and Practice. Prentice Hall, 2001.
Design Engineering 1. Analysis  Design 2 Characteristics of good design 3 The design must implement all of the explicit requirements contained in the.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
7. Modular and structured design
Coupling and Cohesion Rajni Bhalla.
Design engineering Prepared By:Jay A.Dave..
Software Engineering: A Practitioner’s Approach, 6/e Chapter 9 Design Engineering copyright © 1996, 2001, 2005 R.S. Pressman & Associates, Inc. For.
Lecture 9- Design Concepts and Principles
Software Design Mr. Manoj Kumar Kar.
Software Engineering: A Practitioner’s Approach, 6/e Chapter 11 Component-Level Design copyright © 1996, 2001, 2005 R.S. Pressman & Associates, Inc.
TIM 58 Chapter 8: Class and Method Design
CIS 375 Bruce R. Maxim UM-Dearborn
Component-Level Design
Improving the Design “Can the design be better?”
Software Design CMSC 345, Version 1/11.
Lecture 9- Design Concepts and Principles
CS 8532: Advanced Software Engineering
Software Design Lecture : 9.
Cohesion and Coupling.
DESIGN CONCEPTS AND PRINCIPLES
COSC 4406 Software Engineering
Presentation transcript:

Progettazione Dettagliata delle Componenti

Tipologie di Componente Componenti convenzionali (funzioni, procedure, programmi…) Componenti OO (classi, insiemi di classi, oggetti)

Components and Design Principles Several design principles are realised by looking at the concept of component: – Hides Information – Abstracts data, control and function to a certain degree (and with a certain focus) – Modularises the software – Can be internally refined (as it happens for architectures) C I I An interface usually enables performing functions/procedures S

Progettazione delle Componenti Nel caso della progettazione strutturata, la valutazione delle componenti procede applicando di fatto un design principle cioè functional independence Nel caso di componenti orientate agli oggetti il modo più efficace è l’uso di design pattern In entrambe i casi è ragionevole applicare il refactoring (ovvero ristrutturazione) per migliorare il risultato mantenendo l’”equivalenza” I tre casi, possono operare su componenti i cui dettagli interni sono completamente noti ma anche componenti sommariamente descritti, come risultato dai precedenti passi di progettazione che hanno introdotto e raffinato un’architettura

Describing the internal structure of the modules The objective is to define the alghoritms and the data types (by reusing th existing alghoritms and data types) Flow chart, PDL and Decision Tables (see Pressman) can be employed

Flow Chart We are all familiar with the flow chart representations: – Flow chart is a convenient technique to represent the flow of control in a system. A=B if(c == 100) P=20 else p= 80 while(p>20) print(student mark) A=B P=20P=80 Print yes no dummy yes no

Flow Chart versus Structure Chart A structure chart differs from a flow chart in three principal ways: – It is difficult to identify modules of a software from its flow chart representation. – Data interchange among the modules is not represented in a flow chart. – Sequential ordering of tasks inherent in a flow chart is suppressed in a structure chart.

Decision Table From Pressman

Program Design Language (PDL) From Pressman

Describing the internal structure of classes Operations (and how they can be used) must be defined: statecharts for the class are the support for this purpose; however, in simple case, operations can be synthesized from pre and post conditions Class invariants can be used as well Data types for class attributes must be defined Associations should be implemented Inheritance and polymorphism can be used as well (and Framework)

Inheritance Design options: – The class can be designed and built from scratch. That is, inheritance is not used. – The class hierarchy can be searched to determine if a class higher in the hierarchy (a superclass) contains most of the required attributes and operations. The new class inherits from the superclass and additions may then be added, as required. – The class hierarchy can be restructured so that the required attributes and operations can be inherited by the new class. – Characteristics of an existing class can be overridden and different versions of attributes or operations are implemented for the new class. From Pressman

Polymorphism case of graphtype: if graphtype = linegraph then DrawLineGraph (data); if graphtype = piechart then DrawPieChart (data); if graphtype = histogram then DrawHisto (data); if graphtype = kiviat then DrawKiviat (data); end case; All of the graphs become subclasses of a general class called graph. Using a concept called overloading [TAY90], each subclass defines an operation called draw. An object can send a draw message to any one of the objects instantiated from any one of the subclasses. The object receiving the message will invoke its own draw operation to create the appropriate graph. graphtype draw Conventional approach … From Pressman

Frameworks (OO) A framework (OO) is not an architectural pattern, but rather a skeleton with a collection of “plug points” (also called hooks and slots) that enable it to be adapted to a specific problem domain It is like the earlier concept of library of modules Gamma et al. note that: – Design patterns are more abstract than frameworks. – Design patterns are smaller architectural elements than frameworks – Design patterns are less specialized than frameworks From Pressman

Functional Independence: Two Views

Functional Independence Low Coupling and High Cohesion For each Module is the Design Principle enabling better maintaneability, evolvibiliy, reusability (and not only) Elaborated From Pressman Partially, the design principle is guaranteed by a well defined requirement specification

Classification of Cohesiveness coincidental logical temporal procedural sequential communicational functional Degree of cohesion High Low

Classes of coupling content common stamp control data Degree of coupling Low High

Coincidental cohesion The module allows to perform a set of functions which relate to each other very loosely, if at all: the module contains a random collection of functions. functions have been put in the module out of pure coincidence without any thought or design.

Logical cohesion All elements of the module perform similar operations Examples: – unique error handling, data input, data output, etc. – a set of print functions to generate an output report, arranged into a single module; – visualising distinct messages with similar layout

Temporal cohesion The module contains functions that must be executed in the same time span. Example: – The set of functions responsible for initialization, start-up, shut-down of some process, etc.

Procedural cohesion The set of functions of the module certain sequences of steps have to be carried out in a certain order for achieving an objective Example:

Communicational cohesion All functions of the module reference or update the same data structure Example: – the set of functions defined on an array or a stack.

Sequential cohesion Elements of a module form different parts of a specific sequence, output from one element of the sequence is input to the next Example: sort search display

Functional cohesion Different elements of a module cooperate to achieve a single function When a module displays functional cohesion, we can describe its function using a single sentence.

Data coupling Two modules are data coupled, if they communicate via a parameter corresponding to: an elementary data item (e.g an integer, a float, a character,…) a composite data item which contents is fully used The data item should not be used for control purpose.

Stamp coupling Two modules are stamp coupled, if they communicate via a composite data item (i.e. there is a dependency of the structure of data) where some part are not used Composite data item: record in PASCAL structure in C class in Java

Control coupling Data from one module is used to direct order of instruction execution in another Example of control coupling: – a flag set in one module and tested in another module

Common Coupling Two modules are common coupled if they share some global data.

Content coupling Content coupling exists between two modules if they share code in a general sense (code accessing the same internal variables, same data, but also the code needs to be maintained the same)

Evaluating Quality by using Design Principles metricsQuality attributes metrics Quality attributes Coupling and cohesion Fan-in, Fan-out Limited Fan- ou and higher Fan-in for each module Modules are loosely coupled and highly cohesed (not sure)

Evaluating Quality by using Design Principles Clearly Fan-in and Fan-out metrics are only very approximate ways to understand coupling and cohesion of modules Example is the “online train ticket case study” ACB Valutare Costo Valutare Costo& Disponibilità Get Costo Get OpzioniViaggio costo Opzioni+Viaggio Valutare Costo I1I2 Cohesion? Coupling?

Valutare la coesione non necessita la rappresentazione dettagliata di una componente

Coupling in OO Conventional view: – The degree to which a component is connected to other components and to the external world OO view: – a qualitative degree to which classes are connected to one another Level of coupling – Content – Common – Control – Stamp – Data – Routine call – Type use – Inclusion or import – External From Pressman A little bit different from the previous list of coupling levels Sometimes referred to as design pattern (low coupling)

Cohesion in OO Conventional view: – the “single-mindedness” of a module OO view: – cohesion implies that a component or class encapsulates only attributes and operations that are closely related to one another and to the class or component itself Levels of cohesion – Functional – Layer – Communicational – Sequential – Procedural – Temporal – Utility From Pressman A little bit different from the previous list of cohesion levels Sometimes referred to as design pattern (high cohesion)

Refactoring: Generalised View Fowler [FOW99] defines refactoring in the following manner: – "Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code [design] yet improves its internal structure.” Similar to design patterns but design patterns are for building the (non existing) components while refactoring (patterns) is (are) for changing the existing components When software is refactored, the existing design is examined by following empirical ways for – redundancy – unused design elements – inefficient or unnecessary algorithms – poorly constructed or inappropriate data structures – or any other design failure that can be corrected to yield a better design. Elaborated From Pressman

Refactoring in Structured Design Generally speaking, it is a way for increasing cohesion per module and decreasing the overall coupling with the objective of – minimizing the potential duplication of code in each module – separating work modules from management modules (in a structure chart) – providing more generally useful modules – simplifying the future code management modules work modules

Refactoring (Online Train Tickets) ACB Valutare Costo Valutare Costo& Disponibilità Get Costo Get OpzioniViaggio costo Opzioni+Viaggio Valutare Costo I1I2 Valutare Costo Opzioni+Viaggio M costo

Refactoring per componenti OO Il refactoring nel caso di componenti OO opera soprattutto a livello di codice (cioè una volta che le componenti sono state completamente descritte ovvero codificate in qualche linguaggio di programmazione) Un esempio è presentato nel trasparente successivo E’ comunque possibile fare del refactoring durante il progetto (cioè operando su rappresentazioni quali il diagramma delle classi, gli statechart etc., ed è forse anche meglio!

Refactoring Class Diagram Example ViaggioTreno Prenotazione Treno Viaggio Prenotazione A limited definition of each class is needed Partially, the need of refactoring the design model may be decreased by a well defined requirement specification

Conclusioni Architectural views Requirement engineering Design engineering Architecture design Component design Architectural patterns Architectural styles Design patterns Quality attributes (stakeholders) Increment and tranformation guidelines Detailed Comp. design Design principles

Conclusioni Gli approcci proposti hanno la caratteristica della sistematicità e, quindi, della precisa realizzazione della tracciabilità dai requisiti al modello di progetto Un processo di sviluppo prevede quindi a questo punto la costruzione e il test del software costruito reqX (doc. requisiti) Funzione (Modello analitico) Classe (Modello analitico) Classe (Modello di progetto) Modulo (Modello di progetto)