POV-Ray : Newsgroups : povray.off-topic : An interesting read : Re: An interesting read Server Time
28 Jul 2024 14:29:45 EDT (-0400)
  Re: An interesting read  
From: Orchid Win7 v1
Date: 11 Jan 2014 15:22:15
Message: <52d1a7f7$1@news.povray.org>
On 11/01/2014 08:13 PM, Warp wrote:
> Orchid Win7 v1<voi### [at] devnull>  wrote:
>> Possibly the best insight the book has to offer is "if you need to read
>> the comments to work out what the code does... the code sucks".
>
> There are many situations where comments are extremely helpful, not only
> for others, but for the programmer himself.
>
> For example, the implementation of a complex algorithm is often almost
> indecipherable without knowing the algorithm in question, and how it
> has been implemented in that particular case. Trying to understand a
> complex algorithm by reading (uncommented) code only can be really
> laborious and difficult.
>
> Describing the algorithm, however, can make it a lot easier to understand
> what's going on and save a lot of work.

Indeed. If you're trying to implement the Bellman-Ford algorithm or 
something, some comments are probably merited. And the book says that 
non-obvious design choices are one of the few valid reasons to write 
comments.

I guess the vast majority of Java code (and probably C# and similar 
languages) is just yet-another-order-processing-application or similar. 
Hell, I work in data analysis, and > 80% of the codebase is just user 
management, loading and saving configuration data, and other such 
chores. If you're writing mile after mile of that, who needs comments? 
If you label everything clearly enough, it'll probably be fine.

(One could argue that more complex algorithms can be made readable by 
suitably suggestive labelling... but at some point that stops working, 
IMHO.)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.