"jason.greene(a)jboss.com" wrote :
| I do agree with the API consistency argument, however I disagree with using get/set
with method chaining. If you are doing a DSL style method chain, you don't need
get/set, it's just extra verbosity. Get is logically the no-arg version, and Set is
logically the version which takes arguments. In general I think Java developers took the
JavaBean recomendations WAY too far. The whole reason JavaBeans required get & set
notation was so that an automated tool could figure out what the "properties"
are. In other words, JavaBeans are a big hack.
|
I agree get/set vs. DSL style is subjective. To clarify my stay I'm just complaining
about API consistency.
The following two classes are some kind of To be, or not to be Hamlet dilemma in a way:
package org.jboss.bootstrap.api.as.config;
|
| public interface JBossASBasedServerConfig<T extends
JBossASBasedServerConfig<T>> extends ServerConfig<T>
| {
| ...
| String getBindAddress();
| T bindAddress(String bindAddress); // I'm using set/get style in API design?
| ...
| }
|
| package org.jboss.bootstrap.api.server;
|
| public interface Server<K extends Server<K, T>, T extends
ServerConfig<T>>
| {
| ...
| T getConfiguration();
| void setConfiguration(T config); // Or I'm using DSL style in API design?
| ...
| }
"jason.greene(a)jboss.com" wrote :
| Also, as a more general comment, Bloch's advice is just that, advice. API design
is somewhat subjective, so we shouldn't treat them as hard and fast rules.
|
Agreed.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4268937#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...