Hacker News new | ask | show | jobs
by zo7 3126 days ago
The author mentions that they only analyzed the collection of C# repositories that they used in their study on Singletons, but I would expect the results to be different depending on the language used.

In my experience with Python, unit testing is essential to catch careless errors (typos, bad ducks, etc. that can't be caught by a linter) that would cause your program to crash at runtime, so there's a slightly different motivation for writing unit tests. It's a less restrictive language so you don't have the issues with private methods like the author mentioned, and is (at least to me) a bit less of a strain to write tests. Unit testing might correlate more with good hygiene for a Python codebase because testing is vital to check correctness and there are fewer situations where you have to mangle your code for the tests, whereas it may not in C# because you get guarantees from the type system that makes testing less vital and writing tests is more of a nuisance.