[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: "dselect" replacement team



On 19 Apr 1997, Kai Henningsen wrote:

> jgg@gpu.srv.ualberta.ca (Jason Gunthorpe)  wrote on 13.04.97 in <[🔎] Pine.A32.3.93.970413164332.54672I-100000@gpu5.srv.ualberta.ca>:
> 
> > Now, in my definition clear code requires a very high comment density,
> 
> Interestingly enough, I, on the other hand, think that code with a high  
> comment density is very unclear and hard to read.
> 
> Maybe that's because I believe that _most_ code should be written (and  
> _can_ be written) to be easily understandable without any comments at all.  
> That's what descriptive names are for.

Yes, if you already know what the code should be doing, consider:

  Writer->CreateDataBase();
  Writer->ElementMask("Foo","Bar");
  Writer->StreamOut(ElementArray);

Now, please tell me what that does :> Now you can guess to a quite high
degree of detail, but I imagine you really don't know what ElementMask is. 
You don't really know were this 'DataBase' is either. Now, if I only put
comments in 'strange' places then you will have to lookup
Writer::ElementMask, Write::CreateDataBase and Writer::StreamOut, READ
them all and determine exactly when them an all their subfunctions do
before you can understand what those 3 lines actuall do. This could
easially amount to forcing you to -READ- >500 lines of code, not just
quickly scan.

I on the other hand think it's perfectly clear because I alread know what
the database is of, what the masking function does and other details. I
can tell you with many well placed comment and save you alot of time, esp
if you don't really care what CreateDataBase does internally, only
externally. 

Jason

Strange meaning places of code that are not clear if you already know the
rest of the code. 


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: