Patrick Hunt commented on ZOOKEEPER-113:

A stub was my second choice. ;-)

Honestly I don't see how calling a factory method is any more inconvenient for 
a user than calling a constructor, you get a ZooKeeper instance back in any 
case. I would say an interface is _more_ convenient for the user in the 
following respects:

1) the interface provides a specific place to define, document and monitor the 
2) factories are very common constructs, esp as we are considering use of URI 
to specify cluster, users know what they are
3) factories allow separation of "how to construct" from "how to use".
4) in some(limited) sense "what's good for implementors is good for users", 
separating interface from implementation usually results in better code... 
(granted not always true)

> ZooKeeper.java should be interface not concrete class.
> ------------------------------------------------------
>                 Key: ZOOKEEPER-113
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-113
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: java client
>            Reporter: Patrick Hunt
> I think ZooKeeper class in src/java/main should be an interface rather than a 
> concrete class. Among other OO goodness this would give us more flexibility 
> when implementing tests on client code. Would also require something like a 
> factory to be created, which might actually work well with another JIRA we 
> have which is the idea to use a URI(s) rather than a host:port combination 
> when creating zookeeper clients.
> Unfortunately this would have a big impact on clients as it's not b/w 
> compatible (instantiating a new client that is).

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

Reply via email to