TDD should lead to better design - Deepstash

Bite‑sized knowledge

to upgrade

your career

Ideas from books, articles & podcasts.

TDD should lead to better design

TDD should lead to better design

TDD should simplify code, not make it more complicated. If your code becomes harder to read or maintain when you make it testable, you're doing TDD wrong.

You can learn two things:

  • You can write decoupled code without dependency injection, and
  • Maximising code coverage results in diminishing returns.

More complex code often means more cluttered code. Cluttered code is a convenient place for bugs to hide. It's also easier to find things when there's less clutter.

STASHED IN:

3

published ideas from this article:

MORE IDEAS FROM THE SAME ARTICLE

All software development is about the process of breaking a big problem down into smaller independent parts, combining the solutions to form an application that solves the big problem. 

Mocking is necessary when the decomposition strategy failed. When decomposition succeeds, a generic compo...

Unit tests test individual units (modules, functions, classes) in isolation from the rest of the program.

  • Generally, units are tested using the public interface of the unit, known as black-box testing. It leads to less brittle tests.
  • In white box testing - whe...

Code coverage is the amount of code covered by a test. Increasing coverage beyond 90% seems to have little continued correlation with lower bug density.

There are two kinds of coverage: 

  • Code coverage: how much of the code is exercised, and 
  • Case coverag...

A code smell is a surface indication that points to a deeper problem in the system.

Different types of code need different levels (and different kinds) of mocks. Some code exists primarily to facilitate I/O, in which case, there is little to do other than test I/O. Reducing...

Less coupling makes code easier to extend and maintain. Tight coupling makes code more rigid and brittle and more likely to break when changes are needed.

Coupling takes different forms: 

  • Subclass coupling is dependent on the implementation and hierarchy of the p...

Tight coupling has many causes: 

  • Mutation vs immutability  
  • Side-Effects vs purity/isolated side-effects  
  • Responsibility overload vs Do One Thing (DOT)  
  • Procedural instructions vs describing s...

IDEA ABOUT

Discover and save more ideas by creating a

FREE

Deepstash account.

Develop a

reading habit

, save

time

and create an amazing

knowledge library

.

GET THE APP:

MORE LIKE THIS

Testing in React Native

As your codebase expands, small errors and edge cases you don’t expect can cascade into larger failures. Bugs lead to bad user experience and ultimately, business losses. One way to prevent fragile programming is to test your code before releasing it into the wild.

There is more value in te...

5

STASHED IN:

8

Marcus Lemonis

“People, Process, Product”

5

STASHED IN:

46

What Is Functional Programming

Funcational Programming is a declarative way of programming.

4

STASHED IN:

7

published 7 ideas

Not your object oriented programming

0 Comments