07-principles-of-ood

07-principles-of-ood - CS4240 PrinciplesofSoftwareDesign...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
Click to edit Master subtitle style CS 4240 Principles of Software Design Aaron Bloomfield Principles of OOD Fall 2009
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
22 Five principles n The Single Responsibility Principle (SRP) n The Open-Closed Principle (OCP) n The Dependency Inversion Principle (DIP) n The Interface Segregation Principle (ISP) n The Liskov Substitution Principle (LSP)
Background image of page 2
Click to edit Master subtitle style 33 The Single Responsibility  Principle (SRP)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
44 The Single Responsibility Principle (SRP) n A class should have only one reason to change +calculatePay() +calculateTaxes() +writeToDisk() +readFromDisk() +createXML() +parseXML() +displayOnEmployeeReport() +displayOnPayrollReport() +displayOnTaxReport() Employee
Background image of page 4
55 The Single Responsibility Principle (SRP) +calculatePay() +calculateTaxes() Employee +EmployeeToXML() +XMLToEmployee() Employee XML Converter +writeEmployee() +readEmployee() Employee Database TaxReport Employee Report Payroll Report
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
66 The Single Responsibility Principle (SRP) Persistable Employee Employee «interface» Persistable Employee «interface» Persistable
Background image of page 6
77 Does this follow the SRP? interface Modem { public void dial (String pno); public void hangup (); public void send (char c); public char recv(); }
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Click to edit Master subtitle style 88 The Open-Closed Principle  (OCP)
Background image of page 8
99 The Open-Closed Principle (OCP) n Software  entities  (classes,  modules,  functions, etc.) should be open for extension, but closed for modification n Rephrased:  You  should  be  able  to  change  the environment  surrounding  module  without changing the module itself Employee +readEmployee() +writeEmployee() EmployeeDB <<api>> Database
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1010 The Open-Closed Principle (OCP) n This structure is called a Model-View-Controller Employee <<api>> Database +readEmployee() +writeEmployee() «interface» EmployeeDB UnitTest Database Employee Database Implementation
Background image of page 10
1111 The Open-Closed Principle (OCP) Employee Terminator Model +selectionChanged(in employee) +terminate() «interface» Employee Terminator Controller 0..* javax.swing +enableTerminate(in boolean) +setEmployeeList(in employees) +clearSelection() «interface» Employee Terminator View Employee Terminator Dialog String employees
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Click to edit Master subtitle style 1212 The Interface Segregation  Principle (ISP)
Background image of page 12
1313 The Interface Segregation Principle (ISP)
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/25/2009 for the course CS 4240 taught by Professor Aronbloomfiled during the Spring '09 term at UVA.

Page1 / 43

07-principles-of-ood - CS4240 PrinciplesofSoftwareDesign...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online