0% found this document useful (0 votes)
14 views12 pages

UML-Unit 2 Classes & Objects

The document discusses class diagrams and object diagrams. It covers what they are, their common uses, and techniques for modeling class and object structures like collaborations and database schemas.

Uploaded by

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

UML-Unit 2 Classes & Objects

The document discusses class diagrams and object diagrams. It covers what they are, their common uses, and techniques for modeling class and object structures like collaborations and database schemas.

Uploaded by

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

UML-Unit 2

Class and Object Diagrams


Class Diagrams
• A class diagram shows a set of classes, interfaces, and collaborations and
their relationships.
• Graphically, a class diagram is a collection of vertices and arcs.
• Class diagrams commonly contain the following things:
• Classes
• Interfaces
• Collaborations
• Dependency, generalization, and association relationships.
• Like all other diagrams, class diagrams may contain notes and constraints.
• It may also contain packages or subsystems
Common Uses
• Class diagrams are to model the static design view of a system. This view
primarily supports the functional requirements of a system.
• Class diagrams are used in one of three ways:
• To model the vocabulary of a system.
• To model simple collaborations.
• To model a logical database schema
• Modeling the vocabulary of a system: It involves making a decision about
which abstractions are a part of the system and which fall outside its
boundaries.
• Modelling simple collaborations: A collaboration is a society of classes,
interfaces, and other elements that work together to provide some
cooperative behavior that's bigger than the sum of all the elements.
• Modeling logical database schema: Schemas are modelled for the
databases using class diagrams.
Common Modelling Techniques
• Modelling Simple Collaboration
• Modelling a Logical Database Schema
Modelling Simple Collaboration
• To model a collaboration
• Identify the mechanism to model. A mechanism represents some function or
behaviour of the part of the system being modelled that results from the
interaction of a society of classes, interfaces, and other things.
• For each mechanism, identify the classes, interfaces, and other collaborations
that participate in this collaboration. Identify the relationships among these
things, as well.
• Use scenarios to walk through these things. Along the way, the parts of the
model that were missing will be discovered and parts that were just plain
semantically wrong.
• Populate these elements with their contents. For classes, start with getting a
good balance of responsibilities. Then, over time, turn these into concrete
attributes and operations.
Modelling a Logical Database Schema
• Identify those classes whose state must transcend the lifetime of their
applications.
• Create a class diagram that contains these classes and mark them as persistent (a
standard tagged value). Define the own set of tagged values to address database-
specific details.
• Expand the structural details of these classes. In general, this means specifying
the details of their attributes and focusing on the associations and their
cardinalities that structure these classes.
• Watch for common patterns that complicate physical database design, such as
cyclic associations, one-to-one associations, and n-ary associations. Where
necessary, create intermediate abstractions to simplify your logical structure.
• Consider the behavior of these classes by expanding operations that are
important for data access and data integrity. To provide a better separation of
concerns, business rules concerned with the manipulation of sets of these
objects should be encapsulated in a layer above these persistent classes.
• Where possible, use tools to transform the logical design into a physical design.
Modelling a schema
Objects
• An object diagram is a diagram that shows a set of objects and their
relationships at a point in time.
• Graphically, an object diagram is a collection of vertices and arcs
• An object diagram is a special kind of diagram and shares the same
common properties as all other diagrams—that is, a name and
graphical contents that are a projection into a model
• Object diagrams commonly contain
• Objects
• Links
• Like all other diagrams, object diagrams may contain notes and
constraints.
• Object diagrams may also contain packages or subsystems
Common Uses
• Object diagrams are used to model the static design view or static
process view of a system like class diagrams.
• To model the static design view or static process view of a system,
object diagrams are used in one way:
• To model object structures
• Modeling Object Structures
• Modeling object structures involves taking a snapshot of the objects in a
system at a given moment in time.
• An object diagram represents one static frame in the dynamic storyboard
represented by an interaction diagram
Common Modelling Techniques
• Modelling Object Structures
• Identify the mechanism to model. A mechanism represents some function or
behaviour of the part of the system to be modelled that results from the
interaction of a society of classes, interfaces, and other things.
• For each mechanism, identify the classes, interfaces, and other elements that
participate in this collaboration; identify the relationships among these
things, as well.
• Consider one scenario that walks through this mechanism. Freeze that
scenario at a moment in time, and render each object that participates in the
mechanism.
• Expose the state and attribute values of each such object, as necessary, to
understand the scenario.
• Similarly, expose the links among these objects, representing instances of
associations among them.
Object Diagram

You might also like