SlideShare uma empresa Scribd logo
1 de 23
Baixar para ler offline
Computer Engineering Department



Object Oriented Software Modeling and
                Design
                    g
               CE 350
   Abdel-Karim Al-Tamimi, Ph.D.
         altamimi@yu.edu.jo
  http://faculty.yu.edu.jo/altamimi

                 Al-Tamimi 2011 ©           1
Overview
• Introduction to Software Design




                  Al-Tamimi 2011 ©   2
Software Design
• Design phase is one of the most important
  phases in the product development
  process (A.K.A. software life cycle)
          (A K A
• After gathering the required information
  about the project, you are usually required
            project
  to design the product (software) taking
  into consideration its requirements and to
  minimize the need to redo the work if
  changes needed to be made in the future
                   Al-Tamimi 2011 ©         3
Software Life Cycle

Feasibility Study

  Requirement Analysis
    q             y

                    Design

                           Coding

                                     Testing

                                         Maintenance




                      Al-Tamimi 2011 ©                 4
Relative Effort to Phases




         Al-Tamimi 2011 ©   5
Design Phase
• Transform requirements in the SRS document
  into a possible implementation
• Using either Traditional or Object oriented
       g                       bj
  approaches
• Object-oriented approach:
     j              pp
  – System objects are first identified
  – The relationship between these objects are then
    identified and d
     d    f d d documented     d
  – Less development time and efforts
  – Better maintainability of the product
                       Al-Tamimi 2011 ©               6
Why We Need A Good Design?
• If we do not follow a proper design scheme, our
  product may :
            g
• Become rigid
  – Rigidity is the inability to be changed
• Become fragile
            g
  – Software changes seem to exhibit non-local effects
• Become non-reusable
• Have high viscosity (glueyness)
  – Viscosity is resistance to fluid motion

                        Al-Tamimi 2011 ©                 7
Rigid Design
• The impact of a change cannot be
  predicted
• If not predicted, it cannot be estimated
         predicted
• Time and cost cannot be quantified
• Managers become reluctant to authorize
  change



                  Al-Tamimi 2011 ©           8
Fragile Design
• A single change requires a cascade of
  subsequent changes
• New errors appear in areas that seem
  unconnected to the changed areas
• Q li i unpredictable.
  Quality is      di bl
• The development team loses credibility



                  Al-Tamimi 2011 ©         9
Non-Reusable Design
        Non Reusable
• Desirable parts of the
  design are dependent
  upon undesirable
  parts
• The work and risk of
  extracting the
  desirable part may
  exceed the cost of
  redeveloping from
  scratch
                     Al-Tamimi 2011 ©   10
High Viscous Design
• When the “right changes are much more
               right changes”
  difficult than hacking, the viscosity of the
  system is high
• Over time, it will become increasingly
  difficult to continue developing the
  product



                   Al-Tamimi 2011 ©          11
Design Principles
•   SOLID:
•   SRP: The Single Responsibility Principle
•   OCP: The Open/Closed P i i l
    OCP Th O       /Cl d Principle
•   LSP: The Liskov Substitution Principle
•   ISP: The Interface Segregation Principle
•   DIP: The Dependency Inversion Principle



                    Al-Tamimi 2011 ©       12
SRP Principle : Single
                    ibili
            Responsibility
• A class should have one, and only one, reason to
  change
• If a class assumes more than one responsibility, then
  there will be more than one reason for it to change
• If a class has more then one responsibility, then the
  responsibilities b
           ibiliti become coupled l d
• Changes to one responsibility may impair or inhibit
  the class’ ability to meet the others
       class
• This kind of coupling leads to fragile designs that
  break in unexpected ways when changed
                  p         y            g

                       Al-Tamimi 2011 ©              13
Open/Closed Principle
• A principle which states that we should
  add new functionality by adding new code,
  not by editing old code
• Defines a lot of the value of OO
  programming
  – “all member variables should be private”
  – or “ l b l variables should be avoided”
       “global    i bl    h ld b      id d”
• Abstraction is the key

                    Al-Tamimi 2011 ©           14
Abstraction
• Abstraction is the most
  important word in OOD                    Client      Server

• Client/Server
  relationships are “
     l ti   hi      “open””
• Changes to servers cause                          Abstract
                                           Client
  c a ges clients
  changes to c e ts                                  Server


• Abstract servers “close”
  clients to changes in
  implementation
  i l        t ti                                   Concrete
                                                    C     t
                                                     Server




                        Al-Tamimi 2011 ©                        15
Liskov Substitution Principle
• LSP: Derived classes must be usable through the
  base class interface, without the need for the
  user to know the difference
• All derived classes must be substitutable for
  their base classes
• This principle guides us in the creation of
  abstractions
• Question: Can we consider a square class a
  substitute of a rectangle class ?

                    Al-Tamimi 2011 ©           16
Interface Segregation Principle
• Sometimes class methods have various
  groupings
• These classes are used for different
  purposes
• N all users rely upon all methods
  Not ll          l        ll    h d
• This lack of cohesion can cause serious
  dependency problems
• These problems can be refactored away
         p                              y
                  Al-Tamimi 2011 ©          17
ATM User Interface (UI)
     Example l
 Withdraw                Deposit                Transfer




                       «interface»
                         ATM UI

            + GetWithdrawAmountAndAccount()
            + GetDepositAmountAndAccount()
            + GetTransferAmountAndAccounts()




       French ATM UI               English ATM UI


                       Al-Tamimi 2011 ©                    18
A Segregated ATM UI
                    Examplel
            Deposit
              p                                  Withdraw                          Transfer




           «interface»                      «interface»                          «interface»
         ATM Deposit UI                   ATM Withdraw UI                      ATM Transfer UI


+ GetDepositAmountAndAccount()     + GetWithdrawAmountAndAccount       + GetTransferAmountAndAccounts()




                                             «interface»
                                               ATM UI

                                  + GetWithdrawAmountAndAccount()
                                  + GetDepositAmountAndAccount()
                                  + GetTransferAmountAndAccounts()




                                 French ATM UI              English ATM UI


                                          Al-Tamimi 2011 ©                                                19
Dependency Inversion Principle
• Details should depend on abstractions
• Abstractions should not depend on details
• Avoid d i i from concrete classes
  A id deriving f                l
• Avoid associating to concrete classes
• Avoid aggregating concrete classes
• Avoid dependencies on concrete
  components
• There are some reasons to violate this
  principle       Al-Tamimi 2011 ©         20
Dependency Inversion Principle

                                                              Copy


               Copy


                                     VS.


                                                   Reader               Writer

ReadKeyboard          WritePRinter




               ×
                                             KeyboardReader          PrinterWriter




                                Al-Tamimi 2011 ©                                     21
Resources
• Matt Weisfeld, The Object Oriented
        Weisfeld
  Thought Process, Sams Publishing,
  ISBN:0 672 32611 6
  ISBN:0-672-32611-6
• M. Jesse, “UML 2.0 for dummies”,
  ISBN:0764526146
• P. Kimmel, “UML Demystified”, McGraw
  Hill, ISBN:
  Hill ISBN 0-07-148671-2
                     86
• Advanced Principles Of Class Design,
  http://www.objectmentor.com
                Al-Tamimi 2011 ©         22
Resources
• http://www.objectmentor.com/resources/article
  s/ocp.pdf
• http://www.objectmentor.com/resources/article
     p //     bj             /         /
  s/srp.pdf
• http://www.objectmentor.com/resources/article
     p //      j             /         /
  s/lsp.pdf
• http://www.objectmentor.com/resources/article
  s/isp.pdf
• http://www.objectmentor.com/resources/article
  s/dip.pdf
                   Al-Tamimi 2011 ©          23

Mais conteúdo relacionado

Mais procurados (11)

Lecture07 examples
Lecture07 examplesLecture07 examples
Lecture07 examples
 
Lecture05
Lecture05Lecture05
Lecture05
 
Lecture04- Use Case Diagrams
Lecture04- Use Case DiagramsLecture04- Use Case Diagrams
Lecture04- Use Case Diagrams
 
Lecture04- Use Case Diagrams
Lecture04- Use Case DiagramsLecture04- Use Case Diagrams
Lecture04- Use Case Diagrams
 
Lecture07
Lecture07Lecture07
Lecture07
 
Domain model
Domain modelDomain model
Domain model
 
agent uml الوكيل باستخدام لغة النمذجة الموحدة
  agent uml الوكيل باستخدام لغة النمذجة الموحدة  agent uml الوكيل باستخدام لغة النمذجة الموحدة
agent uml الوكيل باستخدام لغة النمذجة الموحدة
 
Extending UML for Agents
Extending UML for AgentsExtending UML for Agents
Extending UML for Agents
 
Agent uml
Agent umlAgent uml
Agent uml
 
Executable UML and SysML Workshop
Executable UML and SysML WorkshopExecutable UML and SysML Workshop
Executable UML and SysML Workshop
 
Case study-the next gen pos
Case study-the next gen posCase study-the next gen pos
Case study-the next gen pos
 

Semelhante a Lecture02

Semelhante a Lecture02 (20)

Managing Technical Debt - by Michael Hall
Managing Technical Debt - by Michael HallManaging Technical Debt - by Michael Hall
Managing Technical Debt - by Michael Hall
 
Microservices for Java Architects (Chicago, April 21, 2015)
Microservices for Java Architects (Chicago, April 21, 2015)Microservices for Java Architects (Chicago, April 21, 2015)
Microservices for Java Architects (Chicago, April 21, 2015)
 
Microservices for Java Architects (Indianapolis, April 15, 2015)
Microservices for Java Architects (Indianapolis, April 15, 2015)Microservices for Java Architects (Indianapolis, April 15, 2015)
Microservices for Java Architects (Indianapolis, April 15, 2015)
 
CampDevOps keynote - DevOps: Using 'Lean' to eliminate Bottlenecks
CampDevOps keynote - DevOps: Using 'Lean' to eliminate BottlenecksCampDevOps keynote - DevOps: Using 'Lean' to eliminate Bottlenecks
CampDevOps keynote - DevOps: Using 'Lean' to eliminate Bottlenecks
 
Microservices for java architects coders-conf-2015-05-15
Microservices for java architects coders-conf-2015-05-15Microservices for java architects coders-conf-2015-05-15
Microservices for java architects coders-conf-2015-05-15
 
The 10 biggest metering and billing mistakes
The 10 biggest metering and billing mistakesThe 10 biggest metering and billing mistakes
The 10 biggest metering and billing mistakes
 
Follow the Flow - Essentials of User Interaction Design
Follow the Flow - Essentials of User Interaction DesignFollow the Flow - Essentials of User Interaction Design
Follow the Flow - Essentials of User Interaction Design
 
Reactive Micro Services with Java seminar
Reactive Micro Services with Java seminarReactive Micro Services with Java seminar
Reactive Micro Services with Java seminar
 
Sdlc models
Sdlc modelsSdlc models
Sdlc models
 
Angular js
Angular jsAngular js
Angular js
 
Vision2015-CBS-1148-Final
Vision2015-CBS-1148-FinalVision2015-CBS-1148-Final
Vision2015-CBS-1148-Final
 
Cloud expo 2015_rags
Cloud expo 2015_ragsCloud expo 2015_rags
Cloud expo 2015_rags
 
ERP 2.0 (Cloud, New Functionality, FAH, Integration and M&A Focus)
ERP 2.0 (Cloud, New Functionality, FAH, Integration and M&A Focus)ERP 2.0 (Cloud, New Functionality, FAH, Integration and M&A Focus)
ERP 2.0 (Cloud, New Functionality, FAH, Integration and M&A Focus)
 
Going agile with scrum
Going agile with scrumGoing agile with scrum
Going agile with scrum
 
BP209 doctors have scalpels, carpenters have hammers, ibm sametime develope...
BP209   doctors have scalpels, carpenters have hammers, ibm sametime develope...BP209   doctors have scalpels, carpenters have hammers, ibm sametime develope...
BP209 doctors have scalpels, carpenters have hammers, ibm sametime develope...
 
apidays LIVE Paris - Break up Monoliths and lay them to REST! by Arun Narayan...
apidays LIVE Paris - Break up Monoliths and lay them to REST! by Arun Narayan...apidays LIVE Paris - Break up Monoliths and lay them to REST! by Arun Narayan...
apidays LIVE Paris - Break up Monoliths and lay them to REST! by Arun Narayan...
 
Cloud Native Operations
Cloud Native OperationsCloud Native Operations
Cloud Native Operations
 
Get Loose! Microservices and Loosely Coupled Architectures
Get Loose! Microservices and Loosely Coupled ArchitecturesGet Loose! Microservices and Loosely Coupled Architectures
Get Loose! Microservices and Loosely Coupled Architectures
 
Get Loose! Microservices and Loosely Coupled Architectures
Get Loose! Microservices and Loosely Coupled Architectures Get Loose! Microservices and Loosely Coupled Architectures
Get Loose! Microservices and Loosely Coupled Architectures
 
Implementing Service Oriented Architecture
Implementing Service Oriented Architecture Implementing Service Oriented Architecture
Implementing Service Oriented Architecture
 

Mais de artgreen (8)

Ce350 class project_spring2011_v1.5
Ce350 class project_spring2011_v1.5Ce350 class project_spring2011_v1.5
Ce350 class project_spring2011_v1.5
 
Lecture09
Lecture09Lecture09
Lecture09
 
Lecture06
Lecture06Lecture06
Lecture06
 
Lecture05
Lecture05Lecture05
Lecture05
 
Lecture05
Lecture05Lecture05
Lecture05
 
Lecture05
Lecture05Lecture05
Lecture05
 
Lecture04- Use Case Diagrams
Lecture04- Use Case DiagramsLecture04- Use Case Diagrams
Lecture04- Use Case Diagrams
 
Lecture-03 Introduction to UML
Lecture-03 Introduction to UMLLecture-03 Introduction to UML
Lecture-03 Introduction to UML
 

Último

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Último (20)

REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 

Lecture02

  • 1. Computer Engineering Department Object Oriented Software Modeling and Design g CE 350 Abdel-Karim Al-Tamimi, Ph.D. altamimi@yu.edu.jo http://faculty.yu.edu.jo/altamimi Al-Tamimi 2011 © 1
  • 2. Overview • Introduction to Software Design Al-Tamimi 2011 © 2
  • 3. Software Design • Design phase is one of the most important phases in the product development process (A.K.A. software life cycle) (A K A • After gathering the required information about the project, you are usually required project to design the product (software) taking into consideration its requirements and to minimize the need to redo the work if changes needed to be made in the future Al-Tamimi 2011 © 3
  • 4. Software Life Cycle Feasibility Study Requirement Analysis q y Design Coding Testing Maintenance Al-Tamimi 2011 © 4
  • 5. Relative Effort to Phases Al-Tamimi 2011 © 5
  • 6. Design Phase • Transform requirements in the SRS document into a possible implementation • Using either Traditional or Object oriented g bj approaches • Object-oriented approach: j pp – System objects are first identified – The relationship between these objects are then identified and d d f d d documented d – Less development time and efforts – Better maintainability of the product Al-Tamimi 2011 © 6
  • 7. Why We Need A Good Design? • If we do not follow a proper design scheme, our product may : g • Become rigid – Rigidity is the inability to be changed • Become fragile g – Software changes seem to exhibit non-local effects • Become non-reusable • Have high viscosity (glueyness) – Viscosity is resistance to fluid motion Al-Tamimi 2011 © 7
  • 8. Rigid Design • The impact of a change cannot be predicted • If not predicted, it cannot be estimated predicted • Time and cost cannot be quantified • Managers become reluctant to authorize change Al-Tamimi 2011 © 8
  • 9. Fragile Design • A single change requires a cascade of subsequent changes • New errors appear in areas that seem unconnected to the changed areas • Q li i unpredictable. Quality is di bl • The development team loses credibility Al-Tamimi 2011 © 9
  • 10. Non-Reusable Design Non Reusable • Desirable parts of the design are dependent upon undesirable parts • The work and risk of extracting the desirable part may exceed the cost of redeveloping from scratch Al-Tamimi 2011 © 10
  • 11. High Viscous Design • When the “right changes are much more right changes” difficult than hacking, the viscosity of the system is high • Over time, it will become increasingly difficult to continue developing the product Al-Tamimi 2011 © 11
  • 12. Design Principles • SOLID: • SRP: The Single Responsibility Principle • OCP: The Open/Closed P i i l OCP Th O /Cl d Principle • LSP: The Liskov Substitution Principle • ISP: The Interface Segregation Principle • DIP: The Dependency Inversion Principle Al-Tamimi 2011 © 12
  • 13. SRP Principle : Single ibili Responsibility • A class should have one, and only one, reason to change • If a class assumes more than one responsibility, then there will be more than one reason for it to change • If a class has more then one responsibility, then the responsibilities b ibiliti become coupled l d • Changes to one responsibility may impair or inhibit the class’ ability to meet the others class • This kind of coupling leads to fragile designs that break in unexpected ways when changed p y g Al-Tamimi 2011 © 13
  • 14. Open/Closed Principle • A principle which states that we should add new functionality by adding new code, not by editing old code • Defines a lot of the value of OO programming – “all member variables should be private” – or “ l b l variables should be avoided” “global i bl h ld b id d” • Abstraction is the key Al-Tamimi 2011 © 14
  • 15. Abstraction • Abstraction is the most important word in OOD Client Server • Client/Server relationships are “ l ti hi “open”” • Changes to servers cause Abstract Client c a ges clients changes to c e ts Server • Abstract servers “close” clients to changes in implementation i l t ti Concrete C t Server Al-Tamimi 2011 © 15
  • 16. Liskov Substitution Principle • LSP: Derived classes must be usable through the base class interface, without the need for the user to know the difference • All derived classes must be substitutable for their base classes • This principle guides us in the creation of abstractions • Question: Can we consider a square class a substitute of a rectangle class ? Al-Tamimi 2011 © 16
  • 17. Interface Segregation Principle • Sometimes class methods have various groupings • These classes are used for different purposes • N all users rely upon all methods Not ll l ll h d • This lack of cohesion can cause serious dependency problems • These problems can be refactored away p y Al-Tamimi 2011 © 17
  • 18. ATM User Interface (UI) Example l Withdraw Deposit Transfer «interface» ATM UI + GetWithdrawAmountAndAccount() + GetDepositAmountAndAccount() + GetTransferAmountAndAccounts() French ATM UI English ATM UI Al-Tamimi 2011 © 18
  • 19. A Segregated ATM UI Examplel Deposit p Withdraw Transfer «interface» «interface» «interface» ATM Deposit UI ATM Withdraw UI ATM Transfer UI + GetDepositAmountAndAccount() + GetWithdrawAmountAndAccount + GetTransferAmountAndAccounts() «interface» ATM UI + GetWithdrawAmountAndAccount() + GetDepositAmountAndAccount() + GetTransferAmountAndAccounts() French ATM UI English ATM UI Al-Tamimi 2011 © 19
  • 20. Dependency Inversion Principle • Details should depend on abstractions • Abstractions should not depend on details • Avoid d i i from concrete classes A id deriving f l • Avoid associating to concrete classes • Avoid aggregating concrete classes • Avoid dependencies on concrete components • There are some reasons to violate this principle Al-Tamimi 2011 © 20
  • 21. Dependency Inversion Principle Copy Copy VS. Reader Writer ReadKeyboard WritePRinter × KeyboardReader PrinterWriter Al-Tamimi 2011 © 21
  • 22. Resources • Matt Weisfeld, The Object Oriented Weisfeld Thought Process, Sams Publishing, ISBN:0 672 32611 6 ISBN:0-672-32611-6 • M. Jesse, “UML 2.0 for dummies”, ISBN:0764526146 • P. Kimmel, “UML Demystified”, McGraw Hill, ISBN: Hill ISBN 0-07-148671-2 86 • Advanced Principles Of Class Design, http://www.objectmentor.com Al-Tamimi 2011 © 22
  • 23. Resources • http://www.objectmentor.com/resources/article s/ocp.pdf • http://www.objectmentor.com/resources/article p // bj / / s/srp.pdf • http://www.objectmentor.com/resources/article p // j / / s/lsp.pdf • http://www.objectmentor.com/resources/article s/isp.pdf • http://www.objectmentor.com/resources/article s/dip.pdf Al-Tamimi 2011 © 23