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

PHPMaster.com:
Reusing Implementation - a Walk-through of Inheritance, Composition, and Delegation
Jul 16, 2012 @ 16:42:54

On PHPMaster.com today there's a new tutorial posted that wants to provide a guide to walk you through a trio of ideas to help with code/idea reuse in your applications - inheritance, composition and delegation.

The popular belief is that reusing implementation, thus producing DRYer code, boils down to exploiting the benefits that Inheritance provides, right? Well, I wish it was that easy! [...] If you don’t know what path to travel when it comes to reusing implementation, in this article I’ll be doing a humble walk-through on the Inheritance/Composition/Delegation trio in an attempt to showcase, side by side, some of their most appealing virtues and clunky drawbacks.

He starts off with a look at Inheritance, showing with a small code sample showing the creation of an interface and a resulting PDO adapter class implementing it. He also shows the concept of composition, following the ideas of the Adapter pattern. In his Delegation example he shows how to implement the creation of the connection object as a part of the class' creation.

tagged: inheritance delegation composition reuse implement tutorial

Link:

PHPClasses.org:
Where are the PHP women?
Oct 27, 2006 @ 12:58:00

It seems the "PHP Women" group is getting support from all over, including from this post on the PHPClasses.org site.

This post lets you know about a new initiative to bring together the women that work with PHP throughout the world.

It explains how spreading the word is vital for the success of communities of specific interests. The article also tells what you can do to help.

Manuel Lemos talks about the group, the formation of it, and who it tries to appeal to. He also gives a suggestion or two of how to help the group really get started (spread the word). There's also a link to the user group information on the PHPClasses.org site, as well as a link to the "Delegations" section of the official PHP Women site.

tagged: women user group spread word support delegation women user group spread word support delegation

Link:

PHPClasses.org:
Where are the PHP women?
Oct 27, 2006 @ 12:58:00

It seems the "PHP Women" group is getting support from all over, including from this post on the PHPClasses.org site.

This post lets you know about a new initiative to bring together the women that work with PHP throughout the world.

It explains how spreading the word is vital for the success of communities of specific interests. The article also tells what you can do to help.

Manuel Lemos talks about the group, the formation of it, and who it tries to appeal to. He also gives a suggestion or two of how to help the group really get started (spread the word). There's also a link to the user group information on the PHPClasses.org site, as well as a link to the "Delegations" section of the official PHP Women site.

tagged: women user group spread word support delegation women user group spread word support delegation

Link:

Developer.com:
PHP 5 OOP - Delegation and Custom Exceptions
May 23, 2006 @ 17:06:36

Developer.com has posted the next part in their series covering object oriented programming in PHP5, this time focusing on using delegation to enhance the functionality of their prexisting DBQuery class.

At present our DBQuery object simply mimics (all be it - rather simply) a stored procedure. Once executed a result resource is returned which you must store and pass the MySqlDB object if you wish to use functions such as num_rows() or fetch_row() on the result set. Would it not be nice if the DBQuery object were able to implement the functions which the MySqlDB object implements; that are designed to work on the result of an executed query?

They explain each step of the way, giving you the code you'll need to attach to the current working script, making this delegation possible. They look briefly at tpye hinting and simple exception handling in the script before hitting you with a full-blown Exception handler class to improve your script's reliability.

tagged: php5 oop delegation custom exceptions part3 tutorial php5 oop delegation custom exceptions part3 tutorial

Link:

Developer.com:
PHP 5 OOP - Delegation and Custom Exceptions
May 23, 2006 @ 17:06:36

Developer.com has posted the next part in their series covering object oriented programming in PHP5, this time focusing on using delegation to enhance the functionality of their prexisting DBQuery class.

At present our DBQuery object simply mimics (all be it - rather simply) a stored procedure. Once executed a result resource is returned which you must store and pass the MySqlDB object if you wish to use functions such as num_rows() or fetch_row() on the result set. Would it not be nice if the DBQuery object were able to implement the functions which the MySqlDB object implements; that are designed to work on the result of an executed query?

They explain each step of the way, giving you the code you'll need to attach to the current working script, making this delegation possible. They look briefly at tpye hinting and simple exception handling in the script before hitting you with a full-blown Exception handler class to improve your script's reliability.

tagged: php5 oop delegation custom exceptions part3 tutorial php5 oop delegation custom exceptions part3 tutorial

Link:


Trending Topics: