[zeromq-dev] HEADS UP: changes to Java binding public API

Martin Sustrik sustrik at 250bpm.com
Thu Apr 8 17:50:58 CEST 2010


>>> Btw. There was a question on IRC about why the package name doesn't
>>> match the website name (zeromq.org vs. zmq.org).
>>> Any thoughts?
>> Beats me. It was that way when I started looking into things. I can
>> change it to zeromq.org in a patch after the one that changes error
>> handling.
>> When I do this change, I will introduce the top-level "namespace" (as
> an
>> all -encompassing class). Should that be ZMQ (nice but inconsistent),
>> ZeroMQ (nice), Zeromq (yikes), other?
> As previously discussed, my next patch to the Java binding will include:
> * Changing the package name from zmq.org to zeromq.org.
> * Adding a top-level ZQM "namespace", this is, a single public class
> that will include all current public classes (Context, Socket, Poller)
> and constants (PUB, SUB, POLL, etc.).
> With the proposed changes, the Java binding would now look like this:
>   import org.zeromq.ZMQ;  // NOT org.zmq.ZMQ!!!
>   ...
>   ZMQ.Context c = new ZMQ.Context(0, 0);
>   ZMQ.Socket s = new ZMQ.Socket(c, ZMQ.PUB);
>   ...
>   ZMQ.Poller p = new ZMQ.Poller(c, 3);
>   ...
> In other words, all classes AND CONSTANTS will reside directly under the
> ZQM namespace.
> This is a change in the public API for the Java binding; hence the heads
> up. If anybody opposes this or has any comments, this is the moment to
> speak up.
> Now, another question. Since I would be changing the public API, perhaps
> this is also the moment to introduce another change:
>   import org.zeromq.ZMQ;  // NOT org.zmq.ZMQ!!!
>   ...
>   ZMQ.Context c = ZMQ.context(0, 0);
>   ZMQ.Socket s = c.socket(ZMQ.PUB);
>   ...
>   ZMQ.Poller p = c.poller(3);
>   ...

I am personally voting for the change!

While it may be painful (but not excruciatingly painful) for those 
already using the binding to catch up, it means that Java binding will 
have _standardised_ API, same as any other language binding. That, in 
turn, will save a lot of pain for those moving between different languages.


More information about the zeromq-dev mailing list