O'Reilly logo

Quality Code: Software Testing Principles, Practices, and Patterns by Stephen Vance

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Scaling Up

One of the bigger challenges in taming legacy code is the size and scope of the existing functions. Larger functions have more dependencies and more complicated logic. You first need to write characterization tests to capture the intent before refactoring to smaller, more focused functions. The functions that I deferred so far fall in that category. I had run out of simple functions and needed to forge ahead.

The next most complicated functions were the date and time parsing utility functions deferred earlier. Of the two remaining functions, splitDateTime() and parseDateInternal(), splitDateTime() was the easier. For one, parseDateInternal() calls splitDateTime(), and it also calls other functions of the datepicker, both original ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required