Wondershare EdrawMax - Class Diagrams

Jul 12, 2024

Wondershare EdrawMax - Class Diagram Lecture

Introduction

  • Class Diagram: Used by developers to map out a system or software in static form.
  • Helps figure out necessary classes, their functionality, and relationships with other system elements (operations, attributes, objects).

Benefits of Class Diagrams

  • Simple and fast to read
  • Provide a sense of orientation
  • Foundation for creating systems
  • Offer detailed insight into system structure
  • Highlight specific code needed for execution
  • Provide implementation-independent explanation of types used in a system

Class Diagram Notations

Class Notation

  • Class Symbol: Represents a concept encapsulating state and behavior.
  • Class Structure: Shown with a signature (Class Name, Attributes, Operations)

Class Name

  • Shown in the first section (mandatory information).

Attributes

  • Shown in the second section, Attribute: Type format.
  • Define a class's values.

Operations/Methods

  • Shown in the third section, Operation: Return Type format.
  • Represent services the class provides.
  • Method parameters are shown with type.

Visibility

  • Public ( + ): Accessible by all.
  • Private ( - ): Accessible only within the class.
  • Protected ( # ): Accessible within the class and subclasses.
  • Package ( ~ ): Accessible within the package.
  • Derived ( / ): Derived attributes.
  • Static: Underlined attributes or operations.

Relationships Between Classes

Bidirectional Association

  • Represented by a straight line; shows awareness of each other.

Inheritance

  • Indicates a parent-child relationship.

Realization

  • One class implements the behavior of another.

Dependency

  • One class depends on another (shown with a dashed arrow).

Aggregation

  • Unilateral relationship; one class is part of another but can exist independently.

Composition

  • Form of aggregation; one class depends on another, cannot exist independently.

Steps to Draw a Class Diagram

Step 1: Identify Class Names

  • Identify primary objects of the system.

Step 2: Distinguish Relationships

  • Determine relationships between classes/objects. Look for commonalities and abstractions.

Step 3: Create Structure

  • Add class names, link with appropriate connectors, add attributes and methods.
  • Use EdrawMax: File > New > Software & Database > Software Development > UML Modeling > New Drawing Sheet.

UML Class Diagram Library

  • Drag and drop required shapes onto the drawing pane.
  • Change names accordingly.
  • Continue building the diagram, adding attributes, operations, and relationship symbols.

Customization

  • Add text: Home tab > Text option.
  • Fill colors: Theme option on the right side of the page.
  • Fit to drawing: Page Layout tab > Fit to Drawing.

Diagram Elements

  • Class: Blueprint for an object.
  • Attributes: Define a class's values.
  • Association: Relationship between classes.
  • Multiplicity: Determines the number of attribute occurrences.
  • Operations: How a class interacts with data.
  • Aggregation: Unilateral relationship between classes.
  • Role Model: Instances of classes in more detail.
  • Abstract Class: Template definition of methods and variables; may contain abstract methods.
  • Generalization Relationship: Child model element is based on a parent model element.

Examples of Class Diagrams in EdrawMax

  • Java API UML Class Diagram
  • Domain Model UML Class Diagram

Conclusion

  • Subscribe for more videos.
  • Links provided for EdrawMax online or software download.