<?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>Thu, 24 May 2012 15:16:14 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Chris Hartjes' Blog: Have a 'Strategy']]></title>
      <guid>http://www.phpdeveloper.org/news/17966</guid>
      <link>http://www.phpdeveloper.org/news/17966</link>
      <description><![CDATA[<p>
In response to <a href="http://odino.org/use-the-strategy-to-avoid-the-switch-case-antipattern/">this suggestion</a> from <i>Alessandro Nadalin</i> about using the "Strategy" design pattern to replace a <a href="http://php.net/switch">switch</a. statement, <i>Chris Hartjes</i> has <a href="http://www.littlehart.net/atthekeyboard/2012/05/15/have-a-strategy/">this new post</a> sharing his opinion of "the right way" do it it.
</p>
<blockquote>
Once I realized what he was doing, I realized that the Strategy pattern was applicable in this case…but his chosen example was dumb and one that I wouldn't have used to demonstrate things. As expected, he told me to supply a sample of a better way. I did, telling him that the sample would be better if he didn't mash the logging level together with the message.
</blockquote>
<p>
Included in the post is sample code, first showing the initial version of the logging class, complete with accompanying tests. Following that, he shows how to refactor it into something using the Strategy pattern, replacing the logging type switch statement with protected methods for each logging message type (critical, notice, etc). 
</p>]]></description>
      <pubDate>Wed, 16 May 2012 10:42:29 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Anthony Ferrara's Blog: Handling Plugins In PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17654</guid>
      <link>http://www.phpdeveloper.org/news/17654</link>
      <description><![CDATA[<p>
<i>Anthony Ferrara</i> has a new post today looking at <a href="http://blog.ircmaxell.com/2012/03/handling-plugins-in-php.html">plugin handling</a> and a few of the more common design patterns that can be used to implement them in your applications.
</p>
<blockquote>
A common problem that developers face when building applications is how to allow the application to be "plug-able" at runtime.  Meaning, to allow non-core code to modify the way an application is processed at runtime.  There are a lot of different ways that this can be done, and lots of examples of it in real life.  Over a year ago, I wrote a <a href="http://stackoverflow.com/a/4471363/338665">StackOverflow Answer</a> on this topic.  However, I think it deserves another look.  So let's look at some patterns and common implementations.
</blockquote>
<p>The patterns he covers are:</p>
<ul>
<li>Observer
<li>Mediator
<li>Strategy
<li>Decorator
<li>Chain of Responsibility
</ul>
<p>
For each there's both a bit of sample code showing it in use and links to some examples from various frameworks and other projects.
</p>]]></description>
      <pubDate>Fri, 09 Mar 2012 13:34:38 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Michael Nitschinger's Blog: Session Encryption with Lithium]]></title>
      <guid>http://www.phpdeveloper.org/news/17427</guid>
      <link>http://www.phpdeveloper.org/news/17427</link>
      <description><![CDATA[<p>
<i>Michael Nitschinger</i> has a new post for the <a href="http://lithify.me/">Lithium framework</a> users out there - a quick tutorial about <a href="http://nitschinger.at/Session-Encryption-with-Lithium">encrypting your session information</a> with the new built in "Encrypt" strategy feature.
</p>
<blockquote>
If you check out the master branch, you can use the new Encrypt strategy to encrypt your session data automatically. This means that you can read and write session data in cleartext and they will be encrypted on the fly before getting stored (in a cookie, for example). 
</blockquote>
<p>
You'll need the <a href="http://php.net/manual/en/book.mcrypt.php">mcrypt extension</a> installed for it to work correctly, but it makes storing the encrypted version of your data more or less automatic. Just set up your Session configuration to use it as a strategy and any time you call a "read" or "write" the hard work is handled for you. For those more interests in what's "under the hood" he goes on to talk about how the strategy works, what cipher it uses by default, how to change it and the default string to use in hashing. 
</p>]]></description>
      <pubDate>Fri, 20 Jan 2012 12:09:08 -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[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>
    <item>
      <title><![CDATA[Zend Developer Zone: Unit Testing Strategies]]></title>
      <guid>http://www.phpdeveloper.org/news/15327</guid>
      <link>http://www.phpdeveloper.org/news/15327</link>
      <description><![CDATA[<p>
On the Zend Developer Zone there's <a href="http://devzone.zend.com/article/12701-Unit-Testing-Strategies">a new article</a> from <i>Keith Casey</i> looking at some of the "best practices" when it comes to writing unit tests for your applications.
</p>
<blockquote>
If we are starting from absolutely nothing, building tests as we go is a near-trivial process. [...] Unfortunately, most of us don't have this situation. We walk into a project with documentation ranging from non-existent to seemingly-useful-but-really-out-of-date, and hundreds of thousands of lines of code, and the coding standards and practices of every developer that has come before us. In this situations, the above Unit Test example is almost mocking us. We can't start that simply! Or can we?
<blockquote>
<p>
He walks through some of the steps he and another project lead took to start their trip into testing - finding the most problematic bits of code first (based on bugs in the tracker) and testing them, figuring out how to test rapidly changing code, finding common code used in several places and testing that and 
</p>]]></description>
      <pubDate>Mon, 25 Oct 2010 08:52:18 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Chance Garcia's Blog: Auth/ACL implementation strategies]]></title>
      <guid>http://www.phpdeveloper.org/news/14934</guid>
      <link>http://www.phpdeveloper.org/news/14934</link>
      <description><![CDATA[<p>
In <a href="http://phpprotip.com/2010/08/authacl-implementation-strategies/">this new post</a> to his blog talks about authentication strategies in Zend Framework applications with the combination of Zend_Acl and Zend_Auth.
</p>
<blockquote>
I'm going to talk more about <a href="http://en.wikipedia.org/wiki/Access_control_list">ACLs</a> than Auth. Auth is simple, it's the ACL that will trip you up.  Since both concepts are coupled together when you're making a login system, I feel it's appropriate to at least touch on Auth. What I want to cover is the ways we can create the ACL object to suit needs based on the scale of the project. I'm going to assume that readers have a passing familiarity with using the Auth and Acl objects and may have even implemented them into projects.
</blockquote>
<p>
He talks about two things you'd need to consider - scalability (how to define your ACLS: hardcoded, in the navigation object and defined in a database) and working with ACLs in multiple projects.
</p>]]></description>
      <pubDate>Tue, 10 Aug 2010 12:20:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[NETTUTS.com: A Beginner's Guide to Design Patterns ]]></title>
      <guid>http://www.phpdeveloper.org/news/14761</guid>
      <link>http://www.phpdeveloper.org/news/14761</link>
      <description><![CDATA[<p>
On NETTUTS.com today there's <a href="http://net.tutsplus.com/articles/general/a-beginners-guide-to-design-patterns">a new tutorial</a> that introduces a bit more advanced concept in the development process - design patterns.
</p>
<blockquote>
Design patterns are optimized, reusable solutions to the programming problems that we encounter every day. A design pattern is not a class or a library that we can simply plug into our system; it's much more than that. It is a template that has to be implemented in the correct situation. It's not language-specific either. A good design pattern should be implementable in most - if not all - languages, depending on the capabilities of the language. 
</blockquote>
<p>
They introduce a few of the more widely used patterns including the strategy pattern, adapter pattern, factory methods, decorator and singleton patterns. Each comes with a bit of code showing how it would work and a "where would I use this?" section with a better example.
</p>]]></description>
      <pubDate>Thu, 08 Jul 2010 08:47:55 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: Simple Database Patching Strategy]]></title>
      <guid>http://www.phpdeveloper.org/news/14109</guid>
      <link>http://www.phpdeveloper.org/news/14109</link>
      <description><![CDATA[<p>
In a new post to her blog today <i>Lorna Mitchell</i> has a few suggestions for <a href="http://www.lornajane.net/posts/2010/Simple-Database-Patching-Strategy">handling database patching</a> when your application starts to outgrow its simple roots.
</p>
<blockquote>
One problem that seems to need solving too often is how to keep databases in sync across different platforms, different developers working on a project, and deploying database changes along with code changes. There are lots of ways of approaching this, none of them are really excellent however and personally I tend to err on the side of simple being better. Fewer dependencies means a solution more likely to work on every platform (and no additional complications for the live platform). Usually this means patch files of some kind.
</blockquote>
<p>
She outlines her usual approach - creating a table with metadata and version information, export the structure of the database in push it into a row, creating numbered patch files and keeping it all stashed away in versioned source control for easy access. Check out <a href="http://www.lornajane.net/posts/2010/Simple-Database-Patching-Strategy#comments">the comments</a> for some more interesting ideas.
</p>]]></description>
      <pubDate>Mon, 01 Mar 2010 14:10:53 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Coders' View Blog: The Strategy Pattern Using PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/12594</guid>
      <link>http://www.phpdeveloper.org/news/12594</link>
      <description><![CDATA[<p>
On the Coders' View blog there's a <a href="http://codersview.blogspot.com/2009/05/strategy-pattern-using-php.html">recent post</a> looking at using the strategy design pattern in your PHP application.
</p>
<blockquote>
In the strategy pattern, algorithms are extracted from complex classes so they can be replaced easily. For example, the strategy pattern is an option if you want to change the way pages are ranked in a search engine. Think about a search engine in several parts - one that iterates through the pages, one that ranks each page, and another that orders the results based on the rank.
</blockquote>
<p>
Their example shows a class that, based on a few different search "strategies", can locate user information in the user listing. Their example uses a random and a "find after" strategy and includes the results.
</p>]]></description>
      <pubDate>Fri, 29 May 2009 11:14:02 -0500</pubDate>
    </item>
  </channel>
</rss>

