Re: cin in brat

From: Christian Holm Christensen (cholm@hehi03.nbi.dk)
Date: Mon Dec 16 2002 - 15:03:27 EST

  • Next message: Stephen J. Sanders: "minor brat changes to allow Macintosh OS 10.2 compilation"
    Hi Truls and others, 
    
    Truls Martin Larsen <t.m.larsen@fys.uio.no> wrote concerning
      cin in brat (was: calibration module problem) [Mon, 16 Dec 2002 11:38:25 +0100] 
    ----------------------------------------------------------------------
    > As Christian mentioned, there are several places in the calibration dir 
    > that uses cin:
    > 
    > modules/calib/bb/BrBbCalModule.cxx:210:    cin >> fCalibFile;
    > modules/calib/bb/BrBbCalModule.cxx:221:    cin >> fCalibFile;
    > modules/calib/bb/BrBbCalModule.cxx:229:      cin >> fComment;
    > modules/calib/chkv/BrChkvCalModule.cxx:146:    cin >> fCalibFile;
    > modules/calib/chkv/BrChkvCalModule.cxx:157:    cin >> fCalibFile;
    > modules/calib/chkv/BrChkvCalModule.cxx:168:      cin >> fComment;
    > modules/calib/dc/BrDcCalModule.cxx:468:    cin >> fTdcMatrixFile;
    > modules/calib/tof/BrTofCalModule.cxx:316:    cin >> fCalibFile;
    > modules/calib/tof/BrTofCalModule.cxx:357:    cin >> fCalibFile;
    > modules/calib/tof/BrTofCalModule.cxx:369:      cin >> fComment;
    > modules/calib/tpc/BrTpcCalModule.cxx:325:    cin >> fCalibFileName;
    > modules/calib/tpc/BrTpcCalModule.cxx:336:    cin >> fCalibFileName;
    > modules/calib/vertex/BrVertexCalModule.cxx:126:    cin >> fCalibFile;
    > modules/calib/vertex/BrVertexCalModule.cxx:137:    cin >> fCalibFile;
    > modules/calib/vertex/BrVertexCalModule.cxx:145:      cin >> fComment;
    > modules/calib/zdc/BrZdcCalModule.cxx:78:        cin >> fCalibFile;
    > modules/calib/zdc/BrZdcCalModule.cxx:90:        cin >> fCalibFile;
    
    Two things to be learned from this: 
    
    * Too much copy'n'paste wrecks havoc, or 
    
         Values of beta will give rise to dom. [1] 
    
      If you're always copying stuff from a perfect source, then there's
      really no problem - but I've never come across a perfect source (a
      `Perfect Storm' though - don't see it - never a perfect source), and
      I doubt it exists.  It's usually much better to think a bit for
      yourself, while deliberating on the merits and errors of others work
      as well.  What often happens when you do copy'n'paste is most often
      the distribution of one error over a much larger body.  
    
    * When some functionality of some modules is similar, it should be
      abstracted into a (abstract) base class.  In the case of the
      calibration modules, it'd make sense to have a `BrCalModule' that
      has the common functionality of all the calibration modules, like
      opening an temporary ASCII file, writing parameters to it, and so
      on. 
    
    Anyway, those `cin's need to go. 
    
    Yours, 
    
     ___  |  Christian Holm Christensen 
      |_| |	 -------------------------------------------------------------
        | |	 Address: Sankt Hansgade 23, 1. th.  Phone:  (+45) 35 35 96 91
         _|	          DK-2200 Copenhagen N       Cell:   (+45) 24 61 85 91
        _|	          Denmark                    Office: (+45) 353  25 305
     ____|	 Email:   cholm@nbi.dk               Web:    www.nbi.dk/~cholm
     | |
    
    
    [1] http://cm.bell-labs.com/cm/cs/who/dmr/odd.html
    
      
    


    This archive was generated by hypermail 2.1.5 : Mon Dec 16 2002 - 15:08:23 EST