9 Save time for performance. Regrettably, but inevitably, something will
go wrong. It's important to have enough time and money to make
modifications. The time a company dedicates to performance issues
depends on several factors, including the competence of its staff and
the consequences for failure.
These suggestions don't take the place of a strong development culture and
plain old common sense. We can help a project succeed by encouraging devel-
opers to watch for performance concerns and allowing them to step forward
without repercussion. I've worked with many teams in a variety of develop-
ment cultures. Some managers tended to staple messengers to the wall; under
those circumstances, problems did not get reported. Other companies encour-
aged developers to find problems and even had formal reward systems for
bringing suggestions to managers' attention. The balance probably lies some-
where in between, with reasonable accountability and an atmosphere that
focuses on fixing problems rather than assigning blame.
The Round-tripping antipattern is a combination of earlier antipatterns in this
book, but it merits special attention here because of its significant impact on
performance. Round-tripping occurs when a design requires significant itera-
tion across an interface boundary. In figure 10.2, the model is deployed on a
different system than the view.
For our purposes, it doesn't matter whether the view logic is imple-
mented as a proprietary client, an applet, or a distributed application across
multiple servers. The key is that the design will require multiple round-trip
communications across the interface boundary between the model and the
view. As the view grows in complexity, the communication costs will rise.
Because we're iterating through the fields of our view across a major inter-
face boundary, this is a classic example of the Round-tripping antipattern.
Solution: Cache and Facade
The antipattern we just described is technically the same problem that
occurred twice in earlier chapters. In chapter 5, we discussed the Cacheless
Cow antipattern and used our bulletin board example to illustrate a round-
tripping scenario without a cache to compensate. The Everything Is an EJB
antipattern in chapter 8 iterates through the fields on an EJB . Three solutions
to the round-tripping antipattern exist: