• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications

 
Ranch Hand
Posts: 479
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What do you think the biggest change in mindset is to take advantage of Java9's Modularity features?
I'm speaking from the perspective of a Web Developer. Should I revisit the way I design Web Apps?
thanks,
Paul
 
Author
Posts: 10
5
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That depends on what you're currently doing ;)

Servlet containers don't support modules yet, so if you want to leverage modules, a good start would be to run your app from a main method, bootstrapping a web server from code.
There are many ways to accomplish this, but Vert.x is one of my favorites and already supports running on Java 9.
From there, decouple your code into multiple modules. Services, as described in chapter 4 of the Java 9 Modularity book is a really nice tool for this.
 
paul nisset
Ranch Hand
Posts: 479
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I guess the idea is if you have Restful Application with several services and say CRUD functionality on each service, each service  would be module?  
 
Paul Bakker
Author
Posts: 10
5
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to slice the code into modules really depends on the situation. One question to ask yourself is "how do I expect changes to the code"? If for a single change you need to touch multiple modules, this can be a sign that module boundaries are incorrect.

You can often slice based both on functionality (e.g. different "things" in a rest API), and also technical concerns. E.g. web vs data storage.
As a very trivial example:

authors.rest
authors.storage
books.rest
books.storage

This is obviously just a starting point. Ask questions like "do you expect to make changes to "books" without requiring changes to authors?" and "do you want to have the flexibility to have different storage providers?".
There's always a balance to be found. Ending up with modules that literally contain a single class usually isn't great, but a module that changes every time you add something to the app is a smell as well.
 
paul nisset
Ranch Hand
Posts: 479
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting.
Thank you Paul .
 
There were millions of the little blood suckers. But thanks to this tiny ad, I wasn't bitten once.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic