Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

DevShed:
Using the Memento Pattern with a File Reading Class
Jan 15, 2007 @ 20:22:00

DevShed continues their look at design patterns in PHP with this last installment of their Memento pattern series - "Using the Memento Pattern with a File Reading Class".

Let me now introduce the topics that I'll be covering in this last article of the series. I'll show you how to use the memento pattern to keep track of some properties that correspond to a file reading class. In this way we'll construct a flexible mechanism for moving back and forth between file lines.

They create both of the needed classes for the pattern to work - the originator and the caretaker class - to handle the reading of the files. The code for both is pretty cut and paste-able, so there's no problem getting your example to work. With those constructed, they tie them together with an example of the design pattern in action - reading and displaying the lines of a text file to the user.

tagged: memento design pattern tutorial read file echo class memento design pattern tutorial read file echo class

Link:

DevShed:
Using the Memento Pattern with a File Reading Class
Jan 15, 2007 @ 20:22:00

DevShed continues their look at design patterns in PHP with this last installment of their Memento pattern series - "Using the Memento Pattern with a File Reading Class".

Let me now introduce the topics that I'll be covering in this last article of the series. I'll show you how to use the memento pattern to keep track of some properties that correspond to a file reading class. In this way we'll construct a flexible mechanism for moving back and forth between file lines.

They create both of the needed classes for the pattern to work - the originator and the caretaker class - to handle the reading of the files. The code for both is pretty cut and paste-able, so there's no problem getting your example to work. With those constructed, they tie them together with an example of the design pattern in action - reading and displaying the lines of a text file to the user.

tagged: memento design pattern tutorial read file echo class memento design pattern tutorial read file echo class

Link:

DevShed:
Introducing the Memento Pattern
Jan 08, 2007 @ 21:48:00

Diving even further into the world of design patterns, DevShed has posted this new tutorial looking at the Memento pattern - useful for (in their example) carrying objects from page to page.

Don't you worry about it for the moment, because in this two-part series, I'm going to demonstrate with numerous code samples how to apply the memento pattern so that it can be used within your own PHP applications with only minor problems.

They start with the simplest example of the pattern, working with arrays - get, set, etc. On top of that, they build a "caretaker" class that

will be the one holding the state of the object from the other class. Finally, they tie them both together to create a simple model of a caretaker that stores and remembers how the object inside is formatted.
tagged: design pattern memento tutorial array caretaker design pattern memento tutorial array caretaker

Link:

DevShed:
Introducing the Memento Pattern
Jan 08, 2007 @ 21:48:00

Diving even further into the world of design patterns, DevShed has posted this new tutorial looking at the Memento pattern - useful for (in their example) carrying objects from page to page.

Don't you worry about it for the moment, because in this two-part series, I'm going to demonstrate with numerous code samples how to apply the memento pattern so that it can be used within your own PHP applications with only minor problems.

They start with the simplest example of the pattern, working with arrays - get, set, etc. On top of that, they build a "caretaker" class that

will be the one holding the state of the object from the other class. Finally, they tie them both together to create a simple model of a caretaker that stores and remembers how the object inside is formatted.
tagged: design pattern memento tutorial array caretaker design pattern memento tutorial array caretaker

Link:


Trending Topics: