By Example
Kent Beck
TDD#
Test-Driven_Development#
Clean_code#
xUnit#
در توسعه نرمافزار، رسیدن به «کد تمیزی که همین حالا کار میکند» اغلب بهنظر متناقض میرسد. کتاب Test-Driven Development با رویکردی معکوس به این چالش پاسخ میدهد: پیش از نوشتن برنامه، برای آن تست بنویس.
این رویکرد، ایدهای نو نیست؛ بلکه همان اصل قدیمی مشخصکردن ورودی و خروجی پیش از کدنویسی است، با این تفاوت که در اینجا با زبانها و ابزارهای مدرن ترکیب شده است تا کدی ساده، تستپذیر و بدون باگ تولید شود.
نویسنده با ارائه دو پروژه کامل از ابتدا تا انتها، بهصورت عملی نشان میدهد که چگونه میتوان با نوشتن تست قبل از پیادهسازی، طراحی را بهصورت گامبهگام رشد داد، از تکرار جلوگیری کرد و با اطمینان بیشتری برنامهنویسی کرد.
در این کتاب یاد میگیرید:
کتاب Test-Driven Development نهتنها روش TDD را آموزش میدهد، بلکه آن را در دل توسعه چابک و تولید سریعتر نرمافزار قرار میدهد. این کتاب راهنمایی ارزشمند برای هر برنامهنویسی است که به دنبال کدی تمیز، ساختاریافته و مطمئن است.
Clean code that works--now. This is the seeming contradiction that lies behind much of the pain of programming. Test-driven development replies to this contradiction with a paradox--test the program before you write it.
A new idea? Not at all. Since the dawn of computing, programmers have been specifying the inputs and outputs before programming precisely. Test-driven development takes this age-old idea, mixes it with modern languages and programming environments, and cooks up a tasty stew guaranteed to satisfy your appetite for clean code that works--now.
Developers face complex programming challenges every day, yet they are not always readily prepared to determine the best solution. More often than not, such difficult projects generate a great deal of stress and bad code. To garner the strength and courage needed to surmount seemingly Herculean tasks, programmers should look to test-driven development (TDD), a proven set of techniques that encourage simple designs and test suites that inspire confidence.
By driving development with automated tests and then eliminating duplication, any developer can write reliable, bug-free code no matter what its level of complexity. Moreover, TDD encourages programmers to learn quickly, communicate more clearly, and seek out constructive feedback.
Readers will learn to:
This book follows two TDD projects from start to finish, illustrating techniques programmers can use to easily and dramatically increase the quality of their work. The examples are followed by references to the featured TDD patterns and refactorings. With its emphasis on agile methods and fast development strategies, Test-Driven Development is sure to inspire readers to embrace these under-utilized but powerful techniques.
Table of Contents
PART I: The Money Example
Chapter 1: Multi-Currency Money
Chapter 2: Degenerate Objects
Chapter 3: Equality for All
Chapter 4: Privacy
Chapter 5: Franc-ly Speaking
Chapter 6: Equality for All, Redux
Chapter 7: Apples and Oranges
Chapter 8: Makin’ Objects
Chapter 9: Times We’re Livin’ In
Chapter 10: Interesting Times
Chapter 11: The Root of All Evil
Chapter 12: Addition, Finally
Chapter 13: Make It
Chapter 14: Change
Chapter 15: Mixed Currencies
Chapter 16: Abstraction, Finally
Chapter 17: Money Retrospective
PART II: The xUnit Example
Chapter 18: First Steps to xUnit
Chapter 19: Set the Table
Chapter 20: Cleaning Up After
Chapter 21: Counting
Chapter 22: Dealing with Failure
Chapter 23: How Suite It Is
Chapter 24: xUnit Retrospective
PART III: Patterns for Test-Driven Development
Chapter 25: Test-Driven Development Patterns
Chapter 26: Red Bar Patterns
Chapter 27: Testing Patterns
Chapter 28: Green Bar Patterns
Chapter 29: xUnit Patterns
Chapter 30: Design Patterns
Chapter 31: Refactoring
Chapter 32: Mastering TDD
Kent Beck consistently challenges software engineering dogma, promoting ideas like patterns, test-driven development, and Extreme Programming. Currently affiliated with Three Rivers Institute and Agitar Software, he is the author of many Addison-Wesley titles.