<?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, 19 May 2013 17:07:00 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Anthony Ferrara: Programming With Anthony - Logic]]></title>
      <guid>http://www.phpdeveloper.org/news/18926</guid>
      <link>http://www.phpdeveloper.org/news/18926</link>
      <description><![CDATA[<p>
<i>Anthony Ferrara</i> has <a href="http://blog.ircmaxell.com/2012/12/programming-with-anthony-logic.html">posted about his latest video tutorial</a> in his "Programming with Anthony" series, looking this time at the topic of "Logic":
</p>
<blockquote>
This week's <a href="https://www.youtube.com/playlist?list=PLM-218uGSX3DQ3KsB5NJnuOqPqc5CW2kW&feature=view_all">Programming With Anthony</a> video is up! In it, we discuss the foundations of Boolean Logic and introduce some very interesting tools for analyzing logical constructs (including Truth Tables and De Morgan's Laws). 
</blockquote>
<p>
You can view this latest video <a href="https://www.youtube.com/watch?v=udOU0gagZqg">over on YouTube</a> or get caught up on the entire series with <a href="https://www.youtube.com/playlist?list=PLM-218uGSX3DQ3KsB5NJnuOqPqc5CW2kW&feature=view_all">the full playlist</a> of this and past episodes.
</p>]]></description>
      <pubDate>Thu, 20 Dec 2012 12:26:26 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Overriding Strategy Logic - The Template Method Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/18514</guid>
      <link>http://www.phpdeveloper.org/news/18514</link>
      <description><![CDATA[<p>
On PHPMaster.com there's a new tutorial posted talking about <a href="http://phpmaster.com/overriding-strategy-logic-the-template-method-pattern/">the Template Method Pattern</a> to help make some sense (and make easier to use) your implementation of the Strategy pattern.
</p>
<blockquote>
This bring us back to the question whether it's feasible to eliminate duplicated strategy logic via Inheritance rather than switching over to plain Composition. Indeed it is, and the clean up process can be conducted through an ubiquitous pattern known as <a href="http://en.wikipedia.org/wiki/Template_method_pattern">Template Method</a>. [...] Simply put, there's a base class (usually an abstract one), which declares a concrete method (a.k.a. the template) responsible for outlining the steps or hooks of a certain algorithm. Most of the time the base type provides boilerplate implementation for some of those steps and the remaining ones are delegated to subclasses.
</blockquote>
<p>
The subtypes then override the base's functionality and extend it with their own. They show an example of this by making a jQuery image slider (using <a href="http://jquery.malsup.com/cycle/">this plugin</a>) , an "AbstractCycleSlider" class and two subclasses for two other types - "FadeSlider" and "ScrollSlider", each outputting their own HTML. It also shows how to implement a slider using a <a href="http://www.zurb.com/playground/orbit-jquery-image-slider">different plugin</a> and output both in the same script.
</p>]]></description>
      <pubDate>Tue, 25 Sep 2012 08:58:01 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[NetTuts.com: Evolving Toward a Persistence Layer]]></title>
      <guid>http://www.phpdeveloper.org/news/18469</guid>
      <link>http://www.phpdeveloper.org/news/18469</link>
      <description><![CDATA[<p>
On NetTuts.com there's a new article posted that introduces you to the concept of a <a href="http://net.tutsplus.com/tutorials/php/evolving-toward-a-persistence-layer/">persistence layer in a PHP application</a>:
</p>
<blockquote>
One of the most confusing design pattern is persistence. The need for an application to persist its internal state and data is so tremendous that there are likely tens - if not hundreds - of different technologies to address this single problem. Unfortunately, no technology is a magic bullet. [...] In this tutorial, I will teach you some best practices to help you determine which approach to take, when working on future applications. I will briefly discuss some high level design concerns and principles, followed by a more detailed view on the Active Record design pattern, combined with a few words about the Table Data Gateway design pattern.
</blockquote>
<p>
Included in the post is a high-level application design with the business logic is at the core and the persistence technology/layer exists outside of it. They show how to create a simple, working solution for a persistence layer to handle a blog post and its contents. It talks about characterization tests, the table gateway design pattern and the possible move to the active record pattern.
</p>]]></description>
      <pubDate>Wed, 12 Sep 2012 10:51:17 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Layer Supertype Pattern: Encapsulating Common Implementation in Multi-Tiered Systems]]></title>
      <guid>http://www.phpdeveloper.org/news/18176</guid>
      <link>http://www.phpdeveloper.org/news/18176</link>
      <description><![CDATA[<p>
On PHPMaster.com there's a new post looking at a design pattern that's commonly in use by developers but they might not know its name - the <a href="http://phpmaster.com/the-layer-supertype-pattern-encapsulating-common-implementation-in-multi-tiered-systems/">Layer Supertype</a> pattern and its use in multi-tiered systems.
</p>
<blockquote>
Inheritance offers a straightforward way to easily spawn a large number of objects that are semantically related to each other without having duplicate code. The concept is ridiculously simple - yet powerful: you first drop as much logic as possible within the boundaries of a base type (usually an abstract class, but it could be a concrete one), and then start deriving refined subtypes according to more specific requirements. [...] Not surprisingly, this repetitive encapsulation/derivation cycle lays down on the formalities of a design pattern known as <a href="http://martinfowler.com/eaaCatalog/layerSupertype.html">Layer Supertype</a>.
</blockquote>
<p>
They describe the "supertype" as a replacement for an overly bloated domain-related model. Their example replaces a PostInterface/CommentInterface with a more generic "AbstractEntity" that handles some of the basics for you - getting/setting, checking a field, setting an ID and outputing the information to an array.
</p>]]></description>
      <pubDate>Wed, 04 Jul 2012 17:13:39 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sankuru Blog: Adding support for if/while/do while, to a simple compiler & virtual machine in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17346</guid>
      <link>http://www.phpdeveloper.org/news/17346</link>
      <description><![CDATA[<p>
Improving on his <a href="http://phpdeveloper.org/news/17327">last post</a> about creating a bytecode compiler in PHP, the Sankuru blog has a new post in the series looking at extending the basic compiler to <a href="http://sankuru.biz/blog/13-adding-support-for-if-while-and-do-while-to-a-simple-compiler-and-virtual-machine-written-in-php">add support for if/while and do while</a> logic.
</p>
<blockquote>
In order to obtain a <a href="http://en.wikipedia.org/wiki/Turing_completeness">turing-complete</a> programming language, that is, a language in which we can implement and execute any arbitrary algorithm, that is, that other turing-complete machines can execute too, we now need to add a way of (conditionally) branching, that is, the IF statement, and at least one way of repeating statements, that is the WHILE or the DO WHILE statements.
</blockquote>
<p>
He includes a simple TL-based script as an end goal for the compiler to be able to execute and shows how to add rules for it to the lexer/parser. Rules for the "if" are relatively simple, but there's a hitch in dealing with embedded "while" statements he had to work around. The post ends with the bytecode results for the sample program and the resulting output from the compiled versions execution.
</p>]]></description>
      <pubDate>Wed, 04 Jan 2012 11:40:22 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[WorkingSoftware Blog: Your templating engine sucks & everything you've written is spaghetti code]]></title>
      <guid>http://www.phpdeveloper.org/news/17259</guid>
      <link>http://www.phpdeveloper.org/news/17259</link>
      <description><![CDATA[<p>
In a bit of a ranting post on the WorkingSoftware.com.au blog <i>Iain Dooley</i> shares his opinion about most of the code he's seen, specifically related to templating engines: "Your templating engine sucks and everything you have ever written is spaghetti code (yes, you)".
</p>
<blockquote>
Templating is a real hot button in the web development community. [...] The high horses that people usually get on are that all too familiar TLA MVC (Model/View/Controller) architecture and "separation of presentation and business logic". The poor pedestrians upon which they look down are those who have written "spaghetti code" - templates where presentation logic, markup, business logic, database access configuration and whatever else you might imagine are mixed up in the same file. Well, I've got some news for you: you're all wrong.
</blockquote>
<p>
He points out that, with most of the major templating tools out there, there's most people still put some sort of business logic in their templates. Rarely will you find a "pure" template that only echoes out the data. He gives an example of a <a href="http://mustache.github.com">Mustache</a> template with "empty" logic in it. He shares a new term his coined too: "Template Animation". This is the separation of the templating process as it is usually done and splitting it so that the output is a modified DOM resource rather than a static template. 
</p>
<p>
He talks about some of the advantages of this approach and an example of its use in an example of a logged in user vs not logged in user as well as a brief discussion of Markdown/HAML.
</p>
<blockquote>
The only thing that Template Animation advocates is that the technological barrier between the frontend and the backend is never crossed - that our templates are truly logic-less.
</blockquote>
<p>
There's <a href="http://www.workingsoftware.com.au/page/Your_templating_engine_sucks_and_everything_you_have_ever_written_is_spaghetti_code_yes_you">lots of comments on the post</a> already - everything from support of the idea to systems that already implement this sort of idea to disagreeing opinions.
</p>]]></description>
      <pubDate>Wed, 14 Dec 2011 12:03:54 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Marco Tabini's Blog: The lost art of using your brain]]></title>
      <guid>http://www.phpdeveloper.org/news/16025</guid>
      <link>http://www.phpdeveloper.org/news/16025</link>
      <description><![CDATA[<p>
In a recent post to his blog <i>Marco Tabini</i> talks about what he calls the <a href="http://blog.tabini.ca/2011/03/the-lost-art-of-using-your-brain/">lost art of using your brain</a>, the fact that people seem to be relying more on the contents of other peoples' brains instead of their own.
</p>
<blockquote>
The world of technology is riddled with inhabitants who treat tools as if they were religions. OOP, unit tests, patterns... these are all instruments that are supposed to make some jobs better, and not theological formulas that will magically make every single line of code written on the face of the Earth better. And yet, the vast majority of people treats them like they are, sparking everything from language wars to endless-and pointless - discussions on whether a particular technique is better than another.
</blockquote>
<p>
He goes on to say that the tools developers use every day aren't just limited to the technology that makes them up. They're there to make things easier, but if the developer using them doesn't take the time to engage their minds to use them correctly, they're practically useless (100% code coverage, for example). He shares his three reasons why he thinks this issue is so wide-spread and the steps he suggests to push out of this way of thinking and back into a more mindful, thinking sort of development path.
</p>]]></description>
      <pubDate>Thu, 10 Mar 2011 10:41:55 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Stubbles Blog: On annotations and logic]]></title>
      <guid>http://www.phpdeveloper.org/news/15826</guid>
      <link>http://www.phpdeveloper.org/news/15826</link>
      <description><![CDATA[<p>
On the Stubbles blog there's <a href="http://www.stubbles.org/archives/91-On-annotations-and-logic.html">a recent post</a> that talks about a feature they introduced into the framework - annotations - with high hopes it would give them more flexibility in how things worked. As <i>Frank Keline</i> says, though, "it's not such a good idea at all".
</p>
<blockquote>
The most simplest reason for this is the idea that annotations are markup. They mark (or, to keep the notion, annotate) code as being special or to be treated in some special kind of way, depending on the scenario where the code is used in. [...] From a design point of view this makes it clear why annotations should not contain logic. If annotations contain parts of such logic, it becomes splitted and possibly cluttered throughout different classes.
</blockquote>
<p>
He goes on to talk about a second reason why he doesn't think they should be considered first-class in an application - it doesn't promote code reuse. For example, if you define them on a method, there's no way to use that method without them. He puts this into the perspective of the <a href="http://stubbles.net/">Stubbles</a> framework that currently uses them and how he's changed the logic to live in special classes instead. He considers other changes like places annotations can be used and having different annotation classes.</p>]]></description>
      <pubDate>Fri, 28 Jan 2011 12:29:40 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Ralph Schindler's Blog: Exception Best Practices in PHP 5.3]]></title>
      <guid>http://www.phpdeveloper.org/news/15140</guid>
      <link>http://www.phpdeveloper.org/news/15140</link>
      <description><![CDATA[<p>
<i>Ralph Schindler</i> has <a href="http://ralphschindler.com/2010/09/15/exception-best-practices-in-php-5-3">put together a new post</a> for his blog about some of the best practices for using exceptions in PHP 5.3 - specifically dealing with some of the new functionality that comes with this latest PHP version.
</p>
<blockquote>
Exception handling in PHP is not a new feature by any stretch. In this article, we'll discuss two new features in PHP 5.3 based around exceptions. The first is nested exceptions and the second is a new set of exception types offered by the SPL extension (which is now a core extension of the PHP runtime). Both of these new features have found their way into the book of best best practices and deserve to be examined in detail.
</blockquote>
<p>
Some of the features he talks about were pre-PHP 5.3, but the focus is largely on these new features. He gives a bit of a background on exception handling in PHP and how custom exceptions could be thrown. He then moves on to the new features - first nesting exceptions and then some about the new core exception types (found <a href="http://us.php.net/manual/en/spl.exceptions.php">here</a>). All that being said, he includes some code to show the dynamic/logic/runtime exceptions in action including a look at best practices in library exception handling.
</p>]]></description>
      <pubDate>Thu, 16 Sep 2010 10:26:17 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Brandon Savage's Blog: Peer Review: Improving The Business Logic]]></title>
      <guid>http://www.phpdeveloper.org/news/13182</guid>
      <link>http://www.phpdeveloper.org/news/13182</link>
      <description><![CDATA[<p>
<i>Brandon Savage</i> has posted the <a href="http://www.brandonsavage.net/peer-review-improving-the-business-logic/">fifth part</a> of his "Peer Review" series where he's taken a sample application and worked it over - refactoring, updated to meeting coding standards and abstracting out interfaces to simplify the code. In this latest article he looks at a method to improve the business logic behind the scenes.
</p>
<blockquote>
So far, we've done quite a bit of work on our Twitter class, making it better. There's still work to be done, though, especially improving the logic. The Twitter class we have now has a number of logical flaws in it that we need to address. Additionally, there are some logical flaws that we started with that I want to highlight, even though we've already fixed them. Let's get started with those.
</blockquote>
<p>
He looks at a few things like setting the host name as a property, using the return of the HTTP request and handling exceptions (like when Twitter's down). The resulting code is included.
</p>]]></description>
      <pubDate>Tue, 08 Sep 2009 10:04:07 -0500</pubDate>
    </item>
  </channel>
</rss>
