Skip to Content
Modern C++ Programming with Test-Driven Development
book

Modern C++ Programming with Test-Driven Development

by Jeff Langr
October 2013
Intermediate to advanced
368 pages
9h 20m
English
Pragmatic Bookshelf
Content preview from Modern C++ Programming with Test-Driven Development

8.2 Legacy Code

Legacy code challenges tend to induce the strong motivator of fear into even the most senior developers. Consider having to specialize a small part of a longer, untested function. Imagine that getting your feature implemented is a matter of introducing three lines worth of variant behavior in the midst of thirty lines. As an experienced programmer, you know that the right design would involve factoring common behavior to a common place. The template method design pattern represents one acceptable solution.

(Another solution would involve introducing a conditional. But that’s often a recipe for gradual decay, as functions become weighted down with flags and nested blocks.)

Yet, also from the stance of experience, many programmers ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Effective Modern C++

Effective Modern C++

Scott Meyers
Modern CMake for C++

Modern CMake for C++

Rafał Świdziński
Embracing Modern C++ Safely

Embracing Modern C++ Safely

John Lakos, Vittorio Romeo, Rostislav Khlebnikov, Alisdair Meredith

Publisher Resources

ISBN: 9781941222423Errata