1 / 6

UML class diagrams: What are they?

UML class diagrams: What are they?. Unified Modeling Language ( UML ) “A family of graphical notations … that help in describing and designing [object-oriented] software systems” – Martin Fowler Developed in 1997 to unify the previous object-oriented graphical modeling languages

cayenne
Download Presentation

UML class diagrams: What are they?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. UML class diagrams: What are they? • Unified Modeling Language (UML) • “A family of graphical notations … that help in describing and designing [object-oriented] software systems” – Martin Fowler • Developed in 1997 to unify the previous object-oriented graphical modeling languages • Now the world-wide standard • We focus on UML class diagrams • These show: • Relationships between classes in the software system • Details of the classes

  2. 1 means one * means 0 or more 1 .. * means 1 or more 0 .. 1 means 0 or 1 A relationships-onlyUML class diagram • is-a (by extending a class) • is-a (by implementing an interface) • has-a Person * * Man Woman Daughter Son 1 1 This diagram might also show which objects are to construct which other objects Father Mother PersonAbleToProcreate <<interface>>

  3. A relationships-onlyUML class diagram Instructor: give each student a paper copy of this slide. The example is taken from Martin Fowler’s UML Distilled, 3rd Edition. Exercise: draw arrows to indicate the relationships between these classes in an order-processing system. For example, think of the company as Amazon and the system as Amazon’s system for processing orders from customers. After drawing the arrows, indicate the multiplicities. Order Customer lineItem Order Line Corporate Customer Personal Customer Product 1 means one * means 0 or more 1 .. * means 1 or more 0 .. 1 means 0 or 1 is-a (by extending a class) is-a (by implementing an interface) has-a salesRep Employee

  4. A relationships-onlyUML class diagram Instructor: give each student a paper copy of this slide. The example is taken from Martin Fowler’s UML Distilled, 3rd Edition. Exercise: draw arrows to indicate the relationships between these classes in an order-processing system. For example, think of the company as Amazon and the system as Amazon’s system for processing orders from customers. Here is one answer, but not the only possible one! Depends on exactly what you want to model… Order Customer * 1 1 lineItem * Order Line * Corporate Customer Personal Customer 1 Product * 1 means one * means 0 or more 1 .. * means 1 or more 0 .. 1 means 0 or 1 is-a (by extending a class) is-a (by implementing an interface) has-a 0..1 salesRep Employee

  5. EyeBall eyeBallColor : Color xPosition : int yPosition : int Radius : int Moves the EyeBallto follow the mouseto the given point draw( Graphics) look(int, int) Fields-and-methods UML class diagram with details • Together, let’s examine JavaEyes and fill in the details for the EyeBall class in the UML class diagram • What are the attributes? Their types? • Any comments needed? • What are the operations? Their types? • Any comments needed? • There are two ways to show an object-type attribute: • Draw a HAS-A arrow to it • List it in the detailed box • Choose the former if you want to emphasize the relationship

  6. UML class diagrams • What they are and why use them • A notation to assist object-oriented design (not just Java) • The notations for (see example on handout and on next slide): • Relationships-only class diagram • Generalization: X extends Y (the is-a relationship) • Association: X knows one or more Ys (the has-a relationship) • Multiplicity • Fields-and-methods class diagram • Class name, Fields (attributes), Methods (operations) • Fields-and-methods class diagram with details • This shows the types of the things • How to use them • Design is an iterative process! • Relationships-only, fields-and-methods, iterate, eventually with details

More Related