原文地址:
http://www.modumind.com/2009/05/04/why-is-osgi-important/
I’ve seen a number of blog posts and tweets lately asking some version of the question Why is OSGi important? If you’re one of the many people looking around at the increasing usage of OSGi and wondering whether it matters to you, here’s my answer.
I’m going to start by making a pretty audacious claim, which is that OSGi is one of the most important technologies to have arisen in the last 20 years. This does not mean, however, that OSGi is a revolutionary technology. In fact, OSGi is so important because it represents the logical next step in the long-term evolution of software development.
Where we’re coming from
To understand what I mean, let’s go back 20 to 30 years to the time when object oriented languages first became popular. One of the main reasons we adopted OO at that time was because it allowed us to hide many of the implementation details of our code.
Moving from procedural languages to OO languages allowed us to develop classes exposing a contract defined by a set of public methods.
The result was that much of our code was invisible outside of its class, and this had profound implications for the way we develop software. By accepting the apparent restriction of visibility we gained immense freedom. We gained the freedom to reuse classes without knowing their implementation details. We gained the freedom to refactor our code without worrying about the consumers of a class.
Can you imagine what a pain it would be if you had to develop software without information hiding?
Where we’re headed
Now imagine what it would be like if you could hide not only the methods within a class but entire sets of classes within a JAR. Imagine that JARs could define public contracts the same way classes do, and that these contracts would be enforced both during development and at runtime. Imagine that we could achieve all of the benefits of information hiding (managing complexity, code reuse, testability, refactoring, etc.) at an entirely new level.
OSGi makes this possible by offering up the standard Java package as a new unit of information hiding. When our code is running inside of an OSGi framework, each package in a JAR can be either exposed or hidden from consumers of that JAR.
Just as a class has a small set of public methods representing its contract with consumers, a modularized JAR (a bundle in OSGi terms) has a small set of exported packages representing its public contract. The bulk of our code lives in internal packages hidden from other JARs.
Imagine being able to rename classes, split or combine classes, move classes from one package to another, move entire packages from one JAR to another, all without having to worry about impacting the consumers of a JAR. So many of these types of refactorings are skipped now out of fear. Package level information hiding gives us the confidence we need to perform these refactorings, allowing us to react with agility to the changing needs of our users.
Modularity is inevitable
Whether OSGi in particular succeeds or not, JAR level information hiding is inevitable. The benefits are simply too great to ignore, and in 5 or 10 years we’ll all be wondering how we could have possibly lived without it.
Currently, OSGi is the only tool we have to accomplish this. Luckily for us it’s a well thought-out, well tested, standards-based solution. I can’t think of one reason (besides perhaps its name) to develop an alternative to OSGi. It’s here. It works. Let’s use it.
It’s time for OSGi
Steve McConnell has a great quote that really gets at the heart of what OSGi is trying to achieve.
In Code Complete, he writes:
Software development has advanced in large part by increasing the granularity of the aggregations that we have to work with.
Because this granularity of aggregation is so critical, the move from unmodular to modular practices is as important as the move from procedural to object-oriented practices. For 20 years we’ve been limited to using the class as our unit of abstraction. As successful as that has been, it’s time to move on to modules. Its time for OSGi.
分享到:
相关推荐
DESCRIPTION What is OSGi? Simply put, OSGi is a standardized technology that allows developers to create the highly modular Java applications that are required for enterprise development. OSGi lets ...
osgi介绍osgi介绍osgi介绍osgi介绍osgi介绍osgi介绍osgi介绍osgi介绍osgi介绍osgi介绍
简要介绍talend-ESB, osgi etl 以及相关知识概述
简要介绍talend-esb osgi etl 等知识,综合介绍了talend-ESB是什么,osgi是什么,以及TOS-ESB相关组件介绍。具体的内容,请下载仔细查看。
The Java™ programming language is one of the most popular languages today ...That module system is called OSGi. OSGi is nothing more nor less than the way to build modular applications in Java.
资源名称:OSGI原理与最佳实践内容简介:国内第一本OSGi图书OSGi国内推广者林昊多年经验的结晶涵盖OSGi从入门到深入的知识体系引领OSGi国内研究和普及本书基于作者多年使用OSGi的经验而编写,涵盖了OSGi从入门到深入...
利用R-OSGi实现分布式OSGi应用 本文通过介绍传统 OSGi 应用程序及 R-OSGi 的实现方式入手,阐述了 R-OSGi 对于 OSGi 规范的实现方式。然后通过一个简单的功能实现由浅入深地讲述传统 OSGi 和 R-OSGi 上的两种不同...
网上收集的OSGI资料. 包括: OSGi原理与最佳实践(精选版).pdf OSGI实战和源码.rar osgi进阶.pdf Introduce.OSGi.ppt OSGi.in.action.ppt r4.cmpn.pdf r4.core.pdf r4.enterprise.pdf
讲OSGI应用的讲OSGI应用的讲OSGI应用的讲OSGI应用的讲OSGI应用的
OSGI 入门资料PDF,包括OSGI实战、OSGI进阶、OSGI 入门和整合Spring、OSGI原理与最佳实践
OSGI 实例 eclipse 插件开发
The OSGi Enterprise Expert Group (EEG) is chartered to define the technical requirements and specifications to tailor and extend the OSGi framework to address information technology software ...
《 OSGi实战》是学习OSGi的全面指导,利用与架构和开发人员相关的示例清楚地讲解OSGi概念,同时探讨了很多实践场景和技术,阐述了开发人员有多需要OSGi,怎么将OSGi嵌入其他容器中,将遗留系统移入OSGi的最佳实践,...
OSGi的入门教程,帮助初学者快速了解OSGi的定义、用途及组成。
OSGi学习不错的材料 OSGi学习不错的材料 OSGi学习不错的材料 OSGi学习不错的材料
osgi,林昊写的osgi实战和进阶,学习osgi的好东西,入门的首选。
Play OSGi Who use OSGi What is OSGi OSGi R4 Implemention How to develop OSGi app OSGi Resources
OSGi开发文档和实践指南,描述了OSGI的开发流程
OSGi的入门资料,网上找的,初探OSGi 的全文
or external changes is an important requirement for both stationary and mobile computing. Without this ability, all requirements have to be foreseen, which is often not possible in practice. Classical...