Thursday, 24 May 2007
Building a Data Validation System with the Prototype Pattern with PHP 5 |
| |
|
| |
Alejandro Gervasio, in a two part series, demonstrates the basic functionality provided by the prototype pattern with PHP 5. Comprised of two articles, this series shows you how to work with many instances of a given class using the functionality provided by the prototype pattern. He provides hands-on examples to supplement the theoretical concepts.
In the first part of the article, he explained when the prototype pattern is applied, the first instance of a class is used as a prototype model, and all the other instances of the class in question are created by cloning the mentioned prototype object.
This pattern can be helpful in situations where a prototype object is required, along with other clones of it, in this final installment of the series he demonstrates how to use it to build a simple application for checking the validity of incoming data.
He explains it with the following steps:
- Building a simple data validation system: he explains how the prototype pattern can be used in a particular situation.
- Creating a few additional classes: he extends the functionality of this simple data validation application to make it capable of checking some additional incoming data, like numbers and e-mail addresses.
- Creating an example: here he shows if it is possible to work with a cloned instance of a specific validation object to check whether or not a particular input entry is considered offending.
|
| |
|
Read the Post
Related Reading: Basics of Using the Prototype Pattern with PHP 5
|
| |
|
|
| |
|
|
| |
|