Leave a comment

Basic Object Oriented(OO) Terms

oops

Some of the basic object-oriented terms:

Class:

A class is a template for an object. A class contains the code which defines how an object will behave and interact either with each other, or with it. Every time you create an object in PHP, you are actually developing the class.

Property:

A property is a container inside the class which can retain some information. Unlike other languages, PHP doesn’t check the type of property variable. A property could be accessible only in class itself, by its subclass, or by everyone. In essence, a property is a variable which is declared inside the class itself, but not inside any function in that class.

Method:

Methods are functions inside a class. Like properties, methods can also be accessible by those three types of users.

Design Patterns:

First invented by the “Gang of Four”, design patterns are just tricks in object oriented programming to solve similar sets of problems with a smarter approach. Using design patterns (DP) can increase the performance of your whole application with minimal code written by developers. Sometimes it is not possible to design optimized solutions without using DP. But unnecessary and unplanned use of DP can also degrade the performance of your application.

Encapsulation:

Encapsulation is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse. The wrapping up of data and methods into a single unit (called class) is known as encapsulation. The benefit of encapsulating is that it performs the task inside without . The benefit of encapsulating is that it performs the task inside without making you worry.

Polymorphism:

Objects could be of any type. A discrete object can have discrete properties and methods which work separately to other objects. However a set of objects could be derived from a parent object and retain some properties of the parent class. This process is called polymorphism. An object could be morphed into several other objects retaining some of its behaviour.

Coupling:

Coupling is the behaviour of how classes are dependent on each other. Loosely coupled architecture is much more reusable than tightly coupled objects.  Coupling is a very important concern for designing better objects.

 Inheritance:

The key process of deriving a new object by extending another object is called inheritance. When you inherit an object from another object, the subclass (which inherits) derives all the properties and methods of the superclass (which is inherited). A subclass can then process each method of superclass anyway (which is called overriding).

Leave a comment