On 2 July 2010 15:37, <markovuksano...@gmail.com> wrote: > Here's what I think... > > What's the purpose of RawWebSocketImpl vs. WebSocket? that you could >> do a new WebSocket() instead of WebSocket.newInstance() ? (I don't >> dispute the interface+implementation, which is more-than-useful for >> mockability). >> > Different browsers might have a slightly different WebSocket object > implementation, so it seems to be necessary to be able to inject > different implementations for different browsers. The other thing is > that it feels much more natural to instantiate a java objet using syntax > like new WebSocket() compared to WebSocket.newInstance(). Third, it adds > to the testability. > "more natural" ? =) The xx.newInstance concept is used in the JDK itself at many places, _because_ its a natural fit for many cases. A few examples: ByteBuffer.allocate SocketChannel.open
-- regards gustav -- http://groups.google.com/group/Google-Web-Toolkit-Contributors