I’ve been a self-taught “developer” for 8 years now, and I realized that I still don’t have a very good grasp of OOP. I find myself just floundering around OOP frameworks, trying different things until something works. Probably not the best approach. So I decided to take some time to learn the Basics of OOP. These are my notes…
Procedural vs OOP
The idea behind OOP is to make code that is both easy to understand and maintain. Based on the principal that you should avoid repeating the same code, OOP splits the code up into chunks that can be re-used in multiple parts of an application.
Let’s say you want to create a website, that displays the contacts in a database. With a procedural approach, you might do something like this…
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>Untitled Document</title> <?php //Define the contacts in the header //Normally this data
Continue reading →