[shrinkwrap-issues] [JBoss JIRA] Updated: (SHRINKDESC-67) Rename "setX(param)" methods which return the "this" instance to "x(param)"
Andrew Rubinger (JIRA)
jira-events at lists.jboss.org
Tue Aug 2 05:33:23 EDT 2011
[ https://issues.jboss.org/browse/SHRINKDESC-67?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrew Rubinger updated SHRINKDESC-67:
--------------------------------------
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)
was:
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()".
"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".
> Rename "setX(param)" methods which return the "this" instance to "x(param)"
> ---------------------------------------------------------------------------
>
> Key: SHRINKDESC-67
> URL: https://issues.jboss.org/browse/SHRINKDESC-67
> Project: ShrinkWrap Descriptors
> Issue Type: Sub-task
> Reporter: Andrew Rubinger
>
> 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)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the shrinkwrap-issues
mailing list