UML Diagram: Class
(Free Web Tutorials)
by Michael Thomas
UML Home Page
On the UML Home page, you can download
the whole UML site (all content, tutorials & examples) !!!
(Note: All of the EclipseUML projects
used in these tutorials are in .zip files located at:
uml\eclipse\viewonly . Just extract them into your workspace.)
Prerequisites
- Review the UML Overview tutorial.
Objectives
- Get a broad over view of UML "Class" diagram.
Definition & Example
- Class Diagram - diagram of the static structure of the system's
classes and interfaces and their relationships or associations
(including inheritance, aggregation, and association) including the
operations and attributes of the classes. Presentation modes are:
Association, Inheritance, Dependency. This is a very common
diagram in UML.
-
Example - (created with
EclipseUML - May of 2008) - Class Diagram for objects associated with a
company.
- Java Source Code - that matches the diagram.
-
Example - (created with Rational Software Modeler v6.0 - Sept of 2005) -
Class Diagram of an online order system.
Goals of the Class diagram
- Model the static design of a system's classes and their
relationships: interfaces, hierarchy, collaborations, dependency,
generalization, associations, etc...
- Show the attributes and operations of the classes. This can
later be used to model a schema in conceptual design of a database.
- Show the class requirements in the form of a diagram.
- Use the Class diagrams as the foundations for component & deployment
diagrams.
UML Class Diagram Terms (used by EclipseUML for UML2)
- Package - a way to organize elements into groups.
For the class diagram this is Java's package: (ex: package
myumltutorial;)
- Class
- Class - is a description of a set of objects that share the same
attributes, methods and relationships.
For the class diagram this is Java's class: (ex: public
class Company)
- Signal - depicts the asynchronous communication between instances of the
class.
- Artifact - is a work product produced by the software development
process.
- Collaboration - indicates that 2 element work together
- Data Type - primitives like numbers, strings, booleans.
- Interface - a group of operations used to force an implementation in
another class.
For the class diagram this is Java's implements: (ex: public class
Person implements myumltutorial.IPerson)
- Enumeration - a list of named values used as a range of an attribute
type.
For the class diagram this is Java's enum: (ex: public enum
enumtest )
- Associations - a relationship between two objects.
For the class diagram this is a Java's 0..1, 1..*, * etc... relationship.
- Association
- Direct Association
- Aggregation Association
- Composition Association
- Dependencies
- Dependency -
- Abstraction -
- Binding -
- Call -
- Create -
- Deployment -
- Implementation -
- Instantiate -
- Manifestation -
- Permission -
- Responsibility -
- Send -
- Usage -
- Generalization - describes a parent / child relationship where the child
is more specialized in it's task. For a class diagram this is the same
as Java's "extends" (ex: public class LocationCompany
extends myumltutorial.Location )
- Realizations -
- Realization -
- Interface Realization -
- Substitution -
- Imports
- Element Import -
- Package Import -
- Package Merge -
- Interface provider -
- Required interface -
- Interface connection -
- Note -
- Indication -
- Diagram Link -
- Text Label -
- EclipseUML (studio version) also has an icon for: EJB Bean, Hibernate,
Web Service, Spring, JSF, Struts