CS162 Lab 8 - Exception Handling discussion

CS162 Lab 8 - Exception Handling discussion

by Deleted user -
Number of replies: 0

Everyone doing ok on the exception handling lab?  I just finished mine and thought I'd share a couple things I stumbled with.

  1. I found it much easier to read from a file, rather than deal with entering data manually.  Reading from a file makes testing soo much easier as I can just make little tweaks, run it, get a result, and make changes.
  2. At first I was overthinking the document code exception and trying to do too much with it.  I eventually concluded all the assignment was asking for was to use a custom exception to check the document type.  So I used it to check one field of my object.  Once I stopped trying to make the custom exception my catch-all problem filter, things got simpler.
  3. My basic plan was to make an empty and arbitrarily big array of objects, read my input file and for each line either create one object or throw an exception if the object couldn't be made.
  4. If you haven't done it yet, this is a great lab to do the CompareTo() extra credit, because it's easy and makes sorting the array of objects a breeze.  It took literally 3 lines of code, and probably saved me several lines I might have otherwise needed to write.  Well worth it!
  5. The extra credit portions aren't that bad, we just did a sort, and writing to a file isn't that bad.  Making a report that summarizes the data isn't hard either, we've been doing that all term.  If you finished the basic lab, I'd highly suggest doing both of the extra credits.  I should qualify for 3, count em 3, extra credits for this assignment alone.  That's a lot of points!

Anyway yeah, if you're stuck or have some insights post your thoughts and let's get a discussion going.