PHP
  Home arrow PHP arrow Generating Web Pages with the Flyweigh...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Generating Web Pages with the Flyweight Pattern in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2007-03-05

    Table of Contents:
  • Generating Web Pages with the Flyweight Pattern in PHP 5
  • Building dynamic web page elements
  • Defining a flyweight factory class
  • Putting the flyweight factory class to work

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Generating Web Pages with the Flyweight Pattern in PHP 5


    (Page 1 of 4 )

    Unnecessary and balanced instantiation of PHP classes are issues that can be easily solved by using the flyweight design pattern. If you want to learn more about it, you should start reading this article. Welcome to the final part of the series “Using the flyweight pattern with PHP 5.” As you may have guessed, this series walks you through the implementation of this helpful pattern with PHP, and shows you how to apply it in concrete cases.

    Introduction

    If you've been a patient reader and already went through the first part of this series, then you'll know what the flyweight pattern is about. However, if that's not the case, let me offer you a quick introduction to it so you can grasp more easily the set of examples that I plan to include in this article.

    Essentially, when the flyweight design pattern is applied, there's one class that controls programmatically the number of objects created across a given application. This implies that the pattern can be used to avoid the unnecessary instantiation of a particular class, and to introduce an improvement in the web server on which the application is running.

    Of course, this definition may sound a bit confusing at first, since the implementation of flyweight classes requires some practice. It's certainly a concept that can be applied to different topics on pattern-based PHP programming as well.

    Nonetheless, you shouldn't feel intimidated by the potential complexity of the subject. In this final part of the series, I'm going to teach you in a step-by-step format how to create in PHP 5 a flyweight class to balance the instantiation of objects that will be used to generate web documents on the fly. Hopefully, by the end of this article, you should have acquired a considerable background in how to apply the flyweight pattern in a real-world situation.

    With the preliminaries out of the way, let's continue learning more about how to create flyweight classes with PHP 5. Let's go!

    More PHP Articles
    More By Alejandro Gervasio


       · In this final article of the series, the flyweight pattern is used to develop a...
       · Sorry, but having read the first part "Introducing the Flyweight Pattern with PHP...
       · Hello Gregor,Thank you for commenting on my PHP article. Now, with reference to...
       · this article is not about the flyweight pattern at all, consider reading about them...
       · Thank you for commenting on my PHP article about implementing the flyweight pattern...
     

       

    PHP ARTICLES

    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview
    - Handling Attachments in MIME Email with PHP
    - Completing the Project Management Application





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway