But this does not tell the full story. Consider the following facts :
- Procedural programming is inefficient
- PHP frameworks rely on object oriented PHP
- Drupal and other CMS systems are now object oriented
- There are more and more parts of WordPress becoming object oriented
So, back to the original question, why bother learning object oriented PHP?
The answer is:
- It is increasingly common
- Developers with this skill earn more
- The code they write is better
Programming in object oriented PHP requires a different way of thinking. That is why it is important to get an understanding of the fundamentals.
What does the book cover?
This book covers the fundamentals of programming in object oriented PHP. This starts with the basics of writing in an object oriented style. That style applies to everything including classes, objects, methods and properties. It also covers how code in a class can be approached from within the class and, crucially, from outside it.
- Creating classes
- Adding properties to a class
- Creating objects from a class
- Setting an object's properties
- Adding methods to a class
The book also shows developers how to write streaming code that is easier to digest and understand because it more closely resembles human language. Plus the book covers a number of other skills, hints, tips and tricks to make object oriented programming more efficient. This includes:
- Protecting code inside classes from the outside
- Object inheritance and how it reduces repetition, therefore saving time
- Abstracting classes and methods so that code is organized better
- Other code organizing tips
- Constructing applications using interfaces and polymorphism
- Integrating code from other sources and libraries with the help of namespaces
The book also covers the intimidating concept of dependency injection in a practical and easy-to-understand way. Once finished with the dependency injection chapter, object oriented programming becomes even faster.
Who is this book for?
Obviously, this book is for procedural PHP developers who want to improve their skills and take their programming development to a new level. It is also for programmers who have a very basic understanding of object oriented PHP, but who want to learn it properly and get more practice.
Others who will benefit are those programmers who have a background in other objected oriented languages like C++ and Java.
So, in summary, the book is for existing programmers who want to learn object oriented PHP as a new skill.
Getting the most from this book
As already established, this book is designed for existing programmers who want to expand their skill set with object oriented PHP. As a result it is written in a learn-then-practice form.
Every principle, idea or process is described in a simple and concise way. It is easy to read as there is no superfluous text. The flow is also structured so that the reader develops hooks to hang additional knowledge on as their understanding grows and develops.
The material is accompanied by relevant and elucidating code examples for improved understanding.
Once the foundations are laid, the learner gets a plethora of opportunities to practice and bring the material to life. In the practice opportunities, the learner is guided through the process of writing code examples that are based on what he has just learned. This is where proper understanding develops as the learner repeatedly gets a chance to practice what he has just learned.
It is not a passive learning tool. This book is designed to give developers knowledge and skills in object oriented PHP quickly. That is achieved through active learning where programmers think for themselves while reading the explanations and examples and practicing the material.
So, to get the most from this book, approach it with an open mind and be ready to get involved. By doing this you will get a good understanding of object oriented PHP with sufficient knowledge and confidence to apply it practically in your work.