home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!psinntp!uu0465!andrew
- From: andrew@tagsys.com (Andrew Gideon)
- Subject: Re: Complexity in the eyes...V2.0
- Message-ID: <1992Dec23.031930.15291@tagsys.com>
- Followup-To: comp.lang.c++
- Summary: That which the errorstack stacks
- Keywords: error errorstack
- Sender: andrew@tagsys.com (Andrew Gideon)
- Organization: TAG Systems inc.
- References: <1992Dec17.042207.8150@tagsys.com> <rmartin.724631935@thor>
- Date: Wed, 23 Dec 1992 03:19:30 GMT
- Lines: 76
-
-
- In article <rmartin.724631935@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
- >
- ...
- >
- >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++
-
-
- Hmm.
-
- If I understand your proposal, you'd have me add an ordered collection
- of "parameters" to the base error atom class? Interesting thought.
-
- Well, let me describe my vision of the error atom - something that I
- stayed away from in previous posts.
-
- The base error atom class ErrorAtom provides virtual methods
- like theSeverity(), theMessage(), isWarning(), etc. Each module
- (or some other partition of code) provides a subtype of the error
- atom for a specific domain of errors.
-
- So instances of the DeviceErrorAtom class might contain a severity
- value and an offset into an array of error messages. This array would
- be a class member (static member). This provides for easy copying of
- atoms, nicely partitioned error spaces, a good starting point for user
- documentation, etc.
-
- In practice, I rarely got this far. Instead, I used a generic error
- atom which contained a severity and a message string. The strings
- were efficient, but the solution was not nearly as complete as I'd
- originally envisioned.
-
- I can certainly envision an atom class accepting additional parameters,
- and then having these used in generating the message returned by
- theMessage(). It is an good idea. Thanks.
-
- But I might change your example to:
-
- ErrorStack err;
- DeviceError devErr;
-
- devErr.theError(code);
- devErr.theAddress(deviceAddress);
- err.pushMessage(devErr);
-
- Add a reasonable constructor, and we have:
-
- ErrorStack err;
- err.pushMessage(DeviceError(code, deviceAddress));
-
- A later call to theMessage() on that atom might yield:
-
- "EMP scrambled device brains at address 0x666"
-
- Hey. I like it.
-
- - Andrew Gideon
-
- ===
- -----------------------------------------------------------
- | Andrew Gideon | |
- | Consultant | |
- | | TAG Systems inc. |
- | Tel: (201) 890-7189 | D2-181 Long Hill Road |
- | Fax: (201) 890-1581 | Little Falls, N.J., 07424 |
- | andrew@tagsys.com | |
- -----------------------------------------------------------
-