SlideShare a Scribd company logo
1 of 25
Inheritance & UML More Advanced UML
Objectives ,[object Object],[object Object],[object Object]
Relationships between classes ,[object Object],[object Object],[object Object],[object Object]
Inheritance hierarchy
Inheritance ,[object Object],[object Object],[object Object],[object Object],[object Object]
Basic class description ,[object Object],[object Object],[object Object],[object Object]
Inheritance Representation (UML) ,[object Object],[object Object],[object Object]
Composition ,[object Object],[object Object],[object Object],[object Object],[object Object]
Different UML Diagrams ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Problem Analysis: Game ,[object Object]
What are the Objects (Classes)? ,[object Object],[object Object]
What are the Operations/Methods? ,[object Object],[object Object]
Class Diagram 1: Frog ,[object Object],[object Object],[object Object],hop () leap () drown () X: integer Y: integer Frog
Class Diagram 2: Highway ,[object Object],[object Object],[object Object],X: integer Y: integer Highway
Class Diagram 3: Truck ,[object Object],[object Object],[object Object],drive () X: integer Y: integer Direction: String Truck
Define Operation Visibility ,[object Object],[object Object],[object Object],Public operations Protected  operations Private operations
How Is Visibility Noted? ,[object Object],[object Object],[object Object],[object Object],Class - privateAttribute # protectedAttribute +publicOp() # protectedOp() - privateOp()
Example: Define Operations Variable Name : Type Function Return Type Student - name : String - dateOfBirth : Date + canEnroll() : Boolean # hasTakenPrerequisites() : Boolean # hasScheduleConflict() : Boolean
Class Relationship ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example:  Single Inheritance ,[object Object],Truck tonnage GroundVehicle weight licenseNumber Car owner register( ) getTax( ) Person 0..* Trailer 1 ancestor decendent generalization size
What is Multiple Inheritance? ,[object Object],Use multiple inheritance only when needed, and  always with caution ! Airplane Helicopter Wolf Horse FlyingThing Animal Bird multiple inheritance
Multiple Inheritance: Problems Name clashes  on  attributes or operations Repeated inheritance FlyingThing color getColor  Animal color getColor  Bird Resolution of these problems is implementation-dependent FlyingThing Animal Bird AnimateObject color
Inheritance vs. Aggregation ,[object Object],[object Object],[object Object],A WindowWithScrollbar “is a” Window A WindowWithScrollbar “has a” Scrollbar Scrollbar Window WindowWithScrollbar 1 1 Window WindowWithScrollbar Scrollbar
Example: Composition (has-a) notifyOfferingSelection(offering : CourseOffering) RegistrationController getOfferings(curriculum) new(context : SecureUser) saveSchedule(sched : Schedule) cancelSchedule(sched : Schedule) <<control>> MaintainScheduleForm displayOfferings() selectCurriculum() : Curriculum selectOffering() : CourseOffering save() cancel() update(changedItem : ISubject) displaySchedule() <<boundary>> 1 1
Generalization to Support Polymorphism Without Polymorphism With Polymorphism ,[object Object],[object Object],[object Object],[object Object],[object Object],do the Animal talk Animal talk () Lion Tiger talk () talk ()

More Related Content

What's hot

What's hot (18)

inheritance in C++
inheritance in C++inheritance in C++
inheritance in C++
 
Intro tooop
Intro tooopIntro tooop
Intro tooop
 
Concept of OOPS with real life examples
Concept of OOPS with real life examplesConcept of OOPS with real life examples
Concept of OOPS with real life examples
 
Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In Java
 
Inheritance in C++
Inheritance in C++Inheritance in C++
Inheritance in C++
 
Multiple Inheritance
Multiple InheritanceMultiple Inheritance
Multiple Inheritance
 
Oop scala
Oop scalaOop scala
Oop scala
 
Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)
 
Inheritance, Object Oriented Programming
Inheritance, Object Oriented ProgrammingInheritance, Object Oriented Programming
Inheritance, Object Oriented Programming
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
EASY TO LEARN INHERITANCE IN C++
EASY TO LEARN INHERITANCE IN C++EASY TO LEARN INHERITANCE IN C++
EASY TO LEARN INHERITANCE IN C++
 
Learn java objects inheritance-overriding-polymorphism
Learn java objects  inheritance-overriding-polymorphismLearn java objects  inheritance-overriding-polymorphism
Learn java objects inheritance-overriding-polymorphism
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance in c++ part1
Inheritance in c++ part1Inheritance in c++ part1
Inheritance in c++ part1
 
inheritance
inheritanceinheritance
inheritance
 
INHERITANCE(OOP's CONCEPT)
INHERITANCE(OOP's CONCEPT)INHERITANCE(OOP's CONCEPT)
INHERITANCE(OOP's CONCEPT)
 
Inheritance
InheritanceInheritance
Inheritance
 
OOP programming
OOP programmingOOP programming
OOP programming
 

Similar to 09 inheritance and_uml

Descriptions of class diagrams in software
Descriptions of class diagrams in softwareDescriptions of class diagrams in software
Descriptions of class diagrams in softwaressuser9d62d6
 
Object Oriented Technologies
Object Oriented TechnologiesObject Oriented Technologies
Object Oriented TechnologiesTushar B Kute
 
Unified modeling language
Unified modeling languageUnified modeling language
Unified modeling languageamity2j
 
Introduction to Java Object Oiented Concepts and Basic terminologies
Introduction to Java Object Oiented Concepts and Basic terminologiesIntroduction to Java Object Oiented Concepts and Basic terminologies
Introduction to Java Object Oiented Concepts and Basic terminologiesTabassumMaktum
 
Java for android developers
Java for android developersJava for android developers
Java for android developersAly Abdelkareem
 
The Scala Programming Language
The Scala Programming LanguageThe Scala Programming Language
The Scala Programming Languageleague
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental PrinciplesIntro C# Book
 
Introduction to UML, a guide to learn.pdf
Introduction to UML, a guide to learn.pdfIntroduction to UML, a guide to learn.pdf
Introduction to UML, a guide to learn.pdfTARGARYEN001
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering Madhar Khan Pathan
 
Stepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaStepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaDerek Chen-Becker
 
Question and answer Programming
Question and answer ProgrammingQuestion and answer Programming
Question and answer ProgrammingInocentshuja Ahmad
 
com-213-unified-modelling-launguage-programming-theory.pdf
com-213-unified-modelling-launguage-programming-theory.pdfcom-213-unified-modelling-launguage-programming-theory.pdf
com-213-unified-modelling-launguage-programming-theory.pdfAhmadInternetCafe
 
Unit 2(advanced class modeling & state diagram)
Unit  2(advanced class modeling & state diagram)Unit  2(advanced class modeling & state diagram)
Unit 2(advanced class modeling & state diagram)Manoj Reddy
 
Introductiontoprogramminginscala
IntroductiontoprogramminginscalaIntroductiontoprogramminginscala
IntroductiontoprogramminginscalaAmuhinda Hungai
 

Similar to 09 inheritance and_uml (20)

Intro uml
Intro umlIntro uml
Intro uml
 
Descriptions of class diagrams in software
Descriptions of class diagrams in softwareDescriptions of class diagrams in software
Descriptions of class diagrams in software
 
Object Oriented Technologies
Object Oriented TechnologiesObject Oriented Technologies
Object Oriented Technologies
 
Unified modeling language
Unified modeling languageUnified modeling language
Unified modeling language
 
Introduction to Java Object Oiented Concepts and Basic terminologies
Introduction to Java Object Oiented Concepts and Basic terminologiesIntroduction to Java Object Oiented Concepts and Basic terminologies
Introduction to Java Object Oiented Concepts and Basic terminologies
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
 
Scala google
Scala google Scala google
Scala google
 
Java for android developers
Java for android developersJava for android developers
Java for android developers
 
Google06
Google06Google06
Google06
 
The Scala Programming Language
The Scala Programming LanguageThe Scala Programming Language
The Scala Programming Language
 
Css uml
Css umlCss uml
Css uml
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles
 
Introduction to UML, a guide to learn.pdf
Introduction to UML, a guide to learn.pdfIntroduction to UML, a guide to learn.pdf
Introduction to UML, a guide to learn.pdf
 
Ontology
OntologyOntology
Ontology
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 
Stepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaStepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to Scala
 
Question and answer Programming
Question and answer ProgrammingQuestion and answer Programming
Question and answer Programming
 
com-213-unified-modelling-launguage-programming-theory.pdf
com-213-unified-modelling-launguage-programming-theory.pdfcom-213-unified-modelling-launguage-programming-theory.pdf
com-213-unified-modelling-launguage-programming-theory.pdf
 
Unit 2(advanced class modeling & state diagram)
Unit  2(advanced class modeling & state diagram)Unit  2(advanced class modeling & state diagram)
Unit 2(advanced class modeling & state diagram)
 
Introductiontoprogramminginscala
IntroductiontoprogramminginscalaIntroductiontoprogramminginscala
Introductiontoprogramminginscala
 

Recently uploaded

Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 

Recently uploaded (20)

Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 

09 inheritance and_uml

  • 1. Inheritance & UML More Advanced UML
  • 2.
  • 3.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. Example: Define Operations Variable Name : Type Function Return Type Student - name : String - dateOfBirth : Date + canEnroll() : Boolean # hasTakenPrerequisites() : Boolean # hasScheduleConflict() : Boolean
  • 19.
  • 20.
  • 21.
  • 22. Multiple Inheritance: Problems Name clashes on attributes or operations Repeated inheritance FlyingThing color getColor Animal color getColor Bird Resolution of these problems is implementation-dependent FlyingThing Animal Bird AnimateObject color
  • 23.
  • 24. Example: Composition (has-a) notifyOfferingSelection(offering : CourseOffering) RegistrationController getOfferings(curriculum) new(context : SecureUser) saveSchedule(sched : Schedule) cancelSchedule(sched : Schedule) <<control>> MaintainScheduleForm displayOfferings() selectCurriculum() : Curriculum selectOffering() : CourseOffering save() cancel() update(changedItem : ISubject) displaySchedule() <<boundary>> 1 1
  • 25.

Editor's Notes

  1. 02/16/11 Operation visibility is the realization of the key object-orientation principle of encapsulation. Public members are accessible directly by any client. Protected members are directly accessible only by instances of subclasses. Private members are directly accessible only by instances of the class to which they are defined. How do you decide what visibility to use? Look at the interaction diagrams on which the operation is referenced. If the message is from outside of the object, use public. If it is from a subclass, use protected. If it’s from itself, use private. You should define the most restrictive visibility possible that will still accomplish the objectives of the class. Client access should be granted explicitly by the class and not taken forcibly. Visibility applies to attributes as well as operations. Attributes are discussed later in this module. UML defines only public/protected/private visibility, not implementation visibility. Implementation visibility should be defined as a property string (UML 1.1, Notation Guide 5.7.2) Re-emphasize that you must define a good abstraction – you must think about what operations are public and private and you must think about encapsulation. It must be done well here for it to be good at the package level.
  2. 02/16/11 In the UML, you can specify the access clients have to attributes and operations. Export control is specified for attributes and operations by preceding the name of the member with the following symbols: + Public # Protected - Private Note that the UML 1.1 Notation Guide explicitly states “A tool may show the visibility indication in a different way, such as by using a special icon …” so the usage of the graphical icons for export control is valid UML.
  3. 02/16/11 In the above example, the student can answer the question of whether it can take a particular offering of a course or not. We must read the description of the operation to understand what rules are considered (e.g. does student’s past schedules include a passing grade for all the courses prerequisites, does students current schedule have a time conflict). If a new rule was added later (e.g. undergraduates can’t take graduate courses) it would go here. That is the value of having an operation that encapsulates a business task (or rule) within a class.
  4. 02/16/11 클래스들 간의 관계는 크게 세가지로 볼 수 있다 . 먼저 계승을 나타내는 IS-A 관계 , member attribute 를 나타내는 aggregation 관계 , 그리고 이 둘이 아닌 일반적인 관계를 들 수 있다 . 이전 단계에서 만든 object diagram 을 보고 이러한 관계성을 찾아내어 클래스 다이어그램에 표시한다 .
  5. 02/16/11 Inheritance is much more than just finding common attribute, operations and relationships. It should be more about the responsibilities and essence of the classes. When building the generalization hierarchies, you should avoid “skyscrapers”; the hierarchies should look like small, independent “forests”. This is general guidance; there may be reasons to break this guideline, just do so consciously. Remember that many levels in an generalization hierarchy affect the understandability of the model. See the Introduction to Object Orientation module for the more formal definition. Some languages do not support generalization. In these cases you will need to update the design model to reflect the characteristics of the implementation language. In cases where the implementation language does not support generalization between classes you must “design generalization in”. Emphasize what happens when a change is made to a super class – the fact that all descendent classes must inherit the change whether they want to or not. Generalization (single inheritance) was introduced in the Introduction to Object Orientation module. This slide was included here, as well, for review purposes.
  6. 02/16/11 See the language-specific appendices for examples of how multiple inheritance is managed in programming environments that support it. Multiple inheritance means that a class can inherit from several other classes. In the above example, Bird inherits from both FlyingThing and Animal. Multiple inheritance is conceptually straightforward and sometimes necessary for modeling the real world accurately. However, there are some potential implementation problems when you use multiple inheritance, and not all implementation languages support it. Thus, be judicial with your use of multiple inheritance. Use it where it accurately describes the concept you are trying to model and reduces the complexity of your model, but be aware that this representation will probably need to be adjusted in design and implementation. Generally, a class inherits from only one class.
  7. 02/16/11 In practice, multiple inheritance is a complex design problem and may lead to implementation difficulties. Two issues associated with multiple inheritance are: 1) Name collisions - both ancestors have attributes and/or operations with the same name, and 2) Repeated inheritance - descendents end up with two copies of an ancestor. See the language-specific appendices for examples of how the multiple inheritance problems are addressed in programming environments that support multiple inheritance.
  8. 02/16/11 The keywords “is a” and “part of” help to determine correct relationship. With Inheritance: Key words “is-a” One object With Aggregation: Key words “part of” Relates multiple objects
  9. 02/16/11 The above example demonstrates how a previous association relationship has been refined into a composition relationship. It was decided that an instance of a RegistrationController would NEVER exist outside the context of a particular Register For Courses Student session. Thus, since the MaintainScheduleForm represents a particular Register For Courses session, a RegistrationController would NEVER exist outside of the context of a particular MaintainScheduleForm. When a MaintainScheduleForm is created, an instance of RegistrationController should always be created. When MaintainScheduleForm is closed, the instance of the RegistrationController should always be deleted. Thus, because they now have coincident lifetimes, composition is used instead of an association.
  10. 02/16/11 Inheritance provides a way to implement polymorphism in cases where polymorphism is implemented the same way for a set of classes. This means that abstract base classes that simply declare inherited operations, but which have no implementations of the operations, and no attributes or associations can be replaced with interfaces. Inheritance now can be (but need not be) restricted to inheritance of implementations only. Polymorphism is not generalization; generalization is one way to implement polymorphism. Polymorphism via generalization is the ability define alternate methods for operations of the ancestor class in the descendent classes. This can reduce the amount of code to be written, as well as help abstract the interface to descendent classes. Polymorphism is an advantage of inheritance realized during implementation and at run-time. Programming environments which support polymorphism use dynamic binding, meaning that the actual code to execute is determined at run-time vs. compile-time. It may be helpful to discuss dynamic binding at this poin; however, try not to get too bogged down in implementation language discussions. Normally the particular method to be executed as a result of a function call is known at compile time. This is called static (or early) binding. The compiler replaces the function call with code telling the program which address to jump to in order to find that function. With polymorphism, the particular type of object for which a method is to be invoked is not known until run time. The compiler cannot provide the address at compile time. The method is selected by the program as it is running This is known as late binding or dynamic linking. See the language-specific appendices for how this is handled by specific programming languages.