[IGSTK-Developers] State machine logic for private functions

Julien Jomier julien.jomier at kitware.com
Thu May 25 16:52:32 EDT 2006


Hi Luis,

Thanks for the quick reply.

This is related to the code review for the igstkVesselObject class.
This class has a private function SetVesselSpatialObject()

/** Set the ITKVesselSpatialObject.
  *  this is accessible only from the friend classes */
void VesselObject
::SetVesselSpatialObject( VesselSpatialObjectType * vessel )
{
   if(vessel)
     {
     m_VesselSpatialObject = vessel;
     this->RequestSetSpatialObject( m_VesselSpatialObject );
     }
}

Your comment on this: "SetVesselSpatialObject is not protected by state 
machine logic."

This class is strictly a data container. So I'm not sure why we need any 
state machine logic here.

Let me know what you think,

Julien

Luis Ibanez wrote:
> 
> Hi Julien,
> 
> The fact that the private functions are going to be called by friends
> doesn't make them totally safe.
> 
> This is because "Frienship" in C++ just means that your friends have
> access to your private data, it doesn' mean that they have good
> intentions, or that they are competetent, or qualified for making
> decisions for you.  C++ "Friends" should actually be called
> "Confidents", because their role is limited to have access to your
> private information.
> 
> It is still important to verify that those private methods will only
> be called when the class is in a state where it makes sense to
> execute those methods. (Even if the caller is a so-called "friend").
> 
> 
> 
> Can you please describe the specific case that you are dealing with ?
> 
> 
> 
>   Thanks
> 
> 
>      Luis
> 
> 
> -----
> 
> Each time that you think of making (programmers) life simpler,
> you should put it in the context of the 84,000 people who died
> annually in U.S. hospitals as a result of medical errors.
> 
> What amount of programmer's life simplicity can justify a crash
> in a software that is being used in the middle of a surgery ?
> 
> How many patients can be put at risk in order to save a couple
> of hours of programming time ?
> 
> 
> I would say that our life will easier if we can actually sleep
> with peace of mind after IGSTK has been used in a surgery.
> 
> 
> ==================================================================
> Julien Jomier wrote:
>> Luis (and other state machine gurus)
>>
>> Do we really need state machine logic for functions that are private 
>> in one class and accessible only by friend classes? I would assume 
>> that all the state machine logic will be performed in the friend class.
>>
>> I know that by design this would be better but I'm just wondering... 
>> (and trying to make life simpler ;))
>>
>> Let me know,
>>
>> Julien
>>
>> _______________________________________________
>> IGSTK-Developers mailing list
>> IGSTK-Developers at public.kitware.com
>> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-developers
>>
>>
> 
> 
> 




More information about the IGSTK-Developers mailing list