Book description
If you program in C++ you've been neglected. Test-driven development (TDD) is a modern software development practice that can dramatically reduce the number of defects in systems, produce more maintainable code, and give you the confidence to change your software to meet changing needs. But C++ programmers have been ignored by those promoting TDD--until now. In this book, Jeff Langr gives you hands-on lessons in the challenges and rewards of doing TDD in C++.
Modern C++ Programming With Test-Driven Development, the only comprehensive treatment on TDD in C++ provides you with everything you need to know about TDD, and the challenges and benefits of implementing it in your C++ systems. Its many detailed code examples take you step-by-step from TDD basics to advanced concepts. As a veteran C++ programmer, you're already writing high-quality code, and you work hard to maintain code quality. It doesn't have to be that hard.
In this book, you'll learn:
how to use TDD to improve legacy C++ systems
how to identify and deal with troublesome system dependencies
how to do dependency injection, which is particularly tricky in C++
how to use testing tools for C++ that aid TDD
* new C++11 features that facilitate TDD
As you grow in TDD mastery, you'll discover how to keep a massive C++ system from becoming a design mess over time, as well as particular C++ trouble spots to avoid. You'll find out how to prevent your tests from being a maintenance burden and how to think in TDD without giving up your hard-won C++ skills. Finally, you'll see how to grow and sustain TDD in your team.
Whether you're a complete unit-testing novice or an experienced tester, this book will lead you to mastery of test-driven development in C++.
Table of contents
- Modern C++ Programming with Test-Driven Development
- For the Best Reading Experience...
- Table of Contents
- Early Praise for Modern C++ Programming with Test-Driven Development
- Foreword
- Introduction
- Chapter 1: Global Setup
-
Chapter 2: Test-Driven Development: A First Example
- Setup
- The Soundex Class
- Getting Started
- Fixing Unclean Code
- Incrementalism
- Fixtures and Setup
- Thinking and TDD
- Test-Driving vs. Testing
- What If?
- One Thing at a Time
- Limiting Length
- Dropping Vowels
- Doing What It Takes to Clarify Tests
- Testing Outside the Box
- Back on Track
- Refactoring to Single-Responsibility Functions
- Finishing Up
- What Tests Are We Missing?
- Our Solution
- The Soundex Class
- Teardown
- Chapter 3: Test-Driven Development Foundations
- Chapter 4: Test Construction
- Chapter 5: Test Doubles
- Chapter 6: Incremental Design
- Chapter 7: Quality Tests
-
Chapter 8: Legacy Challenges
- Setup
- Legacy Code
- Themes
- The Legacy Application
- A Test-Driven Mentality
- Safe Refactoring to Support Testing
- Adding Tests to Characterize Existing Behavior
- Sidetracked by the Reality of Legacy Code
- Creating a Test Double for rlog
- Test-Driving Changes
- A New Story
- A Brief Exploration in Seeking Faster Tests
- Mondo Extracto
- Spying to Sense Using a Member Variable
- Spying to Sense Using a Mock
- Alternate Injection Techniques
- Large-Scale Change with the Mikado Method
- An Overview of the Mikado Method
- Moving a Method via Mikado
- More Thoughts on the Mikado Method
- Is It Worth It?
- Teardown
-
Chapter 9: TDD and Threading
- Setup
- Core Concepts for Test-Driving Threads
- The GeoServer
- Performance Requirements
- Designing an Asynchronous Solution
- Still Simply Test-Driving
- Ready for a Thready!
- Exposing Concurrency Issues
- Creating Client Threads in the Test
- Creating Multiple Threads in the ThreadPool
- Back to the GeoServer
- Teardown
- Chapter 10: Additional TDD Concepts and Discussions
- Chapter 11: Growing and Sustaining TDD
- Appendix 1: Comparing Unit Testing Tools
- Appendix 2: Code Kata: Roman Numeral Converter
- Appendix 3: Bibliography
Product information
- Title: Modern C++ Programming with Test-Driven Development
- Author(s):
- Release date: October 2013
- Publisher(s): Pragmatic Bookshelf
- ISBN: 9781937785482
You might also like
book
Effective Modern C++
Coming to grips with C++11 and C++14 is more than a matter of familiarizing yourself with …
video
Complete Modern C++ (C++11/14/17)
This course provides an extensive exploration of C++. The journey starts with mastering the syntax and …
book
Modern C++ Design: Generic Programming and Design Patterns Applied
Modern C++ Design is an important book. Fundamentally, it demonstrates ‘generic patterns’ or ‘pattern templates’ as …
book
Modern C++ for Absolute Beginners: A Friendly Introduction to C++ Programming Language and C++11 to C++20 Standards
Learn the C++ programming language in a structured, straightforward, and friendly manner. This book teaches the …