There’s lots of articles out there that try to explain valid Object-Oriented Programming concepts in PHP. While not all of them are good or even technically correct, there’s quite a volume of material that does an excellent job of showing how you can properly architect your code to adhere to commonly accepted best practices.
However, no matter how many articles are published to show you how to do things correctly, I still see horrid code on a daily basis. People trying to use the OOP paradigm in PHP, but producing code that makes it obvious they have not even grasped the most basic of concepts yet, and therefore are not getting any of the benefits of OOP.
So, as the number of “How to do X” articles doesn’t seem to have much positive effect on that evolution, I decided to start a “How NOT to do X” series of articles. I call this series the “OOP-NOOB Series“, which stands for “Object-Oriented Programming – No Object-Oriented Benefit“, and fittingly contains the disguised word “Newb” for “Newbie” as well. It also references the term “NOOP“, which stands for “No Operation” in computer science, a statement or command that just does not do anything at all.
If, for whatever reason, you feel that any of the articles in this series concerns you personally, don’t be offended by its silly title. I’m just trying to be witty here. Everyone starts out as a beginner, just as I did at some point, and there’s no shame in that. I’m just less of a beginner than I was a few years ago, and I want to help other people make faster progress.
Each of the articles will cover one such anti-pattern that I commonly encounter, will discuss why people might use it, what problems it causes, and how to improve upon it. I’m hopeful that this might be of value to people beginning to dabble in OOP, but who only have other people’s shoddy code as an example to refer to.
If you encounter any type of code or anti-pattern which you think I should cover, just let me know in the comments here, and I’ll include it in the series if applicable.
Note: The code examples in this series will all be written in PHP, but the principles discussed should be language-agnostic and universally relevant.
Articles in this series:
This list will grow over time.
- That Which Cannot Be Named
- The Publicity Stunt
- The Rich Heritage (coming soon)
- Static Antics (coming soon)
- Religious Beliefs (coming soon)
- Self-ignition (coming soon)
- The Global Trotter (coming soon)