Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Why OSGi (Pros and Cons)? What patterns? JAA book

Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody, but specially to Kirk!

In your opinion, why should we design following the OSGi specifications? Which are the advantages to use OSGi? What about the disadvantages? What are the patterns you review in the book?

Thank you so much, and good luck with the book!!!
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The advantages of OSGi is that it gives you runtime support for modularity. This allows you to do things like enforcing module relationships at runtime, deploy different versions of a module alongside each other, hot deploy modules to a running application, and enforce module encapsulation. These are all things that standard Java cannot do. At the end of Chapter 3 (download link for this chapter available below), I provide an example that demonstrates how you cannot enforce module encapsulation using standard Java. Then, I show how you can enforce module encapsulation using OSGi. Personally, it's one of my favorite examples. Other favorites of mine include the reference implementation in Chapter 7, the Manage Relationships sample code (inverting and eliminating relationships), the Acyclic Relationships sample code (escalation, demotion, callback)...Ok...I like several of the examples, including Part 3 where I show how to take a system that's designed using the patterns and port it to OSGi. It was just so easy to do and you realize the benefits immediately.

In general, runtime support for modularity makes it easier to design modular software since the runtime container enforces your design time constructs. To design modular software without a runtime container, you have to employ other tools (i.e., JarAnalyzer in the book) and techniques (i.e., Levelize Build) to enforce modularity. I'd argue that if you don't already have a modular application, you should focus your efforts on modularizing the application first. Then, start using OSGi. Using OSGi if you don't have a modular application won't provide you all the benefits OSGi offers.

Visit the book's website at where you can review all 18 patterns and download an excerpt of the book. There is also a mobile web application available that you can take with you wherever you go.

Twitter: @pragkirk
Marco Antonio
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Kirk.

Those all things are very interesting and you have awakened my curiosity about OSGi and what it can provide to my job.

Thank you so much!!!
Or we might never have existed at all. Freaky. So we should cherish everything. Even this tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic