Object-Oriented Programming

Posted by Nicolas Marini on November 13, 2019

The basic principle of Object-oriented programming (OOP) is to wrap both logic and data into one unit called an object. The OOP paradigm was a reaction to large scale, complex software systems that became difficult to manage. As applications grew more complex, they also grew more difficult to maintain. Attempting to change one piece of the application could break the rest of the application. Programmers needed a way to section off their data so that they could manipulate it without impacting the rest of the application. OOP was introduced as a way to contain data in objects and avoid complex, and difficult to maintain applications.

Objects may contain data which is represented as attributes, and procedures or logic which are referred to as methods. For example, if an object represented a dog then attributes of the dog object would be name, type of dog, and owner’s name. Methods of the dog object could be walking, barking, and eating. All of this data and logic is encapsulated within one dog object, making the data and logic within the object easier to maintain.

Classes are the object creators, or the blueprints for an object. Classes do not define any data, but they ensure that the objects being created are formated in a specific way.

OOP has four basic concepts that make up the paradigm:

  1. Abstraction, where only the essential data is being presented, and the unessential data is being hidden.
  2. Encapsulation is the process of binding data and logic together, the basic principle of OOP.
  3. Inheritance, which allows for classes to inherit properties of other classes. This creates Super Classes and Sub Classes.
  4. Polymorphism is when you are able to represent data in different forms.

Object-oriented programming originated from the idea of representing data like we experience real life. The first object-oriented language was developed in the 1970’s by Adele Goldberg and Alan Kay at Xerox PARC called SmallTalk. The idea of expressing data as we experience life helps us organize our information in an easily maintainable and familiar format.