OBJECT ORIENTED PROGRAMMING

Object Oriented Programming languages are defined by the following key words: abstraction, encapsulation, inheritance, and polymorphism. An object is a container of data and functions that affect the data. In an OOP, a "child" object can "extend" another object (making it more specific) by inheriting from a "parent" object. Thus the child gets all the parents data and functionality "for free". The idea of an "interface" is also key to OOPs. An interface is the allowed interactions between the outside world (e.g., other programs) and the object itself.
Objects are at heart very simple. They are a way to represent information about a "real world" idea and they contain ways to manipulate that information. All of this "code" is encapsulated in an object recipe (Class file).

*They contain information about something in the program.

*They provide actions (also called functions or methods) which manipulate that information. By combining all the data and actions that can apply to an "object" into one piece of code, we make our programs easier to write and maintain.

Often an "object" in a computer program tries to model (i.e., approximate) a real world entity. For example a "car" could be modeled in a computer by information about the size, number of doors, engine, color, etc. of a car. Additionally there would be little pieces of assocaited code (called methods) which manipulate the car, for example: start_car() would "simulate" turning the engine on, break() would simulate slowing the car down, etc.

The interface between the car object and the rest of the program (or world) would be the putlic methods which are allowed on the car. For example, turn wheel left, turn wheel right, step on gas. We don't know (nor do we care) how these function work, just so long as the car does know and responds appropriately to each function call.
Posted on by