[Kstars-devel] removing KStars::privatedata class

Thomas Kabelmann thomas.kabelmann at gmx.de
Tue Jul 26 18:08:17 CEST 2005


Hi Heiko,

I understand the purpose of this design pattern, but I think it's unnecessary 
in this situation. There are 2 data stored in PrivateData (splash, data) and 
both are pointer variables. For pointer variables you don't need an include 
of the class file, you just need a forward declaration of that class. If I'm 
not mistaken, this forward declaration saves a recompile of the KStars class 
if KStarsData changes. So we can safely pull the code from PrivateData to 
KStars and simplify the code. On the other hand, if we really should add a 
lot of new data directly to KStars class I agree with Jason, to pull all data 
into PrivateData, but I doubt, that there will be that much changes in the 
future.

Regards,
Thomas

Am Dienstag, 26. Juli 2005 11:00 schrieb Heiko Evermann:
> Hi Jason,
>
> > I'd like to remove the KStars::privatedata class (declared at the end of
> > kstars.h).  It just contains pointers for the KStars, KStarsData, and
> > KStarsSplash objects, as well as the buildGUI() function.  I don't really
> > see the purpose of this class; the KStarsData and KStarsSplash objects
> > and the buildGUI() function can just as well be members of KStars
> > instead.
>
> The idea is that the main class does not change whenever the internal data
> structure changes. Otherwise adding an internal member forces a recompile
> of the whole application.
>
> > I guess this class was created to conform to the "d-pointer" style of KDE
> > coding.  However, since we are not a library, we don't really need to
> > maintain BC.
>
> It is good programming style all around the C++-world.
>
> > If there are no arguments for keeping privatedata, I'll remove it as part
> > of my current effort to simplify the startup proceudres.
>
> As a private-data-class only keeps member variables and as it is created
> during the creation of the its object and deleted during the corresponding
> destructor, removing this will probably not simplyfy anything.
>
> Kind regards,
>
> Heiko
> _______________________________________________
> Kstars-devel mailing list
> Kstars-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kstars-devel


More information about the Kstars-devel mailing list