When I do OO programming, automated testing feels harder


When I do OO programming, automated testing feels harder. Here's why: Private methods, shared state (properties outside the method), and complex dependency injection config.

When I do functional programming, testing feels obvious:
1. Call a func
2. Assert on the response
Early in my career, I did mostly OO. I think this is why I avoided automated testing for years. Testing in OO looked complex and intimidating. It required me to dramatically change our code to support it.

Later, I moved to a functional style. Suddenly testing felt obvious.

View original on X