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

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!eff!news.byu.edu!ux1!fcom.cc.utah.edu!swillden
  3. From: swillden@news.ccutah.edu (Shawn Willden)
  4. Subject: Re: Complexity in the eyes...V2.0
  5. Message-ID: <1992Dec18.001800.4373@fcom.cc.utah.edu>
  6. Sender: news@fcom.cc.utah.edu
  7. Organization: University of Utah Computer Center
  8. X-Newsreader: Tin 1.1 PL3
  9. References: <1992Dec17.042207.8150@tagsys.com>
  10. Date: Fri, 18 Dec 92 00:18:00 GMT
  11. Lines: 75
  12.  
  13. andrew@tagsys.com (Andrew Gideon) writes:
  14. : Almost a month ago, I tried to start a new thread on the topic
  15. : of "complexity".  I assume that everyone agrees that a goal of
  16. : software engineering should be the reduction of complexity.  But
  17. : what I have recently seen is that the metrics by which complexity
  18. : is measured appear to be very subjective.
  19. : There were some very interesting comments, but - perhaps because I
  20. : fell way behind in my net-readership - the thread died a quiet
  21. : death.  I'd like to try again, in this case with a specific example.
  22. : Anyway, this is getting long, and I want to write my example up.
  23. : My example is a problem and two solutions: mine and my coworker's.
  24. : The question that I have is: which do you (plural) prefer (for any
  25. : reasons), and why?
  26. : The problem: moving errors around.  This includes moving errors
  27. : between applications, but it also includes the conventional problem
  28. : of passing errors up through a sequence of procedure calls.
  29. : My solution (well, I don't claim that the original idea was mine):
  30. : an error stack class.
  31.  
  32. [ Description deleted ]
  33.  
  34. : My coworker thinks this complex.  He'd prefer returning an integer.
  35. : The integer is an offset into an array of error messages.  If there
  36. : are multiple modules (when are there not?!), use one byte as a module
  37. : number to determine the specific array, and another byte as the offset.
  38. : He doesn't even want this encapsulated in a class, as that would
  39. : "make it more complex."
  40.  
  41. Complexity aside, unless I misread your post, your colleague's
  42. solution doesn't provide the same functionality as yours since it
  43. doesn't allow tracing of many levels of error messages (much less the
  44. log feature).  Increased functionality nearly always implies more
  45. complexity.  
  46.  
  47. If we add a stack to his method to allow tracing of multi-level
  48. messages then they become more comparable.  However, the syntax is
  49. awful unless we also provide functions to manipulate it.  If we do
  50. that, we have produced the same effect as a class with public data,
  51. which we might as well make private, either by making it internal
  52. (static) to the module where the stack manipulation functions are
  53. defined or by remembering that we *are* using a C++ compiler and
  54. building the thing into a class.
  55.  
  56. So, by the time you make his technique do as much as yours the
  57. complexity is the same, or maybe even greater, since it now becomes
  58. the programmer's job to verify by hand that all those error codes
  59. match up to the right error strings.
  60.  
  61. Is the added functionality worth the added complexity?  IMO, yes!
  62. Anything that aids in debugging and does not cost too much (in terms
  63. of syntax and complexity in the places where it is used) is useful.
  64.  
  65. I think the other programmers may not have wanted to use your error
  66. stack class because of laziness; they didn't want to have to think
  67. that much about errors.  In your words: Error handling behavior is
  68. "stuck on" rather than "designed in".
  69.  
  70. :  -----------------------------------------------------------
  71. : | Andrew Gideon              |                              |
  72. : | Consultant                 |                              |
  73. : |                            |   TAG Systems inc.           |
  74. : | Tel: (201) 890-7189        |   D2-181 Long Hill Road      |
  75. : | Fax: (201) 890-1581        |   Little Falls, N.J., 07424  |
  76. : | andrew@tagsys.com          |                              |
  77. :  -----------------------------------------------------------
  78.  
  79. --
  80. Shawn Willden
  81. swillden@icarus.weber.ed
  82.