0% found this document useful (0 votes)
13 views

5 Class Diagram

Uploaded by

Khin Myint
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

5 Class Diagram

Uploaded by

Khin Myint
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 72

UML Class Diagram

• Class diagram is one of the most useful types of diagram in UML to show structure of
system by modeling its classes, attributes, methods, operations and relationships between
objects.
• One of the more popular types in UML is the class diagram. Popular among software
engineers to document software architecture, class diagrams are a type of structure diagram
because they describe what must be present in the system being modeled.
• UML was set up as a standardized model to describe an object-oriented programming
approach. Since classes are the building block of objects, class diagrams are the building
blocks of UML. The various components in a class diagram can represent the classes that
will actually be programmed, the main objects, or the interactions between classes and
objects.
• The class shape itself consists of a rectangle with three rows. The top row contains the
name of the class, the middle row contains the attributes of the class, and the bottom
section expresses the methods or operations that the class may use. Classes and subclasses
are grouped together to show the static relationship between each object.
Basic components of a class diagram
The standard class diagram is composed of three sections:
• Upper section: Contains the name of the class. This section is always required,
whether you are talking about the classifier or an object.
• Middle section: Contains the attributes of the class. Use this section to describe
the qualities of the class. This is only required when describing a specific instance
of a class.
• Bottom section: Includes class operations (methods). Displayed in list format,
each operation takes up its own line. The operations describe how a class interacts
with data.
Member access modifiers
All classes have different access levels depending on the access modifier
(visibility). Here are the access levels with their corresponding symbols:
• Public (+)
• Private (-)
• Protected (#)
• Package (~)
• Derived (/)
• Static (underlined)
Member scopes
There are two scopes for members: classifiers and instances.
• Classifiers are static members while instances are the specific instances of the
class. If you are familiar with basic OO theory, this isn't anything groundbreaking.
Interactions
The term "interactions" refers to the various
relationships and links that can exist in class and
object diagrams. Some of the most common
interactions include:
• Inheritance: The process of a child or sub-class
taking on the functionality of a parent or
superclass, also known as generalization. It's
symbolized with a straight connected line with a
closed arrowhead pointing towards the
superclass. Inheritance is shown in a class
diagram by using a solid line with a closed,
hollow arrow.
Bidirectional association
• The default relationship between two classes. Both classes are aware of each other and their
relationship with the other. This association is represented by a straight line between two
classes.
• In the example above, the Car class and RoadTrip class are interrelated. At one end of the
line, the Car takes on the association of "assignedCar" with the multiplicity value of 0..1, so
when the instance of RoadTrip exists, it can either have one instance of Car associated with it
or no Cars associated with it. In this case, a separate Caravan class with a multiplicity value of
0..* is needed to demonstrate that a RoadTrip could have multiple instances of Cars
associated with it. Since one Car instance could have multiple "getRoadTrip" associations—in
other words, one car could go on multiple road trips—the multiplicity value is set to 0..*
Unidirectional association
• A slightly less common relationship between two classes. One class is aware of the other and
interacts with it. Unidirectional association is modeled with a straight connecting line that
points an open arrowhead from the knowing class to the known class.
• As an example, on your road trip through Arizona, you might run across a speed trap where a
speed cam records your driving activity, but you won't know about it until you get a
notification in the mail. It isn't drawn in the image, but in this case, the multiplicity value
would be 0..* depending on how many times you drive by the speed cam.
Hotel
Management
System
ATM System
• Protected – the same class and subclass
• Package – the same package
Relationship
• inheritance
1. Inheritance
Abstraction support
DRY principle as you can see
2. Association
• Otter eat sea urchin. There is no dependency between them. That is basic association
relationship.
3. Aggregation
4. Composition
• ;lsdfks
5. Multiplicity
• Dlklfjsd
• Jsdkf
Bank Management System
Fitness Tracker
Health and Fitness Tracker
https://creately.com/diagram/example/il6biv9w/atm-class-diagram
https://creately.com/diagram/example/i73m2iqz2/class-diagram-taxi-service
https://online.visual-paradigm.com/diagrams/templates/use-case-diagram/fitness-tracking-app-/
https://www.freeprojectz.com/uml/fitness-center-management-system-class-diagram
https://www3.ntu.edu.sg/home/ehchua/programming/java/j3f_oopexercises.html

• OOP student exercise (Lottery for me)


use it for Student Exercises
• Already downloaded in C# distinction
folder/ OOP Exercises (Lottery)
• Underline – static attr
Association
Gym include Black Box Testing
SDLC
Gym workout thesis research 64 pages
Just for knowledge
Lecture 08
Software Development Lifecycle

You might also like