Membership
Main Menu
Forum Boards
Stats
- 13 tutorials
- 68,437 members
- 630,821 forum posts
- 8 blog posts
Tutorials
OO PHP Part 2: Boring OO Principles
Views: 12150
Introduction
How about that catchy title eh? If you are reading this, you must be REALLY dedicated to learning about Object Orientated applications!
This article will try to explain some OO principles to you, as well as some ‘good practice’.
Know what to expect: there will be no funny pictures, no diagrams. There will be some code, but that won’t be very exciting either. This is all pretty dry stuff. Regardless, it is important. This tutorial will include some of the things intentionally left out of part 1, as mentioned in section 1.2 of that tutorial.
Still feel like it? Come on then, time to get your foundations in place!
Index
1 Core OO(P) Principles
1.1 Inheritance
1.2 Polymorphism
1.3 Encapsulation
2 Coupling, Cohesion and Some Related Principles
2.1 A practical example
2.2 Single Responsibility Principle (SRP)
2.3 Don’t Repeat Yourself (DRY)
2.4 Open-Closed Principle (OCP)
3 Defensive Programming
4 Heuristics
4.1 Avoid global data
4.2 All properties should be private
5 In conclusion
