07/27/2021, 8:21 AM
In the same spirit of the previous post by @louiscad I had a similar pain that might be resolved by the same mechanism. Following the ports and adapters architecture we have the following module structure PortN module AdapterN module ... One Domain module (Domain module depends on all ports, Adapters only depend on one port module) We do this for many reason but mostly to keep our business logic clean and constrain dependencies to their respective concerns. This means that whenever we add a feature we often have to add a file to many modules. Not to mention keeping the same "directory" structure in all modules is a pain that always drifts. In a sense files are categorized based on their type or "layer". An example of this could be if we wanted to add a user profile page to our application. This mean that we need to add: UserRepository interface the db port module UserRepositoryImpl to the repository adapter module UserService to the domain module UserProfile serializable class to the gui port module UserProfilePage gui component to the gui adapter module It would be nicer if we could categorize them based on feature slices such that all the the above mentioned files could be placed in the same directory keeping cohesion much tighter. So how would one do this ? This came to mind after reading on slack about a proposal to group files in source folders based on their "sub extension" ie. UserRepository.dbport.kt, UserRepositoryImpl.dbadapter.kt, ... This proposal seems more general in that it needs be user configurable (unlike the proposal that could be realised by having it preconfigured to js, jvm, etc. sub extensions).