← Back to team overview

kicad-developers team mailing list archive

Re: Code Style (Re: Graphics Abstraction Layer)


Hi Jean-Pierre,

Thanks for your point of view. 
I've made yesterday the decision to use the proposed uppercase for class names too. I don't want to ride a horse to death, it only delays my programming.


> Notation using a prefix (like wxWIDGET) is useful when building (andusing)
> a tool like a library (this is the case for wxWidgets, Qt)
> I even starter using this style some years ago, and some classes use kias 
> prefix (like kiMyClass)
> I was not convinced.

Well, there you have another situation - that are libraries, which are included in other programs. Sure for KiCad I agree it wouldn't make any sense.

> So because I did not found a good way, using uppercases for class namesis 
> ok for me.

All coding style guides I've read so far recommend the upper camel case for class names (for example MyClass). Unlikely Wayne has written, this is in my opinion *not* an arbitrary choice. The logic behind it is, that class names are handled like type names. Because creating a type instance is similar to a class instance. For example:

MyClass myInstance(..);
MyType myVariable;

Please compare also http://geosoft.no/development/cppstyle.html or
the Java code convention:

> and I use m_ as prefix for public member variables.

A simple underscore would work just as well and is easier to read.

> Just to have only one style.

Yes I agree, therefor I've adapted the proposed KiCad style now.
I've assumed that a final decision wasn't made - because I've seen both variants (upper camel case and all upper case) in the source tree.

> Note also coding style has a lot of more important topics:
> using wxFormBuilder to create dialogs, and dialog styles (we are
> usingGnome 
> style ).

Right and exactly this can be a problem with the modern IDEs like Eclipse. They're optimized for the Java code convention.

My opinion is to use something that's established and not to reinvent the wheel. That's currently to late to change for KiCad (because a final choice was made) but I hope that next time is a bit more research is done.

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


Follow ups