Loading ...
Sorry, an error occurred while loading the content.
 

Re: [XP] Writing simple software - A Challenge!

Expand Messages
  • Edmund Schweppe
    ... True. And this, IMHO, is a Good Thing, because now I can use the same object in different environments, putting different clients (with different exception
    Message 1 of 139 , Dec 1, 2002
      Ron Jeffries wrote:
      >
      > On Sunday, December 1, 2002, at 4:38:48 PM, Kyle Cordes wrote:
      >
      > >> The suggestion isn't to mask exceptions. It's to define methods that
      > >> DO NOT HAVE exceptions.
      >
      > > To refer back to an earlier example, what's a good way to handle:
      >
      > > obj.saveStateToDisk()
      >
      > > ? When I call such a method, I'd rather like to know whether it was
      > > able to get the data on to the disk. Normally I'd deal with this by
      > > making sure it either got the data written, or threw an exception. I'm
      > > open to hearing about other approaches. I don't think "silently fail,
      > > so the user and the rest of the app thinks its worked, but it really
      > > didn't" is a good approach.
      >
      > I don't think anyone would be suggesting "silently fail, f2king
      > everyone over".
      >
      > In the save example, I think that an exception might be appropriate,
      > because the situation is in fact exceptional. HOWEVER, that means that
      > nowhere in the universe is it safe to call that method without dealing
      > with the exception. That will lead to duplication, which by our rules
      > must be removed. That, oddly enough, will quite often lead to a method
      > which cannot hurl.

      True. And this, IMHO, is a Good Thing, because now I can use the same
      object in different environments, putting different clients (with
      different exception handling strategies) in front of it as needed. After
      all, for some applications, the right thing to do is tell the user to
      clear out some disk space; other times, it may be better to sleep a few
      seconds and try again; still other times, the best approach may well be
      to lock up and page out for tech support.

      > Another possibility that might sometimes be better would be for the
      > saveStateToDisk() method to loop, popping up a dialog demanding that
      > the user make space and try again, point to another storage medium, or
      > acknowledge that he doesn't want to save after all.
      >
      > In fact, that might well be what we'd wind up with when we removed the
      > duplication mentioned above ...

      Hmmm. *If* the loop was in some sort of caller of saveStateToDisk(), I'd
      probably think it appropriate. I think it would be rather
      *in*appropriate for saveStateToDisk() to pop its own dialog box; that
      tends to limit where I can put the object.

      --
      Edmund Schweppe -- schweppe@... -- http://schweppe.home.tiac.net
      The opinions expressed herein are at best coincidentally related to
      those of any past, present or future employer.
    • J. B. Rainsberger
      So said ericheikkila on 12/4/2002 -------------------- ... Often, i means something. Say what you mean; mean what you say. :) J. B. Rainsberger,
      Message 139 of 139 , Dec 7, 2002
        So said ericheikkila on 12/4/2002 --------------------

        >Single letter variables drive me nuts. ;)
        >I use 'index' instead of 'i' (or loop, or maybe count, depending on
        >the context).
        >As far as abbreviations go...if the entire team agrees, fine.
        >If someone on the team doesn't know that itr is the same as iterator,
        >just change it to iterator.
        >
        >Usually, I'll not abbrev ;)

        Often, "i" means something. Say what you mean; mean what you say. :)

        J. B. Rainsberger,
        President, Diaspar Software Services
        Let's write software that people understand.
        http://www.diasparsoftware.com/
        telephone: +1 416 791-8603
        All correspondence (c) 2002 Diaspar Software Services.
        If you want to use it, just ask; don't steal.
      Your message has been successfully submitted and would be delivered to recipients shortly.