OOAD Quick Guide
The Entity Relationship Diagram (ERD) illustrates the logical structure of the databases. We discuss relations in the tradition of entity-relationship (ER) Binary relations ( such as Own and Supervise) have tuples of length two. Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Generally, most relationship sets in a database system are binary.
Data Hiding Typically, a class is designed such that its data attributes can be accessed only by its class methods and insulated from direct outside access.
It should instead be accessed through the methods setValues and getValues.
Message Passing Any application requires a number of objects interacting in a harmonious manner. Objects in a system may communicate with each other using message passing. Suppose a system has two objects: The object obj1 sends a message to object obj2, if obj1 wants obj2 to execute one of its methods.
Message passing enables all interactions between objects. Message passing essentially involves invoking class methods.
Objects in different processes can be involved in message passing. Inheritance Inheritance is the mechanism that permits new classes to be created out of existing classes by extending and refining its capabilities. The subclass can inherit or derive the attributes and methods of the super-class es provided that the super-class allows so. Besides, the subclass may add its own attributes and methods and may modify any of the super-class methods. Humans, cats, dogs, and cows all have the distinct characteristics of mammals.
In addition, each has its own particular characteristics. The following figure depicts the examples of different types of inheritance. Polymorphism Polymorphism is originally a Greek word that means the ability to take multiple forms.
In object-oriented paradigm, polymorphism implies using operations in different ways, depending upon the instance they are operating upon. Polymorphism allows objects with different internal structures to have a common external interface. Polymorphism is particularly effective while implementing inheritance. Example Let us consider two classes, Circle and Square, each with a method findArea. Though the name and purpose of the methods in the classes are same, the internal implementation, i.
When an object of class Circle invokes its findArea method, the operation finds the area of the circle without any conflict with the findArea method of the Square class. Generalization and Specialization Generalization and specialization represent a hierarchy of relationships between classes, where subclasses inherit from super-classes. Generalization In the generalization process, the common characteristics of classes are combined to form a class in a higher level of hierarchy, i.
Specialization Specialization is the reverse process of generalization. Here, the distinguishing features of groups of objects are used to form specialized classes from existing classes.
ER Diagram Representation
It can be said that the subclasses are the specialized versions of the super-class. The following figure shows an example of generalization and specialization. Links and Association Link A link represents a connection through which an object collaborates with other objects. Through a link, one object may invoke the methods or navigate through another object.
A link depicts the relationship between two or more objects. Association Association is a group of links having common structure and common behavior. Association depicts the relationship between objects of one or more classes. A link can be defined as an instance of an association.
Degree of an Association Degree of an association denotes the number of classes involved in a connection. Degree may be unary, binary, or ternary. A unary relationship connects objects of the same class. A binary relationship connects objects of two classes. A ternary relationship connects objects of three or more classes. Cardinality Ratios of Associations Cardinality of a binary association denotes the number of instances participating in an association.
Aggregation or Composition Aggregation or composition is a relationship among classes by which a class can be made up of any combination of objects of other classes. It allows objects to be placed directly within the body of other classes. An aggregate object is an object that is composed of one or more other objects. Benefits of Object Model Now that we have gone through the core concepts pertaining to object orientation, it would be worthwhile to note the advantages that this model has to offer.
It is easy to maintain. Suppose a module develops an error, then a programmer can fix that particular module, while the other parts of the software are still up and running. It supports relatively hassle-free upgrades. It enables reuse of objects, designs, and functions.
It reduces development risks, particularly in integration of complex systems. In object-oriented software engineering, the software developer identifies and organizes the application in terms of object-oriented concepts, prior to their final representation in any specific programming language or software tools. Phases in Object-Oriented Software Development The major phases of software development using object—oriented methodology are object-oriented analysis, object-oriented design, and object-oriented implementation.
Object—Oriented Analysis In this stage, the problem is formulated, user requirements are identified, and then a model is built based upon real—world objects. The analysis produces models on how the desired system should function and how it must be developed. The models do not include any implementation details so that it can be understood and examined by any non—technical application expert. Object—Oriented Design Object-oriented design includes two main stages, namely, system design and object design.
System Design In this stage, the complete architecture of the desired system is designed. The system is conceived as a set of interacting subsystems that in turn is composed of a hierarchy of interacting objects, grouped into classes.
System design is done according to both the system analysis model and the proposed system architecture. Here, the emphasis is on the objects comprising the system rather than the processes in the system. Object Design In this phase, a design model is developed based on both the models developed in the system analysis phase and the architecture designed in the system design phase.
All the classes required are identified. The associations between the identified classes are established and the hierarchies of classes are identified. Besides, the developer designs the internal details of the classes and their associations, i.
If so, it is appropriate to list it as an attribute. Account objects are in control of their own balances, may alter them within transactions, etc. As another example, in Chapter 6 we will introduce acquaintance relations describing the partners in object interactions.
- A Brief History
- Chapter 4: Object Relationships
In order to describe the behavior of an object in its full generality, independent of the role it may play in a particular target system, we may need to describe a handle to another, as yet unknown, object with which it needs to interact. Binary acquaintance relations serve this need.
However, when one object must be able to determine its partner sthis information may be listed in attribute form. A tuple component of a relation depends functionally on the other components if its value is uniquely determined by the other components.
For example, the following diagram indicates that every person has precisely one mother, and every mother has at least one child. Letting Mo stand for the MotherOf relation: Functions are among the most common kinds of relationships. In functional relationships, at least one direction of the relation associates a single element of one domain to those in the other.
It is convenient and often reasonable to treat them as attributes in functional direction if this appears central to the definition of the class. In this sense as exploited in design -- see Chapter 16 all attributes are functions.
For example, to indicate that each person must have a mother: Similarly, consider the MaintainedBy Account, Branch relation saying that an account must be maintained by one branch, and a branch maintains at least one, possibly more accounts.
This could be described as a functional relationship letting MnBy stand for MaintainedBy: Alternatively, the Account class could have an attribute maintainer with domain Branch.
However, in this case, the attribute normally has a SET domain.
ER Diagram Representation
More generally, any binary relationship may be described with a pair of possibly set-valued functional attributes one per domain when it is meaningful to do so. The extreme case of a functional relationship is a one-to-one function, where the cardinalities of both domains are [1: If one of the domains has cardinality [0: These relationships are most naturally captured as attributes.
When doing so, attribute multiplicity notation may be extended as [1: We summarize these classifications by showing how some standard function categories are described as attributes: A function is one-to-one if each distinct argument maps to a distinct result.
This corresponds to unique. A function is pure if multiple applications with the same argument always give the same result. This corresponds to per-object fixed.
A function is singular or fully many-to-one if it always gives the same answer, regardless of argument. This corresponds to per-class common i.
A function is total if it is defined for each possible argument. Otherwise it is partial.Part 2.1 - Entity relationship model diagram in dbms in hindi introduction and basics syllabus
Partial functions are denoted with [0: Summary Relationship modeling captures generally static connections between objects. Relationships may be distinguished across dimensions including arity, domains, and cardinality. Relationship notation may be embellished with additional features and constraints. Collections, especially sets, may be used to describe groups of objects bearing a common relationship or role.
Further Reading Relationships have been treated extensively in relational database theories and generic entity-relationship modeling; see for instance Ullman [ 6 ] and Maier [ 3 ]. Relationships are widely employed in OOA methods. As discussed in Chapter 3attributes are avoided in Embley et al [ 2 ]. Instead they emphasize the importance of relationships. They use the similar concept of associations instead. Formulate a relation that has tuples of length four, five, John travels from A to B on Sunday.
Can the following information be represented as relationships? The balance of an account ten days ago. Accounts associated with the zip code s of their owners. Employees located in Toronto.
The grandparents of the children living in Springfield. The weather report of January 1. The molecular structure of H2O.
The contents of a library.