Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8133606

JShell API: Add JShell.create() short-cut

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9-repo-kulla
    • 9-repo-kulla
    • tools
    • None

      > On Aug 2, 2015, at 3:58 PM, Brian Goetz <brian.goetz@oracle.com> wrote:
      >
      >> So, you are saying you want:
      >>
      >> JShell.create()
      >>
      >> as a convenience method for:
      >>
      >> JShell.builder().build()
      >
      > Yes. I believe Paul asked for the same thing.
      >
      >> Documenting the latter build approach as the standard way to create an
      >> instance exposes the builder without throwing it in there face. Seem to
      >> me that adding that the one method call shorter approach makes thing
      >> more confusing: “so, do I use create() or builder()?!?".
      >
      > This is a common enough pattern, and I don't think anyone will find it confusing if reasonably documented. The issue with only being buildable through builders is one of "how many concepts do I have to learn to get started." If there is a simple factory method that creates a useful form, then users can get started without having to learn about all the options that are possible during building. Later, they can learn about additional options afforded by the builder. (Also, users tend to get annoyed by overly-complicated paths to build something simple.)

      Uncle.

            rfield Robert Field (Inactive)
            rfield Robert Field (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: