One of the best reasons to use object oriented programming is to organize your code into logical blocks. This allows you to group functions and variables into an organized unit called an object. This practice is called code encapsulation.

A language construct that facilitates the bundling of data with the methods (or other functions) operating on that data. – Wikipeida

It is perfectly possible to create large scale websites and web applications without using OOP techniques. But the degree of difficulty is higher and it is much harder to maintain that code base because everything is at the same level. Which means that logic errors can crop up throughout the code.

With OOP you can group all of the related variables and functions into one unit so that it is easy to manipulate the information and add functionality later down the road.

Vocabulary of OOP

Its always the best way to learn the common terms for a new subject. The hardest part of anything new for me is the basic terminology that is tossed around, and the secret fear that asking what a term means is going to make me look silly.

  • Class
    • the blueprint for creating an object
  • Object
    • the thing that is created from the class definition
  • Instantiate
    • To create an object from a class
  • Method
    • A function that belongs the Object or Class
  • Property
    • A variable that belongs to the Object or Class
  • Magic Method
    • These are specialized methods that PHP creates for every class. The are called by PHP when the appropriate conditions are met.
  • Object Operator
    • This is the coding syntax that you use to access an Objects properties or methods