Home arrow PHP arrow Factoring Content Boxes with the Factory Pattern in PHP 5

Factoring Content Boxes with the Factory Pattern in PHP 5

Working with factory classes is a rather common process for many PHP developers who build object-based applications on a frequent basis. If you want to find out how to make this helpful class work for you, then this group of articles might be what you need. Welcome to the final installment of the series that began with "Using the Factory Pattern in PHP 5." In three parts, this series goes through the key concepts of implementing the factory pattern with PHP, and complements theory with numerous and educational code samples.

TABLE OF CONTENTS:
  1. Factoring Content Boxes with the Factory Pattern in PHP 5
  2. Factoring web page content boxes
  3. Building different types of content boxes
  4. Displaying web page content boxes via the factory pattern
By: Alejandro Gervasio
Rating: starstarstarstarstar / 4
July 09, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

Now that I have introduced the subject of this series, let me remind you of some of the most important topics covered in the previous tutorial. As you learned earlier, implementing the factory pattern using an extremely friendly scripting language like PHP is actually a no-brainer process that can be performed with minor hassles.

Creating a simple yet effective factory class, which can be easily provided with the capacity for spawning multiple objects across a given application, is a procedure reduced to something as basic as defining a method for the class in question that has the ability to return to client code a certain type of object, according to the specifications of a determined context.

Besides, as I clearly demonstrated by the copious hands-on examples included in the two previous tutorials of the series, working with only one instance of the factory class is an issue that can be addressed by different approaches. These include applying the Singleton pattern, or even better, calling statically its factory method.

Now that I mentioned it, I used this last approach with all the code samples shown so far; it's one of the most effective techniques utilized by many PHP programmers. It allows you to create specific objects without having to deal with a concrete instance of a factory class.

However, I'd like to put the tiny details of the factory pattern to the side (at least momentarily) and introduce the topics that I plan to cover in this final article of the series. In this last tutorial I'm going to teach you how to implement this useful pattern to build a bunch of highly-customizable content boxes, which can be quickly included into any web page.

Now that you know what this article is about, let's move on together and learn how to build these popular and handy elements of today's web development by using the functionality provided by the factory pattern. Let's get started!



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: