Partitioning and Layering Fundamentals. The Basic Problem Change is a fact of life RequirementsTechnologies Bug Fixes Software Must Adapt.

Slides:



Advertisements
Similar presentations
MicroKernel Pattern Presented by Sahibzada Sami ud din Kashif Khurshid.
Advertisements

Revealing the Secrets of Self-Documenting Code Svetlin Nakov Telerik Corporation For C# Developers.
EECE 310: Software Engineering Modular Decomposition, Abstraction and Specifications.
Picture It Very Basic Game Picture Pepper. Original Game import java.util.Scanner; public class Game { public static void main() { Scanner scan=new Scanner(System.in);
Object-Oriented Design Patterns Composite Singleton State Observer … Autumn 2012UCN Technology: IT/Computer Science1.
Code Smell Research: History and Future Directions Second PLOW Installment - March 5, Nikolaos Tsantalis Computer Science & Software Engineering.
Behavioral Pattern: Template Method C h a p t e r 5 – P a g e 217 On occasion, two different components in a software system will have significant similarities,
1 Introduction to CS Agenda Syllabus Schedule Lecture: the management of complexity.
Design Patterns Part IV (TIC++V2:C10) Yingcai Xiao 10/01/08.
The Software Design Process CPSC 315 – Programming Studio Fall 2009.
Design Patterns Module Name - Object Oriented Modeling By Archana Munnangi S R Kumar Utkarsh Batwal ( ) ( ) ( )
CSCI-383 Object-Oriented Programming & Design Lecture 15.
Inheritance. © 2004 Pearson Addison-Wesley. All rights reserved 8-2 Inheritance Inheritance is a fundamental object-oriented design technique used to.
Copyright © 2002, Systems and Computer Engineering, Carleton University Intro.ppt * Object-Oriented Software Development Unit 1 Course.
 Simple payroll application that polymorphically calculates the weekly pay of several different types of employees using each employee’s Earnings method.
Katanosh Morovat.   This concept is a formal approach for identifying the rules that encapsulate the structure, constraint, and control of the operation.
1 Dept. of Computer Science & Engineering, York University, Toronto CSE3311 Software Design Adapter Pattern Façade pattern.
© S. Demeyer, S. Ducasse, O. Nierstrasz Intro.1 1. Introduction Goals Why Reengineering ?  Lehman's Laws  Object-Oriented Legacy Typical Problems  common.
SOFTWARE DESIGN AND ARCHITECTURE
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Computer Science 313 – Advanced Programming Topics.
Designing classes How to write classes in a way that they are easily understandable, maintainable and reusable 3.0.
Ivan Marsic Rutgers University LECTURE 2: The Object Model.
Effective C#, Chapter 1: C# Language Elements Last Updated: Fall 2011.
1 Computer Science 340 Software Design & Testing Inheritance.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 05. Review Software design methods Design Paradigms Typical Design Trade-offs.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
Object Oriented Design David Talby. Welcome! n Introduction n UML u Use Case Diagrams u Interaction Diagrams u Class Diagrams n Design Patterns u Composite.
Chapter 21 Test-Driven Development 1CS6359 Fall 2011 John Cole.
REFACTORINGREFACTORING. Realities Code evolves substantially during development Requirements changes 1%-4% per month on a project Current methodologies.
1 Interfaces and Abstract Classes Chapter Objectives You will be able to: Write Interface definitions and class definitions that implement them.
Chapter 18 The Observer Pattern Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
Data Abstaraction Chapter 10.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Designing Classes. Software changes Software is not like a novel that is written once and then remains unchanged. Software is extended, corrected, maintained,
Software Construction and Evolution - CSSE 375 Making Method Calls Simpler Shawn and Steve Below – “Be the character!” The late acting teacher Lee Strasberg.
Design Patterns Introduction
Coming up: Inheritance
Software Quality Assurance and Testing Fazal Rehman Shamil.
CSSE 375 Organizing Data – Part 2 Shawn and Steve Continue the same quiz!
February 19, February 19, 2016February 19, 2016February 19, 2016 Azusa, CA Sheldon X. Liang Ph. D. Software Engineering in CS at APU Azusa Pacific.
Chapter Ten The Bridge Pattern Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
Refactoring. DCS – SWC 2 Refactoring ”A change made to the internal structure of software to make it easier to understand and cheaper to modify without.
Refactoring Software Projects Using Object Oriented Concepts Ankit Desai 1, Jaimin Chavda 2, Amit Ganatra 3, Amit Thakkar 4, Yogesh Kosta 5 Charotar Institute.
Design Engineering 1. Analysis  Design 2 Characteristics of good design 3 The design must implement all of the explicit requirements contained in the.
 The Object Oriented concepts was evolved for solving complex problems. Object- oriented software development started in the 1980s. Object-oriented design.
Chapter 0: Introduction
Design Patterns: MORE Examples
CompSci 280 S Introduction to Software Development
Design Patterns: Brief Examples
Describe ways to assemble objects to implement a new functionality
Data Abstraction: The Walls
Adapter Design Pattern
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
Software Quality Assurance
Informatics 122 Software Design II
Generation Gap By Kurt Rehwinkel
SE-2811 Software Component Design
LECTURE 2: The Object Model
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
By Rajanikanth B OOP Concepts By Rajanikanth B
Informatics 122 Software Design II
Object Oriented Design
Chapter 8, Design Patterns Introduction
Object Oriented Design & Analysis
CSE 143 Lecture 6 interfaces; eclipse; testing
Extending Interface Based Design
Chapter 13 Logical Architecture.
Presentation transcript:

Partitioning and Layering Fundamentals

The Basic Problem Change is a fact of life RequirementsTechnologies Bug Fixes Software Must Adapt

Solution: Software Layers Reduce software coupling Minimize the consequences of change Focused Unit Tests to verify change Example of Code Refactoring

Fundamental Concepts Difference between a type and an object Complex type CompositionInterface

Type class Employee { string name; … void Pay() ….} Data Behavior Simple Type Complex Type

Object Employee emp = new Employee();

Object Composition class Auto { Engine engine; Wheel[4] wheels; void Drive() {…}; }

class Engine { string manufacturer; int horsepower; void Start(){…}; void Stop(){…}; } class Wheel { string manufacturer; float tirePressure; void Turn(){…}; } Object composition introduces dependencies

Write your so that the dependencies of one type on another are eliminated or minimized. Write your applications so that the dependencies of one type on another are eliminated or minimized.

Make types dependent on type's behavior, not its implementation.

Unit tests verify that a type's behavior is correct.

Interfaces interface IEngine { void Start(); void Stop(); } interface IWheel { void Turn(); } Interfaces describe behavior, not implementation

Rewritten Engine, Wheel Classes class Engine : IEngine { string manufacturer; int horsepower; void Start () {…} void Stop() {…} } class Wheel : IWheel { string manufacturer float tirePressure; void Turn(); }

Interface Composition class Auto { IEngine engine; IWheel[4] wheels; void Drive() {…} }

Interfaces Hide Implementation class Diesel: IEngine { string manufacturer; int horsepower; void Start () {…} void Stop() {…} } class WankelEngine : IEngine { string manufacturer; int rotationSpeed; void Start () {…} void Stop() {…} }

Coupling Preserve Essential Coupling Essential Semantics Remove Inessential Coupling Programming Artifacts

Electrical Analogy Wall socket interface removes the inessential coupling due to the physical shape of plugs and appliances An interface cannot remove the essential behavioral coupling of voltage and amperage of standard current

Complexity vs. Flexibility Interfaces add a level of indirection Put interfaces along application fault lines Hard to refactor out of a bad design

Interfaces vs. Inheritance Favor interface over object composition Interface Composition vs. Inheritance? class RacingCar : HighPerformanceCar : Auto class RacingCar : HighPerformanceCar : Auto Static Definition Need to Understand Base Class Behavior

"Inheritance Breaks Encapsulation" class HighPerformanceCar { virtual void Start() {TurnIgnition(); Press GasPedal(); }…} class RacingCar : HighPerformanceCar {…}

Interfaces Avoid Inheriting Implementation Restrict Inessential Coupling Make Interfaces Easy to Modify

Design Patterns Minimize Dependencies in Implementation Use Design Patterns Electrical Analogy Design to work with 110 or 220 volts? Use Transformer Pattern Flexibility even with Essential Coupling

Summary Reduce coupling and dependencies of complex types Use Interface Based Design Use Composition rather than Implementation Inheritance Write unit tests to validate behavior