0%

Your code is a testament to your skills as a developer. No matter what language you use, your code should be clean, elegant, and uncluttered? With test-driven development (TDD), you'll write better code--code that's easy to understand, retains its elegance, and works for years to come.

This indispensable guide will show you how TDD works in three different languages: Go, JavaScript, and Python. With Learning Test-Driven Development at your side, you'll be able to:

  • Tame domain complexity using a divide-and-conquer approach
  • Understand how TDD works across languages, testing frameworks, and domain concepts
  • See how TDD enables continuous integration and continuous delivery
  • Support refactoring and redesign with TDD
  • Set up a continuous integration environment with the unit tests produced during TDD
  • Write clean, uncluttered code using TDD in Go, JavaScript, and Python

Table of Contents

  1. Preface
    1. What is Test-Driven Development
    2. A technique
    3. Designing and structuring code
    4. Enhanced simplicity
    5. Increased confidence
    6. Who is this book for
    7. What are the prerequisites for reading this book
    8. How to read this book
    9. Follow the book one language at a time
    10. Follow the book in two languages first and then in the third language
    11. Follow the book in all three languages simultaneously
    12. Conventions used in this book
    13. Typographical conventions
    14. Lexical conventions
    15. Using Code Examples
    16. The Apologies
    17. Why does this book use Go, JavaScript, and Python?
    18. Why not this other language?
    19. Why does this book have a “Chapter 0”?
  2. Chapter 0 - Introduction & Setup
    1. Setting up your development environment
    2. Common Setup
    3. Go
    4. JavaScript
    5. Python
    6. Where We Are
  3. I. Getting Started
  4. 1. The Money Problem
    1. Red-Green-Refactor — The Building Blocks of TDD
    2. What’s the problem?
    3. Our first failing test
    4. Go
    5. JavaScript
    6. Python
    7. Going for green
    8. Go
    9. JavaScript
    10. Python
    11. Cleaning up
    12. Go
    13. JavaScript
    14. Python
    15. Committing our changes
    16. Where We Are
    17. Go
    18. JavaScript
    19. Python
  5. 2. Multi-currency Money
    1. Enter the Euro
    2. Go
    3. JavaScript
    4. Python
    5. Keeping code DRY
    6. Go
    7. JavaScript
    8. Python
    9. Didn’t we just say “Don’t Repeat Yourself”?!
    10. Divide and Conquer
    11. Go
    12. JavaScript
    13. Python
    14. Cleaning Up
    15. Go
    16. JavaScript
    17. Python
    18. Committing Our Changes
    19. Where We Are
    20. Go
    21. JavaScript
    22. Python
  6. 3. Portfolio
    1. Designing our next test
    2. Go
    3. JavaScript
    4. Python
    5. Committing our changes
    6. Where We Are
  7. II. Modularization
  8. 4. Separation of Concerns
    1. Test and Production Code
    2. Unidirectional Dependency
    3. Dependency Injection
    4. Packaging and Deployment
    5. Modularization
    6. Removing Redundancy
    7. Where We Are
  9. 5. Packages and Modules in Go
    1. Separating our code into Packages
    2. Go Modules
    3. Creating a package
    4. Encapsulation
    5. Removing Redundancy in Tests
    6. Committing Our Changes
    7. Where We Are
  10. 6. Modules in JavaScript
    1. Separating our code into Modules
    2. A segue into JavaScript Modules
    3. CommonJS
    4. Asynchronous Module Definition (AMD)
    5. Universal Module Definition (UMD)
    6. ESModules
    7. Improving Our Tests
    8. Removing redundancy in tests
    9. Adding a test class and test methods
    10. Discovering and running tests automatically
    11. Produce output when tests run successfully
    12. Run all tests even when an earlier test assertion fails
    13. Committing Our Changes
    14. Where We Are
  11. 7. Modules in Python
    1. Separating Our Code into Modules
    2. Removing redundancy in tests
    3. Committing Our Changes
    4. Where We Are
  12. III. Features and Redesign
  13. 8. Evaluating a Portfolio
    1. Mixing money
    2. Go
    3. JavaScript
    4. Python
    5. Committing our changes
    6. Where We Are
  14. 9. Currencies, Currencies, Everywhere
    1. Making a Hash(map) of Things
    2. Go
    3. JavaScript
    4. Python
    5. Committing our changes
    6. Where We Are
  15. 10. Error Handling
    1. Error wish list
    2. Go
    3. JavaScript
    4. Python
    5. Committing our changes
    6. Where We Are
  16. 11. Banking on Redesign
    1. Dependency Injection
    2. Putting it all together
    3. Go
    4. JavaScript
    5. Python
    6. Committing our changes
    7. Where We Are
  17. IV. Finishing Up
  18. 12. A Living Document
    1. Changing exchange rates
    2. Go
    3. JavaScript
    4. Python
    5. Committing our changes
    6. Where We Are
  19. 13. Continuous Integration
    1. Core Concepts
    2. Version Control
    3. Build Server and Agent
    4. Artifact Repository
    5. Deployment Environment
    6. Putting it all together
    7. Create Github account
    8. Verify Github account
    9. Push code repository to Github
    10. Prepare for CI build scripts
    11. Go
    12. JavaScript
    13. Python
    14. Committing our changes
    15. Where We Are
  20. 14. Retrospective
    1. Profile
    2. Cyclomatic complexity
    3. Coupling
    4. Succinctness
    5. Purpose
    6. Cohesion
    7. Completeness
    8. Process
    9. Putting it all together
    10. Go
    11. JavaScript
    12. Python
    13. Where We Are
  21. A. Development Environment Setup
    1. Online REPLs
    2. Repl.it
    3. LeetCode
    4. CoderPad
    5. The Go Playground
    6. The comprehensive list of online REPLs
    7. Integrated Development Environments (IDEs)
    8. Visual Studio Code
    9. IntelliJ IDEA
    10. Eclipse
    11. Installing Language Tools
    12. Go
    13. JavaScript / ES6
    14. Python
  22. B. A brief history of the 3 languages
    1. Go
    2. JavaScript
    3. The assert module
    4. The module mechanism
    5. Python
  23. C. Acknowledgments
3.15.202.129