I was lucky enough to be asked to preform a technical review of “Modular Java: Creating Flexible Applications with OSGi and Spring“.Â It’s Craig Walls‘ next book and it’s being published by the Pragmatic Programmers.
Craig does a great job of making the case for modular Java development with OSGi.Â He covers why we need to start thinking about more than just how we design our methods / classes and focus more on how we design reusable Java modules.
First, Craig makes the case for modular design.Â Then he talks about how OSGi enables us to write modular Java applications.Â He covers both the Apache Felix and Eclipse Equinox OSGi containers.Â Next you are writing and deploying a HelloWorld OSGi service.Â And that’s all done in the first two chapters!
Craig spends the rest of the book covering modular Java and OSGi concepts through the development of an example project, Dude Where’s my JAR.Â You also throughly learn an invaluable tool for OSGi development, Pax Construct. You learn about and writing and deploying OSGi bundles, then writing, deploying and consuming OSGi services.
Once you think you know everything about OSGi, and might be thinking that it’s a bit complicated, Craig brings in the Spring Framework.Â He covers Spring Dynamic Modules for OSGi (Spring-DM) which is used to eliminate all of the OSGi-specific code in the example application.Â You refactor the app away from depending on the OSGi API.Â You change the services to POJOs and OSGi services then inject them into other beans.
My favorite thing about this book was that I didn’t have to read 1000 pages to understand the concepts and get up and running.Â Like all the Pragmatic Programmer books, you are educated, and up and running in a few 100 pages.Â Read this book if you want to quickly get up-to-speed on OSGi and Spring Dynamic Modules.