Java Reference
In-Depth Information
5.3.3
The rewards of well-written bundles
Given the level of effort you spent making your bundles, you would hope for some
sort of pay-off, and unsurprisingly there's a big one. If you've written your bundles
well, it becomes extremely easy to reuse them. Because you have a small list of
imports, it's trivial to supply your dependencies, and because the imports are ver-
sioned, you also know what version of the dependencies to supply. Furthermore, if you
want to make use of a third-party bundle, then later change version or implementa-
tion, you know exactly which bundles are affected; there's no need to scour the entire
codebase of your application. Finally, because all of your exports and imports are ver-
sioned, it doesn't matter if the dependency of a dependency clashes with another; if
the versions are semantically compatible, you can provide one implementation that
both can use, or if not, you can provide two implementations knowing that there's no
risk of failure at runtime!
For those who embrace OSG i, hiding implementation classes adds yet more bene-
fits. Bug fixing and refactoring become trivial because there are no compile-time
dependencies between implementation bundles, only between an implementation
and its API . This significantly reduces the time it takes to debug, fix, build, and deploy.
Although the benefits mentioned are all incredibly worthwhile achievements, OSG i
wouldn't have achieved the popularity it has if that were all it had to offer. For many
people who know OSG i, they're fringe benefits—services are OSG i's killer feature.
We've seen one of the ways OSG i services can be put to use in our discussion of the
whiteboard pattern. We'll discuss OSG i services more in the next chapter.
5.4
Summary
Although this chapter hasn't extended your superstore, it has taught you a lot more
about what was already there. The main reason that you haven't had to make changes
to your application is that it was already following the guidelines for ensuring good
modularity and dynamism. We hope that you have a new-found appreciation for your
little superstore, and that by better understanding the principles that underpin it,
you'll find it easier to recreate its modularity in your own applications.
Search WWH ::




Custom Search