News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

NetTuts.com:
Refactoring Legacy Code Part 9 - Analyzing Concerns
July 24, 2014 @ 11:27:56

The NetTuts.com site has posted part nine in their series sharing helpful hints and methods for refactoring legacy code. In this new post they continue on with their example application and look at where methods should be moved to/created and mocking in their tests.

In this tutorial, we will continue to focus on our business logic. We will evaluate if RunnerFunctions.php belongs to a class and if so, to which class? We will think about concerns and where methods belong. Finally, we will learn a little bit more about the concept of mocking.

They show how to move some of the "Runner" functions from procedural to OOP, integrating them with some of the classes and methods that already exist. Tests are also included showing how it all links together. From there they get into concerns about the placement of functionality and how that relates to the work at hand. They also use Mockery to mock out some of the needed objects in their tests for the new structure.

0 comments voice your opinion now!
refactor legacy code series part6 concerns functionality mock unittest

Link: http://code.tutsplus.com/tutorials/refactoring-legacy-code-part-9-analyzing-concerns--cms-21760

blog comments powered by Disqus

Similar Posts

Matthias Noback: Inject a repository instead of an entity manager

Chris Hartjes: The Grumpy Programmer's PHPUnit Cookbook

VG Tech Blog: Mocking the File System Using PHPUnit and vfsStream

Community News: PHPUnit 3.2 Released

Dejan Angelov: Experimental upgrading to Laravel 5: How I did it


Community Events

Don't see your event here?
Let us know!


install framework symfony2 opinion podcast example laravel api release series application library conference configure introduction language performance community interview php7

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework