OO Concepts   «Prev  Next»
Lesson 6The uses and benefits of object-oriented programming
ObjectiveUses and benefits of object-oriented programming.

OO Programming helps you Manage Complexity

Uses and Benefits of Object-Oriented Programming

Like structured programming in legacy systems, object-oriented programming (OOP) is used to manage the complexity of software systems. However, OOP technology provides several advantages because they are easier to maintain, have more reusable components, and are more scalable. Identifying the source of errors becomes easier because objects are self-contained (encapsulation). The principles of good OOP design contribute to an application's maintainability.

Reusable

Because objects contain both data and functions that act on data, objects can be thought of as self-contained boxes (encapsulation). This feature makes it easy to reuse code in new systems. Messages provide a predefined interface to an object's data and functionality. If you know this interface, you can make use on an object in any context you want. OOP languages like Java make it easy to expand on the functionality of these boxes (polymorphism and inheritance), even if you do not know much about their implementation (again, encapsulation).

Scalable

OO applications are more scalable then their structured programming roots. As an object's interface provides a roadmap for reusing the object in new software, it also provides you with all the information you need to replace the object without affecting other code. This makes it easy to replace old and aging code with faster algorithms and newer technology.

OO Programming

Object-oriented programming was invented to manage simulations of processes. For example, a simulation of a phone network might involve many different customers, calling on a varied set of phone lines at varying and unpredictable times. Classes would model phone company equipment and resources. OOP also works well for applications that are user-interface intensive, especially graphical user interfaces. Classes commonly represent windows, menus, menu items, check boxes, text fields, lists, and much more. The user, rather than being restricted to a fixed set of commands, can generally do anything at anytime.
If there is one thing that distinguishes a problem that is right for object-oriented programming from one that is not, it is flow of control. If the program follows a very linear, step-by step approach, traditional programming can solve it fairly easily.
On the other hand, if the program must continually respond to internal and external events that do not occur at precisely defined points, then the problem is likely a good candidate for an object-oriented solution. There are also a number of additional benefits in using OOP, such as code reuse and team programming, that you'll see in later lessons.
Although most of today's problems are solved with either a structured or an object-oriented solution, other approaches have their advocates.