Hi, I created account only to comment and say: You are wrong. Guys who developed JAVA language has great Idea to make package scope as a default scope (without keyword). Some devs has hard time to understand of true potential of Package scope and even if I explain to You you will probably not get it. But I will try I have one small application with rules:
- app has 3 modules/packages: user management, product management, shop
- user module does not see any class of product module because it doesnât need to.
- product module does not see any interiors of user module because doesnât need to.
- shop module use published iterfaces/facades (public class (only one per module and dtos) ) of user and product module and do not see their interiors because it doesnât need to.
the whole code is encapsulated on each package levels.
If my junior dev colleague will change something in product module/package Iâm sure that he will not break whole application and whatâs more important I have better control of dependencies between modules.
Itâs architected that way because each module can be moved to micro-services in future or moved âsomewhereâ (we do not know that yet) and it is easy because they all has only one point of access for each module (even Controller class is package scope).
Using âinternalâ I would have to create always 2 modules for dtoâs and for service for each module/package
and there would be additional configuration on my head.
It would be great assets to developers if it would be default scope.
There is great presentation of this and package scope: JDD 2017: Keep IT clean: mid-sized building blocks and hexagonal architecture (Jakub Nabrdalik) - YouTube