Tuesday, July 17, 2007

Objects Oriented Concepts

Object
An Object can be a physical entity. An Object may also be intangible, such as a job or class attendance. Each object defines three basic types of information and two types of behavior.
Information
- Its unique Identity
- How to describe itself
- Its current condition, or state.
Behavior
- Wht it can do
- wht can be done to it.
Class
A class is the rules that define the object.

Interface
The Interface is how you communicate to the object and access some of the object's knowledge.

In UML terms, the interface is an opeation, implementation is called the method.

A link is a relationship between two objects.
An association is a relationship between two classes.
A link is an instance of an association.

Associations and links take on three different forms, association, aggregation, and composition.

Association - is a peer-to-peer relationship. One object simply knows about another object. That knowledge is typically stored in the object as a reference. An association is most commonly modeled as a named line between two classes.

Aggregation - Associations can be refined to model a more restrictive type of relationship.

Composition - Aggregation may also be refined to model an even more restrictive relationship called composition.


Defining aggregation
Is a special type of association used to indicate that the participating objects are not just independent objects that know about each other.

To model aggregation on a Class diagram
1. Draw an association (a line) between the class that represents the member or part of the assembly and the class that represents aggregation, the assembly.
2. Draw a hollow diamond on the end of the association that is attached to the aggregate class.

Defining Composition

Composition is used for aggregations in which the life span of the part depends on the life span pf the aggregate object.
The aggregate has control over the creation and destruction of the part.
The member object cannot exist apart from the assembly.

1.Draw this stronger form of aggregation simply by making the aggregation diamond solid (black).

In database applications this type of relationship is reflected in "cascading deletions". When the master record is deleted , then all the related records are deleted. ex Order-Details.


Generalization
Creating a generalization is the process of organizing the features of different types of objects that share the same pupose. ex. Employees of different types Manager, clecks, peons.

A generalization is a description of the features shared by a set of objects.

Super class is a class that contains features that are common to two or more types of objects that share the same purpose.

Sub class is a class that contains some combination of fatures that are unique to a type of objects that is partially defined by a super class.

Abstract class is a class that lacks a complete definition.It do not have methods. Abstract classes must have subclasses that provide mothods have for any unimplemented operations.

Concrete class is a class that has a method for every operation so that it can create objects.

Discriminator is an attribute or rule that describes how you choose the set of subclasses for a superclass.


There are at least five objective criteria we can use to discriminate between objects within the same class
-Attribute type
-Attribute values allowed
-Operation(interface)
-Method(implementation)
-Associations


Defining Polymorphism

Is the ability to dynamically choose the method for an operation at runtime, depending on the type of object responding to the request. A polymorphic operation has a different method in each classs in which it is implemented.

Interface
An interface may only declae operation signatures-the operation details that tell other objects how to invoke the behavior. This typically consits of the name, parametrs, and result.
An interface class is an abstract class with no methods at all.

Cohesion
Cohesion is a measure of hoe well the parts of an object support the same purpose.
High Cohesion means that an object has one well-defined purpose and everything in the object contributes directly to that purpose.

Coupling
Coupling is a measure of the degree of dependency between objects.
Loose coupling means that an object is pretty much free to do its job without a lot of interaction with other objects.

No comments: