Class
A Class in object-oriented programming and UML is a blueprint for creating objects. It defines a set of attributes (data) and methods (behaviors) that the objects of that Class will have. In Modeldraw, the Class shape is used to represent these classes in your diagrams.
Understanding Class
Key concepts to understand about Classes:
Abstraction: A class represents an abstract concept or entity in your system. It encapsulates the essential properties and behaviors of that entity.
Attributes: These are the data members of the class. They represent the state or characteristics of objects created from this class.
Methods: These are the functions or operations that can be performed by objects of the class. They represent the behaviors or actions of the class.
Encapsulation: Classes encapsulate data (attributes) and the methods that operate on that data, hiding the internal details and providing a public interface.
Instantiation: Objects are instances of a class. A class serves as a template from which individual objects are created.
Visibility: Classes can have different levels of visibility for their members:
Public (+): Accessible from anywhere
Private (-): Accessible only within the class
Protected (#): Accessible within the class and its subclasses
Package (~): Accessible within the same package (in some programming languages)
Inheritance: Classes can inherit attributes and methods from other classes, forming a parent-child (superclass-subclass) relationship.
Polymorphism: Subclasses can override methods from their superclass, allowing objects of different classes to respond differently to the same method call.
In Modeldraw, a Class shape visually represents these concepts:
The class name at the top of the shape identifies the class
The attributes section lists the data members
The methods section lists the available operations
Visibility is indicated by symbols (+, -, #, ~) before each member
Relationships with other classes (like inheritance or associations) are shown through connections between Class shapes
Understanding these fundamental concepts of classes will help you effectively use the Class shape in Modeldraw to create accurate and meaningful UML diagrams.
Display Modes
Modeldraw offers two display modes for Class shapes:
Compact Mode (Default)
Full Mode
Compact Mode
In Compact Mode, only the class name is displayed. This mode is useful for:
Creating high-level overviews of system architecture
Simplifying complex diagrams
Focusing on relationships between classes
Full Mode
Full Mode displays all compartments of the class, including:
Class Name
Attributes
Methods
This mode provides a detailed view of the class structure.
Switching Between Modes
To switch between Compact and Full modes:
Double-click the Class shape
In the properties dialog, find the "Display mode" option
Choose between "Compact" and "Full"
Adding an Existing Class to a Diagram
To add an existing class to a diagram:
Open the diagram you want to add the Class to
Drag and drop the Class from the navigation tree into the diagram
Last updated