← Back to team overview

kicad-developers team mailing list archive

Re: Was: page selection dialog, everybody please comment

 

On 4/19/2013 8:11 AM, jp charras wrote:
Le 19/04/2013 13:12, Lorenzo Marcantonio a écrit :
On Fri, Apr 19, 2013 at 05:45:33AM -0500, Dick Hollenbeck wrote:
We might do well as a team by slowing down and focusing on
reliability and
quality not features for awhile.  Firstly, the bugs are damaging to the
project.

Using the user visible string as an index *is* a bad practice and a bug
in the user view. Why not replacing it with a simpler enumeration? The
whole one-class-for-paper format is also debatable when a simple array
would suffice (like for the color table array).

Good or bad practice mainly depend on your criteria:
I know (and Dick knows) using an user visible string can create issues,
but using an index is not better:
when you insert a new item or change items order, indexes in existing
files will be broken.
I remember I already used indexes in config files (to identify the
language to use in user interface) and have serious issues.
Indexes are always an image of the internal code, and I can say using
them is also a bad practice.
However they are often used because this is an easy way to store info.

Good or bad practice just depends only the most important issue you want
to fix or avoid (like file readability), and the time you accept to
spend to code some things.


As for the layer number issue, as I already said, you're free to search
and replace it to int. I'll do it personally if you like it. Then you're
even free to use void* for every pointer in the project. Good luck then
finding when a layer is used instead of a simple counter (or something
which is not a layer is passed in, which actually occurred a few times
in the past). Also have fun with the two layer numbers encoded in
a single variable in the via class (obviously worth the 4 byte gain for
each via).

Other than that these are only design opinions (altough type safety is
generally considered a good thing) and everybody can do whatever he want
with his own code.


Layers names, number of layers and other things related to layers (setup
dialogs, DRC requirement...) are an other topic,
and I can say a *very* complicated topic that cannot be fixed in one
minute.
This topic *needs* time and *very good* ideas.
(And not just a remark like "I want more layers", useless for developers)


Maybe some historical perspective will help. When I designed the new file format, there was a long discussion between Dick, JP, and myself about the layer definitions with an eye on the future expansion of the number of layers. The original intent was to use the layer names alone without the ordinal (index) numbers and this was how the first commit of the new format behaved. This failed due to translated layer names and the decision to put the ordinal numbers back in was made. The new file format was disabled until was fairly stable so most users would not have noticed these problems. Later, Dick suggested that the layer names be simplified so that through hole modules layers could be defined as *.Cu (all copper layers) rather than have every copper layer name in the module layer definition along with some other simplifications. This significantly cleaned up the file format for the better. JP's comments about indices is correct. Using an ordinal number does not guarantee layer compatibility when we finally get around to adding more layers. They are also not readable. What is a layer 0, 1, 2, 3...N? You would always have to refer back to the layer table to know which layer the ordinal number is mapped to if they were used define layers in the rest of the file. The only good thing about ordinal numbers in this case is they cannot be translated.

That being said, I do believe that providing users a way to define their own layer names that can be translated is a good thing. It's just that they cannot be used in the file layer definitions or any of the layer manipulation code. They can only be mapped to the standard layer names and only be used for UI purposes. I'm guessing that adding a 4th entry to the layer definition in the file would do the trick. However, I am in agreement with Dick that we should get the footprint library table implemented so that both the board and footprint file formats are stable then consider how we want to add user defined layer names. I working on it as fast as I can given my time constraints.

Wayne




Follow ups

References