ctubbsii commented on issue #747: Shorten method names in AccumuloClient builder
URL: https://github.com/apache/accumulo/issues/747#issuecomment-436348954
 
 
   > I don't think a user would ever write code like the following because they 
would usually not know the number of zookeepers at compile time.
   > 
   > ```java
   >  Accumulo.newClient().to(name, {zk1, zk2});
   > ```
   
   Okay, sure, but accepting an array doesn't require them to... that was just 
one example of calling the proposed method. I'd expect them to supply the array 
from whatever data structure they have. I would not necessarily expect them to 
collapse their data structure into our specific, comma-separated 
"stringly-typed" field in our Java API (in our config in serialized form, yes, 
but not in our programmatic API). Other examples of calling this method with 
the array type:
   
   ```java
     Accumulo.newClient().to(name, zkString.split(";")); // OR
     Accumulo.newClient().to(name, zkGson.fromJson(jsonLine, String[].class)); 
// OR
     Accumulo.newClient().to(name, zkList.toArray());
   ```
   
   If the array parameter type isn't a good idea, can anybody else suggest an 
alternative solution to avoid the `(String, String)` parameter ordering 
ambiguity? Or, since I think this is also a problem, can anybody suggest a 
clean way to decouple the params from each other? The fact that cluster 
instance name and ZKs are coupled is an implementation detail that need not be 
exposed in the API... or at least, if it is exposed, it should be more clear 
their relationship. For example, it should be more clear that the name is the 
registration name, and that ZKs is the registration service, as in 
`.registeredAs(name, zks)`, or maybe just `.zk(name, zks)` (with good API docs 
explaining the use of ZK as a registration service). Or, maybe they should be 
decoupled in a way that also avoids the parameter ambiguity? As in: 
`.to(name).at(zks)`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to