← Back to team overview

kicad-developers team mailing list archive

Re: Code Style (Re: Graphics Abstraction Layer)


Hi Dick,

> The project is not a democracy. It is "closer to" a group of share 
> holders at a stock holder's meeting. I say it is "closer to", and not 
> exactly like, and this is accurate. Where it can deviate is when 
> somebody just gets louder on a particular issue and the larger 
> shareholders can back off a little. Jean-Pierre is the largest
> shareholder.

To a certain degree I'd agree with that. Still I think such details should be discussed, of course at the end the project leader (Jean-Pierre) has to decide.

> I don't make noise on it everyday, but I keep most of my powder dry for 
> the style discussion. I chose the style, picked uncrustify & chose the 
> uncrustify.cfg settings and beautified scores of source files. It would 
> be impossible for anyone to be louder on this subject.

OK, thus it's basically your own coding style.

> This just shows what someone else likes, not what I like, and where we 
> are trying to go in this project. After 29 years of writing C, C++ and 
> Java (40+ hours per week), it is even remotely possible that I don't 
> know what I like? (I once wrote a project like wxwidgets all by myself, 
> a knock off of CommonView for OS2, so I do not stand in amazement at the 
> style choices made by the Qt team.)

I fully respect your career and your experience; but I have a slightly different opinion. Usually the coding convention is found as compromise and not just by an individual. I understand, that the opinion of a contributor like you has a higher value - simply because you're longer around here.

There is in my opinion a simple reason for the style choice of the QT team; it's similar or even based on the Java coding convention. Java is the number one programming language at the university, this is what you're learning first - inclusive the coding convention. That means in future you'll see it for even more projects. Just compare the existing style guides for C++ on the web.

Some details are of course matter of taste.


> Thanks, it is more about the uncrustify.cfg settings. The easiest way, 
> but not the only way, is to use uncrustify to at least learn the desired 
> style.

I've already set up Eclipse for this style; I'll have to see if everything works like the uncrustify settings (of course running uncrustify over the final code would be no big deal either). 

> Wayne has prepared a coding style document and I am reviewing it now. 
> Wayne is a *great* contributor to this project and he has my 
> considerable respect.

If possible - I'd like to see it too.

> The biggest thing we'll have to button down on is to not use tabs, but 
> rather spaces. Spaces are the standard here.

No problem, that's just one click for me :)

Anything with the exception of class names is fine for me. Here I'd like go my own way - because I see the following problems of all uppercase: 
(a) Possible confusing with defines and constants 
(b) Inconsistency - the other projects that I know use mixed cases, this includes wxWidgets too. If there is really a requirement for all uppercase, refactoring the class names is for me a matter of a few minutes. Perhaps you have a strong motivation for using all uppercase that I don't see at the moment.

I'd just cite from Geosoft's coding guide:

1. Any violation to the guide is allowed if it enhances readability.
The main goal of the recommendation is to improve readability and thereby the understanding and the maintainability and general quality of the code. It is impossible to cover all the specific cases in a general guide and the programmer should be flexible.

2. The rules can be violated if there are strong personal objections against them.
The attempt is to make a guideline, not to force a particular coding style onto individuals. Experienced programmers normally want to adopt a style like this anyway, but having one, and at least requiring everyone to get familiar with it, usually makes people start thinking about programming style and evaluate their own habits in this area.

Thanks ..
GMX DSL: Internet, Telefon und Entertainment für nur 19,99 EUR/mtl.!


Follow ups