Self-documenting code vs Javadocs?

Posted by Andiaz on Programmers See other posts from Programmers or by Andiaz
Published on 2011-11-30T10:00:16Z Indexed on 2011/11/30 10:31 UTC
Read the original article Hit count: 286

Recently I've been working on refactoring parts of the code base I'm currently dealing with - not only to understand it better myself, but also to make it easier for others who are working on the code.

I tend to lean on the side of thinking that self-documenting code is nice. I just think it's cleaner and if the code speaks for itself, well... That's great.

On the other hand we have documentation such as javadocs. I like this as well, but there's a certain risk that comments here gets outdated (as well as comments in general of course). However, if they are up-to-date they can be extremely useful of say, understanding a complex algorithm.

What are the best practices for this? Where do you draw the line between self-documenting code and javadocs?

© Programmers or respective owner

Related posts about java

Related posts about documentation