Sunday, November 29, 2015

The Object Oriented Concept

Object Oriented System Design is another concept in system design. We are talking about system analysis and design here so it is connected with programing in a later part. OOP is the latest trend in programing and when we design a system it is important to understand about object oriented concept. There are six basic things we need to understand clearly in order to proceed with the object oriented concept.

  1. Objects
  2. Classes
  3. Messages
  4. Encapsulation
  5. Inheritance
  6. Polymorphism


Now let’s discuss about these things one by one;

Objects (attributes / behaviors / methods)

An object is a representation of real world thing. For an example “A Car” is an object. Objects have attributes and behaviors. Behaviors are initiated by methods in programing language.  Attributes are unique characteristics which identify the object from other obejcts. In a car attributes are model, make, chassis number, engine number, vehicle number, etc. Also an object can have behaviors. Behaviors of a car can described as engine start, engine off, lights on, lights off, running, stooped, etc.

Classes (group of objects)

Class is a group of similar objects that shares same attributes and behaviors. In our car example we can define a class “Vehicle” with attributes of vehicle registration number, engine number, chassis number, make, model, etc. because every vehicle has these common attributes and behaviors such as engine start, engine stopped, lights on, lights off, etc.
In programing objects are created from classes. For an example “Car” object can be created from “vehicle” class.

Messages

Messages are instructions or information sent between objects. For an example a message “Start Engine” can be sent by an object called “Driver” in the class “Operators” to the object “Car” in “Vehicle” class. These instructions on how, when and where to send messages need to be define in programing.

Encapsulation

Encapsulation is the ability to hide internal working, data and behavior of an object. In OOP (Object Oriented Programing) objects are standalone things that they communicated with other objects using methods (getters and setters). For an example when we called a method in Car object named start_engine(), we do not worry about its internal functionality – we all care about is it’s status changes from stopped to start of the engine.

Inheritance

Inheritance is the mechanism of implementing classes with similar attributes and behaviors. There are two kinds of inheritance implementations called generalization and specialization. Also here we need to understand the concept of super class and sub class. Generalization is the process of creating super classes – super class is a class with more common characteristics. For an example generalization of “Parrot, Crow, and Chicken” is the creating of super class called “Birds”. Parrot is a sub class of birds with all its characteristics and having at least one attribute that is unique to parrot and it is called specialization of the class.

Aggregation

Aggregation is the process of building objects using other objects in similar classes. For an example the object “Car” is built using “Engine and Body” objects. Simply you need to understand that aggregation is composing of similar objects of different classes to create another object.

Dependency

This is the relationship between two objects / classes. If changes of one object affects the other is called there is a dependency relationship between two objects.  If changes in object A affect to the behavior of object B then the B is called the dependent object.

Association

Association described the relationship between two objects.

Polymorphism


Polymorphism is the way that the object orientation allows methods of same name to have predictable and meaningful results in related instances performing the operations differently to achieve similar results. For an example Play_Game() method will execute playing of different games such as play_cricket(), play_tennis(), play_soccer(), etc.

No comments:

Post a Comment

Important Notice!

Dear students and friends. When you commenting please do not mention your email address. Because your email address will be publicly available and visible to all. Soon, it will start sending tons of spams because email crawlers can extract your email from feed text.

To contact me directly regarding any inquiry you may send an email to info@bcslectures.website and I will reply accordingly.