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

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

Expand Messages
  • Ron Jeffries
    ... No. The idea is that the second /has/ no error conditions. It s like a mathematical function defined over all the Reals: it just works. ... If there was
    Message 1 of 139 , Dec 1, 2002
      On Sunday, December 1, 2002, at 1:58:34 PM, Ian Collins wrote:

      > But doesn't the second hide error conditions, requiring the caller to
      > check the returned result for error?

      No. The idea is that the second /has/ no error conditions. It's like a
      mathematical function defined over all the Reals: it just works.

      > The caller could choose to ignore the exceptions form the first method,
      > but at least he/she has the option of taking some action if they are thrown.

      If there was some actual need for that, one could do it. However, most
      users are planning to use the function properly, and burdening them
      with exceptions and such makes their job harder. IMO elaborating a
      perfectly useful function with exceptions and strange returns is rude
      and wasteful, unless there is a clean known reason to do so.

      One might also consider a separate method for people who want to know
      if odd things are happening. If anyone does.

      I think this rule is an example of YAGNI.

      > What if ConcatenateTextFiles was something like MakeURI, would you
      > rather make a broken URI, or get an exception?

      I think I would prefer to get a URI in every case rather than an
      exception. AFAIK the syntax of a URI does not provide for a standard
      error format, so this might not be possible.

      > Exceptions are for exceptional circumstances, their abuse should be
      > avoided, their correct use encouraged.

      Yes. I encourage avoiding them whenever possible.

      Ron Jeffries
      www.XProgramming.com
      You do ill if you praise, but worse if you censure,
      what you do not understand. --Leonardo da Vinci
    • 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.