The third solution to round-tripping is to simply refactor. In some
cases, it's possible to redefine the major interface boundaries so that
they fall in places with fewer round-trip communications. In rare cases,
we should sacrifice packaging for performance if we can eliminate a
large number of round-trips, but as a rule, refactoring should produce a
cleaner, more readable architecture. For this type of refactoring, the
UML sequence diagram, like the one in figure 10.3, is extremely useful.
UML sequence diagrams clearly show round-trip communication layers
between major interface points. The rectangles across the top of the graph
represent objects. The vertical lines under each are timelines. The horizontal
arrows represent flow of control. For optimization, iterations and chatty inter-
faces between objects can be shifted off an interface boundary. In other cases,
we can add a facade or cache. The detail and layout of good sequence dia-
grams makes it all possible.
Ask for data bean
Get information from EJB
Set copy of
Figure 10.3 Sequence diagrams are ideal for dealing with round-tripping. The interfaces
between objects can be clearly seen, and we can determine if we have iteration or major
activity across them.