[Ktechlab-devel] =P

P Zoltan zoltan.padrah at gmail.com
Fri Oct 16 21:23:17 UTC 2009


On Fri, 16 Oct 2009 03:10:00 +0200, Alan Grimes <agrimes at speakeasy.net>  
wrote:

>
> Also, I realized that in my work on the component library (really all
> parts of ktechlab), I had been continuing a bad legacy design decision
> to use pointers for everything everywhere, and to manually instantiate
> things each time the class was loaded. A much more elegant solution is
> to simply make the classes members of the class you are working on.

  Depends... it's not that obvious. One should put the question: could the  
member exist outside/wihtout the class? If it could, a pointer might be a  
better solution.

>
> One especially tricky concept is the standard template libraries should
> not be used to store pointers to objects but rather directly contain the
> objects themselves. (a practice violated universally by ktechlab's
> current code).

  We have also Qt's collection classes:

  http://doc.trolltech.com/3.0/collection.html#collection-classes

  Now which ones should be used? :D

>
> When done correctly, you can go to std::vector and say "I need 20
> logic-outs", and it will give you 20 logic-outs. =P You don't,
> necessarily, have to loop through, create and add each one. Crazy.

  I don't see any object that _should_ be instanciated in such quantities  
and all objects the same. If this is a problem, we should document it.

>
> Anyway, look for opportunities to get rid of pointers to things, they're
> inherently buggy and

  This is what the people at Sun thought, and invented Java. :)

>  take up waaaay too much space on 64 bit
> architectures!!!

  LOL. You can't get away witout pointers, if you don't write your memory  
manager.

  I've stated my opinion before: let's have something maintainable, then  
optimize / work on high efficiency. I'd say if it's good enough for now,  
let's not change it.





More information about the Ktechlab-devel mailing list