Posted by : Rhyf Ahmad Friday, May 22, 2015

Now that you’ve learned the ins and outs of object - oriented (OO) application design in PHP, you might be tempted to dive in and start coding your application. With your new - found knowledge, you’re certainly ready to do just that, but you will almost certainly be taking the longest route to get there.
There are a number of shortcuts you can take along the way, in the form of a series of utilities and reusable classes that together comprise an immensely powerful, easy - to – use development toolkit. This book introduces you to some useful toolkit components, piece by piece, and shows you (with real - world examples) just how useful it can be. The first class in your toolkit is called Collection, and that’s what you’ll meet in this chapter.
The Collection class is an OO replacement for the traditional array data type. Much like an array, it contains member variables, although those variables tend to be other objects, rather than simpler data types such as strings, integers, and so forth. The class then provides simple methods to enable you to add member variables, remove them, and fetch them for use in applications.
As you’ll see in this chapter, it has numerous advantages over using a simple array for storing a series of instantiated objects. As with many of the chapters in this book, in this chapter you will not only utilize the code for the class itself, but also see exactly how it is put together, based on original design requirements that will be determined. Along the way, topics such as lazy instantiation using callbacks are discussed, as well as how to put the Collection class to use, and what possible improvements could be made to it in the future.


Purpose of the Collection Class
Designing the Collection Class
Collection Class Basics

  1. The addItem Method
  2. The removeItem and getItem Methods
  3. Other Methods
  4. Using the Collection Class
Implementing Lazy Instantiation
  1. Callbacks
  2. The setLoadCallback Method in the Collection Class
  3. Using the Collection Class
  4. Improving the Collection Class

Ebook Preview
Get the ebook now (297 KB)

If the link above doesn't work, try the link below

Mirror: Get the ebook now (297 KB)

Leave a Reply

You can leave a comment to request any article(s), software(s), ebook(s) or report the dead link.
Then I will reply as soon as I can :)

Subscribe to Posts | Subscribe to Comments

Welcome to My Blog

Recent Post

Recent Posts Widget

- Copyright © Madriva -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -