glob2-devel
[Top][All Lists]
Advanced

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

Re: [glob2-devel] coding guidlines


From: Leo Wandersleb
Subject: Re: [glob2-devel] coding guidlines
Date: Tue, 21 Oct 2008 02:12:00 +0200
User-agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724)

Stephane Magnenat wrote:
> Hi,
> 
>> what do you think about the following guidlines?
>> - one class per file (i've seen files with 5900 lines.)
> 
> I do not like this convention if it is applied strictly. In some case, it
> is reasonable to have several small classes related together in a single
> source file, not speaking about inner classes.

No question inner classes would not belong to extra files. Also I would never
support strict rules in a sense of commit hooks that block things against
those rules. Moreover I wanted to see if I may try and sort the code a bit
by splitting up files and folders. As Bradley seams to believe his
AIEcho-50-classes file is somewhat a well sorted code i doubt i will get far
as this is one of the files I'd have split up into many files all in
one folder tree AI/Echo/...

> I would prefer a more semantic-oriented and not so syntactic-oriented
> convention, so as "each file should contain a single logical element that
> could be conceptually represented as a box in a architecture schema at a
> specific level of detail."

boxes can get very big ;)

>> - a folder hirarchy reflecting the namespace usage.
> 
> You mean, for glob2/usl/libgag instead of the src/header directories? I
> agree that separating src and headers was a bad idea.
> 
> However, I think that we should not create too much directories, because
> it makes fast searching more complex (a single grep is not sufficient
> anymore) and fast choice of files to load more complex as well. Currently,
> it is very convenient to display all .h or all .cpp files with kwrite and
> just load whatever one need, for instance. We should not make this more
> complicated when there is no sound reasons to do so.

sorting the code can sort it in the mind of the developer, too. As Martin
mentioned before, rgrep will do the job for you.

As I certainly wouldn't want to scare you and Bradley away I will not push
ideas you are seriously opposed to as my contributions are rather minor to
yours and I may never be the c++ guy you two are but whenever I come to code
a bit it takes me hours to get things sorted.

A file of some 100 lines is more inviting to dig into than one with some 1000.

My tool is more and more Eclipse/CDT and using the code links (intellisense)
makes big or many files both little trouble anyway but doxygen comments are
really worth a lot.

>> - every public attribute has to be commented (use /// or /** */ so doxygen
>> works) even when the name is speaking so the comment is nothing more than
>> this name.
> 
> Why not. But again, sometimes it is much more important to write a small
> description of the class then a dumb documentation of all of its members.
> Of course the two are not contradictory.

Greetings,

Leo Wandersleb





reply via email to

[Prev in Thread] Current Thread [Next in Thread]