Reply to Re: The Adapter Pattern in PHP5

Your name:

Reply:


Posted by Richard Levasseur on 08/23/06 07:41

I really like your site, since it provides clean, simple examples of
common patterns.
A few notes:
Pass the code through highlight_string for some basic syntax
highlighting, makes code a lot easier to read.
And:
I realized the one thing it is lacking though: an English description
of the code you're about to read. The opening blurbs are very terse
and don't explain the process and logic behind the pattern so much as
give a text book definition of what it is. The code itself is very
explanatory, but a providing a context can help immensely.

Ex: Singleton: In the singleton pattern a class can distribute one
instance of itself to other classes.

Might be better worded as: <what it means> <what it is suppose to do>
<purpose in software designing> <common method of implementation>
<special cases to note>

In the singleton pattern a class can control the instantiation of
itself to the user. This is akin to having a global instance of an
object, and is used when only a single instance of a class should
exist.

The common way of implementing this is storing a static, private
instance of the class within the class and using a static class
getInstance() method to fetch the stored instance.

This is useful for:
Database connections
Configuration classes
Controlling what instance a user gets
When class instances should be shared regardless of context

Feel free to copy/paste that and modify it as you wish.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация