|All reviews||Object-Oriented Programming with PHP5||Latest reviews||Best sellers ranking|
Object-Oriented Programming with PHP5
December 30, 2007
Week: 228 All time: 104
ryanpartington.comSince the release of PHP4, support for OOP (Object Oriented Programming) has been vastly improved.
For those not familiar with (OOP) here is a general overview. OOP is a way of structuring your code. It differs from procedural programming as every function and variable is grouped in classes of objects.
Object classes perform specific tasks within a module. This allows modifications to be made much easier without disrupting the flow of existing code.
Another benefit is rapid application development, as code duplication is reduced by including common functions already written by the developer or a third party.
PHP 3 was the first version to really offer OOP support, but the implementation was poor in comparison to pure OOP languages, such as Ruby or Java. PHP 5 has dealt with many of prior versions limitations and improved the language overall object oriented capabilities.
"Object Oriented Programming with PHP5" is a book that helps understanding many of the core OOP features within PHP, whilst looking at the Model-View-Controller (MVC) design pattern and unit testing.
The author Hasin Hayder is a Zend PHP Certified Engineer and has 5 years experience working with PHP. This is the third book which he has written and published through Packt Publishing. Previous books have all contained an element of PHP and in his latest edition, it is easy to forget he is only been working with PHP for 5 years.
On the book cover it states the book is being written for beginners to intermediate users. Although I have two years experience, I consider myself a beginner. My prior development has been using a procedural approach and was hoping for a better understanding of OOP which I could use in the future.
Chapter 1 looked like an ideal introduction, "OOP vs Procedural Programming". I found it difficult to understand as there were no clear indications of the differences. Now that I have finished reading the book and re-read the chapter, I have a better understanding of what Hasin is trying to say, albeit not very well.
For an introductory chapter too much is expected from the reader. Unfamiliar terms are used which set a precedence of complication throughout the book, which is not a fair reflection on how the book progresses.
Chapter 2 "Kick starting OOP" does a great deal more for the reader by breaking down an object into its individual components. The way an object is designed and interacts can be difficult to understand at first.
Hasin does a good job explaining the concept allowing a foundation to be set on which the rest of the book is built. The example is clear and concise as one would hope for such an important chapter.
Chapter 3 "More OOP" was like reading php.net site page by page. We are shown many features but none of the added value one may expect to find in a book.
Chapter 4 "Design Patterns" is the beginning of a theme which continues throughout the book, packing pages with code. Code in a programming book is expected, but there must be a balance between examples and descriptions.
Design patterns are key to efficient application development. We are introduced to many common approaches. Unfortunately, I feel much of the valuable information will be lost, as readers quickly turn pages trying to escape the aggregation of code which accompanies each pattern.
Chapter 5 "Reflection and Unit Testing", again too much code used but the e-mail validation example and explanation about test driven development is very good.
There is a lot to learn from this chapter. It was written to help those that are new to these techniques to understand the core principals. It ends by including 10 pages from "PHPUnit Pocket Guide" book. It was pretty useless, as the author states himself the function names are self explanatory.
Chapter 6 through 9 continue very much of the same, a lot of code with basic descriptions. Chapter 7 "Database in an OOP Way" is important. It may have been better if it was introduced earlier in the book.
If you are coding in PHP one of the first things you learn, is how to interact with a database. We get an overview of the database abstraction layers which are used in the majority of enterprise applications. They are very handy as they save you having to re-write chunks code if the back-end database changes.
It finishes with Chapter 9 "Building a better MVC" which I really enjoyed. The code continues to flow but it is relevant and very helpful. All major Web development frameworks use the MVC design pattern. Here we are guided through building one from the ground up, including how to do the necessary MySQL table creation.
We end with a basic blogging system which is an excellent way for developers to learn these new skills. All the code is available from Packt Publishing once you have purchased the book.
"Object Oriented Programming with PHP5" is a good reference book with strong chapters on Database and MVC design.
This book is packed with code, more than required to guide you through many of the chapters. Better explanations could have been used earlier on. The book may have benefited from reordered chapters to address the more common uses of OOP first, easing the reader in.
2. PHPClasses.org: Book Review: Object-Oriented Programming with PHP5 (2008-04-22 05:59)
1. PHP Weekly Reader - April 27th 2008 (2008-04-29 22:53)