kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #04481
Re: Code Style (Re: Graphics Abstraction Layer)
-
To:
kicad-devel@xxxxxxxxxxxxxxx
-
From:
"Torsten Hüter" <torstenhtr@...>
-
Date:
Sun, 28 Feb 2010 17:01:21 +0100
-
In-reply-to:
<4B8986F7.10209@...>
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:
http://java.sun.com/docs/codeconv/
> 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 ..
Torsten
--
GMX DSL: Internet, Telefon und Entertainment für nur 19,99 EUR/mtl.!
http://portal.gmx.net/de/go/dsl02
Follow ups
References