Hacker News new | ask | show | jobs
by akud 3321 days ago
Correct me if I'm wrong on my understanding of how the module system works, but I noticed a glaring flaw at a Java One presentation last year: all modules only have access, at _runtime_ to the modules they explicitly list as dependencies.

This means if you have an abstract module of just interfaces, and others that implement them, client modules can't only list the abstract module as a dependency and get the implentations injected at runtime. That's a core use case to me, it follows Effective Java's advice to program against abstractions, and I've used it in the past, to e.g. inject different file store clients depending on environment.

I can see why they would do it that way, since it prevents dependency creep.