← Back to team overview

kicad-developers team mailing list archive

Re: Concerns about clearing disagreements before committing.


At Tuesday 22 of November 2011 22:26:23 from Brian F. G. Bidulock:
> Why one or two fields?  This makes for unnecessary work.
> Why not them all?  You see, the easiest way to do this is t
> just make all the fields private and then use the compiler
> to identify everywhere that contract is broken, change each
> occurrence to use an accessor, and they you're done.  There
> should be absolutely no change in behaviour unless there is
> a compiler bug.  At least that's what I did over a year ago.

Though accessors it widely used way, they're not self worth feature.
Accessors are useful when:
- Class should re-render (cache, graphic or whatever) on its attribute change.
- Notifications about changes should be sent to another object.
- Other attributes should change coherently.
- I forget.

There are two data storage 'paradigms':
- true object having designed interface with all its internals hidden,
- plain old data type with free access.
In most cases it is good to head toward one of them. Accessors are seem to be 
emulation of POD in true object.

Instead of accessors it is better to design proper interface, specific to its 
usage. Making accessors first, then proper interface one could do double work. 
So IMO we could make interfaces right off without intermediate work on 

For example, there could be:
Geometric Interface, applicable to every object on the board (and scheme 
Connectivity Interface, applicable to every electrically connectible object.

--- KeyFP: DC07 D4C3 BB33 E596 CF5E  CEF9 D4E3 B618 65BA 2B61

Follow ups