Here, we step back a bit and explore the topic of Object-Oriented Programming as a whole. This part of the series is very brief as it only introduces the subject and then off-loads the details as references to other excellent sources.
If you have been following this series from the start you may have realized that almost every thing I have discussed so far are related to the subject of this part of the series, Object Oriented Programming. Here we are just taking a step back to get a more broad view of the subject.
Object Oriented Programming is a method of writing computer codes that involves the use of 'classes' and 'objects' to represent data and functionality, as well as to organize the codes in a way that make it easy to work with. The two core concepts of OOP are classes and objects.
While the idea of OOP cuts across many modern programming languages, our area of interest here is as it relates to PHP and Drupal.
I have no intention to teaching OOP here, instead I will make references to external sources that does that very well.
Please you may wish to explore the following excellent resources to learn the basics of Object Oriented PHP.
Some of the basics of OOP that you will learn from these resources includes:
- Understanding Objects and Classes
- Knowing the differences between Objects and Classes
- Creating classes and objects
- Class properties and class methods
- Constructors and Destructors
- Object Inheritance
- Visibility of Properties and Methods: The meaning of private, public, protected
In addition to the basic knowledge of Object Oriented PHP outlined above, the other topics that are of interest to mastering Drupal 8 development includes advanced subjects like design patterns, factory method, dependency injection, late static binding, etc. Some of these we have already discussed in previous parts of this series. Others we will be looking into in subsequent posts.
In versions of Drupal prior to Drupal 8, you could get away with developing mostly with procedural PHP, but not so with Drupal 8. Drupal 8 is heavily dependent on Object Oriented programming. So in order to remain up to date as a Drupal developer and not get left behind as a result of the forwards movement of Drupal, a mastery of these foundational subjects is a must.
The earlier you start to make an investment of time and efforts into mastering these topics the sooner you can still call yourself a Drupal developer and be taken seriously.
Next we will tackle the last subject of this sub-section of this series: Modern PHP Programming: Late Static Binding.