Principles of Good Design

Slides:



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

Object-Oriented Software Construction Bertrand Meyer 2nd ed., Prentice Hall, 1997.
Software Engineering Software Design Slide 1 Software Engineering Software Design.
Software Design Hoang Huu Hanh, Hue University hanh-at-hueuni.edu.vn.
The Architecture Design Process
Design The goal is to design a modular solution, using the techniques of: Decomposition Abstraction Encapsulation In Object Oriented Programming this is.
CS350/550 Software Engineering Lecture 1. Class Work The main part of the class is a practical software engineering project, in teams of 3-5 people There.
1 CS115 Class 7: Architecture Due today –Requirements –Read Architecture paper pages 1-15 Next Tuesday –Read Practical UML.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Software Issues Derived from Dr. Fawcett’s Slides Phil Pratt-Szeliga Fall 2009.
Course Instructor: Aisha Azeem
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 11 Slide 1 Architectural Design.
MADALINA CROITORU Software Engineering week 4 Madalina Croitoru IUT Montpellier.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
1/19 Component Design On-demand Learning Series Software Engineering of Web Application - Principles of Good Component Design Hunan University, Software.
CSE 303 – Software Design and Architecture
Ceg860 (Prasad)L6MR1 Modularity Extendibility Reusability.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 10Slide 1 Architectural Design l Establishing the overall structure of a software system.
SOFTWARE DESIGN (SWD) Instructor: Dr. Hany H. Ammar
SOFTWARE DESIGN.
GRASP: Designing Objects with Responsibilities
Software Engineering Principles. SE Principles Principles are statements describing desirable properties of the product and process.
SOFTWARE DESIGN. INTRODUCTION There are 3 distinct types of activities in design 1.External design 2.Architectural design 3.Detailed design Architectural.
PRINCIPLES OF GOOD DESIGN 12/7/ Assignment 4 – Deadline 28 Nov.  Read an article placed in generalshare course folder  Point: Design Patterns.
Thanks for Coming l WEB. Principles of Good Design SEI, SJTU WEB APPS and SERVICES.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
1 Software Design Lecture What’s Design It’s a representation of something that is to be built. i.e. design  implementation.
Review of Parnas’ Criteria for Decomposing Systems into Modules Zheng Wang, Yuan Zhang Michigan State University 04/19/2002.
Or how to work smarter when building solutions.  2:30 – 3:30 Mondays – focus on problem solving (with some terminology thrown in upon occasion)  All.
Object-Oriented Design Concepts University of Sunderland.
Chapter 10 Software quality. This chapter discusses n Some important properties we want our system to have, specifically correctness and maintainability.
DESIGN PROCESS AND CONCEPTS. Design process s/w design is an iterative process through which requirements are translated into a “blueprint” for constructing.
Design Engineering 1. Analysis  Design 2 Characteristics of good design 3 The design must implement all of the explicit requirements contained in the.
Design Concepts ch-8
Principles of Programming & Software Engineering
GRASP – Designing Objects with Responsibilities
Software Design.
7. Modular and structured design
CompSci 280 S Introduction to Software Development
IS301 – Software Engineering Dept of Computer Information Systems
SOFTWARE DESIGN AND ARCHITECTURE
On the Criteria to Be Used in Decomposing Systems into Modules
Lecture 9- Design Concepts and Principles
Software Design Mr. Manoj Kumar Kar.
Part 3 Design What does design mean in different fields?
Software Quality Engineering
Hierarchical Architecture
TIM 58 Chapter 8: Class and Method Design
CIS 375 Bruce R. Maxim UM-Dearborn
Chapter 5 Designing the Architecture Shari L. Pfleeger Joanne M. Atlee
Improving the Design “Can the design be better?”
Object-Oriented Design
Software Architecture
Lecture 9- Design Concepts and Principles
Object oriented analysis and design
Chapter 5 Architectural Design.
CSE403 Software Engineering Autumn 2000 Design (Overview)
An Introduction to Software Architecture
CIS601: Object-Oriented Programming in C++
SAMANVITHA RAMAYANAM 18TH FEBRUARY 2010 CPE 691
What Is Good Software(Program)?
Chapter 5 Architectural Design.
Design Yaodong Bi.
Principles of Good Design
Software Design Lecture : 6
Software Engineering Software Design.
Presentation transcript:

Principles of Good Design Lecture 1

From Journeyman to Master Pieces, Moves Criteria, Principles, Heuristics Contextual Solutions How to Apply "Good"? How to Play? What is Good? Lecture 1

Stages of Learning Learn the Rules! Learn the Principles! algorithms, data structures and languages of software write programs, although not always good ones Learn the Principles! software design, programming paradigms with pros and cons importance of cohesion, coupling, information hiding, dependency management Learn the Patterns! study the "design of masters" Understand! Memorize! Apply! Lecture 1

Citing Robert Martin ... "... But to truly master software design, one must study the designs of other masters. Deep within those designs are patterns that can be used in other designs. Those patterns must be understood, memorized, and applied repeatedly until they become second nature." Lecture 1

Where Do We Stand ? We know the Rules We heard about Principles 1-2 OO programming language (Java, C++) some experience in writing programs (< 10 KLOC) We heard about Principles "Open-Closed"; "Liskov Substitution Principle" etc. randomly applied some of them We dream of becoming "design masters" but... …we believe that writing good software is somehow "magic" exclusively tailored for geniuses, "artists", gurus ;-) Lecture 1

A Roadmap What is Good Design? What is Good Object-Oriented Design? Goals of Design Key Concepts and Principles Criteria for Good Design Principles and Rules of Good Design What is Good Object-Oriented Design? Guidelines, Rules, Heuristics How to Apply Good Design? Design Patterns Architectural Patterns (Styles) Lecture 1

Goals of Design Decompose system into components i.e. identify the software architecture Describe component functionality informally or formally Determine relationships between components identify component dependencies determine inter-component communication mechanisms Specify component interfaces Interfaces should be well defined facilitates component testing and team communication Lecture 1

What is Good Design? There is no correct design! You must decide! The temptation of "correct design" insurance against "design catastrophes" design methods that guarantee the "correct design" A good design is one that balances trade-offs to minimize the total cost of the system over its entire lifetime […] a matter of avoiding those characteristics that lead to bad consequences. Coad & Jourdon There is no correct design! You must decide! Need of criteria for evaluating a design Need of principles and rules for creating good designs Lecture 1

Key Design Issues 1. Decomposition/Composition 2. Modularity Main purpose - Manage software system complexity by ... ... improving software quality factors ... facilitate systematic reuse 1. Decomposition/Composition Why and How ? What is a component? Principles 2. Modularity Definition. Benefits Criteria Principles Lecture 1

Decomposition 1. Select a piece of the problem WHY ? Handle complexity by splitting large problems into smaller problems, i.e. "divide and conquer" methodology 1. Select a piece of the problem initially, the whole problem 2. Determine the components in this piece using a design paradigm e.g. functional, structured, object-oriented, generic, etc. 3. Describe the components interactions 4. Repeat steps 1 through 3 until some termination criteria is met e.g., customer is satisfied, run out of money, etc. ;-) Lecture 1

A Component Is ... ... a SW entity encapsulating the representation of an abstraction ... a vehicle for hiding at least one design decision ... a "work" assignment for a programmer or group of programmers ... a unit of code that has one (or more) name(s) has identifiable boundaries can be (re-)used by other components encapsulates data hides unnecessary details can be separately compiled Lecture 1

Component Interface A component interface consists of several sections: Exports services provided to other components Imports services required from other components Access Control e.g. protected/private/public Lecture 1

Decomposition Principles P1. Don't design components to correspond to execution steps Since design decisions usually transcend execution time [Parnas72] P2. Decompose so as to limit the effects of design decisions Anything that spreads within the system will be expensive to change P3. Components should be specified by all information needed to use the component and nothing more! Lecture 1

Modularity A modular system is one that's structured into identifiable abstractions called components Components should possess well-specified abstract interfaces Components should have high cohesion and low coupling A software construction method is modular if it helps designers produce software systems made of autonomous elements connected by a coherent, simple structure. B. Meyer Lecture 1

Benefits of Modularity Modularity facilitates software quality factors, e.g.: Extensibility well-defined, abstract interfaces Reusability low-coupling, high-cohesion Portability hide machine dependencies Modularity is important for good design since it Enhances for separation of concerns Enables developers to reduce overall system complexity via decentralized software architectures Increases scalability by supporting independent and concurrent development by multiple personnel Lecture 1

Meyer's Five Criteria for Evaluating Modularity Decomposability Are larger components decomposed into smaller components? Composability Are larger components composed from smaller components? Understandability Are components separately understandable? Continuity Do small changes to the specification affect a localized and limited number of components? Protection Are the effects of run-time abnormalities confined to a small number of related components? Lecture 1

1. Decomposability Decompose problem into smaller sub-problems that can be solved separately Goal: Division of Labor keep dependencies explicit and minimal Example: Top-Down Design Counter-example: Initialisation Module initialize everything for everybody Lecture 1

2. Composability Freely combine modules to produce new systems Reusability in different environments  components Example: Math libraries; UNIX command & pipes Counter-example: use of prepocessors Lecture 1

Composability and Decomposability The second [precept I devised for myself ] was to divide each of the difficulties which I would examine into as many parcels as it would be possible and required to solve it better. The third was to drive my thoughts in due order, beginning with these objects most simple and easiest to know, and climbing little by little, so to speak by degrees, up to the knowledge of the most composite ones; and assuming some order even between those which do not naturally precede one another. Rene Decartes Lecture 1

3. Understandability Individual modules understandable by human reader Counter-example: Sequential Dependencies (A | B | C) contextual significance of modules Lecture 1

4. Continuity Small change in requirements results in: changes in only a few modules does not affect the architecture Example: Symbolic Constants Counter-Example: data-driven design Lecture 1

5. Protection Effects of an abnormal run-time condition is confined to a few modules Example: Validating input at source Counter-example: Undisciplined exceptions Lecture 1

Meyer's Five Rules of Modularity Direct Mapping consistent relation between problem model and solution structure Few Interfaces Every component should communicate with as few others as possible Small Interfaces If any two components communicate at all, they should exchange as little information as possible Explicit Interfaces Whenever two components A and B communicate, this must be obvious from the text of A or B or both Information Hiding Lecture 1

1. Direct Mapping Keep the structure of the solution compatible with the structure of the modeled problem domain clear mapping (correspondence) between the two Impact on: Continuity easier to assess and limit the impact of change Decomposability decomposition in the problem domain model as a good starting point for the decomposition of the software Lecture 1

2. Few Interfaces Every module should communicate with as few others as possible rather n-1 than n(n-1)/ 2 Continuity, Protection, Understandability, Composability centralized anarchic distributed Lecture 1

3. Small Interfaces 4. Explicit Interfaces If two modules communicate, they should exchange as little information as possible limited "bandwidth" of communication Continuity and Protection 4. Explicit Interfaces Whenever two modules A and B communicate, this must be obvious from the text of A or B or both. Decomposability and Composability Continuity, Understandability Lecture 1

4. Explicit Interfaces (2) The issue of indirect coupling data sharing Module A Module B modifies accesses Data Item x Lecture 1

Rule 2 – Rule 3 – Rule 3 Rephrased Few Interfaces: “Don’t talk to many!” Small Interfaces: “Don’t talk a lot!” Explicit Interfaces: “Talk loud and in public! Don’t whisper!” Lecture 1

5. Information Hiding Motivation: design decisions that are subject to change should be hidden behind abstract interfaces, i.e. components Components should communicate only through well-defined interfaces Each component is specified by as little information as possible remember Schmidt’s decomposition principles! Continuity: If internal details change, client components should be minimally affected not even recompiling or linking Information hiding is one means to enhance abstraction! Lecture 1

Abstraction vs. Information Hiding Lecture 1

Coming Next ... What is Good Object-Oriented Design? The Object-Oriented ... Hype Mapping of Criteria and Rules to OO Design Principles of OO Design (R. Martin) Design Heuristics (A.J. Riel) Lecture 1