For infrastructure libraries there is no alternative IMO.
I have implemented a struct emulation (
http://code.google.com/p/fast-serialization/wiki/StructsIntroduction) and I am currently (re-)implementing a high performance messaging based on it, and found it pretty convenient to use (though I had some VM crashes along the way).
Having a convenient way to access packed structures let's me
* send up to ~4GByte / second through localhost socket/shared mem queue/ tcp over infiniband
* do up to 8 million (reliable) remote calls per second (single-topic incl. method dispatch)
* nearby allocationf free
This would be impossible using standard java. For basic infrastructure libraries this is very useful as it exactly profits from the 3 points martin mentioned above
* very low Full GC cost, only ~1000 objects allocated (even with >1GB of message buffers). A messaging layer should be mostly GC-neutral.
* very fast filtering of messages as no decoding is required to access partial data of a message
* high locality for fast processing of retransmission requests and packet/message filtering
* easy to read from non-java code
The "beauty" of the dedicated structs approach is, that it addresses several issues at once (IPC, GC, performance). While other approaches excel in a single area (e.g.locality), structs catch several things at once.
On the other hand i agree this won't be a main stream tool to represent ordinary business data as the notion of 'pointer' and objects-which-aren't-objects will mess up any multi-person project in a few weeks. However it comes in handy in the 5% of performance/throughput/latency critical code and will work there well encapsulated without any problem.
One can see it as a tool to avoid C/C++ mix ins in many cases, not as a common "language extension". After all the code stays somewhat maintainable and readable, it's not that ugly as direct getInt/putInt stuff frequently used.
Am Montag, 9. September 2013 04:04:12 UTC+2 schrieb Kevin Burton: