Details

    • Type: Sub-task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 1.2.0-alpha-1
    • Component/s: None
    • Labels:
      None

      Description

      For example:

      Application5Descriptor.securityRole().setRoleName(roleName)

      Here the API looks backwards. "securityRole()" is really a "get" operation, because it doesn't return the descriptor, but instead SecurityRoleType. So it should be named "getSecurityRole()" if it's a get, or "newSecurityRole|createSecurityRole" if it's making a new one.

      "setRoleName" on the other hand is used in method chaining, so according to the conventions we use in ShrinkWrap alongside Fowler's definition for fluent APIs in DSLs:

      http://martinfowler.com/bliki/FluentInterface.html

      ...then "setRoleName(param)" should become simply "roleName".

      So all together, I'd expect this to look more like:

      Application5Descriptor.createSecurityRole().roleName(roleName)

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            rbattenfeld Ralf Battenfeld added a comment -

            I suppose to introduce getOrCreate for elements which only occurring once. The underlying Node class uses the same name. Otherwise, we have to introduce a getXX and a createXX for such single elements. What do you think?

            For the elements which can be defined multiple times, your suggestion is good, e.g. Application5Descriptor.createSecurityRole().roleName(roleName)

            Show
            rbattenfeld Ralf Battenfeld added a comment - I suppose to introduce getOrCreate for elements which only occurring once. The underlying Node class uses the same name. Otherwise, we have to introduce a getXX and a createXX for such single elements. What do you think? For the elements which can be defined multiple times, your suggestion is good, e.g. Application5Descriptor.createSecurityRole().roleName(roleName)
            Hide
            alrubinger Andrew Rubinger added a comment -

            Let's do 3:

            getX - Returns null if doesn't exist
            createX - Throws IllegalStateException (or a subclass of) if already exists
            getOrCreateX - Returns either the one found or just created

            Show
            alrubinger Andrew Rubinger added a comment - Let's do 3: getX - Returns null if doesn't exist createX - Throws IllegalStateException (or a subclass of) if already exists getOrCreateX - Returns either the one found or just created
            Hide
            rbattenfeld Ralf Battenfeld added a comment -

            Good, this will be independend from the occurence of an element. I will do this. It is consistend for all elements. It will come sometimes this week.

            Show
            rbattenfeld Ralf Battenfeld added a comment - Good, this will be independend from the occurence of an element. I will do this. It is consistend for all elements. It will come sometimes this week.
            Hide
            rbattenfeld Ralf Battenfeld added a comment -

            Hi Andrew

            I am making good progress. I plan to be ready end of this week. It will include a refactored ddJava.xsl making the maintainability much easier as before.

            Regards,
            Ralf

            Show
            rbattenfeld Ralf Battenfeld added a comment - Hi Andrew I am making good progress. I plan to be ready end of this week. It will include a refactored ddJava.xsl making the maintainability much easier as before. Regards, Ralf
            Hide
            alrubinger Andrew Rubinger added a comment -

            Fantastic!

            Show
            alrubinger Andrew Rubinger added a comment - Fantastic!
            Show
            alrubinger Andrew Rubinger added a comment - Upstream: https://github.com/shrinkwrap/descriptors/commit/c21ef96e8e45cc2bc5810c4dd417021c8fd4b29c

              People

              • Assignee:
                rbattenfeld Ralf Battenfeld
                Reporter:
                alrubinger Andrew Rubinger
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development