home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / cplus / 18160 < prev    next >
Encoding:
Text File  |  1992-12-18  |  1.5 KB  |  51 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!rational.com!thor!rmartin
  3. From: rmartin@thor.Rational.COM (Bob Martin)
  4. Subject: Re: Complexity in the eyes...V2.0
  5. Message-ID: <rmartin.724631935@thor>
  6. Sender: news@rational.com
  7. Organization: Rational
  8. References: <1992Dec17.042207.8150@tagsys.com>
  9. Date: Thu, 17 Dec 1992 22:38:55 GMT
  10. Lines: 39
  11.  
  12. andrew@tagsys.com (Andrew Gideon) writes:
  13.  
  14.  
  15.  
  16. >My solution (well, I don't claim that the original idea was mine):
  17. >an error stack class.  This permits a function to push messages
  18. >onto the stack as the error is propogated upwards.
  19.  
  20. ...
  21.  
  22. >My coworker thinks this complex.  He'd prefer returning an integer.
  23.  
  24. ...
  25.  
  26. >So...what is the opinion of the net?
  27.  
  28.  
  29. To say that you are right and that he is wrong would be arbitrary.
  30. Either solution might be appropriate depending upon the kind of
  31. application.  However, in any application of reasonable complexity, I
  32. would prefer your solution.  I think it is elegant, and easy to use
  33. and provides a very nice mechanism for tracing an error to its source.
  34.  
  35. You might want to add parameters to the error stack too.  These
  36. parameters could convey more context information.  Thus:
  37.  
  38. ErrStack e;
  39. e.PushMessage("Device error");
  40. e.AddParam(deviceAddress);
  41. e.AddParam(errorCode);
  42.  
  43. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  44.  
  45.  
  46. --
  47. Robert Martin                        Training courses offered in:
  48. R. C. M. Consulting                       Object Oriented Analysis
  49. 2080 Cranbrook Rd.                        Object Oriented Design
  50. Green Oaks, Il 60048 (708) 918-1004       C++
  51.