Hacker News new | ask | show | jobs
by bbq 1219 days ago
Lots of people in the comments here stuck on the boring semantic definition debate of mocks vs stubs vs nulls vs whatever.

This is not really by what the article is about IMHO. It’s a great overview of how to grow and organize your application with some opinionated patterns that give some favorable properties to your system. The nullable stuff just helps achieve those properties. If you want to use a mocking library to write nullables, and call them mocks, fine. Not important.

2 comments

I think this might be a problem of expectation management that could stem from the title. A headline along the lines of “Patterns to organize your code for testability” might reflect the general character of the article more clearly. But as it specifically says “testing without mocks”, I was intuitively expecting something different, and even was a bit confused when the author suggested techniques that I would refer to as “mocking”.
Yes, exactly. “Bake your mocks into your third-party library implementations” is an interesting idea and might be a useful thing to do, but it’s certainly not “testing without mocks.”
Agreed and I find this happening a lot in discussion of testing. It seems everyone/every company has "their way" of doing testing, which at times even includes new words for certain concepts that they find useful (e.g. stubs) and then the conversation about testing gets muddled by people doing things/naming things differently.

I only recently got into testing my code and while I love writing tests, getting started was kind of difficult because there was just so much noise. I eventually had to find one person to follow in my space (Kent C. Dodds) and just kind of go all in on his methodology.

I don't always test my code But when I do, I do it in production.