Object Oriented Design

Priyanka Saxena
2 min readOct 3, 2020
  • What is object oriented design?
  • What is procedural design?
  • What makes a design good?
  • Why do bad designs break?

What is object oriented design?

In less cryptic terms than definitions, objects are something which have a defined set of associated values (state which only the object controls) and a defined set of actions that these can do (member functions). OO design thinks of softwares in terms of interactions between objects based on the pre-defined set of associated actions. Use of member functions to interact with other objects is termed as message passing, these messages form the foundation of OO design. The values and member functions associated with an object are defined in terms of a class definition, stating the nature of object members.

An example of what you petting your dog would like in OO terms, you are an object of type person who can perform the action of petting a dog (function), this action increases the value of happiness (data) associated with you. The second object is your dog which can be petted by a person (function), this action increases your dog’s happiness (data). Now the petting actions becomes object A (you) performing it’s petting function on object B (your dog) which responds with it’s own being_petted function, the result is increase in happiness values of both objects (state change of objects).

What is procedural design?

Procedural design thinks of softwares in terms of variables which have a data type associated with them, and functions which can operate on these variables. The data type (which can either be language defined or user defined) associated with a variable determines how functions can operate on it. A possible issue with such designs is when a data is passed on to a function, there’s no control over what happens to the data, this makes changes unpredictable and untraceable.

What makes a design good?

Change is eternal, even for software systems. Requirements change over time, badly designed softwares break when changes are to be made requiring a complete remapping of previously designed features to support newer requirements, good design gives enough leeway for future changes that it adapts seamlessly to changing requirements.

Why OO designs break?

OO systems are composed of objects which interact with each other to satisfy requirements. To ensure that these interactions are successful, objects must know some information about the object they wish to interact with (function related). When these functions change, interactions which depend on it break. Good design is about managing these dependencies to be amenable to changes.

Source: Agile Ruby Design

--

--