Sharks
Pojo Application Server
There are sharks in the sea, swimming around between your ships
and your harbor.
- The biggest shark is distance, when you design your
application, always try keep in mind how you intend splitting
the classes between client and server, and that distance
structure should be very evident in your CD Unit.
Making bean like business logic units with Harbor is actually
child's play, we thinking more along the lines of something
like having a gaming loop on the client side firing millions
of messages at the server side code, not a good idea and you
need to try visualize the distance between classes.
- There are other things, like you cannot fire events at the
clients. So doing something like leaving the GUI engine on the
server, and expecting events to happen 2000kms away on the
canvas, will never work. What will happen is when you setup
your callback, the canvas will serialize down to the server,
and the events will fire in that, you will never see them.
Easiest way to think about it, is as you would about firing
events from a web server to a browser, not an easy or
efficient thing to do. The trick is to get the split right in
the first place.
- Then there are some things that POJO just doesn't do well,
trying to serialize a ResultSet is one of them. ResultSets
don't move over a wire. There are many alternatives, such as
customizing the serial interface in the class, dropping down
to more primitive collections like arrays, using a CachedRowSet,
wrapping the non serialize-able structures in a holder class
and calling into its methods etc etc.
In general when you use collections in java, its always worth
having a look at whether it is serialize-able. If it carries
that interface, its wire friendly.
The intension here is just to make you a little more distance
aware. Its not that difficult to avoid sharks, if you train
yourself to spot them. These considerations are not specific to a
Pojo Application Server, they come into play as soon as machines
talk over the wire. With Harbor its so easy to forget that there
even is a wire, that one has to be reminded.