[Kstars-devel] branches/work/kdeedu_kstars_htm/kstars/kstars/skycomponents

Thomas Kabelmann thomas.kabelmann at gmx.de
Wed Aug 8 09:39:09 CEST 2007


Hi James,

as I am enthused by your work, there is a small note I wanna do about this 
code fragment:

LineListComponent::LineListComponent( SkyComponent *parent )
  	: SkyComponent( parent ), LabelPosition( NoLabel ), Label( QString() )
{
	m_skyLabeler = ((SkyMapComposite*) parent)->skyLabeler();
}

I find it very weird to cast from SkyComponent to a SkyMapComposite. As a 
compromise in the composite pattern the component class (interface) should 
know all methods, so that there is no cast needed. The component class could 
offer a default implementation which returns null and SkyMapComposite has the 
real implementation. So then we are really programming by interfaces and it 
makes the code more readable.

I don't know, who put skyLabel() in the SkyMapComposite class. So don't be 
annoyed that I'm writing this to you :-) As I have no time until october to 
work on kstars, I would ask you, if you could clean up this mess in your 
branch too?

Regards Thomas


More information about the Kstars-devel mailing list