Successfully reported this slideshow.
Your SlideShare is downloading. ×

Moved to https://slidr.io/azzazzel/what-s-not-new-in-modular-java

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 70 Ad

Moved to https://slidr.io/azzazzel/what-s-not-new-in-modular-java

Download to read offline

This slide deck will be removed from here in the future. It has been moved to : https://slidr.io/azzazzel/what-s-not-new-in-modular-java

This slide deck will be removed from here in the future. It has been moved to : https://slidr.io/azzazzel/what-s-not-new-in-modular-java

Advertisement
Advertisement

More Related Content

Slideshows for you (20)

Viewers also liked (20)

Advertisement

Similar to Moved to https://slidr.io/azzazzel/what-s-not-new-in-modular-java (20)

Recently uploaded (20)

Advertisement

Moved to https://slidr.io/azzazzel/what-s-not-new-in-modular-java

  1. 1. What's not new in modular Java! Milen Dyankov @ Featuring JDK 9 Early Access with Project Jigsaw Developer advocate @ milendyankov Liferay
  2. 2. Think of not new as in not new concept and not as in not new car
  3. 3. Why is it about time to start thinking about modularity in Java?
  4. 4. JSR 277 JSR 294 JSR 376 JEP 200 JEP 201 JEP 220 JEP 260 JEP 261 ... 2005 2014
  5. 5. Antwerp, Belgium, November 2015 “Survey” at
  6. 6. What is modularity /particularly in Java/ anyway?
  7. 7. "When I use a word," Humpty Dumpty said, in rather a scornful tone, "it means just what I choose it to mean - neither more nor less."
  8. 8. Modularity Maturity Model proposed by Dr Graham Charters at the OSGi Community Event 2011 Level 1 Ad Hoc nothing Level 2 Modules decoupled from artifact Level 3 Modularity decoupled from identity Level 4 Loose-Coupling decoupled from implementation Level 5 Devolution decoupled from ownership Level 6 Dynamism decoupled from time
  9. 9. Level 1 Ad Hoc nothing Level 2 Modules decoupled from artifact Level 3 Modularity decoupled from identity Level 4 Loose-Coupling decoupled from implementation Level 5 Devolution decoupled from ownership Level 6 Dynamism decoupled from time Level 7 Peter Kriens only available to people who are Peter Kriens Modularity Maturity Model proposed by Dr Graham Charters at the OSGi Community Event 2011
  10. 10. Modularity Maturity Model proposed by Peter Kriens in foreword to “Java Application Architecture” Level 1 Ad Hoc Level 2 Modules Level 3 Modularity Level 4 Loose-Coupling Level 5 Devolution Level 6 Dynamism Unmanaged / chaos Managing dependencies Proper isolation Minimize coupling Service-oriented architecture
  11. 11. Level 1 Monolith Level 2 Composite Level 3 Containers Level 4 Discovery Level 5 JuServices Buzzword compliant Modularity Maturity Model
  12. 12. Level 1 Monolith Unaware of own dependencies Level 2 Composite Aware of infrastructural dependencies Level 3 Containers Aware of functional dependencies Level 4 Discovery Aware of functional requirements Level 5 Adapts to changing requirementsJuServices Buzzword compliant Modularity Maturity Model
  13. 13. Level 1 Monolith Level 2 Composite Level 3 Containers Level 4 Discovery Level 5 JuServices Buzzword compliant Modularity Maturity Model
  14. 14. Level 1 Monolith Level 2 Composite Level 3 Containers Level 4 Discovery Level 5 JuServices Buzzword compliant Modularity Maturity Model
  15. 15. Buzzword compliant Modularity Maturity Model JuServices Level 1 Monolith Level 2 Composite Level 3 Containers Level 4 Discovery Level 5
  16. 16. Buzzword compliant Modularity Maturity Model JuServices Level 1 Monolith Level 2 Composite Level 3 Containers Level 4 Discovery Level 5 OSGi
  17. 17. Buzzword compliant Modularity Maturity Model JuServices OSGi JSR 376 Level 1 Monolith Level 2 Composite Level 3 Containers Level 4 Discovery Level 5
  18. 18. Buzzword compliant Modularity Maturity Model JuServices OSGi JSR 376 Level 1 Monolith Level 2 Composite Level 3 Containers Level 4 Discovery Level 5
  19. 19. What is modularity from application perspective ?
  20. 20. Java application
  21. 21. Java application Java Platform Libraries
  22. 22. OSGi
  23. 23. There is nothing we can do about it! OSGi
  24. 24. class loaders There is nothing we can do about it! OSGi
  25. 25. class loaders There is nothing we can do about it! Dynamic multi-layer modular runtime! OSGi
  26. 26. class loaders There is nothing we can do about it! Dynamic multi-layer modular runtime! It's so easy, everyone should release bundles (modules)! OSGi
  27. 27. “Many people claim OSGi is hard without acknowledging that modularizing applications is the hard part. . . . JSR 376 will demonstrate that OSGi was just the messenger and actually not the cause.” Peter Kriens
  28. 28. JSR376
  29. 29. JSR376 Modules are first class citizens!
  30. 30. JSR376 Modules are first class citizens! Nothing to do about it, must use modules!
  31. 31. JSR376 Modules are first class citizens! Nothing to do about it, must use modules! It's so easy, everyone must release modules!
  32. 32. not new except now you kinda have to new Modular Java SE Platform! Modular Java SE Applications!
  33. 33. “A lot of people will discover that their babies are not as modular as they thought” Peter Kriens
  34. 34. When is “keep it simple!” not enough?
  35. 35. product intermediate intermediate material
  36. 36. Product Entity Entity Entity Entity Entity Entity Offer Offer Offer Offer Offer Offer Offer Offer Offer Offer Offer
  37. 37. Application Artifact Artifact Artifact Artifact Artifact Artifact Export Export Export Export Export Export Export Export Export Export Export
  38. 38. Artifact OSGi JSR 376 Manifest-Version: 1.0 Bundle-SymbolicName: com.mycompany.mymodule ... MANIFEST.MF module com.mycompany.mymodule { ... } module-info.java Level 2 decoupled from artifact
  39. 39. Buzzword compliant Modularity Maturity Model JuServices OSGi JSR 376 Level 1 Monolith Level 2 Composite Level 3 Containers Level 4 Discovery Level 5 OK!
  40. 40. Artifact OSGi JSR 376 Manifest-Version: 1.0 Bundle-SymbolicName: com.mycompany.mymodule Export-Package: com.mycompany.mypackage ... MANIFEST.MF module com.mycompany.mymodule { exports com.mycompany.mypackage; ... } module-info.java Export Level 3 decoupled from identity
  41. 41. OSGi JSR 376 Manifest-Version: 1.0 Bundle-SymbolicName: com.mycompany.mymodule Require-Bundle: other.module Import-Package: com.some.package; version="[2,3)",... ... MANIFEST.MF module com.mycompany.mymodule { requires other.module; ... } module-info.java Artifact Export Artifact Level 3 decoupled from identity
  42. 42. OSGi JSR 376 Manifest-Version: 1.0 Bundle-SymbolicName: com.mycompany.mymodule Require-Bundle: other.module Import-Package: com.some.package; version="[2,3)",... ... MANIFEST.MF module com.mycompany.mymodule { requires other.module; ... } module-info.java Artifact Export Artifact Level 3 decoupled from identity Posted by: Neil Bartlett and Kai Hackbarth on Sep 22, 2016
  43. 43. OSGi JSR 376 Manifest-Version: 1.0 Bundle-SymbolicName: com.mycompany.mymodule Require-Bundle: com.foo Import-Package: com.generic.powerplug; version="[2,3)",... ... MANIFEST.MF module com.mycompany.mymodule { requires com.foo; ... } module-info.java Foo Me I need power plug! I need Foo because I know it offers power plugs and I know only Foo offers power plugs! Level 3 decoupled from identity
  44. 44. OSGi JSR 376Level 3 decoupled from identity Manifest-Version: 1.0 Bundle-SymbolicName: com.mycompany.mymodule Require-Bundle: com.foo Import-Package: com.generic.powerplug; version="[2,3)",... ... MANIFEST.MF module com.mycompany.mymodule { requires com.foo; ... } module-info.java Foo Me I'm compatible with all 2.x.x versions! I expect developer/user to know which version will work and provide it on module path!
  45. 45. OSGi JSR 376Level 3 decoupled from identity Manifest-Version: 1.0 Bundle-SymbolicName: com.mycompany.mymodule Export-Package: com.mycompany.mypackage; uses:="com.some.package” ... MANIFEST.MF module com.mycompany.mymodule { exports com.mycompany.mypackage; requires public other.module; ... } module-info.java Artifact Artifact Artifact Export Uses Export
  46. 46. OSGi JSR 376Level 3 decoupled from identity Manifest-Version: 1.0 Bundle-SymbolicName: com.mycompany.devices Export-Package: com.mycompany.pc; uses:="foo.tools.powerplug” ... MANIFEST.MF module com.mycompany.devices { exports com.mycompany.pc; requires public foo.tools; ... } module-info.java Me Consumer Foo I used a power plug from Foo! You may need it! I used something from Foo tools, so you now depend on Foo tools as well!
  47. 47. Buzzword compliant Modularity Maturity Model JuServices OSGi JSR 376 Level 1 Monolith Level 2 Composite Level 3 Containers Level 4 Discovery Level 5 Not fully decoupled from identity! OK!
  48. 48. OSGi JSR 376Level 4 decoupled from implementation Artifact Artifact Requirement Need to connect device to power outlet! Capability Can connect device to power outlet! RESOLVER Bundles with custom metadata Requirements and Capabilities with LDAP like filters Bundle lifecycle events and listeners Extender pattern Nothing OOTB. Use OSGi :) Probably doable via external resolver dynamic modules and layers JEE or 3rd party solutions on top of JSR 376 may provide solutions
  49. 49. Buzzword compliant Modularity Maturity Model JuServices OSGi JSR 376 Level 1 Monolith Level 2 Composite Level 3 Containers Level 4 Discovery Level 5 Not fully decoupled from identity! Some very basic APIs only! OK!
  50. 50. OSGi JSR 376Level 5 decoupled from ownership & time JuServices Artifact Artifact REGISTRY Service Service Service Service Service registry with metadata Finding services via LDAP like filters Service lifecycle, events and listeners Multiple component frameworks Whiteboard pattern Traditional Java ServiceLoader (not dynamic) moved to module descriptor Alternative: minimal standalone Java applications with external service discovery
  51. 51. Buzzword compliant Modularity Maturity Model JuServices OSGi JSR 376 Level 1 Monolith Level 2 Composite Level 3 Containers Level 4 Discovery Level 5 Not fully decoupled from identity! Very limited service layer! DIY dynamism! OK!OK! Some very basic APIs only!
  52. 52. Does this mean JSR 376 got modularity wrong?
  53. 53. When they say modular Java it means just what they choose it to mean - neither more nor less!
  54. 54. JSR 376 solves some issues in Java platform! Level 5 modularity was never one of them! Reliable configuration Strong encapsulation A scalable Java SE Platform Greater platform integrity Improved performance
  55. 55. “... once modularization becomes part of the Java core tool set, developers will begin to embrace it en-masse, and as they do so, they will seek more robust and more mature solutions. Enter OSGi!” Victor Grazi
  56. 56. When an application needs modularity at higher level ?
  57. 57. The essence of modularity is Not knowing
  58. 58. 1 platform over 100 apps over 600 modules over 2500 μServices Some examples of how deals with not knowing The essence of modularity is Not knowing
  59. 59. Require-Capability: osgi.contract; filter:="(&(osgi.contract=JavaJAXRS)(version=2))" Provide-Capability: osgi.contract; osgi.contract=JavaJAXRS; Uses:= "javax.ws.rs, javax.ws.rs.core, javax.ws.rs.client, javax.ws.rs.container, javax.ws.rs.ext"; version:Version=2 Some examples of how deals with not knowing The essence of modularity is Not knowing
  60. 60. @Component( immediate = true, property = {"javax.portlet.name=other_Portlet"}, service = PortletFilter.class ) public class MyFilter implements RenderFilter { ... Some examples of how deals with not knowing The essence of modularity is Not knowing
  61. 61. @Component( immediate = true, property = {"destination.name=" + MONITORING}, service = {MessageListener.class} ) public class MonitoringMessageListener ... @Reference( cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY ) protected synchronized void registerProcessor( ... Some examples of how deals with not knowing The essence of modularity is Not knowing
  62. 62. The essence of modularity is Not knowing Which enforces optimization for Predictability
  63. 63. Which results in application Agility The essence of modularity is Not knowing Which enforces optimization for Predictability
  64. 64. milen.dyankov@liferay.com @MilenDyankov http://www.liferay.com @Liferay

×