Uploaded image for project: 'Commons CLI'
  1. Commons CLI
  2. CLI-83

OptionBuilder only has static methods, yet many return an OptionBuilder instance

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.0
    • CLI-2.x
    • None
    • Operating System: other
      Platform: Other

    • 24191

    Description

      First of all, I think CLI is great.

      However, the OptionBuilder really gets my goat. All of the methods are static,
      yet all, except the create() methods, return an OptionBuilder instance.
      Presumably this is to allow us to chain calls to the builder, but by chaining
      calls, we are calling static methods through an instance, which is generally
      considered bad form.

      Also, it doesn't really qualify as an instance of the Builder Pattern in its
      current form since it does not meet the intent: 'Separate the construction of a
      complex object from its representation so that the same construction process can
      create different representations' (this is because of the static methods).

      Why not make the methods non-static and get the client to create an instance of
      the builder before proceeding? In it's current form, it seems a bit schizophrenic.

      Regards,

      Lance

      Attachments

        Activity

          People

            Unassigned Unassigned
            lance@teaminabox.co.uk Lance Walton
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: