Hacker News new | ask | show | jobs
by moomoo11 330 days ago
If you follow basic things like single responsibility principle and layers you don’t need code documentation.

The tests can be a useful guide on how the code is supposed to work. But let’s be honest most test suites become wack any time you work on really big or complex projects.

I think the best thing you can do is optimize for that. Write code in a clean way, and organize tests in a way that can quickly convey high level functionality to maintainers.

If you find yourself writing tests that are doing too much or need to add documentation to code, you’re probably doing other things wrong too. (Not you btw just saying in general)

1 comments

> If you follow basic things like single responsibility principle and layers you don’t need code documentation.

Yes, write the code so cleanly, and with such good names, that you don't need documentation. Absolutely.

But the code is never quite clean enough, and the names are never clear enough, and the people coming later don't know everything that you know. So write documentation anyway. And not just "sling something out there" - write the best documentation you can; write it as well as you write the code.

(No, I don't do as I say. But it's the right thing to do...)