Fluent Interfaces

I’m starting to get a little better at identifying fluent interfaces. This is a programming technique where you can chain method calls together, and it reduces redundant code. Some claim that it is easier to read, but I think that the old way may be a little easier for me at this point, until I get used to this method of calling class methods.

Here’s an example:

$passwordFilter->addFilter(new Zend_Filter_HtmlEntities())
->addFilter(new Zend_Filter_StripTags());

Tags:

Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>