1 / 26

UML – Class Diagrams Lesson - 9

UML – Class Diagrams Lesson - 9. Objectives. What is UML? UML Diagrams Use Case Diagram Class Diagram. What is UML?.

ima
Download Presentation

UML – Class Diagrams Lesson - 9

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 DiagramsLesson - 9

  2. Objectives • What is UML? • UML Diagrams • Use Case Diagram • Class Diagram

  3. What is UML? • The Unified Modeling Language (UML) is a standard  language for specifying, visualizing, constructing, and documenting the artifacts of software systems, as well as for business modeling and other non-software systems. • UML uses graphical notations to express the design of software projects. • Modeling is necessary for readability and reuse of systems.

  4. UML Diagrams • UML modeling consists of nine different diagrams to model a software system. • Each UML diagram is designed to let developers and customers view a software system from a different perspective and in varying degrees of abstraction.

  5. UML Diagrams • Use case Diagram • Class Diagram • Object Diagram • State Diagram • Activity Diagram • Sequence Diagram • Collaboration diagram • Component diagram • Deployment diagram

  6. Use case Diagram • Use case diagram displays the relationship among actors and use cases. • Actors: An actor is any entity that performs certain roles in a given system. For example, In a banking application, a customer entity represents an actor. Similarly, the person who provides service at the counter is also an actor.

  7. Use case Diagram • Use Case: A use case in a use case diagram is a visual representation of a distinct business function in a system. For example, In a banking application, a deposit function represents a use case. • To identify use cases, you should list the discrete business functions the user might do in order to complete an action. For a banking application it might be: deposit money withdraw money

  8. Use case Diagram

  9. Class Diagram • Class diagrams model class structure and contents using design elements such as classes, packages and objects. • A class diagram is a diagram showing a collection of classes and interfaces, along with the collaborations and relationships among classes and interfaces. A class diagram is composed of: • Class: A class has a business functionality called methods, and properties that reflect unique features of a class. The properties of a class are called attributes.

  10. Class Diagram • For example: Let us take a class named Student. The Student class encapsulates student information such as student id #, student name, and so forth. Student id, student name, and so on are the attributes of the Student class. The Student class also exposes functionality to other classes by using methods such as getStudentName(), getStudentId(), and the like. Let us take a look at how a class is represented in a class diagram.

  11. Class Diagram The following diagram shows a typical class in a class diagram:

  12. Elements of a Class Diagram • Attributes correspond to the class level variables (but not variables declared within the body of a method). • Operations correspond to methods in Java. • Public members (attributes or operations) can be referenced directly by any classes in this or any other model package (more on packages later). • Private members can only be referenced in the same class where they’re declared. • Protected members can be referenced in the same class or in any descendants of that class (more on inheritance later). • Package scope members can be referenced by any classes in the same UML package only.

  13. Access Specifiers

  14. Static Members • Static members can be referenced without instantiating the class to which they belong. • In UML, static members are underlined.

  15. Abstract Classes • Abstract classes are partially implemented and force us to extend it before we can use its functionality. In class diagrams, the name of an abstract class is specified in italics • Abstract methods that must be implemented in subclasses of the abstract class are again specified in italics.

  16. Dependencies • A dependency is a using relationship that states that a change in a specification of one thing may effect another thing that uses it • You will use dependencies in the context of classes to show that one class uses another class as an argument in its method’s signature.

  17. Generalization • A generalization is a relationship between a general thing (a superclass) and a more specific kind of that thing (a subclass). • It is a is-a-kind-of relationship.

  18. Association • An association represents a relationship that specifies that objects of one thing are connected to objects of another.

  19. Aggregation • An association in which one class represents a larger thing, which consists of smaller things is called an aggregation relation • It is a has-a relationship meaning an object of the whole has objects of the part.

  20. Composite • In a composite aggregation, an object may be a part of only one composite at a time. For example, a Frame belongs to exactly one Window. • In simple aggregation, a part may be shared by several wholes. For example a Wall may be a part of one or more Room objects.

  21. Realization-Interfaces • A realization relationship shows that one class implements the interface of another class. • A realization can be represented in two ways. Design View (canonical form) System’s Implementation View (elided form)

  22. Realization

  23. Packages

  24. Package - Client

  25. Package - Policies

  26. Package - GUI

More Related