You are on page 1of 12

Unit I (Referred Book: (Lalit arora: oops using java)

Object Modeling: Objects and classes, links and association, generalization, Specilization
inheritance,aggregation, abstract class, meta data, candidate keys, constraints.
Dynamic Modeling: Events and states, operations, nested state diagrams and concurrency,
advanced dynamic modeling concepts, a sample dynamic model.

1- Object Modeling -Object and class:


The object modeling is based on these two concept – object and class. The object corresponds
to real world entities and classes are the collection of the similar objects or entites.

Object:-
The object in a class , contains some data values , called attributes. Such as name, age and
weight are the attributes of person objects. Each attributes has a value for each object
instance.
For example: attributes age has value 34 in object Ram. . it means Ram is 34 years old. The
different object instance may have the same or different values for a given attributes.

“An object is a concept , abstraction or a real world thing with strict


boundaries and meaning for an application .”

Class:-
A class describes a group of objects with some properties (data structure or attributes),
common behavior (methods or operation) common relationship to other objects, and common
semantics . In fact , objects are instances of the type class. Each object is associated with the
data of type class with which they are created.

A class thus a collection of objects of similar type.


Foe example , mango , apple and orange are member of the class fruit.

“A class describes a group of objects with common attributes operations


and semantics.”
links and association
links and association are the means for building the relationship among the objects and
classes. Links and association , both are quite same feature but links establishing
among the objects (instance) and association establishing among the class.
Finally link is related to objects whereas association is related to classes

Links: In object modeling links provides a relationship between the objects. These
objects or instance may be same or different in data structure and behavior. Therefore a
link is a physical or conceptual connection between instance (or objects).
For example: Ram works for HCL company. In this example “works for” is the link
between “Ram” and “HCL company”. Links are relationship among the objects(instance)

Types of links:

1.One to one links:


2.one to many and many to one links
3. many to many

Associations: The object modeling describes as a group of links with common


structure and common semantics. All the links among the object are the forms of
association among the same classes.The association is the relationship among classes.
1. Association
2. Association with inverse direction
3. Association between student and university

Degree of association:
1. Unary association(degree of one)
2. Binary Association (degree of two)
3. Ternary Association (degree of three)
4. Quaternary Association (degree of four)
5. Higher order association (more than four)

1. Unary Association: the association can be defined on a single class. This


type of association called unary (or singular) association.
2. Binary Association: The binary association contain the degree of two
classes. The association uses two class.
3. Ternary Association: The association which contain the degree of three
classes is called ternary association. The ternary Association is an atomic unit
and cannot be subdivided into binary association without losing information.
4. Quaternary Association: The Quaternary Association exists when there are
four classes associated.
5. Higher degree Association: The higher order association are more
complicated to draw , implement because when more than four class need to
be associated then it seems a hard task.
Generalization
Generalization is a process of defining a super class from a given set of
semantically related entity set.
Generalization is the process of extracting shared characteristics from two or more
classes, and combining them into a generalized super class. Shared characteristics
can be attributes, associations, or methods.
Specialization
Specialization is a process of defining specialized subclass from a given
entity set.
specialization means creating new subclasses from an existing class. If it turns out
that certain attributes, associations, or methods only apply to some of the objects of
the class, a subclass can be created. The most inclusive class in a
generalization/specialization is called the superclass and is generally located at the
top of the diagram. The more specific classes are called subclasses and are
generally placed below the superclass.
Inheritance
Inheritance is a relationship among classes. Wherein one class shares the
structure or behavior defined in one or more other classes so inheritance is a
mechanism of sharing attributes and operations among classes.
According to the object , modeling inheritance defines the relationship in two
ways:
1. Single inheritance
2. Multiple inheritance
1. Single inheritance: In this section, subclasses inherits the features of
a single superclass. Each derived class contain only a single base
class, and base class may be derived by only a single class, and so on.

Bird

Flying Bird Non –Flying Bird

2. Multiple inheritance: it allows a class to have more than one


superclass and to inherit features from all parents or base class.
A1 A2

B1 B2 B3

aggregation
the aggregation is an extension of association mean aggregation is a strong form
of association in which an aggregate object is made of components.
Components are part of the aggregate. Thus aggregation is the “part-whole” or
“a-part-of” relationship.
For ex: keyboard is a part of computer or we can say key are parts of keyboard.
abstract class
An abstract class is a class that is declared abstract—it may or may not include
abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.

An abstract method is a method that is declared without an implementation (without


braces, and followed by a semicolon), like this:
abstract void moveTo(double deltaX, double deltaY);

If a class includes abstract methods, the class itself must be declared abstract, as in:
public abstract class GraphicObject {
// declare fields
// declare non-abstract methods
abstract void draw();
}

When an abstract class is subclassed, the subclass usually provides implementations


for all of the abstract methods in its parent class. However, if it does not, the subclass
must also be declared abstract.

An Abstract Class Example

In an object-oriented drawing application, you can draw circles, rectangles, lines,


Bezier curves, and many other graphic objects. These objects all have certain states
(for example: position, orientation, line color, fill color) and behaviors (for example:
moveTo, rotate, resize, draw) in common. Some of these states and behaviors are the
same for all graphic objects—for example: position, fill color, and moveTo. Others
require different implementations—for example, resize or draw. All GraphicObjects
must know how to draw or resize themselves; they just differ in how they do it. This is
a perfect situation for an abstract superclass. You can take advantage of the
similarities and declare all the graphic objects to inherit from the same abstract parent
object—for example, GraphicObject, as shown in the following figure.

Classes Rectangle, Line, Bezier, and Circle inherit from


GraphicObject

First, you declare an abstract class, GraphicObject, to provide member variables and
methods that are wholly shared by all subclasses, such as the current position and
the moveTo method. GraphicObject also declares abstract methods for methods, such
as draw or resize, that need to be implemented by all subclasses but must be
implemented in different ways. The GraphicObject class can look something like this:
abstract class GraphicObject {
int x, y;
...
void moveTo(int newX, int newY) {
...
}
abstract void draw();
abstract void resize();
}

Each non-abstract subclass of GraphicObject, such as Circle and Rectangle, must


provide implementations for the draw and resize methods:
class Circle extends GraphicObject {
void draw() {
...
}
void resize() {
...
}
}
class Rectangle extends GraphicObject {
void draw() {
...
}
void resize() {
...
}
}
Meta data
Meta data is data that is used to describe other data definition are sometimes
referred to as metadata.
For ex: definition of scheme, definition of a class are metadata.
 Meta data is a data (information) about data, term which describe other
data.
 The term metadata refers to "data about data". The term is ambiguous, as it is
used for two fundamentally different concepts (types).Structural metadata is
about the design and specification of data structures and is more properly called
"data about the containers of data"; descriptive metadata, on the other hand, is
about individual instances of application data, the data content. In this case, a
useful description would be "data about data content" or "content about content"
thus metacontent. Descriptive, Guide and the National Information Standards
Organization concept of administrative metadata are all subtypes of meta content.
 Metadata (metacontent) are traditionally found in the card catalogs of libraries. As
information has become increasingly digital, metadata are also used to describe
digital data using metadata standards specific to a particular discipline. By
describing the contentsand context of data files, the quality of the original
data/files is greatly increased. For example, a webpage may include metadata
specifying what language it is written in, what tools were used to create it, and
where to go for more on the subject, allowing browsers to automatically improve
the experience of users.

Pattern: A pattern is a form , template or model which can be used to make or


generate things or parts of a thing , especially if the things that are generated have
enough in common for the underlying pattern to be inferred or discerned , in which case
the things are said to exhibit the pattern.

Car Model Car

Model name Serial No


Year Color
Base price options

manufacture owner

Company person
Candidate keys
Candidate key is a term commonly used within the data base community,
However , candidate key is a really not a database concept. Candidates key is a
logical concept.
“Candidate key is a minimal set of attributes that uniquely identifies an
object.”

Constraints
Constraint defines some functional relationship between entities of an object. The
term entity includes objects , classes , attributes , links and association., It mean
constraints can be implemented on the objects, classes , attributes , links as well
as on association too.

1. Candidate key:[Person , company] Many to many association:It requires


both related objects to uniquely identify each link.
2. Candidate Key (person) one to many association:It has a single
candidate key, which will be object on the many end.
3. Candidate key (country) (city) optional to one associations: It has two
candidate keys , which will be either of the objects.

1. Peroson

Own stock

Compay

2. person

Works for

company

3 Country
Has Capital

City

2-Dynamic Modeling: Events and states


A dynamic model represents the behaviour of an object
over time. It is used where the object's behaviour is best
described as a set of states that occur in a defined
sequence. The components of the dynamic model are:
States. The purchase order (PO) is modeled as
passing through a set of states. The operations that
can be performed on the PO are dependent on the
state it is in. For example, information cannot be
entered after it has reached the approved state.
State transitions. When purchase order data entry
has been completed it transitions from the entering
PO state to the pending approval state. State
transitions are modeled as being instantaneous.
Events. Events trigger state transitions. For
example, the order mailed event triggers a state
transition from theapproved to the placed state.
Actions. Actions occur on state transitions. For
example, on a goods received event the action
of notify purchaseris performed. Actions are
modeled as instantaneous occurrences (contrast with
activities).
Activities. An activity is performed while an object
is in a specific state. For example, while in
the entering PO state data is entered into the PO.
Activities are modeled as occurring over a period of
time (contrast with actions).

Operations

 Self Prepared
Nested state diagrams
 Self Prepared

Concurrency
 Self Prepared

Advanced dynamic modeling concepts


 Self Prepared

A sample dynamic model

You might also like