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

Object & Class Diagram

The document describes object and class diagrams used in object-oriented modeling. It defines objects as concepts or things with identity, while classes describe groups of objects with the same properties. Class diagrams capture the static view of a system by characterizing objects and relationships. They can be used for conceptual and detailed modeling. The document provides examples of class diagrams showing classes, attributes, operations, relationships like associations and generalizations. It also describes concepts like multiplicity, roles, visibility and aggregation.

Uploaded by

Dinesh Bhawnani
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

Object & Class Diagram

The document describes object and class diagrams used in object-oriented modeling. It defines objects as concepts or things with identity, while classes describe groups of objects with the same properties. Class diagrams capture the static view of a system by characterizing objects and relationships. They can be used for conceptual and detailed modeling. The document provides examples of class diagrams showing classes, attributes, operations, relationships like associations and generalizations. It also describes concepts like multiplicity, roles, visibility and aggregation.

Uploaded by

Dinesh Bhawnani
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Object & Class Diagram

Objects:
 a concept, abstraction, or thing with identity that has meaning for
an application.

 often appear as proper nouns or specific references in problem


descriptions

 All objects have identity and are distinguishable

 the choice of objects depends on judgment and the nature of


problem
Classes:
 Describes a group of objects with the same properties
(attributes), behavior (operations), kinds of relationships and
semantics.

 Often appear as common nouns and noun phrases in problem


description.
 Objects in a class have the same attributes and forms of
behavior

 The choice of classes depends on the nature and scope of an


application and is matter of judgment
 The interpretation of semantics depends on the purpose of each
application and is a matter of judgment.
Class Diagram

The class model captures the static view of an system

 by characterizing the objects in the system


 the relationship between the objects
 and the attributes and operations for each class of objects
Class Diagram
• The class diagram is the main building block of object
oriented modeling.

• used for
– general conceptual modeling of the systematics of the
application
– detailed modeling translating the models into programming
code.

• Class diagrams can also be used for data modeling


Class Diagram
• describes the attributes and operations of a
class and also the constraints imposed on the
system.
• widely used in the modeling of object oriented
systems
– can be mapped directly with object oriented
languages
– widely used at the time of construction.
Object Diagram
JoeSmith:Person MaySharp:Person Person

Objects

• An object diagram shows individual objects and their


relationships
• Helpful for documenting test cases

A class diagram corresponds to an infinite set of object diagrams.


Class Diagram

Class Name

Attributes

Operations
Class and Object

• First, there is the division of class and object.

– A class is an abstraction;
– an object is one concrete manifestation of that abstraction.

• In the UML, you can model classes as well as objects, as


shown in following Figures
Class and Object
Class Diagram
“Order System”
• First of all Order and Customer are identified as the two
elements of the system and they have a one to many
relationship because a customer can have multiple orders.

• We would keep Order class is an abstract class and it has two


concrete classes (inheritance relationship) SpecialOrder and
NormalOrder.

• The two inherited classes have all the properties as the Order
class. In addition they have additional functions like dispatch
() and receive ().
Class Diagram for Order System
Relationships among Classes
• Links
– the basic relationship among objects
– a tuple i.e. the list of objects
– an instance of an association
• Association
– represents a family of links with common structure and
semantics.
– Links of an association connect objects from same classes.
– Describes a set of potential links
– Binary associations (with two ends) are normally
represented as a line.
Notation
• Link
– line between objects
– If the link has name, it is underlined
• Association
– Line between related classes
– Association name is optional, if unambiguous
• Ambiguity arise when a model has multiple associations
among the same classes
– Bidirectional
• Can be traversed in either direction and equally
meaningful
Class Diagram
Class Diagram: Generalization
Class Diagram: Association Names
Multiplicity

– Multiplicity specifies the number of instances of one class


that may relate to a single instance of an associated class.

– Multiplicity constrains the number of related objects.

– a subset of nonnegative integers.


Multiplicity
• UML specifies multiplicity with an interval, such as..

0..1 No instances, or one instance (optional, may)


1 Exactly one instance
0..* or *  Zero or more instances
1..*  One or more instances (at least one)
3..5  three to five inclusive
Class Diagram: Multiplicity
Class Diagram: Roles
Class Diagram: Aggregation
Visibility in UML
To specify the visibility of a class member (i.e., any attribute or
method) these are the following notations that must be placed
before the member's name:
"+" Public
"-" Private
"#" Protected
"/" Derived (can be combined with one of the
others)
“~" Static
Association Types
• Aggregation

– a variant of the "has a" association relationship;


– aggregation is more specific than association
– It is an association that represents a part-whole or part-of
relationship.
– can occur when a class is a collection or container of other
classes, but where the contained classes do not have a
strong life cycle dependency on the container
– if the container is destroyed, its contents are not.

You might also like