Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Fantastic Java contracts and where to define them? - M Dyankov

80 views

Published on

OSGi Community Event 2017 Presentation by Milen Dyankov [Liferay]

Creating objects in Java using `new` keyword was a no brainer for many years! Then IoC / DI questioned the approach and component containers changed the way we think about it!

Managing dependencies between artifacts is yet another topic we still tend to think we have sorted out. Maven central has become the de facto standard artifact repository. Yet it's far from perfect as it is still developer's responsibility to know and configure proper dependencies. This easily becomes nightmare with transitive and provided dependencies. So may be it's time to challenge that approach too? What if we move from hardcoded artifacts to artifact discovery based on well defined contracts?

This talk will demonstrate how that can be done today using OSGi Requirements and Capabilities specification in combination with existing Maven plugins. It will present a PoC for Maven extension that makes it very easy to discover artifacts and assemble applications (both standalone and deployed in containers). It will also point out the issues and draft a potential roadmap to fully automated, contract based dependency management!

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Fantastic Java contracts and where to define them? - M Dyankov

  1. 1. Fantastic Java Contracts and where to define them? @MilenDyankov Developer Advocate, Liferay
  2. 2. r = 9.5mm r = 7.5mm r = 7.5mm r = 3.75mm r = 3.75mm r = 2mm r = 2mm Liferay Platform Marketplace Sync Screens Mobile SDK Faces AlloyEditor Liferay IDE AlloyUI Lexicon Electric Senna.js Metal.js Deploy
  3. 3. Once upon a time there was new Keyword();
  4. 4. Once upon a time there was new Keyword(); Then the spring brought us some <beans>
  5. 5. Once upon a time there was new Keyword(); Then the spring brought us some <beans> Today we have @Components
  6. 6. It was not about writing code easier or faster! It was opening the door for a whole new world of possibilities!
  7. 7. Once upon a time there were libs and deps folders
  8. 8. Once upon a time there were libs and deps folders Then Maven brought us <dependencies>
  9. 9. It was about easier and faster! It didn’t change the way we think about dependencies, it changed the way we store and distribute them!
  10. 10. Dependencies
  11. 11. Dependencies They can be transitive, but it’s still us developers solving the conflicts!
  12. 12. Dependencies They can have version ranges but it’s still us developers to know which SLF4J logger finally goes to production!
  13. 13. Dependencies They have scopes but it’s still us developers to decide what is provided by containers, runtimes and systems!
  14. 14. Dependencies They define relationships between each other but not to external resources like runtime, OS, infrastructure, ...
  15. 15. Dependencies They tell you NOTHING about WHY they depend on each other!
  16. 16. box box Dependencies as we see them! Depends on
  17. 17. box item box item Dependencies as they are Depends on
  18. 18. box item box item Requirements and Capabilities I need XYZ inspect create I have XYZ inspect create
  19. 19. box item box item Requirements and Capabilities I need XYZ inspect create I have XYZ inspect create No dependencies but contracts
  20. 20. Live DEMO https://github.com/azzazzel/Fantastic-Java-Contracts-Demo
  21. 21. calc API markup simple calc depends depends editor depends
  22. 22. calc API markup simple calc depends depends editor depends depends
  23. 23. calc API markup simple calc depends depends editor depends depends
  24. 24. calc API markup simple calc depends depends editor depends depends
  25. 25. calc API markup simple calc depends depends editor depends depends another calc depends calculator panel depends depends
  26. 26. calc API markup simple calc depends depends editor depends
  27. 27. calc API markup simple calc depends depends editor depends Contractors repository register simple-calc . . . I require calc implementation I provide calc implementation hint resolve
  28. 28. calc API markup simple calc depends depends editor depends Contractors repository register another calc depends register simple-calc another-calc . . . I require calc implementation I provide calc implementation I provide calc implementation hint resolve
  29. 29. Eccentric Modularity https://github.com/commsen/EM
  30. 30. module module module module module module module contractor contractor modular runtime resolve context resolver I provide …. I require …. I provide …. I provide …. I provide …. I provide …. I provide …. I provide …. I provide …. I provide …. I require …. I provide …. module module module module contractor A contractor B ... module M1 module M2 ...
  31. 31. Thank you! @MilenDyankov Developer Advocate, Liferay

×