1 / 18

Chapter 11: Class Diagram Chapter 19 in Applying UML and Patterns Book.

Chapter 11: Class Diagram Chapter 19 in Applying UML and Patterns Book. What is Class Diagram ? The different between Domain Model and Design Model. How to build UML Class Diagram (Class, Attribute, Relationship). Overview.

martel
Download Presentation

Chapter 11: Class Diagram Chapter 19 in Applying UML and Patterns Book.

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. Chapter 11: Class Diagram Chapter 19 in Applying UML and Patterns Book.

  2. What is Class Diagram? • The different between Domain Model and Design Model. • How to build UML Class Diagram (Class, Attribute, Relationship). Overview

  3. A classdiagramshows the existence of classes and theirrelationships in the logical view of a system. • UML modeling elements in classdiagrams: • Classes and their structure and behavior. • Association, aggregation, dependency, and inheritance relationships. • Multiplicity and navigation indicators. • Role names. What is Class Diagram ?

  4. Dependency • Dependency means “One class uses the other” • A dependency relationship indicates that a change in oneclass may effect the dependentclass, but not necessarily the reverse. • A dependency relationship is often used to show that a methodhasobject of a class as arguments. Basic Class Dependent Class Depends on

  5. Generalization hierarchy

  6. Generalization hierarchy with added detail

  7. (Conceptual Model) (Class Diagram) Domain Model (Conceptual Model) vs. Design Model Classes (Class Diagram)

  8. Example Design Class Diagrams (DCD)

  9. Identify all the classes participating in the software solution. Do this byanalyzing the interactiondiagrams. Draw them in a class diagram. • Duplicate (i.e. copy) the attributes from the associated concepts in the Domain Model. Creating NextGen POS DCD

  10. Steps: Design to Code Main goal is to define Design Class Diagram with Attributes and Methods Defining Concepts Adding Reference Attributes, attributes. Creating methods from interaction diagrams: Find & Add methods. Add typeinformation to the attributes and methods Add navigability and associations. Collection classes in code.

  11. Addmethodnames for each class by analyzing the interaction diagrams. Creating NextGen POS DCD

  12. 12 Creating Methods from Sequence Diagrams :Register :ProductCatalogue Sale :SalesLineItem :ProductSpec Constructor 1. Spec=getSpecification(itemID) 1.1 Spec=Find(itemID) 2. makeLineItem(spec,quantity) 2.1 sli= Create(spec,quantity) 2.1.1 Sub=getSubTotal(itemID) 2.2 Add(sli)

  13. Add typeinformationto the attributes and methods. Creating NextGen POS DCD

  14. Question: Register – addLineItem Method • The addLineItem sequence diagram will be used to illustrate the Java definition of the addLineItemmethod. • Which class addLineItem should belong to? • The addLineItem message is sent to a Register instance, therefore the addLineItem method is defined in class Register. • public void addLineItem (itemIDitemID, int quantity); • Message 1. A getSpecification message is sent to the productCatalog to retrieve a productSpecification. • productSpecification spec = catalog.getSpecification (itemID); • Message 2. The makeLineItem message is sent to the Sale. • sale.makeLineItem (spec, quantity);

  15. Register - addLineItem Method Public void addlineitem(itemiditemid, int quantity) { productSpecification spec = catalog.getSpecification(itemID); sale.makeLineItem(spec, quantity);} Public productSpecificationgetSpecification(itemID){ spec := find(itemID); Return spec; } Public void makeLineItem (productSpecification spec, int quantity){ sli= create(spec, quantity); //new in java add(sli); }

  16. Skeletal definition of Register Class

  17. Collection Classes in Code

  18. Adding Navigability & Dependency Relationships

More Related