Recently I was challenged on the fly to come up with an example of a factory pattern. Here is the result:
/**
* Database Connection Example
* @author randymelder
*/
interface DatabaseConnection {
function connect();
}
class MySQLDatabaseConnection implements DatabaseConnection {
var $link;
var $user;
var [...]
Recently, I started re-learning c++ and the topic of data structures surfaced. The conversation evolved to their usefulness in web development. Without commenting on that, I decided to partake in an exercise to implement c style functionality in a PHP OOP context. Here is the code I came up with:
/*
* Stack - the [...]