Tom's Blog

From tech to non-tech

Writing Testable Code

| Comments

Last week I watched 3 half an hour videos about how to write testable code. These videos re iterated a lot that I already knew but in a way still opened my eyes. I found them cool enough that I would like to share these with you and I think that if you watch these you will be able to write more testable code starting from today!

The Clean Code Talks - Unit Testing

  • Introduction to the series
  • It is not about writing tests it is about writing testable code
  • Explains and shows hard to test code
  • Goes over different levels of tests and argues about their importance
  • Explains how to write more testable code

The Clean Code Talks - Don’t Look For Things!

  • Globa state and how it will hurt your tests
  • Law of Demeter
  • Dependency Injection
    • Business logic
    • Wiring and creation logic

The Clean Code Talks - Global State and Singletons

  • Global state and insanity
  • Singletons and singletons
  • Deceptive APIs

Conclusions

Writing tests is easier than you think but for easy tests you need your code to be set up in a way that makes it easy to test!

Comments