Book Review: The essentials of Object Oriented PHP
PHP started out as a disorganized scripting language but right before our very eyes it is transforming into a full-fledged programming language that uses object-oriented programming (quite like Python, Ruby, and Java). Although the use of object-oriented programming is still a secondary and optional part of PHP, we are witnessing a surging demand for PHP programmers who have additionally mastered the specific technicalities of object-oriented PHP. This swiftly growing and unquenched demand makes such PHP programmers, who can also write object-oriented code, a hot commodity in the job market among organizations that have a requirement for sophisticated web applications.
But that's only part of the big picture, especially when we consider the following facts:
- The procedural style of programming is not efficient.
- All of the PHP frameworks (such as laravel, Zend, and codeIgniter) are based on object-oriented code.
- Drupal and other content management systems are object-oriented at their core.
- More and more parts of WordPress are becoming object-oriented as time goes on.
The main point is the first one, as all the other reasons for the increasing use of object-oriented programming in PHP stem from it - and that's because the code that is written in object-oriented style is more effective. Though it is possible to write a functioning program by using only procedural code, it is hard to escape the chaos of spaghetti code, in which variables and functions are in a jumble - along with CSS, HTML, and JavaScript - resulting in a code which is ineffective by nature. Object-oriented programming is more organized because the code is divided into distinct units, each having a clear goal. This means that you can more easily find what you want in the code. Also, it is easier to add, replace, or remove portions of the code from only one place. Finally, object-oriented code provides an opportunity for programmers to integrate code libraries from different sources.
So, back to the original question: why bother learning object-oriented PHP? The short answer is that object-oriented PHP is a more efficient style of programming.
How to learn object-oriented PHP?
After we have established the fact that we need to learn object-oriented PHP in order to become better web developers, another question arises as to how we can learn it in the most effective way?
Object-oriented programming requires a special understanding which can be acquired by learning its fundamentals. And a better way to learn the fundamentals is by reading "The essentials of Object Oriented PHP", an eBook I highly recommend because it explains, in detail, the principles of object-oriented programming in PHP.
Among the topics that this eBook covers are:
- Creating classes.
- Adding properties and methods to classes.
- Creating objects from classes.
The eBook explains how to write code which is simple to understand. This is possible because the code it teaches you to write is similar to human language. In addition, it explains the most basic of skills, and also adds tricks and tips to make the object-oriented PHP coding process even more efficient. Among other things that the eBook covers are as follows:
- How to encapsulate code within classes.
- How to make the code more efficient by using inheritance.
- How to use abstract classes and methods for improved code organization.
- How to build better applications by using interfaces and polymorphism.
- How to integrate code from various sources by using namespaces.
The eBook also explains the intimidating subject of dependency injection in a practical and easy to understand way. When you are done reading the chapter on dependency injection, you will become a better programmer.
Who is this eBook for?
First and foremost, the eBook is written for procedural PHP developers who want to improve their skills and take their programming to a higher level. Other people who would benefit from reading the eBook are programmers who have a background in object-oriented languages such as C ++ or Java.
How to benefit the most from reading this eBook?
As we explained, the eBook is intended for programmers who want to further their knowledge of object-oriented PHP. Accordingly, the eBook offers practice exercises also, and not just theoretical learning.
Each principle, idea, or skill is explained in a simple and precise way, with each step resting on the foundations that were laid in the previous steps. After each time the readers are given a theoretical explanation, they are invited to practice what they have learned by writing code that is based on what was taught. In this way, the learners can effectively assimilate the knowledge imparted and achieve full understanding.
It is better not to read the eBook in a passive way since it is designed to provide knowledge and skills in object-oriented PHP by encouraging and developing thinking. Therefore, in order to get the most from the eBook, keep your mind open and be prepared to practice everything that you learn. By doing so, you will achieve a well-rounded understanding of object-oriented PHP, as well as gain the confidence to apply your obtained knowledge to your work and your daily life.
To the eBook: The essentials of Object Oriented PHP