<?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, 17 May 2012 03:48:51 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Sebastian G&ouml;ttschkes' Blog: Testclasses for symfony2]]></title>
      <guid>http://www.phpdeveloper.org/news/17815</guid>
      <link>http://www.phpdeveloper.org/news/17815</link>
      <description><![CDATA[<p>
<i>Sebastian G&ouml;ttschkes</i> has <a href="http://sgoettschkes.blogspot.com/2012/04/testclasses-for-symfony2.html">a new post to his blog</a> about a set of abstract base testing classes he's developed to help with the functional, unit and validation testing of his Symfony2-based applications.
</p>
<blockquote>
So, when developing with symfony2, I rely on my tests. They are my safety net and without them, I get a little nervous after every change. Does everything work? Did I forget anything? So I developed some classes which I extend. They work on top of PHPUnit and the symfony2 WebTestCase. The classes are used by my different types of Tests: UnitTests, ValidationTests, FunctionalTests (as well as IntegrationTests).
</blockquote>
<p>
Code for each type of testing base class is included in the post showing how he extends the based PHPUnit test case for unit testing and the Symfony WebTestCase for validation and functional testing. Each one of the classes are ready to use and give you some handy helper methods too. 
</p>]]></description>
      <pubDate>Fri, 13 Apr 2012 11:57:53 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Effects of Wrapping Code in Class Constructs]]></title>
      <guid>http://www.phpdeveloper.org/news/17320</guid>
      <link>http://www.phpdeveloper.org/news/17320</link>
      <description><![CDATA[<p>
DevShed has a new tutorial posted today looking to help you counteract the bad practice of <a href="http://www.devshed.com/c/a/PHP/PHP-Effects-of-Wrapping-Code-in-Class-Constructs/">wrapping procedural code in "class" constructs</a> and provide some useful suggestions of how to avoid it.
</p>
<blockquote>
Static helpers seem to be a great idea at first glance, as they're reusable components that don't require any kind of expensive instantiation for doing common tasks [...]. But the sad and unavoidable truth is in many cases they're simply wrappers for procedural code, which has been elegantly hidden behind a "class" construct. So what's wrong with this? Well, even in the most harmless situations, when you use a static helper that produces a deterministic output, you're actually throwing away the advantages that OOP provides.
</blockquote>
<p>
To illustrate, they create a basic validation class that can check for things like valid emails, float values, integers and URLs using PHP's <a href="http://php.net/filter_var">filter_var</a> function. They point out that the class is difficult to extend and that it is doing too many things to be correctly considered a "piece" of functionality. To correct the problem, they opt for a different approach - an abstract class acting as an interface to structure custom validators against. This provides set/get methods for things like the error message and value to evaluate. The implementation of the validators on top of this class is coming in the next part of the series.
</p>]]></description>
      <pubDate>Thu, 29 Dec 2011 10:06:58 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Building Concrete Validators]]></title>
      <guid>http://www.phpdeveloper.org/news/17293</guid>
      <link>http://www.phpdeveloper.org/news/17293</link>
      <description><![CDATA[<p>
On DevShed.com today there's the first part of a two-part series showing how to <a href="http://www.devshed.com/c/a/PHP/PHP-Building-Concrete-Validators/">build self-contained validator objects</a> that can be used to test the format of user input for validity.
</p>
<blockquote>
In this two-part tutorial, I show why the use of static helper classes can be detrimental to building robust and scalable object-oriented applications in PHP (though you should take into account that the concept is language agnostic). I also implement a set of instantiable, fine-grained validators, which can be easily tested in isolation, injected into the internals of other objects, and so forth.
</blockquote>
<p>
Their set of "concrete validators" are all based off of a validator interface/abstract class and check things like email formatting, floats, integers and URLs. Also included are a few examples of using the validators in a sample script.
</p>]]></description>
      <pubDate>Thu, 22 Dec 2011 11:24:25 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[XpertDeveloper.com: Abstract in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17055</guid>
      <link>http://www.phpdeveloper.org/news/17055</link>
      <description><![CDATA[<p>
On the XpertDeveloper.com site today there's a new tutorial talking about something that can not only help the structure of your application but can make things more reusable in the end - <a href="http://www.xpertdeveloper.com/2011/10/abstract-in-php/">abstract classes</a>.
</p>
<blockquote>
For Abstact keyword we can say that, abstract is type of the class and class which we can't create a object of it. Surprised???? [...] Abstract class can be used some what like an interface in PHP. So basically we can implement class using abstract. We can't extend more than one abstract class while we can implement more than one interface.
</blockquote>
<p>
They introduce you to the creation of an abstract class and show how to set up some abstract methods inside. These methods are required to be defined as a part of the extension in your class. One of the benefits they don't mention of abstract classes over interfaces is the ability to have methods in the abstract that are actual code, not just definitions of the structure (that's more of what <a href="http://us.php.net/interfaces">interfaces</a> are for).
</p>]]></description>
      <pubDate>Fri, 28 Oct 2011 09:55:07 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Ian Christian's Blog: Creating a custom form field type in Symfony 2]]></title>
      <guid>http://www.phpdeveloper.org/news/16725</guid>
      <link>http://www.phpdeveloper.org/news/16725</link>
      <description><![CDATA[<p>
<i>Ian Christian</i> has added a new post to his blog today showing how you can <a href="http://pookey.co.uk/wordpress/archives/286-creating-a-custom-form-field-type-in-symfony-2">create a custom form field type in Symfony 2</a> by extending the AbstractType.
</p>
<blockquote>
I am finally starting to dive into symfony 2 properly. Yes - it's taken a while, work has taken me in different directions! I found myself needing to create a custom form field type pretty quickly, but couldn't find much in the way of documentation to do so, so I thought I'ld throw it up here; partly to help others, but mostly to get feedback to make sure I'm not approaching this from the wrong angle.
</blockquote>
<p>
He includes the code that creates his custom "Person" model and the class to create his "transport type" select box that pulls in its values from a "choice list" class. He registers it in his bundle and it can then be included in his buildForm() method just like any other form field.
</p>]]></description>
      <pubDate>Tue, 16 Aug 2011 12:04:37 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[RubySource.com: PHP to Ruby: Modules, Mixins and Ducks]]></title>
      <guid>http://www.phpdeveloper.org/news/16722</guid>
      <link>http://www.phpdeveloper.org/news/16722</link>
      <description><![CDATA[<p>
In his latest article comparing some of the functionality of PHP to Ruby, <i>Dave Kennedy</i> looks at <a href="http://rubysource.com/php-to-ruby-modules-mixins-and-ducks/">modules, mixins and ducks</a> and how they compare to PHP's interfaces and abstract classes.
</p>
<blockquote>
If you have been writing PHP for a few years you will no doubt have come across Interfaces and Abstract classes. They were introduced in PHP5 object model and since have had medium usage in the PHP world. If you Google "PHP Interfaces" you will get some results on the official documentation and the rest saying how pointless they are. Why the divide? I believe it is mainly down to lack of understanding to what interfaces give you. They imply what your classes should do, but that's it. Yep, we are talking programming contracts.
</blockquote>
<p>
He starts with some code examples of an interface and a class that implements it (to work with PDFs). He makes an abstract class to extend the functionality even further and allow for different kinds of reporting PDFs to be generated. From there he moves into the Ruby world, showing examples of duck typing and modules to avoid duplication (mixins).
</p>]]></description>
      <pubDate>Tue, 16 Aug 2011 09:11:35 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Bence Eros' Blog: Using Inheritance]]></title>
      <guid>http://www.phpdeveloper.org/news/15529</guid>
      <link>http://www.phpdeveloper.org/news/15529</link>
      <description><![CDATA[<p>
In <a href="http://erosbence.blogspot.com/2010/11/using-inheritance.html">this new post</a> to his blog, <i>Bence</i> looks at how inheritance is commonly used in PHP applications and how, if not controlled carefully can be something that creates bad habits among PHP developers.
</p>
<blockquote>
In fact I think that using inheritance all the time is a very big mistake and makes your code hard to maintain and more hard to integrate (the latter is a mistake for application codes and a fatal mistake for libraries). The main problem with inheritance is that if you use it for coupling two classes, then a very important property of the subclass is used up: it's superclass. It is taken, reserved, and it can not be used for anything else furthermore. If you want to connect your subclass to an other class using inheritance, you can't.
</blockquote>
<p>
He recommends avoiding the typical uses of typical superclass/subclass inheritance unless what you're doing specifically requires it. Working with interfaces, abstract classes and good composition planning is a much better idea.
</p>]]></description>
      <pubDate>Thu, 02 Dec 2010 12:14:39 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[OpenSky Blog: Inheritance in PHP, or why you want to use an Interface or an Abstract class...]]></title>
      <guid>http://www.phpdeveloper.org/news/15514</guid>
      <link>http://www.phpdeveloper.org/news/15514</link>
      <description><![CDATA[<p>
On the OpenSky blog today there's <a href="http://engineering.shopopensky.com/post/inheritance-in-php-or-why-you-want-to-use-an-interface-or-an-abstract-class">a new post</a> about object oriented development and class structure. More specifically about how you should use interfaces and abstract classes if you want to truly lock down the methods of your classes.
</p>
<blockquote>
Every class has an interface, every class can be typehinted as a method argument, typehint lets you specify the collaborator requirements. Not every typehint is the same.
</blockquote>
<p>
He includes an example of how, despite a "BankAccount" type hint, classes for different types of accounts can be created and methods from the parent can be overwritten. To help remedy the situation, he shows a more structured example that uses interfaces/an abstract class to define the BankAccount structure, setting requirements on the child class functionality. 
</p>]]></description>
      <pubDate>Tue, 30 Nov 2010 11:09:17 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[NETTUTS.com: Understanding and Applying Polymorphism in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/15103</guid>
      <link>http://www.phpdeveloper.org/news/15103</link>
      <description><![CDATA[<p>
On the NETTUTS.com site today there's a new tutorial by <i>Steve Guidetti</i> about understanding and handling polymorphism in PHP - making interfaces to multiple objects that all work the same way. In <a href="http://net.tutsplus.com/tutorials/php/understanding-and-applying-polymorphism-in-php/">this tutorial</a> he gets more in depth and includes some code to illustrate.
</p>
<blockquote>
In object oriented programming, polymorphism is a powerful and fundamental tool. It can be used to create a more organic flow in your application. This tutorial will describe the general concept of polymorphism, and how it can easily be deployed in PHP.
</blockquote>
<p>
He explains to concept of polymorphism for those that haven't seen it before - common interfaces to multiple objects - and how to can help make using the parts of your application much simpler. In his code examples he uses interfaces and abstract classes to make the connections. The interfaces define the structure to follow and the abstract classes are the multiple objects that must follow it.
</p>]]></description>
      <pubDate>Thu, 09 Sep 2010 11:13:37 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Test.icial.ly Blog: Why are interfaces widely ignored in the PHP world...]]></title>
      <guid>http://www.phpdeveloper.org/news/14524</guid>
      <link>http://www.phpdeveloper.org/news/14524</link>
      <description><![CDATA[<p>
In a new post to the test.icial.ly blog today <i>Christian</i> looks at <a href="http://test.ical.ly/2010/05/12/why-are-interfaces-widely-ignored-in-the-php-world-and-what-use-do-they-have-when-working-with-symfony/">interfaces in PHP</a> and why they seem to be ignored in a lot of the development work being done.
</p>
<blockquote>
Every once in a while I stumble upon interfaces or somebody mentions them to me. Whenever this happens I realise that the use of Interfaces as an OOP key feature in PHP is next to none at all. But why is that?
</blockquote>
<p>
They note that, while interfaces are used all over projects in other languages, it seems like PHP development has steered away from their use. They define normal interfaces and abstract interfaces for those that don't know and talk about the differences between them. He also includes a brief code sample with description of its use and a bit about interfaces and frameworks.
</p>]]></description>
      <pubDate>Mon, 17 May 2010 16:09:23 -0500</pubDate>
    </item>
  </channel>
</rss>

