Object-oriented programming (OOP) has become the most widely used approach to software development since it’s introduction. Because of the amount of time it’s been around, there is a LOT (and I mean a LOT) of materials available. Rather then re-hash all of the many concepts, I wanted to create a breakdown type of format. In other words, maybe you wouldn’t be able to read this then walk in to a company to re-architect their HR or Payroll system. But at the same time, it’s a way of giving you a brief refresher of some of the more popular concepts, catchphrases and buzzwords.

What Is an Object in Programming?

Object-oriented programming, or OOP, is an approach to problem solving where all computations are carried out using objects. An object is a component of a program that knows how to perform certain actions and how to interact with other elements of the program. Objects are the basic units of object-oriented programming. A popular example of an object would be a Person. Logically, you would expect a Person to have a name. This would be considered a property of the person. You could also expect a person to be able to do something, such as walking or driving – in other words, an action. This would be considered a method of the person.

Basic Principles

  • encapsulate the property that changes.
  • each class should only have one reason to change.
  • classes try to define a behavior or specific functionality.

Basic Object Oriented Terms

  • Abstraction is the act by which you separate and generalize an idea from specific instances of that idea in action.
  • Encapsulation is the creation of an Interface to enclose properties and/or state within a Class with the goal to prevent unauthorized property or state changes.
  • Polymorphism is the ability to process Classes or Objects differently depending upon their data type or Class.
  • Inheritance is the reliance of one Class upon another Class. It is a pillar of Code Reuse, as the relationships between the Objects and Classes creates a hierarchy of your system.
  • Multiple Inheritance is the reliance of one Object or Class upon multiple Objects, Classes or Interfaces.

More Options then Inheritance

  • Delegation is when you hand over the responsibility for a specific task (or function) to another Object.
  • Composition is when you use behavior from a family of other classes that changes during runtime.
  • Aggregation is when one Class is used as part of another Class, but both Classes can exist independently.

Object Oriented Mantras / Principles

  • DRY - Don’t Repeat Yourself - is the aim of avoiding code duplication by using abstraction of common tasks to a single implementation.
  • SOLID Principles: ** Single Responsibility - every Object in your system should have one and only one responsibility. ** Open-Closed - every Class should be open for extension by other Classes, but closed for modification. ** Liskov Substitution Principle (LSP) - ** Interface Segregation Principle (ISP) -
  • Dependency Inversion Principle (DIP) ** High level modules should not depend on low level modules. ** Abstractions should not depend on details, but details should depend on abstractions.