Chapter 4. Creating Clean Code with OOP
When applications start growing, representing more complex data structures becomes necessary. Primitive types like integers, strings, or arrays are not enough when you want to associate specific behavior to data. More than half a century ago, computer scientists started using the concept of objects to refer to the encapsulation of properties and functionality that represented an object in real life.
Nowadays, OOP is one of the most used programming paradigms, and you will be glad to know that PHP supports it. Knowing OOP is not just a matter of knowing the syntax of the language, but knowing when and how to use it. But do not worry, after this chapter and a bit of practice, you will become a confident OOP developer.
In this chapter, you will learn about the following:
- Classes and objects
- Visibility, static properties, and methods
- Namespaces
- Autoloading classes
- Inheritance, interfaces, and traits
- Handling exceptions
- Design patterns
- Anonymous functions...