14 Jul 2005CSE403, Summer'05, Lecture 09 Lecture 09: Fundamental Principles and Best Practices for Software Design Valentin Razmov.

Slides:



Advertisements
Similar presentations
1 Object-Oriented Reengineering © R. Marinescu Lecture 5 Radu Marinescu Principles of Object-Oriented Design.
Advertisements

Since 1995, we’ve been building innovative custom solutions specifically designed to meet the unique needs of America’s most recognized companies. If you.
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
Inheritance and object compatibility Object type compatibility An instance of a subclass can be used instead of an instance of the superclass, but not.
Developed by Reneta Barneva, SUNY Fredonia Component Level Design.
13-Jul-15 Refactoring II. Books Design Patterns is the classic book by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides Basically a catalog.
CSCI-383 Object-Oriented Programming & Design Lecture 15.
13 Jul 2006CSE403, Summer'06, Lecture10 Lifecycle Architecture Review: Preliminary Feedback Valentin Razmov.
Design II Today: Design Principles…can we define them intro.12.ppt CS 121 “Ordering Chaos” “Mike” Michael A. Erlinger.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented Design.
Object-oriented metrics Design decisions: Class Cohesion Open-Closed Single Responsibility Interface Segregation Dependency Inversion Liskov Substitution.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
CLASS DESIGN PRINCIPLES Lecture 2. The quality of the architecture What is a good design? It is the design that at least does not have signs of “bad”.
22 Jul 2005CSE403, Summer'05, Lecture 12 Lecture 12: Scheduling, Estimation, and Prioritization (Part II) Valentin Razmov.
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,
More Design. Next Tuesday First draft of architectural design –use cases –class diagrams for major classes with responsibilities –sequence diagrams for.
Object-Oriented Modeling Chapter 10 CSCI CSCI 1302 – Object-Oriented Modeling2 Outline The Software Development Process Discovering Relationships.
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
© 2004 Capgemini - All rights reserved SOLID - OO DESIGN PRINCIPLES Andreas Enbohm, Capgemini.
CSE 301 Exam Revision Lecture
Introduction to SOLID Principles. Background Dependency Inversion Principle Single Responsibility Principle Open/Closed Principle Liskov Substitution.
S.O.L.I.D. Software Development 12 January 2010 (Martin Verboon, Patrick Kalkman, Stan Verdiesen)
SWE © Solomon Seifu ELABORATION. SWE © Solomon Seifu Lesson 12-5 Software Engineering Design Goals.
Design Principles iwongu at gmail dot com.
The benefits of SOLID in software development Ruben Agudo Santos (GS-AIS-HR)
CSE 403, Spring 2008, Alverson Software Design “There are two ways of constructing a software design: one way is to make it so simple that there are obviously.
 What is SOLID  The S in SOLID  The O in SOLID  The L in SOLID  The I in SOLID  The D in SOLID  Questions.
Software Design Principles
Incremental Design Why incremental design? Goal of incremental design Tools for incremental design  UML diagrams  Design principles  Design patterns.
Elements of OO Abstraction Encapsulation Modularity Hierarchy: Inheritance & Aggregation 4 major/essential elements3 minor/helpful elements Typing Concurrency.
1 Venkat Subramaniam Quality of Software Design Good design is critical to a software application A good design has following characteristics –Specific.
Chapter 17 – Object- Oriented Design. Chapter Goals To learn about the software life cycle To learn about the software life cycle To learn how to discover.
Software Design Patterns Curtsy: Fahad Hassan (TxLabs)
High Cohesion Low Coupling Old Standards for Object Oriented Programming.
Five design principles
11 Jul 2005CSE403, Summer'05, Lecture 08 Lecture 08: Best Practices for Software Design (Part I) Valentin Razmov.
Software Design 1.1 CPS 108, Spring 2006 l Object oriented programming and design, we'll use Java and C++  Language independent concepts including design.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 11 Object-Oriented.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Object-Oriented Design.
Evaluating an Object-Oriented Design ©SoftMoore ConsultingSlide 1.
Principles of Object Oriented Design
SOLID Design Principles
Session 33 More on SOLID Steve Chenoweth Office: Moench Room F220 Phone: (812) Chandan Rupakheti Office: Moench.
Dependency Inversion By Steve Faurie. Dependency Inversion Described in Agile Principles, Patterns and Practices in C# by Robert C. Martin.
S.Ducasse Stéphane Ducasse 1 Some Principles Stéphane Ducasse ---
07 Jul 2006CSE403, Summer'06, Lecture10 Lecture 10: Core Principles and Best Practices for Software Design (Part I) “Treat design as a wicked, sloppy,
Microsoft Advertising 16:9 Template Light Use the slides below to start the design of your presentation. Additional slides layouts (title slides, tile.
Beginning Software Craftsmanship Brendan Enrick Steve Smith
Deliverables: Zero-Feature Release Build process, installation process, code repository, automated testing framework, bug tracking system Maybe no tests.
CSCI 383 Object-Oriented Programming & Design Lecture 15 Martin van Bommel.
More Design Heuristics
CSE687 - Object Oriented Design class notes Survey of the C++ Programming Language Jim Fawcett Spring 2004.
Best Practices for Software System Design
Copyright © by Curt Hill
lecture 08, OO Design Principle
Lecture 09: Software Architecture (Part I)
Software Design Lecture : 14.
Questions First On class? On project? On material we’ve discussed?
The SOLID Principles.
A (partial) blueprint for dealing with change
Principles of Object-Oriented Design
Informatics 122 Software Design II
Questions First On class? On project? On material we’ve discussed?
Object Oriented Design & Analysis
Some principles for object oriented design
Liskov Substitution Principle (LSP)
Chapter 10 – Component-Level Design
Presentation transcript:

14 Jul 2005CSE403, Summer'05, Lecture 09 Lecture 09: Fundamental Principles and Best Practices for Software Design Valentin Razmov

14 Jul 2005CSE403, Summer'05, Lecture 09 Outline Best practices for software design (cont. from Lecture 08) Principles for good design Software systems building good practices Examples of bad design practices How detailed should a design be?

14 Jul 2005CSE403, Summer'05, Lecture 09 Resources Code Complete (2 nd ed.), chapter 5, by Steve McConnell, Design Patterns Explained – A New Perspective on Object-Oriented Design, by Alan Shalloway and James Trott Agile Software Development – Principles, Patterns and Practices, by Robert C. Martin

14 Jul 2005CSE403, Summer'05, Lecture 09 How to Approach Design (a reminder) “Treat design as a wicked, sloppy, heuristic process. Don’t settle for the first design that occurs to you. Collaborate. Strive for simplicity. Prototype when you need to. Iterate, iterate, and iterate again. You’ll be happy with your designs.” -- Steve McConnell, Code Complete (2 nd ed.), ch.5 “There are two ways of constructing a software design: one way is to make it so simple that there are obviously no deficiencies; the other is to make it so complicated that there are no obvious deficiencies.” -- C.A.R. Hoare (1985)

14 Jul 2005CSE403, Summer'05, Lecture 09 Best Practices for Software Design (cont.) Favor composition over inheritance. Example:

14 Jul 2005CSE403, Summer'05, Lecture 09 Principles for Good Design: Single Responsibility Principle “A class should have only one reason to change.” Principle of strong cohesion “God-object” metaphor Example 1: Putting state in a GUI class. Model-View-Controller pattern helps to avoid this. Example 2: Where is this principle violated below? interface Modem { public void dial (String pno); public void hangup(); public void send (char c); public char recv(); }

14 Jul 2005CSE403, Summer'05, Lecture 09 Principles for Good Design: Open-Closed Principle “Software entities (classes, modules, functions, etc.) should be open for extension but closed for modification.” Example: An abstract class to extend (with as many new subclasses as needed) rather than modifying an existing class to accommodate each new addition. The designer chooses what changes to anticipate and what parts of the system to “fix.”

14 Jul 2005CSE403, Summer'05, Lecture 09 Principles for Good Design: Interface Segregation Principle “Clients should not be forced to depend on methods that they do not use.” Example: Dogs jump but don’t sing.

14 Jul 2005CSE403, Summer'05, Lecture 09 Principles for Good Design: Dependency Inversion Principle (A) “High-level modules should not depend on low-level modules. Both should depend on abstractions.” (B) “Abstractions should not depend on details. Details should depend on abstractions.” Example: Separation of policy and mechanism

14 Jul 2005CSE403, Summer'05, Lecture 09 Principles for Good Design: Dependency Inversion Principle (Example) #define TEMP_GAUGE 0x86 #define FURNACE 0x87 #define ENGAGE 1 #define DISENGAGE 0 void Regulate( double minTemp, double maxTemp) { for(;;) { while (read(TEMP_GAUGE)>minTemp) wait(1); set(FURNACE, ENGAGE); while (read(TEMP_GAUGE)<maxTemp) wait(1); set(FURNACE, ENGAGE); } void Regulate( Thermometer t, Heater h, double minTemp, double maxTemp) { for(;;) { while (t.Read() > minTemp) wait(1); h.Engage(); while (t.Read() < maxTemp) wait(1); h.Disengage(); }

14 Jul 2005CSE403, Summer'05, Lecture 09 Principles for Good Design: Liskov Substitution Principle “Subtypes must be substitutable for their base types.” This is different from saying that there must be an IS-A relationship between the two types. Example: Is Square always substitutable for Rectangle?

14 Jul 2005CSE403, Summer'05, Lecture 09 Examples of Bad Designs Practices “Design by committee” Everyone on the committee puts in their favorite features into the soup. What is the result? Moral: The design must be owned and managed by someone. Other examples you have heard of?

14 Jul 2005CSE403, Summer'05, Lecture 09 Additional Best Practices for Building Software Systems Make the common case fast and the uncommon case correct. But do not spend time on optimizing code early on. “It is easier to optimize correct code than to correct optimized code.” -- Donald Knuth Establish and maintain a clear audit trail. It requires little investment upfront but is invaluable for debugging purposes.

14 Jul 2005CSE403, Summer'05, Lecture 09 How Detailed Should It Be?

14 Jul 2005CSE403, Summer'05, Lecture 09 Your Questions on Principles and Practices for Software Design