News for hackers. Stuff that matters.
Re:Ask HN: What's the largest amount of bad code you have ev... by mooreds on Wednesday November 14, 2018 @07:32AM (#18449353)
Love the idea of this.

In my experience it's far easier to introduce testing by focusing on unit testing complicated, stateless business logic. The setup is less complex, the feedback cycle is quick, and the value is apparent ("oh gosh, now I understand all these edge cases and can change this complicated code with more confidence"). I think it also leads to better code at the class/module/function level.

In my experience once a test (of any kind) saves a developer from a regression, they become far more amenable to writing more tests.

That said I think starting with integration tests might be a good area of growth for me.

Re:Ask HN: What's the largest amount of bad code you have ev... by TickleSteve on Wednesday November 14, 2018 @08:19AM (#18449613)
In general, I test those things that relate to the application, not those about the implementation.

i.e. Test business logic edge-cases, don't test a linked-list implementation... that's just locking your design in.

Re:Ask HN: What's the largest amount of bad code you have ev... by int_19h on Wednesday November 14, 2018 @06:49PM (#18455437)
Writing functional tests is easy when you have a clear spec. If you do, tests are basically the expression of that spec in code. Conversely, if they're hard to write, that means that your spec is underspecified or otherwise deficient (and then, as a developer, ideally, you go bug the product manager to fix that).
Re:Ask HN: What's the largest amount of bad code you have ev... by mooreds on Wednesday November 14, 2018 @10:58AM (#18450810)
Right, like I said "complicated business logic". I agree completely, I have no desire to test a library or framework (unless it's proven to need it).