<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sun, 26 May 2013 02:26:42 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHP-Tip-a-Day: PHP Tutorial: The Allegory of The Factory Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/18081</guid>
      <link>http://www.phpdeveloper.org/news/18081</link>
      <description><![CDATA[<p>
On the PHP-Tip-a-Day site there's a new post from <i>Greg Bulmash</i> with an <a href="http://www.php-tip-a-day.com/php-tutorial-the-allegory-of-the-factory-pattern/">allegory about the Factory pattern</a> (design pattern) to relate it to something a bit more practical and introduce some of its core concepts.
</p>
<blockquote>
If you've read the <a href="http://www.php-tip-a-day.com/about-this-site/">About This Site</a> page, you'll know that instead of pursuing my passion for computers, I got sidetracked into the arts in college. So when it came time for me to learn and explain the <a href="https://www.ibm.com/developerworks/library/os-php-designptrns/#N10076">Factory Pattern</a>, I thought it might be fun to express it as an allegory...
</blockquote>
<p>
His example involves cars, axles and wood to illustrate how the Factory pattern lets you generate objects of different types automatically without having to worry about how they're created. He includes a code example in the form of an interface and a class that implements it (the "Axle" class). 
</p>]]></description>
      <pubDate>Tue, 12 Jun 2012 09:13:24 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Handling Collections of Aggregate Roots - the Repository Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/17969</guid>
      <link>http://www.phpdeveloper.org/news/17969</link>
      <description><![CDATA[<p>
On PHPMaster.com today they have a new tutorial focusing on <a href="http://phpmaster.com/handling-collections-of-aggregate-roots/">using the Repository</a> (a part of the <a href="http://en.wikipedia.org/wiki/Domain-driven_design">domain driven design</a> architecture) to enhance your model's current functionality.
</p>
<blockquote>
Unlike mappers, though, which are part of the infrastructure, a repository characterizes itself as speaking the model's language, as it's intimately bound to it. And because of its implicit dependency on the mappers, it preserves the persistence ignorance as well, therefore providing a higher level of data abstraction, much closer to the domain objects.
</blockquote>
<p>
Included in the tutorial is the full code you'll need to create a simple UserInterface class and a User model that extends it. He also makes a UserCollection class to handle working with multiple User objects and a UserMapper to handle the actual data source fetching. Finally, he implements the Repository on top of this base structure showing how it lays on top of everything via the UserMapperInterface instance. At the end some example code showing it in use is also included - making the PDO connection, creating the UserRepository and fetching by a few different data types (email, name and role).
</p>]]></description>
      <pubDate>Thu, 17 May 2012 08:44:37 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Ralph Schindler's Blog: PHP Constructor Best Practices And The Prototype Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/17659</guid>
      <link>http://www.phpdeveloper.org/news/17659</link>
      <description><![CDATA[<p>
In <a href="http://ralphschindler.com/2012/03/09/php-constructor-best-practices-and-the-prototype-pattern">this new post</a> <i>Ralph Schindler</i> takes a look at the Prototype design pattern and uses it to illustrate some best practices in using constructors in PHP.
</p>
<blockquote>
If your knowledge of constructors ends with "the place where I put my object initialization code," read on. While this is mostly what a constructor is, the way a developer crafts their class constructor greatly impacts the initial API of a particular class/object; which ultimately affects usability and extensibility. After all, the constructor is the first impression a particular class can make.
</blockquote>
<p>
He starts at ground level, reintroducing what a constructor is and what it should (and shouldn't) be used for. He talks about constructor overloading, constructor injection, dynamic class extension and using the <a href="http://en.wikipedia.org/wiki/Prototype_pattern">Prototype pattern</a> to create "an unlimited number of objects of a particular type, with dependencies in tact, each with slight variations." He gives an example with a "DbAdapter" class, showing dynamic class instantiation and how to, using the Prototype method, inject a DbAdapter object and have your class use that instead.
</p>]]></description>
      <pubDate>Mon, 12 Mar 2012 11:26:10 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Understanding the Observer Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/17578</guid>
      <link>http://www.phpdeveloper.org/news/17578</link>
      <description><![CDATA[<p>
PHPMaster.com has a new tutorial looking at another popular design pattern, the <a href="http://phpmaster.com/understanding-the-observer-pattern/">Observer pattern</a>, and sharing some example code putting it to use. (Their other design pattern articles include ones on <a href="http://phpmaster.com/understanding-the-command-design-pattern/">command</a> and <a href="http://phpmaster.com/understanding-the-factory-method-design-pattern/">factory</a> patterns).
</p>
<blockquote>
In this article I'll show you how to implement the Observer Pattern. You'll learn how various classes in the pattern relate to one another as subject and observers, how the subject notifies observers of a change in its state, and how to identify scenarios where it would be suitable to use the Observer Pattern in your own code.
</blockquote>
<p>
The introduce the pattern by using an abstract "Observer" and "Subject" (that defines "attach", "detach", "getState", "setState", "notify" and "getObservers" methods) observer classes to coordinate the attached classes. They extend these classes with "Auth" and "Auth_ForumHook" show how to attach the "Auth_ForumHook" classes to the main "Auth" observer manager and change the state of the observer to notify it of an update.
</p>
<p>
You can find a more detailed explanation of the Observer pattern <a href="http://en.wikipedia.org/wiki/Observer_pattern">on Wikipedia</a>.
</p>]]></description>
      <pubDate>Thu, 23 Feb 2012 11:39:10 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: Practical Testing Patterns - Redux]]></title>
      <guid>http://www.phpdeveloper.org/news/16420</guid>
      <link>http://www.phpdeveloper.org/news/16420</link>
      <description><![CDATA[<p>
A while back we <a href="http://phpdeveloper.org/news/15371">posted about</a> a series of articles <i>Giorgio Sironi</i> was doing about some of the more practical applications of testing patterns in PHP unit testing. He' been building on the series ever since and has lots of great patterns you can use to more correctly structure your testing practices.
</p>
<p>
The <a href="http://css.dzone.com/books/practical-php-testing-patterns">current list</a> includes:
</p>
<ul>
<li><a href="http://css.dzone.com/books/practical-php-testing/practical-php-testing-patterns-0">Test Strategy: Scripted Test</a>
<li><a href="http://css.dzone.com/books/practical-php-testing-patterns/practical-php-testing-patterns-4">Design for Testability: Dependency Injection</a>
<li><a href="http://css.dzone.com/books/practical-php-testing/practical-php-testing-patterns-19">Fixture Setup: Delegated Setup</a>
<li><a href="http://css.dzone.com/books/practical-php-testing/practical-php-testing-patterns-33">Fixture Teardown: Automated Teardown</a>
<li><a href="http://css.dzone.com/books/practical-php-testing/practical-php-testing-patterns-39">Test Double: Mock Object</a>
</ul>
<p>
There's lots more where these came from, all divided into sections like "Fixture Setup", "Test Double" and "Database Isolation" patterns. You can find the full list so far <a href="http://css.dzone.com/books/practical-php-testing-patterns">here</a>.
</p>]]></description>
      <pubDate>Thu, 02 Jun 2011 12:12:25 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Label Media Blog: Design Patterns in PHP - Observer Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/15894</guid>
      <link>http://www.phpdeveloper.org/news/15894</link>
      <description><![CDATA[<p>
<i>Tom Rawcliffe</i> has posted the latest in his design patterns series covering some of the most common patterns and how they would work in PHP. In this new post he looks at <a href="http://labelmedia.co.uk/blog/posts/php-design-patterns-observer-pattern.html">the observer pattern</a>.
</p>
<blockquote>
So far in my series of articles on design patterns in PHP we've looked at a creational pattern, a structural pattern and a behavioral pattern. Today I'll be taking a closer look at another behavioral pattern - the observer. The observer pattern (also known as the Subscribe/Publish Pattern) is used to notify one object, the observer, about a change of state from another object, the subject.
</blockquote>
<p>
He gives the layout of the pattern in a <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/Observer.svg/500px-Observer.svg.png">simple UML diagram</a> before moving into the description and code. His sample builds a Users object that has a set of observers on it. His custom observer is a logger that, when a change is made on the Users, it writes out a value of the current object.
</p>]]></description>
      <pubDate>Fri, 11 Feb 2011 11:03:21 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Wil Sinclair's Blog: Process Patterns]]></title>
      <guid>http://www.phpdeveloper.org/news/15655</guid>
      <link>http://www.phpdeveloper.org/news/15655</link>
      <description><![CDATA[<p>
On the Zend Developer Zone today there's <a href="http://devzone.zend.com/article/12887-Wil-Sinclair-talks-about-Process-Patterns">a new post</a> mentioning something from <i>Wil Sinclair</i> about something he calls "process patterns" in software development.
</p>
<p>From <a href="http://wllm.com/2010/12/28/process-pattern/">Wil's post</a>:
<blockquote>
I need a word for several engineers working on the same project that isn't 'team'. Why? Because most engineers working on the same project aren't working together as a team. This is why I believe in process patterns. Note: I didn't say that I believe in processes, because I don't. [...] You name a methodology, and I don't believe in it. But I do believe that there are some process patterns that can dramatically improve team productivity.
</blockquote>
<p>
These patterns are things that are common to several of the processes common to software development - like backlogs, test driven development, etc - but don't have to be considered as something that only comes with XP or Scrum and shouldn't be used outside them. There's even <a href="http://www.ambysoft.com/processPatternsPage.html">a whole other site</a> dedicated to defining these patterns and where the ideas came from. Oh, and don't forget to add <i>Wil</i>'s new word to your vocabulary - "hackle", two or more engineers working together on one project (not necessarily as a team).
</p>]]></description>
      <pubDate>Thu, 30 Dec 2010 08:34:01 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Label Media Blog: Design Patterns in PHP - Strategy Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/15515</guid>
      <link>http://www.phpdeveloper.org/news/15515</link>
      <description><![CDATA[<p>
On the Label Media blog today <i>Tom Rawcliffe</i> continues his series looking at design patterns (see <a href="http://phpdeveloper.org/news/15501">here</a> for his look at the Factory pattern) with <a href="http://www.labelmedia.co.uk/blog/posts/design-patterns-strategy-pattern.html">this new post</a> focusing in on the Strategy pattern.
</p>
<blockquote>
The Strategy Pattern is used to decouple an algorithm from the context in which it is used. I'm going to equate this example to a real world scenario starring a man, I'll call him Bob.
</blockquote>
<p>
In his example Bob heads to work and takes whatever way he wants to get there. His boss only cares that he makes it there, not the path he takes. Bob can take many different ways ("strategies") to get there, but how is up to him. <i>Tom</i> illustrates this with a bit of sample code with a "bob.php" that can use any number of other classes/methods to get to work (like commute, the train or a car).
</p>]]></description>
      <pubDate>Tue, 30 Nov 2010 12:48:26 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Ibuildings techPortal: Optimising MHVC Web Applications for Performance]]></title>
      <guid>http://www.phpdeveloper.org/news/15443</guid>
      <link>http://www.phpdeveloper.org/news/15443</link>
      <description><![CDATA[<p>
On the Ibuildings techPortal there's <a href="http://techportal.ibuildings.com/2010/11/16/optimising-hmvc-web-applications-for-performance/">a new tutorial</a> from <i>Sam de Freyssinet</i> that follows up on a <a href="http://techportal.ibuildings.com/2010/02/22/scaling-web-applications-with-hmvc/">previous article</a> he wrote about using HMVC (Hierarchical-Model-View-Controller). In this new article, he talks about some of the things you can do with that pattern to increase performance.
</p>
<blockquote>
Hierarchical-MVC has been shown to make large web applications easier to scale out, but there is a price to pay- namely overall performance. This article will investigate ways of improving performance within HMVC web applications using asynchronous processing and some good old caching techniques. Predominantly this article will use examples written for the <a href="http://kohanaframework.org/">Kohana Framework</a>; however all the concepts portrayed here could apply to any framework or web application.
</blockquote>
<p>
He starts by pointing out what's wrong with the typical HMVC application - namely that the clean separation of code structure (the hierarchical part) costs the application in overall speed and memory usage. He suggests a simple technology for helping ease the load - caching as much information as possible, mostly in the HTTP client code since HMVC applications rely heavily on it. Code samples includd show how to implement this in a simple Kohana application.
</p>]]></description>
      <pubDate>Wed, 17 Nov 2010 08:17:19 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: Test Strategy Patterns]]></title>
      <guid>http://www.phpdeveloper.org/news/15371</guid>
      <link>http://www.phpdeveloper.org/news/15371</link>
      <description><![CDATA[<p>
<i>Giorgio Sironi</i> has started up a new series on DZone.com about some practical testing patterns you can use when writing up unit tests (and other types of testing in some cases) for your applications - the <a href="http://css.dzone.com/books/practical-php-testing-patterns/test-strategy-patterns">Test Strategy Patterns</a>.
</p>
<p>
The list so far includes the patterns for:
</p>
<ul>
<li><a href="http://css.dzone.com/books/practical-php-testing/practical-php-testing-patterns">Recoded tests</a>
<li><a href="http://css.dzone.com/books/practical-php-testing/practical-php-testing-patterns-0">Scripted tests</a>
<li><a href="http://css.dzone.com/books/practical-php-testing/practical-php-testing-patterns-1">Data-driven tests</a>
<li><a href="http://css.dzone.com/books/practical-php-testing/practical-php-testing-patterns-2">Test automation frameworks</a>
</ul>
<p>
Keep an eye on <a href="http://css.dzone.com/books/practical-php-testing-patterns/test-strategy-patterns">this great series</a>. There's more to come that can be quite helpful when you're trying to generate those tests and procedures around them.
</p>]]></description>
      <pubDate>Tue, 02 Nov 2010 13:42:40 -0500</pubDate>
    </item>
  </channel>
</rss>
