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 2 - Magic Strings & Constants
April 03, 2014 @ 12:47:46

NetTuts.com has posted the second part of their "Refactoring Legacy Code" series today continuing on from their beginning of the series. They continue the refactor of their "trivia" application.

Old code. Ugly code. Complicated code. Spaghetti code. Jibberish nonsense. In two words, Legacy Code. This is a series that will help you work and deal with it. We first met our legacy source code in our previous lesson. [...] The time for the first changes have come and what better way to understand a difficult code base than start to extract magic constants and strings into variables? These seemingly simple tasks will give us greater and sometimes unexpected insights into the inner workings of legacy code. We will need to figure out the intentions of the original code author and find the proper names for the pieces of code that we've never seen before.

They talk about refactoring out things like "magic strings" and other hard-coded return values and checks. They mention updating the tests to reflect these changes while keeping an eye out for "magic constants" as well.

0 comments voice your opinion now!
refactoring unittest magic string constant trivia

Link: http://code.tutsplus.com/tutorials/refactoring-legacy-code-part-2-magic-strings-constants--cms-20527

blog comments powered by Disqus

Similar Posts

NetTuts.com: Refactoring Legacy Code: Part 2 - Magic Strings & Constants

Reddit.com: Avoid static methods at all costs? (testability)

Alvaro Videla: Using RabbitMQ in Unit Tests

Zend Developer Zone: Zend Framework application's PHPUnit suite 3x faster

Stefan Koopmanschap's Blog: Dutch PHP TestFest big success


Community Events

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


api opinion voicesoftheelephpant example release xdebug podcast php7 community series language extension introduction install unittest framework laravel laravel5 library interview

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