Principles of Package Design COMPOSE AT A HIGHER LEVEL OF ABSTRACTION.

Slides:



Advertisements
Similar presentations
Obligatory cuteness. Guidelines for Using Multiple Views in Information Visualization ● A guideline paper – does not introduce any new techniques, but.
Advertisements

•7/12 /07 F-1 © 2010 T. Horton CS 4240 Principles of SW Design Packages in Java and UML.
Luca Lista - C++ Metriche nel software Luca Lista INFN, Sezione di Napoli.
Design Concepts and Principles
Framework is l Reusable Code, often domain specific (GUI, Net, Web, etc) l expressed as l a set of classes and l the way objects in those classes collaborate.
Stability and Volatility is Software Design H. Rahnama Tutorial in software engineering.
General OO Concepts and Principles CSE301 University of Sunderland Harry R. Erwin, PhD.
Lecture 9 Improving Software Design CSC301-Winter 2011 – University of Toronto – Department of Computer Science Hesam C. Esfahani
SOLID Object Oriented Design Craig Berntson
Software measurement Ronan Fitzpatrick.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
אביב תשס " ה JCT תיכון תוכנה ד " ר ר ' גלנט / י ' לויאןכל הזכויות שמורות 1 פרק 10 Packages.
Object-Orientated Design Unit 3: Objects and Classes Jin Sa.
Developed by Reneta Barneva, SUNY Fredonia Component Level Design.
Package design and the Iterative process model. What is a package? Classes are not sufficient to group code –Some classes collaborate, implying dependencies.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
TEST-1 7. Object-Oriented Design Principles. TEST-2 The Pillars of the Paradigm Abstraction Encapsulation Hierarchy –Association, Aggregation –Inheritance.
Chapter 13 Starting Design: Logical Architecture and UML Package Diagrams.
Pedro Mejia Alvarez CINVESTAV-PN
1 OO Design Principles Project Group eXtreme Programming Md. Abul Bashar 07/09/2004.
Alexander Serebrenik, Serguei Roubtsov, and Mark van den Brand D n -based Design Quality Comparison of Industrial Java Applications.
CSE 303 – Software Design and Architecture
9.4 Software Architecture
1 OO Design Novosoft, 2001 by V. Mukhortov. 2 OO Design Goals  Flexibility Changes must be localized  Maintainability Modules requiring changes can.
11:57© , hello2morrow1 Software Sustainability Alexander v. Zitzewitz hello2morrow, Inc.
Ch:10 Component Level Design Unit 4. What is Component? A component is a modular building block for computer software Because components reside within.
Company Confidential – Do Not Duplicate 2 Copyright 2008 McLane Advanced Technologies, LLC S.O.L.I.D. Software Development Achieving Object Oriented Principles,
Advanced Principles II Principles of Object-Oriented Component Design Copyright  by Object Mentor, Inc All Rights Reserved Portions of this.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
SWE © Solomon Seifu ELABORATION. SWE © Solomon Seifu Lesson 12-5 Software Engineering Design Goals.
4/1/05F-1 © 2001 T. Horton CS 494 Object-Oriented Analysis & Design Packages and Components in Java and UML.
Software Engineering Principles. SE Principles Principles are statements describing desirable properties of the product and process.
Chapter 10 Software Engineering. Understand the software life cycle. Describe the development process models. Understand the concept of modularity in.
1 OO Package Design PrinciplesStefan Kluth 4OO Package Design Principles 4.1Packages Introduction 4.2Packages in UML 4.3Three Package Design Principles.
Elements of OO Abstraction Encapsulation Modularity Hierarchy: Inheritance & Aggregation 4 major/essential elements3 minor/helpful elements Typing Concurrency.
OO Design Principles Copyright © Vyacheslav Mukhortov, Nikita Nyanchuk-Tatarskiy, Copyright © INTEKS LLC,
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 11a: Component-Level Design 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:
CHAPTER 3 MODELING COMPONENT-LEVEL DESIGN.
Watching the movie the hard way…. Page 256 – Head First Design Patterns.
SOLID Design Principles
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Dependency Inversion Principle Jon McBee Principal Software Engineer Ultratech CNT.
Session 33 More on SOLID Steve Chenoweth Office: Moench Room F220 Phone: (812) Chandan Rupakheti Office: Moench.
1 Good Object-Oriented Design Radu Marinescu Lecture 3 Principles of Object-Oriented Design Part II 19 th November 2002.
09:18© , hello2morrow1 Golden Rules to Improve Your Architecture Alexander v. Zitzewitz hello2morrow Inc.
1 Advanced Object- oriented Design – Principles CS320 Fall 2005.
1 Advanced Object-oriented Design – Principles and Patterns OO Design Principles.
Course information Old exam Resit Report Result and walkthrough
Dependency Inversion Principle
by C.A. Conley and L. Sproull
Design Patterns: MORE Examples
Chapter 12 Object Oriented Design Principles
Chapter 12 Object Oriented Design Principles
CMPE 135: Object-Oriented Analysis and Design October 24 Class Meeting
Unfunded Liabilities: How Poor Package Design Drives Technical Debt and What You Can Do About It Allen C Smith, CLA Senior Systems Engineer, ATE.
Software Design and Architecture
Software Engineering: A Practitioner’s Approach, 6/e Chapter 11 Component-Level Design copyright © 1996, 2001, 2005 R.S. Pressman & Associates, Inc.
Principles of Package Architecture
Object-Oriented Design
Starting Design: Logical Architecture and UML Package Diagrams
Design Tips.
CMPE 135 Object-Oriented Analysis and Design March 21 Class Meeting
Better Architecture Management Made Easy
Principles of Object-Oriented Design Part II
A (partial) blueprint for dealing with change
the Java package design analyser
Principles of High-Level Design
Dependency Inversion principle
Chapter 10 – Component-Level Design
Presentation transcript:

Principles of Package Design COMPOSE AT A HIGHER LEVEL OF ABSTRACTION

As applications grow in size and complexity they require some kind of high-level organization

Grouping code into packages provides two benefits It allows us to reason about the design at a higher level of abstraction It helps us manage the development and distribution of the software Package Coupling Package Cohesion

What is a package? ^ LabVIEW

Principles of Package Design Package Cohesion Reuse-Release Equivalence Principle (REP) Common-Reuse Principle (CRP) Common-Closure Principle (CCP) Package Coupling Acyclic-Dependencies Principle (ADP) Stable-Dependencies Principle (SDP) Stable-Abstractions Principle (SAP)

Package Cohesion The three principles of package cohesion provide guidance on how to partition classes into packages

Reuse-Release Equivalence Principle “ The granule of reuse is the granule of release” - Bob Martin

Reuse-Release Equivalence Principle Reusability comes only after there is a tracking system in place that offers the guarantees of notification, safety, and support

Reuse-Release Equivalence Principle If a package contains software designed for reuse then it should not also contain software designed not for reuse All software in a package should be reusable by the same audience What does this tell us about the internal structure of the package?

Reuse-Release Equivalence Principle Packages should be easy for users to use Packages should be released through a tracking system For a package to be reusable, all of its classes should be reusable Summary

Common-Reuse Principle “ The classes in a package are reused together. If you reuse one of the classes in a package, you reuse them all” - Bob Martin

Common-Reuse Principle It is typical for classes in a package to be tightly coupled It should be impossible to depend on some classes in a package without depending on all classes in a package

Common-Reuse Principle SRP: Classes should have only one reason to change CRP: Classes in a package should be reused together

Common-Reuse Principle Group classes according to common reuse CRP is SRP applied to packages Classes which are not tightly bound to each other should not be packaged together Summary

Common-Closure Principle “ The classes in a package should be closed together against the same kinds of changes” - Bob Martin

Common-Closure Principle The classes in a package should be closed together against the same kind of changes. A change that affects a package affects all the classes in that package

Common-Closure Principle The classes in a package should be closed together against the same kind of changes. A change that affects a package affects all the classes in that package

Common-Closure Principle OCP: Classes should be open for extension, but closed for modification CCP: Classes in a package should be closed to the same kinds of changes

Common-Closure Principle Packages should be closed to anticipated changes CCP is OCP applied to packages CCP reduces package release frequency Summary

Package Cohesion Summary In choosing classes to include in packages we have to balance reusability and developability This balancing act will cause the composition of the packages to change over time The partitioning of classes into packages cannot happen until after the classes and their interrelationships have been created There are no metrics for package cohesion

Package Coupling The three principles of package coupling deal with the relationships between packages

Acyclic-Dependencies Principle “ Allow no cycles in the package- dependency graph” - Bob Martin

Acyclic-Dependencies Principle Acyclic Dependencies Principle: The dependency structure for the package must be a Directed Acyclic Graph (DAG) where nodes are packages and edges are dependencies

Acyclic-Dependencies Principle MyAppMsgWindwTaskWindwMyTasksDatabaseMyDialogsTasksWindows

Acyclic-Dependencies Principle

MyAppMsgWindwTaskWindwMyTasksDatabaseMyDialogsTasksWindows

Acyclic-Dependencies Principle

How do we break the cycle? Dependency Inversion Principle Create a new package and move dependent classes into the new package

Acyclic-Dependencies Principle Class X MyDialogs MyApp Class Y Class XClass YClass iY

Acyclic-Dependencies Principle MyAppMsgWindwTaskWindwMyTasksDatabaseMyDialogsTasksWindows newPckg

Acyclic-Dependencies Principle Dependency graphs should be acyclic Cycles can be measured using DFS Cycles can be removed through dependency inversion Summary

Stable-Dependencies Principle “ Depend in the direction of stability” - Bob Martin

Stable-Dependencies Principle Change is inevitable, we can use the Common-Closure Principle (CCP) to create packages that are sensitive to certain kinds of changes

Stable-Dependencies Principle A package with lots of incoming dependencies is very stable because it takes a great deal of work to change it

Stable-Dependencies Principle X X is responsible to these three packages X is independent

Stable-Dependencies Principle Y Y is irresponsible Y is dependent

Stable-Dependencies Principle Stability Metrics Ca = Afferent Coupling: Number of classes outside the package that depend on classes inside Ce = Efferent Coupling: Number of classes inside the package that depend on classes outside I = Instability = Ce / (Ca + Ce)

Stable-Dependencies Principle AB C D QRS TUV Package C Metrics Ca = 3 Ce = 1 I = 1/4

Demo: Package Metrics

Stable-Dependencies Principle Summary Responsible, dependent packages are stable We can calculate Instability Not all packages should be stable, if they were the system would be unchangeable

Stable-Abstractions Principle “ A package should be as abstract as it is stable” - Bob Martin

Stable-Abstractions Principle A stable package should be abstract so that its stability does not prevent it from being extended

Stable-Abstractions Principle SAP + SDP = DIP for packages SDP says that dependencies should run in the direction of stability, and SAP says that stability implies abstraction -> Dependencies run in the direction of abstraction

Stable-Abstractions Principle Measuring Abstraction Nc = Number of classes in the package Na = Number of abstract classes in the package A = Na / Nc

Stable-Abstractions Principle What is an abstract class in LabVIEW? Any Class with at least one abstract method?

Stable-Abstractions Principle Distance from the Main Sequence D = |A + I - 1| A I (1,1) (1,0)(0,0) (0,1) Zone of Pain Zone of Uselessness

Demo: Package Metrics

Summary Packages provide high level organization for large LabVIEW applications Package cohesion is a balance between usability and developability Package coupling can be measured Package design happens after classes and their interconnectedness have been created, and evolves as the application changes