Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between a Class Diagram vs an Object Diagram? [closed]

What is the difference between Class Diagram and Object Diagram?

like image 449
Ahmed Mahmoud Avatar asked Oct 09 '13 21:10

Ahmed Mahmoud


People also ask

What is the difference between class and object?

Object is an instance of a class. Class is a blueprint or template from which objects are created. Object is a real world entity such as pen, laptop, mobile, bed, keyboard, mouse, chair etc. Class is a group of similar objects.

What is the difference between class diagram and UML?

The main difference between UML and class diagram is that UML is a general-purpose visual modeling language that helps to visualize, construct and documents software systems while class diagram is a type of UML diagram that represents the static view of an application.

What is object class diagram?

Object diagrams represent an instance of a class diagram. The basic concepts are similar for class diagrams and object diagrams. Object diagrams also represent the static view of a system but this static view is a snapshot of the system at a particular moment.

What is a class and object give the diagram and representation of class and object?

Class diagrams show classes that represent concepts, while object diagrams show objects that represent specific instances of those concepts. The next few sections talk in detail about the representation of classes and objects in class and object diagrams.


2 Answers

As specified in the UML specifications:

class diagram is a graph of Classifier elements connected by their various static relationships. Note that a “class” diagram may also contain interfaces, packages, relationships, and even instances, such as objects and links. Perhaps a better name would be “static structural diagram”, but “class diagram” is shorter and well established.

object diagram

is a graph of instances, including objects and data values. A static object diagram is an instance of a class diagram; it shows a snapshot of the detailed state of a system at a point in time. The use of object diagrams is fairly limited, mainly to show examples of data structures.


In simple words...

Class diagram shows a collection of declarative (static) model elements, such as classes, types, and their contents and relationships.

Object diagram encompasses objects and their relationships at a point in time. It may be considered a special case of a class diagram or a collaboration diagram.


class diagram

enter image description here

object diagram

enter image description here

A good powerpoint to start with: http://people.bu.edu/rfv/SC511/downloads/uml.ppt

like image 176
MrSimpleMind Avatar answered Sep 23 '22 18:09

MrSimpleMind


Wikipedia gives examples of both: Class Diagram Object Diagram

The differences are in the purpose, and what they show.

A Class Diagram will show what the Objects in your system consist of (members) and what they are capable of doing (methods).

In contrast, an Object Diagram will show how objects in your system are interacting with each other at some point in time, and what values those objects contain when the program is in this state.

like image 16
tredontho Avatar answered Sep 22 '22 18:09

tredontho