Compare the Difference Between Similar Terms

Difference Between

Home / Technology / IT / Programming /Difference Between Class Diagram and Object Diagram

Difference Between Class Diagram and Object Diagram

June 13, 2018Posted byLithmee

Thekey differencebetween class diagram and object diagram is that theclass diagram represents theclassesand their relationships between them while the object diagram represents the objects and their relationships between them at a particular moment.

UMLstands for Unified Modelling Language. It helps to model the object-oriented concepts to develop software solutions. UML diagrams provide various advantages such as understanding business requirements and to get a high-level understanding of the system functionalities. There are two main UML modelling types. They are structural modelling and behavioral modelling. Structured modeling describes the static features of the system. On the other hand, behavioral modeling describes the dynamic nature of the system. The class diagram and object diagram are two structural modeling UML diagrams.

CONTENTS

1.Overview and Key Difference
2.What is Class Diagram
3.What is Object Diagram
4.Side by Side Comparison – Class Diagram vs Object Diagram in Tabular Form
5.Summary

What is Class Diagram?

A class diagram represents a static view of the system. It describes theattributesand operations of classes. Class diagrams are the most widely used modeling diagram for object-oriented systems because they can be directly mapped with object-oriented languages.

Difference Between Class Diagram and Object Diagram

Figure 01: Class Diagram

Above is a simple example of a class diagram. It is an online ordering system. User, Customer, Administrator, Order, OrderDetails are classes. Each class consist of attributes and methods. Attributes describe the properties while methods describe the behaviors or operations.

In a class diagram, a rectangle represents the class. It further divides into three sections. The top section is to write the name of the class. The middle section is for attributes, and the last section is for methods. The Customer class has attributes such as name, address, email, customerId, accountBalance and methods such as register, login and purchase.

Attributes and Methods

The attributes and methods have a symbol to indicate the visibility. The – represents private. The other classes cannot access the private members. They are visible only to that specific class. The + represents public and other classes can access those members. Usually, the class attributes are private, and the methods are public. There is another visibility. This is called protected, and # symbol represent it. Only the same class and sub class members can access the protected members.

The User is the generalized form of Administrator and Customer. These two classes can have the attributes and methods of the user class as well as their own attributes and methods. The User class is the parent class while the Customer and Administrator classes are the child classes. This concept is called Generalization.

The Customer and Order have the composition relationship. The Order class cannot exist without the Customer class. The Order and OrderDetails have the composition relationship. Therefore, the OrderDetails class cannot exist without the Order class.

The class diagram also represents multiplicity. When referring to the Customer and Order relationship, the customer can have zero or many orders. On the other hand, an order only belongs to one customer. The order and OrderDetails have 1 to 1 relationship. An Order can have only one OrderDetails. Those are some basics of Class Diagrams.

What is Object Diagram?

Another structural diagram is an object diagram. It is similar to a class diagram, but it focuses on objects. The basic concepts of object diagram are similar to a class diagram. These diagrams help to understand object behavior and their relationships at a particular moment.

Key Difference Between Class Diagram and Object Diagram

Figure 02: Object Diagram

The s1, s2, and s3 are student objects, and they enroll to c1 course object. The l1 lecturer object teaches the course c1. The lecturer object l2 teaches the special course c2. The Student s3 enrolls to c1 course as well as c2 special course. This diagram illustrates how a set of objects relates to each other. Overall, an object diagram represents the static view of a system but specifically, it represents a static view of the system at a particular moment.

What is the Difference Between Class Diagram and Object Diagram?

类图是一种静态结构迪亚gram that describes the structure of the system by showing the classes, their attributes, methods and the relationship among the classes. An object diagram is also a type of static structural diagram that shows a complete or partial view of the structure of a modeled system at a specific time.

Furthermore, class diagrams define classes and show how they relate to each other. Object diagrams show the objects and their relationships. Classes are the blueprints and objects are the instances of classes. This is the main difference between class diagram and object diagram.

Further, in a class diagram, the class name starts with uppercase. e.g., Student. In an object diagram, the object name is in lowercase, and it is underlined. e.g.,s1: Student

Difference Between Class Diagram and Object Diagram in Tabular Form

Summary – Class Diagram vs Object Diagram

Both class and object diagrams represent static features of a system. The difference between class diagram and object diagram is that class diagram represents the classes and their relationships between them while object diagram represents the objects and their relationships between them at a particular moment. These diagrams help to get a high-level understanding of the system.

Reference:

1.“Unified Modeling Language (UML) | Object Diagrams.” GeeksforGeeks, 13 Feb. 2018.Available here
2.Tutorials Point. “UML – Class Diagram.”Tutorials Point, 8 Jan. 2018.Available here
3.Tutorials Point. “UML – Object Diagrams.”Tutorials Point, 8 Jan. 2018.Available here

Related posts:

Difference Between Performance and Load Testing Difference Between Visual Basic and Visual Basic.Net (VB6 and VB.net) Difference Between EJB2 and EJB3 Difference Between Java5 and Java6 Difference Between Netbeans and Eclipse

Filed Under:Programming

About the Author:Lithmee

Lithmee Mandula is a BEng (Hons) graduate in Computer Systems Engineering. She is currently pursuing a Master’s Degree in Computer Science. Her areas of interests in writing and research include programming, data science, and computer systems.

Leave a ReplyCancel reply

Your email address will not be published.Required fields are marked*

Request Article

Featured Posts

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and SARS

Difference Between Coronavirus and SARS

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Covid 19

Difference Between Coronavirus and Covid 19

You May Like

Difference Between Animism and Animatism

Difference Between Animism and Animatism

Difference Between Masking and Demasking Agents

Difference Between Masking and Demasking Agents

Difference Between Zantac and Omeprazole

Difference Between Heels and Stilettos

Difference Between Standard Deviation and Mean

Latest Posts

  • What is the Difference Between Acne and Rosacea
  • What is the Difference Between Blood Transfusion and Dialysis
  • What is the Difference Between Language Acquisition and Language Learning
  • What is the Difference Between Heart Attack and Gastric Pain
  • 维生素和氨基酸之间的区别是什么Acids
  • What is the Difference Between Induction Cooker and Normal Cooker
  • Home
  • Vacancies
  • About
  • Request Article
  • Contact Us

Copyright © 2010-2018Difference Between. All rights reserved.Terms of Useand Privacy Policy:Legal.