Overview of the Course

Learn about the principle of modularity and how this principle saves time.

Concepts of OOP The purpose of this course is to unlock the secrets of object-oriented PHP to help you improve your programming skills.

Principle of modularity

At the heart of all these secrets is the principle of modularity. This principle is what makes object-oriented PHP possible.

The principle of modularity essentially means to break down the larger, overarching code of an application into smaller and easier-to-use parts.

This makes the code more flexible, and improves our ability to change, update, debug, and develop. It also saves a huge amount of time.

How does modularity save time?

The modularity principle saves time in the following ways:

  • With modularity, programmers can change the code of an application simply by working on the specific, relevant sections instead of checking the entire codebase. Adding, removing, or changing functions is therefore quicker.
  • Modularity allows the work of other programmers to be easily incorporated into a project. This means developers can use tried and tested functions written elsewhere and put them into the code without heavy adaptation.
  • Finally, modularity saves time because it allows multiple people to work on a single project simultaneously. Without it, a slight change to the code from one programmer can have repercussions across many workstations, but modularity overcomes this problem.

Blog example

Take a blog as an example. This is a simple application, but it might still have several classes, including a user class, a database class, a posts class, and a mail class. With modularity and object-oriented PHP, each of these classes has its own section in the code base. Each section can be handled independently of the others, allowing developers to add, remove, or replace parts of the code without affecting everything else.

Say we wanted to replace the mail class of our blog example with another library. With modularity, this can be done, even though the user class depends on the mail class to send emails to blog users. Each of the classes is treated separately.

The benefit of more efficiently working with multiple programmers on a single project should not be understated either. This again saves time and prevents headaches, errors, and arguments among programmers. In particular, there is no risk of name collisions. This is where more than one function or variable in the program has the same name. Modularity means that each of these functions or variables resides in an independent module, so name collisions are not an issue.

It also covers the intimidating concept of dependency injection in a practical and easy-to-understand way. Once we’re finished with the dependency injection, object-oriented programming (also known as OOP) becomes even faster.

What does the course cover?

This course covers the fundamentals of programming in object-oriented PHP.

Basics of OOP

The course 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 to code in a class can be approached from within the class and, crucially, from outside it. For example, OOP can be used to do the following:

  • Create classes.
  • Add properties to a class.
  • Create objects from a class.
  • Set an object’s properties.
  • Add methods to a class.

Concepts of OOP

The course also shows developers how to write streaming code that is easier to digest and understand because it more closely resembles human language.

In addition, the course covers many skills, hints, tips, and tricks to make object-oriented programming more efficient. For example, we’ll learn how we can

  • Protect code inside classes from the outside.

  • Use inheritance to reduce repetition and save time.

  • Abstract classes and methods so that code is organized better.

  • Construct applications using interfaces and polymorphism.

  • Integrate code from other sources and libraries with the help of namespaces.