e9c0eea9   
   From: miles@gnu.org   
      
   Gene Bushuyev writes:   
   > What you're describing is this: your class needs to create another   
   > complex or costly object, which it then uses as an organ donor to   
   > initialize (or assign) its own members. Perhaps, if the class   
   > contained that complex or costly object instead of its organs would   
   > be a better design and made this procedure unnecessary.   
      
   Certainly one way of working around this issue is to add new field(s)   
   which store the intermediate valu(e). But if the code in the class   
   all operates on the derived values, and the intermediate value isn't a   
   "natural" part of the class data, then having this value stored in the   
   class is artificial -- i.e., it's a workaround, not "better design."   
      
   If the intermediate value is small / doesn't consume too many   
   resources, then whatever, maybe it's an _acceptable_ workaround, but   
   it's still a workaround.   
      
   [E.g., consider a class which takes a string value as a constructor   
   argument, makes a filename from it, reads some parameter values from a   
   file with that name, and stores the parameter values as data members   
   in the new object. All subsequent operations just use the parameters.]   
      
   -Miles   
      
   --   
   The automobile has not merely taken over the street, it has dissolved the   
   living tissue of the city. Its appetite for space is absolutely insatiable;   
   moving and parked, it devours urban land, leaving the buildings as mere   
   islands of habitable space in a sea of dangerous and ugly traffic.   
   [James Marston Fitch, New York Times, 1 May 1960]   
      
      
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
    [ comp.lang.c++.moderated. First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|