Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Fantastic Java contracts - and where to define ...

Fantastic Java contracts - and where to define them

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, what are the issues and draft a potential roadmap to fully automated dependency management!

Avatar for Milen Dyankov

Milen Dyankov

May 31, 2017
Tweet

More Decks by Milen Dyankov

Other Decks in Programming

Transcript

  1. Liferay Platform Marketplace Sync Screens Mobile SDK Faces AlloyEditor Liferay

    IDE AlloyUI Lexicon Electric Senna.js Metal.js Deploy
  2. Once upon a time there was new Keyword(); Then the

    spring brought us some <beans> Today we have @Components
  3. It was not about writing code easier or faster! It

    was opening the door for a whole new world of possibilities!
  4. Once upon a time there were libs and deps folders

    Then Maven brought us <dependencies>
  5. 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!
  6. Dependencies They can have version ranges but it’s still us

    developers to know which SLF4J logger finally goes to production!
  7. Dependencies They have scopes but it’s still us developers to

    decide what is provided by containers, runtimes and systems!
  8. Dependencies They define relationships between each other but not to

    external resources like runtime, OS, infrastructure, ...
  9. item item Requirements and Capabilities inspect create inspect create box

    box I have
 XYZ I need
 XYZ No dependencies but contracts
  10. calc API markup simple
 calc editor another
 calc calculator
 panel

    depends depends depends depends depends depends depends
  11. calc API markup simple
 calc editor Contractors
 repository simple-calc .

    . . I require calc implementation I provide calc implementation depends depends depends resolve
  12. calc API markup simple
 calc editor Contractors
 repository simple-calc .

    . . I require calc implementation I provide calc implementation depends depends depends resolve another
 calc I provide calc implementation depends
  13. module JAR contractor I provide …. I require …. I

    provide …. Maven Central JAR contractor I provide …. I require …. module I provide ….
  14. module JAR contractor I provide …. I require …. I

    provide …. Maven Central Contractors
 repository Prepare 
 (optional) mvn em:addContractors … JAR contractor I provide …. I require …. module I provide ….
  15. contractor A
 contractor B
 ... 
 module M1
 module M2

    module JAR contractor I provide …. I require …. I provide …. module I provide …. Maven Central Contractors
 repository Prepare 
 (optional) mvn em:addContractors … JAR contractor I provide …. I require …. Build mvn package … module I provide …. module I require …. hint modular
 runtime I provide ….
  16. module JAR contractor I provide …. I require …. I

    provide …. module I provide …. Maven Central Contractors
 repository Prepare 
 (optional) mvn em:addContractors … JAR contractor I provide …. I require …. Build mvn package … module I provide …. hint module module module … deploy contractor A
 contractor B
 ... 
 module M1
 module M2 modular
 runtime I provide …. module I require ….