All Java projects I have seen use a folder structure that follows the package structure. This results I large number of folders that do not contain any files.
So for example packages start with com.mydomain.mysystem.myutility
. This would result in a folders src\com
, src\com\mydomain
, src\com\mydomain\mysystem
that do not contain any files. Most likely the myutility
will also only contain only folders.
Most likely there will also be a project folder that contains the name myutility
so the complete folder path could be myutility\src\main\java\com\mydomain\mysystem\myutility\otherfolder
This practice is very common but it makes we wonder how useful it is. What is benefit compared to the situation where these extra folders are not created? Using for example myutility\src\main\java\otherfolder
It seems to be just as valid but it saves everybody the extra navigation steps. I can compile Java source files with both approaches just fine.
In a project typically all source is in com\mydomain\mysystem
. What is the benefit of putting those 'empty' folders in all projects?
Just to be clear, I am not questioning the usefulness of package structure. Also Maven is clear.
The question is why we use the empty folders that are typically the same throughout the repository for an organisation.