Submitted by: M.Shahid ROLL NO: MIT 19 -245 Assignment: 3 What is an object Model? The object model visualizes the elements in a software application in terms of objects. In this chapter, we will look into the basic concepts and terminologies of object–oriented systems. An object is a real-world element in an object–oriented environment that may have a physical or a conceptual existence. Each object has Identity that distinguishes it from other objects in the system. State that determines the characteristic properties of an object as well as the values of the properties that the object holds. Behavior that represents externally visible activities performed by an object in terms of changes in its state. Objects can be modelled according to the needs of the application. An object may have a physical existence, like a customer, a car, etc.; or an intangible conceptual existence, like a project, a process, etc. QuestioǏ#02 Write a comprehensive note on Cardinality regarding Object Model. ? In data modeling, cardinality refers to the relationship of data in one database table with respect to another table. Two tables can be related as “one-to-one”, "one-to-many", or "many-to-many": 1:1. One row in table A relates to one row in table B. Using an entity-relationship (ER) model, 1:1 means that one occurrence of an entity relates to only one occurrence in another entity. 1:Many. One row in table A relates to many rows in table B. In ER modelling, 1:Many means that one occurrence in an entity relates to many occurrences in another entity. Many:Many (M:N). Many rows in table A relate to many rows in table B. In ER terms, many occurrences in one entity relate to many occurrences in another entity. For example, a student (table A) may sign up for many classes (table B), and a class may have several students in it. Many-to-many relationships normally require a cross-reference table, AB with two one-to-many relationships A:AB and B:AB. A relationship may also be optional. Optional means that a row in one table doesn't have to relate to any row in the other table. For example, not all associates are provided business credit cards. To put it a different way, an associate may have 0 (zero) or more credit cards issued by the company. Diagraǎ QuestioǏ#03 What is the difference b/w Static behavior and dynamic behavior /structure? Static vs Dynamic View Static modeling is used to specify the structure of the objects, classes or components that exist in the problem domain. These are expressed using class, object or component. While dynamic modeling refers to representing the object interactions during runtime. Dynamiǀ behaviour anǁ stateǏ: A class model, taken alone, is a description of the static structure of a system; this means that it shows the system in a way that is independent of time. In the library system discussed earlier, the individual books may come and go, and individual members for that matter, but the classes “Book” and “Member” persist. To say that a lending library has books and members is true, independent of time. Of course, in reality the system will change over time. This change is reflected in the values of the attributes of objects, and the numbers of instances of each class. The library may begin with 1000 books, and ten years later it may have 10 000 books; but there will never be a time when the class “Book” is not a valid one for the library. Similarly, the addresses and even the names of the members will change. This will be reflected in the values of the attributes of the instances of class “Member”. The sum total of information carried by the attributes of an object is called its state. If we know the state of an object, then we know everything there is to know about it. This last statement is true by definition. If in describing an object the designer finds that its attributes are not sufficient to specify its state completely, then they have overlooked some attributes. If the state of an object is given by the values of all its attributes, then the state of the system is given by the states of all its objects. In other words, the values of all the attributes of all the objects completely specify the state of the system at any given time. If state is so important, why can it not be represented in a class model? The reason is that there are far better ways to represent changes in state. The UML provides state transition modelling for this purpose. In a full design it may be necessary to provide state transition diagrams for some or all classes, to describe their state changes in detail. The pattern of state change over time is called the dynamic behaviour of a system, and modelling this is called dynamic modelling. As well as state transition modelling, the UML provides object interaction diagrams, activity diagrams, sequence diagrams and communication diagrams for dynamic modelling. One can, of course, describe the dynamic behaviour of classes in plain language as well, and one probably should. Only objects have state; classes do not have a state. This is because a class specifies properties that are true of all objects of that class. However, a class can have a default state. This is the set of attribute values that an object of that class will have by default, that is, if not provided with any other information.