Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications

 
Ranch Hand
Posts: 467
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: 467
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: 467
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting.
Thank you Paul .
 
and POOF! You're gone! But look, this tiny ad is still here:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic