In the next video, you will learn what a class diagram is and why you need it. Class diagram is a type of Structural Diagram and used for the system design.
In the previous video, you learnt that in the object-oriented world, everything is represented as an object. These objects have different properties attached to them, which are called attributes. These objects also perform some actions, which are called methods.
A class is a blueprint from which different objects of the same type are created. For example, in your Inventory Management System, there can be 100 suppliers. So, there will be 100 supplier objects but only one supplier class. They will have the same attributes, but the values of those attributes will be different. For example, in your Inventory Management System, each supplier will have an attribute called name, but the value of that attribute will be different for different suppliers or supplier objects.
A class diagram is used to show what classes will be present in the system and how they will be related to each other. So, the main constituents of a class diagram are:
In an object oriented programming we identify everything as an object. So in our inventory management system, for example, we have suppliers, we have admin, inventory managers and so on so forth. So each of those actors or the nouns kind of becomes your class. So each of this class could have multiple attributes or what we call as properties and each of this actor could trigger set of functionalities like paying an invoice, viewing an invoice, placing an order and stuff. In this case, each of these actions becomes these methods, methods are actually becomes your actions, the verbs in your requirements becomes your methods and the input to those methods becomes the parameters or the arguments to your methods. So the representation of these classes methods attributes are done using a class diagram. In your inventory management system. There could be multiple suppliers, multiple inventory managers, but we don't really code for everyone. In your diagrams, we show just a single generic representation which is similar to a blueprint for a particular class. And and in addition to these, each of these actors interact with each other to fulfill an activity. So the class diagram also showcases the relationships between different classes within the system.
Object-oriented programming identifies everything as an object.
Actors or nouns become classes, with multiple attributes and functionalities.
Methods are the verbs in the requirements and their input becomes the parameters.
Class diagrams represent classes, methods, and attributes of an inventory management system.
The diagrams show a generic representation of multiple actors in the system.
Different actors interact with each other to fulfill an activity.
Class diagrams showcase relationships between different classes in the system.
A class diagram is also used for college and hospital management systems.
Inventory management system involves suppliers, admins, and inventory managers as actors.
Methods include paying an invoice, viewing an invoice, placing an order, etc.
In this segment, you learned about the class diagram. A class diagram is used to show what classes will be present in the system and how they will be related to each other. A class has attributes and methods which represent the properties and functions of those classes.