Announcements UML ❚ HW2 ❙ Phase 2 peer reviews: due today, Jan 29 th at 5pm ❙ Phase 3 review of reviewers: due Sun, Feb 1 st Class diagrams Sequence diagrams CS361 6-2 1 Modeling notations Usage of UML ❚ Used for both requirements analysis and ❚ Help developers communicate for specification and design ❚ Provide documentation ❚ Useful for technical people ❚ Help find errors (tools check for ❚ Provide a high-level view consistency) ❚ Require training ❚ Generate code (with tools) ❚ Many notations ❙ each good for something ❚ Drawing Tools: ArgoUML, Visio ❙ none good for everything (Microsoft), OmniGraffle CS361 6-3 CS361 6-4 Elements of UML class UML Class Diagrams diagram ❚ Formed by merging Booch Diagrams + ❚ Class Jim Rumbaugh (OMT) Object Diagrams + ❙ attributes ❙ operations Ivar Jacobson use case diagrams ❚ Associations ❚ Descendent of Entity-Relationship ❙ multiplicity Diagrams ❙ direction/aggregation/ ❚ Generalization ❚ Describes data and operations CS361 6-5 CS361 6-6 1
Claim Class Diagram Inheritance Claim Plan Claim Plan Claim Image Claim Image 0..N * 0..1 image 0..1 date: Date name: String date: Date name: String ID: String ID: String 0..1 procedure: String 0..1 claim procedure: String 0..N * supplies: String supplies: String price: Integer price: Integer Provider Provider ❚ 0..1 or 0..N means optional name: String name: String address: String address: String Fax Image Scanned Image ❚ 1 means mandatory phone: String phone: String ❚ * means 0..N CS361 6-7 CS361 6-8 OO modeling points: how do you come up with objects Attributes vs. associations ❚ Best objects correspond to real-world entities. Claim Image Plan ❚ Some correspond to actors (adjudicator). Claim * 0..1 ID: String They are actually interfaces to the actors. 0..1 date: Date * ❚ Some correspond to complex processes, but this is an exception, and should not be Procedure Provider common. name: String * name: String ❚ * is 0..N supplies: String address: String price: Integer phone: String CS361 6-9 CS361 6-10 Health Claims Processing Behavior ❚ Receives health claims and supporting documents via many sources: Claim Image Plan electronically, fax, on paper. Claim * 0..1 name: String ID: String ❚ Scanned paper and fax processed by OCR. 0..1 * date: Date form_dropout() Documents first subject to form dropout, deskew() deskewing, despeckling. despeckle() Provider log() ❚ All images are logged to optical disk. name: String address: String phone: String CS361 6-11 CS361 6-12 2
OO modeling points Analysis vs. Design ❚ Class diagrams are used in both analysis ❚ Class names should be nouns and design ❙ Avoid class names ending in “ er ” ❚ Analysis - conceptual ❚ Verbs become operations ❙ model problem, not software solution ❙ can include actors outside system ❚ Design - specification ❙ tells how the system should act ❚ Design - implementation ❙ actual classes of implementation CS361 6-13 CS361 6-14 Temporary vs. permanent Extending class diagrams ❚ Most class diagrams are temporary ❚ No modeling notation can do everything. ❙ Boxes and lines ❚ Modeling notations should be extensible. ❙ Gradually add ❚ UML has two techniques ❘ More classes ❙ Constraints ❘ Attributes ❙ Stereotypes ❘ Labels/cardinality of associations ❚ Most class diagrams only show small part of model CS361 6-15 CS361 6-16 Constraints Stereotype <<Remote>> <<Persistent>> Claim Image Plan Claim Image Plan Claim * Claim * 0..1 0..1 name: String name: String ID: String ID: String 0..1 0..1 * * date: Date date: Date form_dropout() form_dropout() {Provider is legal under plan} deskew() deskew() despeckle() despeckle() Provider Provider log() log() name: String name: String address: String address: String phone: String phone: String CS361 6-17 CS361 6-18 3
Sequence diagram (event trace) ❚ Model how a set of objects communicate Automatic claim processor Mainframe system ❚ Describe sequence of events +handle claim() ❚ A line for each object +handle claim() ❚ Time goes from top to bottom 0..n ❚ Arrows represent communication events Postal system Claim Adjudicator 0..n -field1 : any 0..1 +ID : string +send letter() -field2 : any +handle claim() +accept/reject() CS361 6-19 CS361 6-20 Sequence diagram for claim Class Diagram automatic mainframe postal ❚ Central model for OO systems an Adjud. a claim claim proc. system system ❚ Describes data and behavior ❚ In UML, is used along with Use Cases and handle claim * get data Packages for analysis accept or ❚ Is also used to describe implementation reject [accept] handle claim ❚ Don ’ t confuse analysis and implementation! [reject] send letter Don’t add all implementation details CS361 6-21 CS361 6-22 Class Activity: modeling a customer Next time order from an online retail catalog A customer can place an order. A customer can ❚ Read through chapter 7 of UML Distilled buy several items within a single order. The (third edition) system calculates the tax, the total price, and ❚ More UML resources the total shipping weight for an order. An order ❙ http://dn.codegear.com/article/31863 contains information (such as quantity, tax ❙ http://www.sparxsystems.com.au/ status) about the item. An item contains info UML_Tutorial.htm like its shipping weight and description of the ❙ http://www.gnome.org/projects/dia/umltut/ item. index.html There are three ways (which can also be combined) to make a payment: cash, check, or credit. CS361 6-24 4
Recommend
More recommend