7

Refactoring | The PHP Consulting Company

 3 years ago
source link: https://thephp.cc/news/2021/01/refactoring
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
The PHP Consulting Company

Test-Driven Development has a Red-Green-Refactor cycle. First you write down your expectation as test code, then you make that test green. Writing code that works is hard enough, therefore we often fail at making it "pretty" at the same time. That is why we often end up with code that works, but is hard to maintain. Refactoring to the rescue.

Refactoring

Martin Fowler explains:

"Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior."

This works great if your code it covered by automated tests. But what if your legacy application has no unit tests? In their live coding session at The Online PHP Conference, Arne and Stefan will demonstrate how to refactor existing code and how to use characterization tests to safeguard these changes.

More about Stefan's and Arne's live coding session

Share this article:

Welcome to The PHP Consulting Company (thePHP.cc). We are leading experts on software development, specifically using PHP and related technologies.

You can find us on Twitter, LinkedIn, and XING.

We speak at conferences, offer best-in-breed training, publish seminal articles, and are available for consulting.

About the authors

Sebastian Bergmann is the author of PHPUnit and sets the industry standard of quality assurance.

Arne Blankerts has solutions ready before others have even understood the problem.

Stefan Priebsch inspires with a combination of new ideas and field-tested approaches.

How to get in touch with us:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK