From: Alexey D. <a.d...@se...> - 2005-05-11 08:11:09
|
If I understand you correctly, TOra uses singleton pattern (to some extent) for most of the tools and you want to get rid of it. Whilst I understand the urge to reshape the TOra according to our own tastes and preferences in OOP - I nevertheless would like to note the fact that our immediate goal was to make it stable and release new non-developer version on several platforms. Hence although the refactoring may be beneficial but to do a change like this in a time when we "nearly there" is not a good idea. In other words until release time it's better not to change it if it isn't broken. Besides, if you don't like statics, the other approach (less drastic) may be to implement singleton in a proper OO way - i.e. introduce static getInstance() method in all such classes or createInstance() to make it more factory like if you want (although the getInstance() is probably less intrusive and requires less changes). Alexey > -----Original Message----- > From: Thomas Porschberg [mailto:tho...@os...] > Sent: Wednesday, May 11, 2005 7:38 AM > To: tor...@li... > Subject: [Tora-develop] static usage > > > Hi, > > I see a lot utilization of the "static keyword" for objects which > are local to a translation unit. > E.g. the creation of tools is mostly implemented by the > following approach: > > 1) declare/define the tool-class inside a cpp-unit (e.g. toScriptTool) > 2) construct the tool-object at static storage inside the > same cpp-unit > (e.g.: static toScriptTool ScriptTool; // inside toscript.cpp) > 3) make use of this object inside the same cpp-unit > > I would like to get rid of these static objects and I would also > like to see a seperate interface/implementation unit for the tool > classes. > As an first alternative the tools could be created at heap in > constructor of tomain(maybe later via a factory). > > what do you make of these thoughts ? > > Thomas > > -- > Bjarne Stroustrup, The C++ Programming Language > see index of contents : static --> anachronism > > `In C and older C++ programs, the keyword static is > (confusingly) used to mean > "use internal linkage". Don't use static except inside > functions and classes.` > -- > > > > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click > _______________________________________________ > Tora-develop mailing list > Tor...@li... > https://lists.sourceforge.net/lists/listinfo/tora-develop > |