Object Oriented Thinking

By | October 22, 2018

What is Object Oriented Thinking?

Object oriented thinking is the thought process in which we will consider everything in terms of object.

Example:

Consider we have a room. That room contains some tables, chairs, computers etc. Also people works inside the room. Now how we can think it an object oriented way as follows-

  • Table is an object
  • Chair is an object
  • Computer is an object
  • Person is an object
  • Room itself is an object

In above example we considered each category of element as an individual object. This is called object oriented thinking.

How to think any concept/problem in object oriented way?

To think any concept/problem in object oriented way we need to follow some steps given below-

  1. Break down the given problem/concept into different parts based on their responsibility
  2. Consider each part as an individual object
  3. Then relate between those objects

Example:

1. Breaking down the given problem into different parts

According to above example we have a big concept room. Then we broke down the concept into different parts according to their responsibilities as follows-

  • Table
  • Chair
  • Computer
  • Person
  • Room

2. All above are object of our concept room.

3. Now we will relate between those objects like-

  • A room can contain one or more chair(s)
  • A room can contain one or more Table(s)
  • A room can contain one or more Computer(s)
  • One or more person(s) can have inside the room
  • One person can seat on a chair
  • One or more computer(s) can placed on a Table
  • One person can use a computer

Why we need to thinking anything in object oriented way?

Object oriented modeling is the major part of object oriented design. During translating any problem/concept to object oriented model, object oriented thinking is single most important thing we need to know because- “It represents the key concepts of our system in terms of objects”

What is object?

Objects are real life entity. Around us everything are object like dog, television, bicycle etc.

Each object has two characteristics-

1. State and

2. Behavior.

1. State/detail

Each object has specific states/details. Those details are relevant to the user of those objects.

Example:

Person object has specific details like- name, age, gender, occupation etc.

Computer object has its specific details like- processor speed, monitor size, resolution, RAM, HDD capacity etc.

Chair object has its own dimension, color etc.

2. Behavior/Responsibility

Each object has their own behavior associated with them

Example

A person may have some behaviors like talking, eating, walking, sitting down, typing etc.

A computer has some behaviors like power on or off, performing operation etc.

In software development we will use object oriented concepts to represent the things/entities. It will help our code to stay organized, flexible and reusable. Let’s see how-

Object keeps our code Organized

Objects keep code organized by putting related details and specific functions in distinct, easy-to-find places.

Example

Details of a person and behavior of a person will put inside Person object. Person object is a single, distinct place. So the person object’s code remains organized.

Object keeps our code Flexible

Objects keep code flexible. So details can be easily changed in a modular way within the object, without affecting the rest of the code.

Example

From a person object we can change person’s details like person’s occupation easily. And this change will not affect the rest of the code.

Object makes our code Reusable

Objects allow our code to be reused. It helps us to reduce the amount of code to recreate. Also helps to keep our program simple.

Example

An employee is also a person. So we can reuse the Person object in terms of Employee.

In object-oriented thinking everything considered an object regardless whether it is animate or inanimate.

Example

A person is an object (Animate)

A chair is an object. (Inanimate)

In object oriented thinking objects are self-aware regardless whether they are animate or inanimate.

Example:

A computer knows its specification.

A chair would know its dimension and location.

Prepare for object oriented design

The good practice for prepare ourselves for object oriented design is-

  • We will think everything around us in terms of object.
  • Try to identify all the attributes those objects might have.

 Exercise of Object Oriented Thinking

A good exercise of object oriented thinking is-

  • Look around the room
  • Identify what objects contains inside the room

Example:

Computer, person, furniture’s

  • Identify the specific details of each individual objects

Example:

A computer system contains some specific details like operating system, display revaluation, processor speed, Virtual Memory etc. all

  • Identify the specific behaviors/responsibilities of each individual objects

Example

On and off the computer system, displaying a screen etc. is the behavior of a computer system

Even the room itself is an object! It may have a seating capacity, a room number etc. are the specific details of the room. The purpose for being the room is uses are the responsibility of the room

Best way to think everything in Object Oriented Way

So the best way to thinking in object oriented way is- think about

  • What objects are around you?
  • What kinds of details/properties they might have?
  • What behaviors/responsibilities it they might have?
17 Total Views 1 Views Today
Md. Mojammel Haque

CSM, CSPO, CSD, CSP-SM, CSP-PO (ScrumAlliance.org)
Certification Profile Link-
https://www.scrumalliance.org/community/profile/mhaque13

Currently working as Lead Team (Application Architecture) at Raven Systems Ltd. Passion for software development especially agile practices such as TDD with in depth knowledge of Object Oriented Programming, SOLID Principles, Gang of Four Design Patterns, Some Enterprise Application Architectural Patterns. Over 8 years of software development experience ASP.NET. Has the ability to understand and transform complex business requirements into software ensuring applications are delivered on time. Also experience in non Microsoft .NET technologies such as Dapper.Net, Git, Structure Map & Angular, Bootstrap, HTML-5, CSS-3 etc.

Category: 1.09-Object Oriented Analysis & Design
Md. Mojammel Haque

About Md. Mojammel Haque

CSM, CSPO, CSD, CSP-SM, CSP-PO (ScrumAlliance.org) Certification Profile Link- https://www.scrumalliance.org/community/profile/mhaque13 Currently working as Lead Team (Application Architecture) at Raven Systems Ltd. Passion for software development especially agile practices such as TDD with in depth knowledge of Object Oriented Programming, SOLID Principles, Gang of Four Design Patterns, Some Enterprise Application Architectural Patterns. Over 8 years of software development experience ASP.NET. Has the ability to understand and transform complex business requirements into software ensuring applications are delivered on time. Also experience in non Microsoft .NET technologies such as Dapper.Net, Git, Structure Map & Angular, Bootstrap, HTML-5, CSS-3 etc.

Leave a Reply

Your email address will not be published. Required fields are marked *