<?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>Sat, 25 May 2013 08:58:56 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Reddit.com: Moving a large existing project onto a framework]]></title>
      <guid>http://www.phpdeveloper.org/news/19123</guid>
      <link>http://www.phpdeveloper.org/news/19123</link>
      <description><![CDATA[<p>
On Reddit.com a discussion has started up around a question asked about legacy application migration - things to consider when <a href="http://www.reddit.com/r/PHP/comments/17lpl8/moving_a_large_existing_project_onto_a_framework/">moving a large existing project onto a framework</a>.
</p>
<blockquote>
I am working for an online store that has a codebase which has spanned dozens of developers and has been constantly upgraded. The codebase has its problems but it is not too bad. I would love to put it onto a framework like laravel and systematically start cleaning up as I go, but I am unsure if it will work trying to shove a framework into the current site. Has anyone done something similar, it would take me months to rewrite the whole system, has anyone done something like this successfully? Any advice would be appreciated.
</blockquote>
<p>There's lots of good recommendations made in the comments including:</p>
<ul>
<li>"If it were me, I'd take a step back before trying to build on top of a framework. I'd start by refactoring the existing codebase out into PSR-0 compliant namespace."
<li>"In my experience you only rewrite an entire application if what you have has become too expensive to maintain. At this point it is actually more cost effective to rewrite it using a framework."
<li>"We have recently moved our website to the Symfony2 framework at my company [...] it definitely is not a one programmer job."
<li>"Whatever you do, replace one bit at a time. And always strive to de-couple code."
</ul>
<p>
Read up on the rest of the responses or add your own <a href="http://www.reddit.com/r/PHP/comments/17lpl8/moving_a_large_existing_project_onto_a_framework/">to the post</a>.
</p>]]></description>
      <pubDate>Fri, 01 Feb 2013 12:18:13 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Justin Carmony: Refactoring or Rebuilding: Working with Legacy Code]]></title>
      <guid>http://www.phpdeveloper.org/news/18427</guid>
      <link>http://www.phpdeveloper.org/news/18427</link>
      <description><![CDATA[<p>
In <a href="http://www.justincarmony.com/blog/2012/08/30/refactoring-or-rebuilding-working-with-legacy-code/">this post</a> to his site, <i>Justin Carmony</i> shares some of his experience in working with a legacy code base and shares some of the steps he's taking in his own work to modernize it.
</p>
<blockquote>
There is [still] one big piece written in a less than ideal system. Its still PHP, but much more hacked together. It is our backend CMS system for controlling the website. It is painful to use, and we get many complaints all the time about it. [...] on Twitter, I saw a link for a talk Paul M. Jones gave at the Nashville PHP Usergroup. It was entitled: "<a href="http://paul-m-jones.com/archives/2667">It Was Like That When I Got Here: Steps Toward Modernizing a Legacy Codebase</a>." I couldn't think of a better title for that talk, nor a better talk to listen to at this very moment.
</blockquote>
<p>
He mentions the steps he taking to further advance his own project towards a better, non-legacy state including an audit of the current functionality and getting input from users as to which features give them the most pain.
</p>
<blockquote>
Using these lists to decide what to refactor, we can get the biggest gains for the least amount of work. If we were to rebuild, we would get the smallest gains (if any) of barely having something functional with the greatest effort.
</blockquote>]]></description>
      <pubDate>Fri, 31 Aug 2012 08:23:24 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: Record and replay for testing of legacy PHP applications]]></title>
      <guid>http://www.phpdeveloper.org/news/18122</guid>
      <link>http://www.phpdeveloper.org/news/18122</link>
      <description><![CDATA[<p>
In <a href="http://css.dzone.com/articles/record-and-replay-testing">this new post</a> to DZone.com <i>Giorgio Sironi</i> looks at a method for "recording" the request and response information for an application that might be lacking in documentation using PHP's <a href="http://php.net/manual/en/book.outcontrol.php">output buffering</a>.
</p>
<blockquote>
So you've got this big ball of code. You don't even know how to call all of these scripts, but the code is in production and works just fine (until you have to change even a single line). How to define some characterization tests that describe how the .php scripts work now? [...]  If tests do not exist, we do not know if they expect GET or POST requests, which parameters they contain, and above all what their response should be in correct and error cases. Even if all the links and calling code are under your control, it may be faster to go for the recording approach. If other applications and machines call your .php files, it is your only choice.
</blockquote>
<p>
He suggests using <a href="http://php.net/ob_start">ob_start</a> and the output buffering methods to handle the recording as it lets us define a callback (or in his case, a recording object). He includes an abstract version of it, showing how to implement a "Tape" class and a "record" method to handle the data and push it into a log or some other recording mechanism.
</p>]]></description>
      <pubDate>Thu, 21 Jun 2012 10:43:09 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Laura Thompson's Blog: All systems suck]]></title>
      <guid>http://www.phpdeveloper.org/news/16376</guid>
      <link>http://www.phpdeveloper.org/news/16376</link>
      <description><![CDATA[<p>
<i>Laura Thompson</i> has a quick post to her blog explaining one simple fact that all developers (or really anyone even loosely related to computing systems) should remember - <a href="http://www.laurathomson.com/2011/05/all-systems-suck/">all systems suck</a>.
</p>
<blockquote>
I've been thinking a lot about this idea lately.  I've spent a lot of years as an engineer and consultant fixing other people's systems that suck, writing my own systems that suck, and working on legacy systems, that, well, suck. Don't let anyone fool you.  All systems suck, to a greater or lesser extent
</blockquote>
<p>
She presents her "slightly jaded" points of view about legacy systems, current systems and ones yet to be built nothing that, no matter how impressive and well-planned out they are, they'll still suck (some maybe just a bit less than others). 
</p>
<blockquote>
Here's the punchline: sucking is like scaling.  You just have to keep on top of it, keep fixing and refactoring and improving and rewriting as you go.  Sometimes you can manage the suck in a linear fashion with bug fixes and refactoring, and sometimes you need a phase change where you re-do parts or all of the system to recover from suckiness.
</blockquote>]]></description>
      <pubDate>Tue, 24 May 2011 10:08:22 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Qafoo Blog: Testing legacy code]]></title>
      <guid>http://www.phpdeveloper.org/news/14885</guid>
      <link>http://www.phpdeveloper.org/news/14885</link>
      <description><![CDATA[<p>
On the Qafoo blog today there's <a href="http://qafoo.com/blog/003_testing_legacy_code.html">a new article</a> talking about testing the one thing that we as developers can fear the most - legacy code.
</p>
<blockquote>
Today we know about the benefits of Test Driven Development and normally also start new projects using TDD. Most projects from the last couple of years integrated this method in their daily development process, which often results in in good code coverage results of 90% and above. But what about all the other old projects, you still manage in your daily work?
</blockquote>
<p>
They offer three possible solutions to the problem with the third being their recommended option - adding tests to the code as we have to change it. This can still lead to a code base with less than ideal coverage numbers so they've developed a new tool, <a href="http://github.com/manuelpichler/php-change-coverage">PHP_ChangeCoverage</a>, that creates a new kind of report based on a timeframe rather than an overall codebase coerage. You can see an example of the report <a href="http://qafoo.com/blog/images/phpccov_without_timerange.png">here</a> (versus <a href="http://qafoo.com/blog/images/phpccov_no_coverage.png">this</a>). Installation instructions are also included.
</p>]]></description>
      <pubDate>Mon, 02 Aug 2010 09:26:41 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matt Curry's Blog: Review: Refactoring Legacy Applications Using CakePHP]]></title>
      <guid>http://www.phpdeveloper.org/news/12313</guid>
      <link>http://www.phpdeveloper.org/news/12313</link>
      <description><![CDATA[<p>
<i>Matt Curry</i> has <a href="http://www.pseudocoder.com/archives/2009/04/08/review-refactoring-legacy-applications-using-cakephp/">posted his review</a> of the recently released "Refactoring Legacy Applications Using CakePHP" book from <i>Chris Hartjes</i>. The book looks to help developers get a better feel for using CakePHP in real-world applications.
</p>
<blockquote>
Shortly after Chris Hartjes released his new book <A href="http://littlehart.net/book/">Refactoring Legacy Applications Using CakePHP</a> he contacted me and asked if I'd be willing to review it. I jumped at the chance and Chris emailed me the DRM free PDF. After posting it to <a href="http://www.littlehart.net/book/cakebook-sample.pdf">The PirateBay</a>, I settled in and gave it a read.
</blockquote>
<p>
Overall, <i>Matt</i> found the content of the book good but had a few things he might change - the "too smooth" nature of the update to CakePHP and the inclusion of a "partial refactoring" section (one that talked about only updating part of an application to the framework and integrating it with the rest of the site).
</p>]]></description>
      <pubDate>Thu, 09 Apr 2009 11:14:05 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Chris Hartjes' Blog: Preview of "Refactoring Legacy Applications using CakePHP"]]></title>
      <guid>http://www.phpdeveloper.org/news/11763</guid>
      <link>http://www.phpdeveloper.org/news/11763</link>
      <description><![CDATA[<p>
<i>Chris Hartjes</i>, a guru of <a href="http://www.cakephp.org">CakePHP</a> knowledge, is <a href="http://www.littlehart.net/atthekeyboard/2009/01/16/preview-of-refactoring-legacy-applications-using-cakephp/">putting together a book</a> - "Refactoring Legacy Applications Using CakePHP".
</p>
<blockquote>
Some of you may know that I have started writing a e-book about CakePHP. I'm planning on publishing it myself for the low, low price of $7. I thought I'd let people take a sneak peek at how it looks so far by publishing the first two chapters in very rough form. 
</blockquote>
<p>
You can find a rough draft <a href="http://cakebook.s3.amazonaws.com/cakephp_book.pdf">here</a> (pdf). Keep an eye out on <i>Chris'</i> blog for more (possible) preview releases and for the final product once its wrapped.
</p>]]></description>
      <pubDate>Mon, 19 Jan 2009 09:30:26 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Chris Hartjes' Blog: Converting Legacy Apps to CakePHP, Part 3]]></title>
      <guid>http://www.phpdeveloper.org/news/11653</guid>
      <link>http://www.phpdeveloper.org/news/11653</link>
      <description><![CDATA[<p>
<i>Chris Hartjes</i> continues his series looking at converting over legacy applications into a CakePHP environment with <a href="http://www.littlehart.net/atthekeyboard/2008/12/30/converting-legacy-apps-to-cakephp-part-3/">this third part</a>, a focus on what can be one of the hardest parts - separating out business logic and presentation logic.
</p>
<blockquote>
Anyway, onto other matters. As you saw in parts 1 and 2, a bug part in having a successful transition from legacy app to CakePHP is having an environment that is well suited to the use of a framework. Having laid out the groundwork for that switchover, it's time to talk about the part of a refactoring or porting that is most difficult: separating your business logic from your display logic. 
</blockquote>
<p>
He talks about fat models, skinny controllers and flexible views with some code to illustrate each. This method makes the models do most of the work while the controllers are more of a go-between for them and the views. The views, then, are pliable enough to work with whatever data might be thrown at them.
</p>]]></description>
      <pubDate>Wed, 31 Dec 2008 12:58:33 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Chris Hartjes' Blog: Converting Legacy Apps to CakePHP, Part 2]]></title>
      <guid>http://www.phpdeveloper.org/news/11535</guid>
      <link>http://www.phpdeveloper.org/news/11535</link>
      <description><![CDATA[<p>
<i>Chris Hartjes</i> has posted the <a href="http://www.littlehart.net/atthekeyboard/2008/12/04/converting-legacy-apps-to-cakephp-part-2/">second part</a> of his look at converting legacy applications over to a more structured CakePHP environment. In this new post he looks at working with the database schema.
</p>
<blockquote>
Now you've decided to convert your legacy app over to CakePHP, you will run into the first serious obstacle: your database schema. To put it bluntly, if your schema does not already account for relationships between multiple tables you are screwed. Given that CakePHP is good at generating the queries you need to pull related records in for you, you NEED that schema to contain relationships. 
</blockquote>
<p>
He talks about the importance of relationships, creating his working models and some things to get well acquainted with - ow relationships work in CakePHP, how to use <a href="http://book.cakephp.org/view/474/Containable">Containable behavior</a> and some good SQL to back you up should you need it.
</p>]]></description>
      <pubDate>Tue, 09 Dec 2008 10:26:09 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Chris Hartjes' Blog: Converting Legacy Apps to CakePHP, Part 1]]></title>
      <guid>http://www.phpdeveloper.org/news/11463</guid>
      <link>http://www.phpdeveloper.org/news/11463</link>
      <description><![CDATA[<p>
<i>Chris Hartjes</i> has <a href="http://www.littlehart.net/atthekeyboard/2008/11/27/converting-legacy-apps-to-cakephp-part-1/">started up a new series</a> on his blog about converting legacy applications over to shiny, new CakePHP framework versions.
</p>
<blockquote>
In my rapidly dwidling spare time I have been working on a project to convert an existing site for a legal services company over to PHP. I'm *this* close to being done, so I thought I'd share what I went through to get to where I am right now. [...] So after giving the code review I was asked to do the rewrite. The client realized that they had some serious maintenance issues on their hands and were in the process of creating a new look-and-feel for the site. Being the framework guy that I am, I indicated that porting the code over to a framework would be the best way to reduce maintenance issues going forward.
</blockquote>
<p>
The series will document the process he followed to convert the application over. In part two he'll get into the meat of things - reworking the database structure.
</p>]]></description>
      <pubDate>Thu, 27 Nov 2008 12:14:38 -0600</pubDate>
    </item>
  </channel>
</rss>
