Order dependence is fine if the fluent interface verbs imply ordering
(appendXXX) rather than not (setXXX). But some of the parts of a URI are
order-independent (e.g., scheme), even if others are not (e.g., path
component). I see no reason to impose an order on the order-independent
parts.

Abstractly, though, would you rather see ReferenceBuilderException checked
or unchecked in the following:

  try {
      Reference ref = ReferenceBuilder.appendBar
("myBar").appendFoo("myFoo");
      // do something with ref
  } catch (ReferenceBuilderException e) {
      // myBad: foo must come before bar
      // clean up
      // ? throw e;
  }

Programmer was wrong -- this should be unchecked, right?

--tim

On Nov 29, 2007 7:32 PM, Rob Heittman <[EMAIL PROTECTED]> wrote:

>
> Oh, no, I'm about to agree unconditionally with Paul.  :-)
>
> > Why should it enforce the order?  The burden should be on the
> > implementor, not the user.  Don't use a StringBuilder: use simple
> > fields:
>
> >        class URI {
> >            private String scheme;
> >            private String host;
> >            // ...
> >        }
>
> Yeah, that.  The warnings to the user (cough Checked Exceptions /cough)
> should come in when you try to confess the builder into a URI, Reference, or
> String and it doesn't contain enough pieces and parts to have meaning.
>
> - R
>
>

Reply via email to