DOC PREVIEW
Toronto CSC 302 - Lecture 3 - Class Diagrams

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 1Lecture 3:Class Diagrams Advanced Class Diagrams Uses of UML Relationship between UML and program codeUniversity of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 2Capturing the Structure of the DesignDivision of ResponsibilityOperations that objects are responsible for providingSubclassingInheritance, generalizationNavigability / VisibilityWhen objects need to know about other objects to call their operationsAggregation / CompositionWhen objects are part of other objectsDependenciesWhen changing the design of a class will affect other classesInterfacesUsed to reduce coupling between objects2University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 3Uses of UMLAs a sketchVery selective - informal and dynamicForward engineering: describe some concept you need to implementReverse engineering: explain how some part of the program worksAs a blueprintEmphasis on completenessForward engineering: model as a detailed spec for the programmerReverse engineering: model as a code browserRoundtrip: tools provide both forward and reverse engineering to move back andforth between program and codeAs a Programming languageUML models are automatically compiled into working codeRequires sophisticated tools“tripless”University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 4Anatomy of a class Student+ name: string [1] = “Anon” {readOnly}+ registeredIn: Course [*]+ register (c: Course)+ isRegistered (c: Course) : BooleanName of the classVisibility:+, -, #, …AttributenameOperationnameParametersReturn valueAttributetypeMultiplicityDefault valueOther Properties3University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 5Subclassing (refresher)Note: Used for generalization, not instantiationAll attributes, operations and associations are inheritedUniversity of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 6Navigability / Visibility Order+ dateReceived: Date [0..1] + isPrepaid: Boolean [1]+ lineItems: OrderLine [*] {ordered}OrderDate BooleanOrderLine+isPrepaid+dateReceived+lineItems {ordered}1*0..1 *14University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 7Bidirectional AssociationsPerson Car*0..1 Person+ carsOwned: Car [*] Car+ Owner: Person [0..1] Hard to implement correctly!University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 8Aggregation / Composition (Refresher)3..*centre{ordered}1*compositionaggregationMemberClubPolygonCirclePoint*Note: No sharing - any instance of point canbe part of a polygon or a circle, but not bothWhat doesthis mean??5University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 9View ViewControllerModelLayoutDependenciesExample Dependency types:<<call>><<use>><<create>><<derive>><<instantiate>><<permit>><<realize>><<refine>><<substitute>><<parameter>>University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 10Interfaces OrderLineItems [*] ArrayList OrderLineItems [*] <<interface>> Listget <<interface>> Collectionequalsadd ArrayListgetadd<<requires>><<implements>>ListCollection6University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 11AnnotationsComments-- can be used to add comments within a class descriptionNotesConstraint RulesAny further constraints {in curly braces}e.g. {time limit: length must not be more than three months}{length = start - end} Date RangeStart: DateEnd: Date/length:


View Full Document

Toronto CSC 302 - Lecture 3 - Class Diagrams

Documents in this Course
Load more
Download Lecture 3 - Class Diagrams
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 3 - Class Diagrams and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 3 - Class Diagrams 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?