95
Why OSGi? BJ Hargrave, IBM Peter Kriens, aQute

Why OSGi?

Embed Size (px)

DESCRIPTION

Presentation by Peter Kriens and BJ Hargrave at JavaOne 2011.

Citation preview

Page 1: Why OSGi?

Why OSGi?BJ Hargrave, IBM

Peter Kriens, aQute

Page 2: Why OSGi?

Agenda

• Why OSGi?

• The Dream

• Looking for Shoulders

• Java & Packages

• OSGi Bundles & Services

• Conclusion

Page 3: Why OSGi?

Why OSGi?

Page 4: Why OSGi?

Why OSGi?

Scriptorium

Page 5: Why OSGi?

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

Why OSGi?

Page 6: 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

Page 7: Why OSGi?

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

Page 8: Why OSGi?

The Dream

Page 9: Why OSGi?

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

G

B

E

H

C

F

I

Page 10: Why OSGi?

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

B

E

H

C

F

I

Page 11: Why OSGi?

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

F

I

B

Page 12: Why OSGi?

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

F

I

Page 13: Why OSGi?

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

F

I

Page 14: Why OSGi?

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

F

I

Page 15: Why OSGi?

Ba Bb

The Dream

D

A

G

E

H

C

F

I

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

Page 16: Why OSGi?

Ba Bb

The Dream

D

A

G

E

H

C

FF

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

Page 17: Why OSGi?

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

FF

Page 18: Why OSGi?

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

Page 19: Why OSGi?

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

FF

Page 20: Why OSGi?

Ba Bb

The Dream

• Adaptive

• Flexible

• Contracts

• Robust

• Secure

• Evolution

• Distributed

D

A

G

E

H

C

FF

I v2.0

Page 21: Why OSGi?

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

Page 22: Why OSGi?

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

Page 23: Why OSGi?

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

Page 24: Why OSGi?

Cambridge in the 50’s

Page 25: Why OSGi?

“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

Page 26: Why OSGi?

Subroutines

Page 27: Why OSGi?

Subroutines

Subroutines

Page 28: Why OSGi?

Subroutines

• Subroutine:

• Focus on what, not how

• Encapsulate the implementation details

• Formalized the input data (arguments)

• Formalized the output (return values)

Page 29: Why OSGi?

Subroutines

• Abstraction

• Easier to understand

• Less Code

• Fewer Errors

• Sharing

• Simpler Maintenance (depends …)

Page 30: Why OSGi?

Subroutines

Page 31: Why OSGi?

Functions

Page 32: Why OSGi?

Functions

Function

Page 33: Why OSGi?

Functions

Input(arguments)

Function

Page 34: Why OSGi?

Functions

Input(arguments)

Output(return)

Function

Page 35: Why OSGi?

Functions

Input(arguments)

Output(return)

Private

Function

Page 36: Why OSGi?

Then Systems Grew

Page 37: Why OSGi?

Then Systems Grew

Page 38: Why OSGi?

Spaghetti Code

Page 39: Why OSGi?

Pittsburg 70’s

Page 40: Why OSGi?

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

Page 41: Why OSGi?

Modules

Page 42: Why OSGi?

Modules

Module

Page 43: Why OSGi?

Modules

ImportedFunctions

ExportedFunctions

Private Functions

Module

Page 44: Why OSGi?

Then Systems Grew

Page 45: Why OSGi?

Then Systems Grew

Page 46: Why OSGi?

Sharing Proved Hard

Page 47: Why OSGi?

Sharing Proved Hard

Page 48: Why OSGi?

Sharing Proved Hard

Page 49: Why OSGi?

Palo Alto 80’s

Page 50: Why OSGi?

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

Page 51: Why OSGi?

Objects

Page 52: Why OSGi?

Objects

ImportedMembers

ExportedMembers

Private Members

Type

Page 53: Why OSGi?

Objects

• Objects/Classes => Modules +

• Instantiation (private data per instance)

• Inheritance

• Polymorphism

Page 54: Why OSGi?

Then Systems Grew

Page 55: Why OSGi?

Then Systems Grew

Page 56: Why OSGi?

C++

Page 57: Why OSGi?

Menlo Park 90’s

Page 58: Why OSGi?

Menlo Park 90’s

Page 59: Why OSGi?

Packages

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

Java Language Specification

Page 60: Why OSGi?

Packages

ImportedTypes

ExportedTypes

Private Types

Packages

Page 61: Why OSGi?

Then Systems Grew

Page 62: Why OSGi?

Then Systems Grew

Page 63: Why OSGi?

And Distributed

Page 64: Why OSGi?

And Distributed

Page 65: Why OSGi?

And Multiplied

Page 66: Why OSGi?

And Multiplied

Page 67: Why OSGi?

Small Java App ...

Page 68: Why OSGi?

Worldwide 00’s

Page 69: Why OSGi?

Worldwide 00’s

Page 70: Why OSGi?

Worldwide 00’s

Page 71: Why OSGi?

Next Level of Modularity

Page 72: Why OSGi?

Next Level of Modularity

Functions

Page 73: Why OSGi?

Next Level of Modularity

Functions

Classes/Objects

Page 74: Why OSGi?

Next Level of Modularity

Functions

Classes/Objects

Packages

Page 75: Why OSGi?

Next Level of Modularity

Functions

Classes/Objects

Packages

Bundles

Page 76: Why OSGi?

Next Level of Modularity

Functions

Classes/Objects

Packages

Bundles

Page 77: Why OSGi?

Bundles

ImportedPackages

ExportedPackages

Private Packages

Bundle(JAR file)

Page 78: Why OSGi?

Type Coupling

Page 79: Why OSGi?

Type Coupling

Page 80: Why OSGi?

Download the Internet

Page 81: Why OSGi?

Type Coupling

Page 82: Why OSGi?

Type Coupling

substitutablepackages= API

Page 83: Why OSGi?

Instance Coupling

Provider BundleConsumer Bundle

Page 84: Why OSGi?

Instance Coupling

API Bundle

Provider BundleConsumer Bundle

Page 85: Why OSGi?

Instance Coupling

API Bundle

Provider BundleConsumer Bundle

need aninstance ...

Page 86: Why OSGi?

Instance Coupling

API Bundle

Provider BundleConsumer Bundle

need aninstance ... X

Page 87: Why OSGi?

Instance Coupling

Page 88: Why OSGi?

Instance Coupling

API Bundle

Provider BundleConsumer Bundle

Service

Page 89: Why OSGi?

A Dream Come True

D

A

G

B

E

H

C

F

I

Page 90: Why OSGi?

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

Why OSGi?

Page 91: 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

Page 92: Why OSGi?

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!

Page 93: Why OSGi?

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

Page 94: Why OSGi?

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

Page 95: Why OSGi?

Q&A