Things of Note

PHP will not fail if variables are uninitialized, it will assume that they are null and issue a notice to tell you about it.

Declarations are powerful, and it pays to maximize their power. Classes can be declared as abstract when they are not intended to be used on their own to create objects but used only to build subclasses. Methods can be declared as public, private, or protected and the most suitable options should always be chosen. Variables inside an object should be declared wherever possible, and like methods, their visibility should be stated. In line with the previous comments, it is a good idea to initialize every declared variable in a class with a reasonably safe value.

Efficiency is achieved by good design and avoiding writing unnecessary code. The fastest code is the code that has been factored out of the design and no longer exists!

Bearing this in mind, what I advocate is an approach to object-orientation where the classes and objects come naturally from the problem being solved. Arbitrary rules for class building are best avoided in favour of letting the problem show through the code. And although patterns can be immensely valuable, they should also be treated with some caution.

Bibliographical Information

PHP5 CMS Framework Development:

  • By: Martin Brampton
  • Publisher: Packt Publishing
  • Pub. Date: June 06, 2008
  • ISBN 978-1-84719-357-5

These are notes I made after reading this book. See more book notes

Just to let you know, this page was last updated Monday, Mar 18 24