|
From: Roger H. <rog...@mi...> - 2005-01-06 16:15:30
|
I would like a second opinion on what I have done so far. I have changed the plan slightly as I am using '~' rather than '-' to modify the sizeof the new records as some classes have no instance data and 0 == -0 whereas 0 != ~0. OpaqueTQ3Object is now a class with all its fields private, and it will be the base class for the entire object hierarchy. Maybe in the long term it will be a class with no fields and no methods and a new class probably called ClassTree will inherit from it and all existing fields will be moved there. As all the fields are private and as all the existing E3ClassTree routines make extensive use of these fields I have at the moment made every E3ClassTree routine a friend of OpaqueTQ3Object. This is the minimum change necessary, but maybe is not the way we want to proceed. Should I leave it as it is now or change all the E3ClassTree routines into methods of OpaqueTQ3Object? The ones which do not take a TQ3Object as a parameter would have to be static methods. The rest could be re-coded as proper methods and all their (principal) TQ3Object accessed via " this ". Of course " this-> " could be removed where fields or other methods are used. Although this sounds preferable it does mean a lot more changes will be needed, eventually as the changes move up through the object hierarchy, almost every routine in every file will need to be modified. I am not concerned about the volume of work but by the possibility of introducing bugs. Fortunately Quesa is a relatively compact source code compared to some of Microspot's products. If we do decide to go to methods, there is also the question of names. Should I retain the existing names or take out the E3ClassTree prefix so that eventually routines like E3ClassTree_Destroy would become ClassTree::Destroy rather that ClassTree::E3ClassTree_Destroy. Maybe the case for non static methods is less clear cut, should a call to E3ClassTree_GetClassByObject look like this: theObject -> E3ClassTree_GetClassByObject() ; // option A or like this: theObject -> GetClassByObject() ; // option B or just this: theObject -> GetClass() ; // option C To recap, my questions are: 1) Should every E3ClassTree routine be a friend or a method? 2) If a method, then should ones with a TQ3Object take it as their 'this' ? 3) If so, should the method names be as in option A, B or C ? 4) Any other comments or ideas you have. I will await input before proceeding further. |