home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!rational.com!thor!rmartin
- From: rmartin@thor.Rational.COM (Bob Martin)
- Subject: Re: Complexity in the eyes...V2.0
- Message-ID: <rmartin.724631935@thor>
- Sender: news@rational.com
- Organization: Rational
- References: <1992Dec17.042207.8150@tagsys.com>
- Date: Thu, 17 Dec 1992 22:38:55 GMT
- Lines: 39
-
- andrew@tagsys.com (Andrew Gideon) writes:
-
-
-
- >My solution (well, I don't claim that the original idea was mine):
- >an error stack class. This permits a function to push messages
- >onto the stack as the error is propogated upwards.
-
- ...
-
- >My coworker thinks this complex. He'd prefer returning an integer.
-
- ...
-
- >So...what is the opinion of the net?
-
-
- To say that you are right and that he is wrong would be arbitrary.
- Either solution might be appropriate depending upon the kind of
- application. However, in any application of reasonable complexity, I
- would prefer your solution. I think it is elegant, and easy to use
- and provides a very nice mechanism for tracing an error to its source.
-
- You might want to add parameters to the error stack too. These
- parameters could convey more context information. Thus:
-
- ErrStack e;
- e.PushMessage("Device error");
- e.AddParam(deviceAddress);
- e.AddParam(errorCode);
-
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
-
- --
- Robert Martin Training courses offered in:
- R. C. M. Consulting Object Oriented Analysis
- 2080 Cranbrook Rd. Object Oriented Design
- Green Oaks, Il 60048 (708) 918-1004 C++
-