Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fundamentals of Software Development 1Slide 1 UML class diagrams: Outline Why types / classes are importantWhy types / classes are important –Why types.

Similar presentations


Presentation on theme: "Fundamentals of Software Development 1Slide 1 UML class diagrams: Outline Why types / classes are importantWhy types / classes are important –Why types."— Presentation transcript:

1 Fundamentals of Software Development 1Slide 1 UML class diagrams: Outline Why types / classes are importantWhy types / classes are important –Why types are important –The relationship between types and classes –Why classes are important Three key relationships between classesThree key relationships between classes –is-a (by extending a class) –is-a (by implementing an interface) –has-a UML class diagramsUML class diagrams –What they are for –How to read them Customers/Orders example (handout)Customers/Orders example (handout) –How to draw them Reverse-engineer JavaEyesReverse-engineer JavaEyes This is what we just did – Questions? Now we turn to this

2 Fundamentals of Software Development 1Slide 2 Three key relationships between classes is-a (by extending a class)is-a (by extending a class) –A Student is-a Person So every Student inherits from Person all of Person’s:So every Student inherits from Person all of Person’s: –Attributes (in Java, fields) –Behaviors (in Java, methods) is-a (by implementing an interface)is-a (by implementing an interface) –A Student might implement the Customer interface So every Student must implement every method specified by the Customer interfaceSo every Student must implement every method specified by the Customer interface has-ahas-a –A Student has-a Advisor So every Student can ask their Advisor to do things on the Student’s behalfSo every Student can ask their Advisor to do things on the Student’s behalf

3 Fundamentals of Software Development 1Slide 3 Three key relationships between classes is-a (by extending a class)is-a (by extending a class) is-a (by implementing an interface)is-a (by implementing an interface) has-ahas-a Person ManWoman Son Father Daughter Mother PersonAbleToProcreate > Exercise: In groups of 4, draw these boxes (classes) on the board, per this slide. Then draw labeled arrows to indicate the relationships between the classes. This solution is NOT the best – it does not include the knowledge that a man has a mother, for example. Design is an iterative process! How could this solution be improved? (Answer on next slide)

4 Fundamentals of Software Development 1Slide 4 Three key relationships between classes Person ManWoman Son Father Daughter Mother PersonAbleToProcreate > Improved design: Do you see that it shows that a Woman has-a Mother? That a Son has-a Mother? Questions? is-a (by extending a class)is-a (by extending a class) is-a (by implementing an interface)is-a (by implementing an interface) has-ahas-a


Download ppt "Fundamentals of Software Development 1Slide 1 UML class diagrams: Outline Why types / classes are importantWhy types / classes are important –Why types."

Similar presentations


Ads by Google