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

Developer Tutorials Blog: Testing email routines in web applications

Lukas Smith's Blog: Its like everybody sees the wall coming...

Community News: Free Webcast - Connecting PHP to Microsoft Technologies (July 10th)

Sebastian Bergmann's Blog: Copy & Paste Detection in PHPUnit 3.2

Jani Hartikainen's Blog: Unit testing 4: Mock objects and testing code which uses the database


Community Events





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


conference language release deployment interview podcast development introduction threedevsandamaybe symfony api developer series list laravel framework code tips community zendserver

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