News for hackers. Stuff that matters.
Re:Stop being frantic about code testing by AtNightWeCode on Wednesday March 31, 2021 @03:08PM (#26651626)
I think one of the major advantages of writing testable code is that you get better code and architecture for free. You end up with less stateful code, more pure functions, more clear dependencies, fewer hard coded things, flows that are understandable for humans and so on.

If a solution is so complex that writing a complete test for it is hard then the solution is probably not very good and the next coder will not enjoy debugging it.

For UX for instance I agree that automated tests are not that valuable.

Re:Stop being frantic about code testing by rualca on Wednesday March 31, 2021 @04:47PM (#26652971)
> I think one of the major advantages of writing testable code is that you get better code and architecture for free.

This.

Untestable code tends to be so tightly coupled that's practically impossible to isolate subcomponents or even pure function bits. Being untestable is synonymous to being unmaintainable. Complaining about the hassle of creating unit tests is a red flag about the overall state of the whole project.