Why OSGi?

Preview:

DESCRIPTION

Presentation by Peter Kriens and BJ Hargrave at JavaOne 2011.

Citation preview

Why OSGi?BJ Hargrave, IBM

Peter Kriens, aQute

Agenda

• Why OSGi?

• The Dream

• Looking for Shoulders

• Java & Packages

• OSGi Bundles & Services

• Conclusion

Why OSGi?

Why OSGi?

Scriptorium

… because there should be a better way to develop software ...

Why OSGi?

Why OSGi?

2010 2003

1996 1989

1982 1982

1975 1968

1961

Amount of software doubling every 7 yearssource: http://users.jyu.fi/~koskinen/smcosts.htm

Why OSGi?

2010 2003

1996 1989

1982 1982

1975 1968

1961

2017

Amount of software doubling every 7 yearssource: http://users.jyu.fi/~koskinen/smcosts.htm

The Dream

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

G

B

E

H

C

F

I

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

B

E

H

C

F

I

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

F

I

B

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

F

I

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

F

I

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

F

I

Ba Bb

The Dream

D

A

G

E

H

C

F

I

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

Ba Bb

The Dream

D

A

G

E

H

C

FF

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

FF

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

FF

Ba Bb

D

A

G

E

H

C

F

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

FF

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

FF

I v2.0

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

FF

I v2.0

S;1.1.0

F

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

FF

I v2.0

S;1.1.0

F

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

FF

I v2.0

S;1.1.0

F

Cambridge in the 50’s

“As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought.”

“… the realization came over me with full force that a good part of the remainder of my life was going to be spent finding errors in my own programs.”

Maurice Wilkes

Cambridge in the 50’s

Subroutines

Subroutines

Subroutines

Subroutines

• Subroutine:

• Focus on what, not how

• Encapsulate the implementation details

• Formalized the input data (arguments)

• Formalized the output (return values)

Subroutines

• Abstraction

• Easier to understand

• Less Code

• Fewer Errors

• Sharing

• Simpler Maintenance (depends …)

Subroutines

Functions

Functions

Function

Functions

Input(arguments)

Function

Functions

Input(arguments)

Output(return)

Function

Functions

Input(arguments)

Output(return)

Private

Function

Then Systems Grew

Then Systems Grew

Spaghetti Code

Pittsburg 70’s

Pittsburg 70’s

“ … modularization as a mechanism for improving the flexibility and comprehensibility of a system while allowing the shortening of its development time.”

David Parnas

Modules

Modules

Module

Modules

ImportedFunctions

ExportedFunctions

Private Functions

Module

Then Systems Grew

Then Systems Grew

Sharing Proved Hard

Sharing Proved Hard

Sharing Proved Hard

Palo Alto 80’s

Palo Alto 80’s“Objects support modularity - the functioning of an object does not depend on the internal details of another object. The complexity of the system is reduced by this minimization of interdependencies of system components.”

Smalltalk Team

Objects

Objects

ImportedMembers

ExportedMembers

Private Members

Type

Objects

• Objects/Classes => Modules +

• Instantiation (private data per instance)

• Inheritance

• Polymorphism

Then Systems Grew

Then Systems Grew

C++

Menlo Park 90’s

Menlo Park 90’s

Packages

“Chapter 7 describes the structure of a program, which is organized into packages similar to the modules of Modula.”

Java Language Specification

Packages

ImportedTypes

ExportedTypes

Private Types

Packages

Then Systems Grew

Then Systems Grew

And Distributed

And Distributed

And Multiplied

And Multiplied

Small Java App ...

Worldwide 00’s

Worldwide 00’s

Worldwide 00’s

Next Level of Modularity

Next Level of Modularity

Functions

Next Level of Modularity

Functions

Classes/Objects

Next Level of Modularity

Functions

Classes/Objects

Packages

Next Level of Modularity

Functions

Classes/Objects

Packages

Bundles

Next Level of Modularity

Functions

Classes/Objects

Packages

Bundles

Bundles

ImportedPackages

ExportedPackages

Private Packages

Bundle(JAR file)

Type Coupling

Type Coupling

Download the Internet

Type Coupling

Type Coupling

substitutablepackages= API

Instance Coupling

Provider BundleConsumer Bundle

Instance Coupling

API Bundle

Provider BundleConsumer Bundle

Instance Coupling

API Bundle

Provider BundleConsumer Bundle

need aninstance ...

Instance Coupling

API Bundle

Provider BundleConsumer Bundle

need aninstance ... X

Instance Coupling

Instance Coupling

API Bundle

Provider BundleConsumer Bundle

Service

A Dream Come True

D

A

G

B

E

H

C

F

I

… because it is a better way to develop software ...

Why OSGi?

Conclusion

2010 2003

1996 1989

1982 1982

1975 1968

1961

2017

Amount of software doubling every 7 yearssource: http://users.jyu.fi/~koskinen/smcosts.htm

OSGi

• Legacy and backward compatibility is important

• Modularizing is hard

• Many popular Java patterns are fundamentally not modular

• In the next 7 years, we double the amount of software

• Investment in modularity has a great ROI!

OSGi Alliance• The OSGi Alliance is a non-profit that has the

vision to develop a Java component model to ease software development

• Comprehensive framework specification

• Service specifications

• An active community

• Repository

• Tools

Join!

• Help us to achieve our vision to make software simpler to develop

• Provide Requirements

• Develop specifications

• Help the community

• OSGi Alliance restructured to provide lower-cost membership levels

Q&A

Recommended