A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

16
A Student Guide to A Student Guide to Object-Oriented Object-Oriented Development Development Chapter 10 Designing Chapter 10 Designing objects and classes objects and classes

Transcript of A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

Page 1: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

A Student Guide to Object-A Student Guide to Object-Oriented DevelopmentOriented Development

Chapter 10 Designing objects and Chapter 10 Designing objects and classesclasses

Page 2: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

Detailed design activitiesDetailed design activities

Revisit class diagram to add implementation details

Revisit interaction diagrams to add implementation detail

Page 3: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

Class diagramClass diagram

Add new classes e.g. interface and control classes

Specify technical details of associations between classes

Specify visibility of classes, attributes and operation

Specify attributes in detailSpecify operations in detail

Page 4: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

Different types of classesDifferent types of classes

Entity classes

Boundary classes

Control classes

Page 5: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

EntityEntity classesclasses

Model features of the problem domain e.g. bikes, customers, hires

Also known as domain or application classes

All of the classes so far have been entity classes

Page 6: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

Boundary classesBoundary classes

Model the system’s interface with its actors

Used to capture user input and present results

Page 7: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

Control classesControl classes

Control the sequencing of events (e.g. in the execution of a use case scenario)

In a system of any size we expect a boundary and a control object for each use case

Page 8: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

Attribute signature: Bike class Attribute signature: Bike class attribute - depositattribute - deposit

#deposit : Integer = 0

visibility name type-expressioninitial-value

Page 9: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

+findBike(bike# : Integer) : Bike

visibility name

parameter list Return-type

Operation signature:Bike class - Operation signature:Bike class - findBike(bike)findBike(bike)

Page 10: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

Wheels collaboration diagram for use case ‘Maintain Bike’, Wheels collaboration diagram for use case ‘Maintain Bike’, ‘Add new bike’ scenario‘Add new bike’ scenario

Control object :MaintainBike added Interface object :MaintainBikeUI added

Page 11: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

Collection class in useCollection class in use : MaintainBike

UI : BikeList : Bike

bikeID:=getBike (bike#)

* bikeID:=findBike(bike#)

getDailyHireRate ( )

Sequence diagram showing how the collection class works

Page 12: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

Sequence diagrams: object creation and Sequence diagrams: object creation and deletiondeletion

the interface object :MaintainBikeUI is created and destroyed in this interaction

Page 13: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

Sequence diagrams: iterationSequence diagrams: iteration

Page 14: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

Sequence diagrams: iterationSequence diagrams: iteration

everything inside the rectangle is repeated while there are more bikes to add

Page 15: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

Sequence diagrams: conditional behaviour Sequence diagrams: conditional behaviour and branchingand branching

conditions should be mutually exclusive

Page 16: A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.

Wheels: design sequence diagramWheels: design sequence diagram