by Dinesh Thakur

Object-oriented programming allows you to organize a large project into manageable pieces. In comparison, procedural programming is a set of instructions, step by step, that the computer must follow.

A procedural program can consist of a series of conditions and function calls for logic, but the end result is very linear. There is nothing intrinsically wrong with procedural programming, and for small projects it can be an appropriate practice.

The problem comes when you scale up.

You may find yourself defining arrays with long descriptive keys, or passing large numbers of global variables between scripts, or searching for a nonfatal bug across a dozen scripts with thousands of lines of code with little indication of which component is at fault.

With that in mind, object-oriented programming introduces structure and principles aimed at mitigating procedural scaling and maintainability issues.

A number of features of object- oriented programming include:

Abstraction, which defines data and program structures using a representation of the meaning while hiding the implementation itself--this allows for the use of human-readable terminology to be used as part of the software solution;

Encapsulation, which exposes functionality while restricting access to low-level components and data;

Hierarchy, where attributes and behavior from pre-existing classes are inherited, allowing for incremental development; modularity, where functionality is broken into modules that accomplish one task and contain everything necessary to complete said task--instead of trying to deal with one large problem, a number of smaller sub problems work in conjunction with each other; and polymorphism, which is the ability to interact with classes without having to know what class they are.

By implementing this technique, the compartmentalized components can be maintained and expanded without affecting the overall architecture, which in turn reduces overhead.