Modern C++ Programming with Test-Driven Development: Code Better, Sleep Better (Paperback)
暫譯: 現代 C++ 程式設計與測試驅動開發:寫出更好的程式,睡得更好 (平裝本)

Jeff Langr

買這商品的人也買了...

相關主題

商品描述

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++.

What You Need

  • A C++ compiler running under Windows or Linux, preferably one that supports C++11. Examples presented in the book were built under gcc 4.7.2.
  • Google Mock 1.6 (downloadable for free; it contains Google Test as well) or an alternate C++ unit testing tool. Most examples in the book are written for Google Mock, but it isn't difficult to translate them to your tool of choice.
  • A good programmer's editor or IDE.
  • cmake, preferably. Of course, you can use your own preferred make too. CMakeLists.txt files are provided for each project. Examples provided were built using cmake version 2.8.9.
  • Various freely-available third-party libraries are used as the basis for examples in the book. These include:
  • cURL
  • JsonCpp
  • Boost (filesystem, date_time/gregorian, algorithm, assign)

Several examples use the boost headers/libraries. Only one example uses cURL and JsonCpp.

商品描述(中文翻譯)

如果你使用 C++ 編程,你可能會感到被忽視。測試驅動開發(Test-Driven Development, TDD)是一種現代軟體開發實踐,可以顯著減少系統中的缺陷數量,產生更易於維護的代碼,並讓你有信心根據不斷變化的需求來改變你的軟體。但 C++ 程式設計師在推廣 TDD 的過程中一直被忽略——直到現在。在這本書中,Jeff Langr 為你提供了在 C++ 中進行 TDD 的挑戰和回報的實作課程。

《現代 C++ 程式設計與測試驅動開發》是唯一全面探討 C++ 中 TDD 的書籍,提供了你需要了解的所有 TDD 相關知識,以及在你的 C++ 系統中實施 TDD 的挑戰和好處。書中許多詳細的代碼範例將帶你一步步從 TDD 基礎到進階概念。作為一名資深的 C++ 程式設計師,你已經在撰寫高品質的代碼,並努力維持代碼質量,但這不必如此困難。

在這本書中,你將學到:
- 如何使用 TDD 改進舊有的 C++ 系統
- 如何識別和處理麻煩的系統依賴
- 如何進行依賴注入,這在 C++ 中特別棘手
- 如何使用有助於 TDD 的 C++ 測試工具
- 促進 TDD 的新 C++11 特性

隨著你在 TDD 精通度的提升,你將發現如何防止龐大的 C++ 系統隨著時間的推移變成設計混亂,以及需要避免的特定 C++ 問題點。你將學會如何防止測試成為維護負擔,以及如何在不放棄你辛苦獲得的 C++ 技能的情況下進行 TDD 思考。最後,你將看到如何在你的團隊中發展和維持 TDD。

無論你是完全不懂單元測試的新手,還是經驗豐富的測試者,這本書將引導你掌握 C++ 中的測試驅動開發。

你需要的:
- 一個在 Windows 或 Linux 上運行的 C++ 編譯器,最好支持 C++11。書中示例是在 gcc 4.7.2 下構建的。
- Google Mock 1.6(可免費下載;它也包含 Google Test)或其他 C++ 單元測試工具。書中的大多數示例都是為 Google Mock 編寫的,但將它們轉換為你選擇的工具並不困難。
- 一個好的程式設計編輯器或 IDE。
- cmake,最好是這樣。當然,你也可以使用自己喜歡的 make。每個項目都提供了 CMakeLists.txt 文件。提供的示例是使用 cmake 版本 2.8.9 構建的。
- 書中示例的基礎使用了各種免費的第三方庫,包括:
- cURL
- JsonCpp
- Boost(filesystem、date_time/gregorian、algorithm、assign)

幾個示例使用了 Boost 標頭/庫。只有一個示例使用了 cURL 和 JsonCpp。