I stand by my remarks. In particular:
Do you expect every programmer to understand the code you’ve written without checking any documentation?
Yes, almost all of the time I do. You may need to understand the problem domain (with or without documentation), but the code should stand alone nearly all the time. If it doesn’t then it’s bad code.
The purpose of comments and documentation is to give you first the whole picture. The code is there for the details.
Like I said earlier, I’ve been in this business a long time. I understand what comments and documentation are for. But I’ll say it again, my experience over 20+ years leads me to my opinion that comments and documentation do not make up for bad code. Good code, almost by definition, requires little of either.
Maintaining code that has no documentation is far difficult than code with documentation.
Not necessarily true. Documentation needs to be maintained along with the code (misleading documentation is worse than useless). That’s more work. Forever. For everybody who works on that code. So you should keep documentation to a minimum. This may or may not be zero, but if you can make your code understandable without documentation, that’s just got to be better. Most of the time that’s possible.
FWIW, the best code I’ve ever seen had no documentation at all (it had unit tests, which do the job better if done well).
If code and documentation aren’t necessary, why do these popular frameworks (for example frameworks for Java) have to write documentation?
I assume you mean comments and documentation, and I didn’t say they weren’t necessary. However, good frameworks require less documentation. If you have a framework that requires a lot of docs to be understood, I’ll argue you don’t have a well written framework.
I would point out that writing frameworks (ie code that is intended to be widely reused) is much more difficult than “normal” code. Which is why so few of them are very well written
Note that useful != well written.
Believe me I had handled a big chunk of framework that doesn’t even have documentation
I’ve handled a lot of code too, framework and otherwise, over the last 20 some years of professional programming. I’m speaking from that level of experience. You don’t fix crappy code with comments and documentation, you need to fix the code. My experience also very strongly correlates lots of comments with very poor code.
I rather do extra work documenting than allow my fellow programmer struggle.
If I was your fellow programmer, I’d rather you did extra work improving your code so you didn’t need to document it
Once upon a time, I thought as you did. Way back then, I was told that good code required comments only rarely. I didn’t believe it either
Maybe there is no point giving people the benefit of your experience, and you have to learn some things the hard way. But I urge you to do a bit of research and give writing code that doesn’t require comments and docs a try.