[fpc-pascal] Re: [Lazarus] Should TObject or TComponent have a Comment property?

Alberto Narduzzi albertonarduzzi at yahoo.com
Wed Jul 17 23:12:21 CEST 2013


On 17/07/13 00:56, vfclists . wrote:

>     I completely disagree. It is the code that is the primary expression
>     of intent not the comments. This is mainly accomplished through
>     sensible identifier naming.

I perfectly agree, a well formed name is worth a thousand words, in this 
context.


>     Comments exist to compensate for a
>     developer's inability to express intent through the code and IMHO
>     should be reserved for this sole purpose. In most cases you should
>     be able to look at a function signature and know exactly what that
>     function's intent is. Likewise you should be able to tell the intent
>     of a class by its name and the names of its public/published
>     members. This is, at least, what I strive for in my own code. Bob
>     Martin's "Clean Code" dedicates the entire 4th chapter to the
>     discussion of comments and make some very compelling arguments for
>     limiting their use.

That's true, in principle; thou' you shall look at the comments also 
like: you cannot express the meaning and whole role of a function by its 
name (unless you want to couple wikipedia, of course), especially where 
you made some tricks that _today_ they look obvious because you're in 
the thing, but _tomorrow_ they might not.
I still endlessly thank myself for having put some of these comments 
somewhere in my code, some of 15 years ago... they helped me make the 
migration from DOS to Linux a little less hurting ;-)

Of course, we're talking about good and wise use of comments, which is, 
IMHO, still an art.

Just my 2c on this,
Al.



More information about the fpc-pascal mailing list