Find a better name for @NamedInterface
See original GitHub issueContext
A Moduliths module exposes types for other modules to be allowed to use. The default set of types consists of all public types in the module’s base package.
- com.acme
- com.acme.module
+ PublicType <- implicit API, because public and in the module package
o PackageProtectedType
If the module contains sub-packages, all types in the sub-packages are considered internal.
- com.acme
- com.acme.module
+ PublicType <- implicit API, because public and in the module package
o PackageProtectedType
- com.acme.module.internal
+ PublicType <- unaccessible by other modules
@NamedInterface
exists to annotate packages (and soon types, see #74) to define a named set of types to act as a dependency target.
- com.acme
- com.acme.module.api
- package-info.java // annotated with e.g. @NamedInterface("API"), makes all public types API
+ PublicType
o PackageProtectedType
- com.acme.module.internal
+ PublicType <- unaccessible by other modules
- com.acme.module.spi
- package-info.java // annotated with e.g. @NamedInterface("SPI"), makes all public types SPI
+ PublicType
o PackageProtectedType
Problem
The term “named interface” was used to describe that kind of concept, originating from Sonargraph, that exposed that concept in its architecture modeling language. However, using “interface” in a term used inside a Java codebase creates confusion as it’s not immediately clear whether you’re talking about a Java interface or Moduliths named interface.
Alternatives
UML exposes the same kind of concept as “port” (see this article). Using port might create a few connections towards Hexagonal Architecture and it’s ports & adapters concept. While you can implement such an architecture with Moduliths, I wonder whether we should create such strong ties.
Suggestions?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top GitHub Comments
What about something like “published” or “exported” … the Java module system uses similar concepts for distinguishing between public and published types.
The annotation sounds more like a command to me. So perhaps something like
@AllowAccess
,@AllowExternalAccess
or@ExposeInterface
?