PBF(Package by Feature), no more PBL(Package by Layer)
The directory structure is the most important thing encountered by a developer when browsing source code. Everything flows from it. Everything depends on it. It is clearly one of the most important aspects of the source code.
You will get the codebase in this github link.
- Understandability: Everyone can get to know about the features of the app only by seeing the folder structure.
- Adding New Feature: Anyone can add a feature easily in this folder structure. They have to create a feature named folder within the feature package. Example: If anyone wants to add a login & register feature. Then we will create a package named authentication within the feature package. Within the authentication package, we will create a login & register package. Then we will do our work within that package.
- Deleting Feature: If anyone wants to delete a feature then we have to delete the full feature named package from the package feature. Example: If we want to delete the registration module from the project then we will go to the feature package, then we will check where this registration feature resides. Then we will delete that registration feature.
- Code Navigation & Modularity: We can easily navigate to the code. It also increases the modularity of the project which emphasizes separating the functionality of a program into independent, interchangeable modules.
- Scalability: It increases the scalability of the project. We can easily scale up and scale down the project.
- Reusability: Every project has some common code which will be reused across the features. We can keep this common code within the shared package which resides into the feature package.
- PBF increases the cohesion within the same module, low coupling between packages, enables us to maintain the structure properly and also increases the readability of the code.
- Developers can work separately into their own feature package. It reduces the modification of other classes created by other developers. Actually, it decreases the chances of confliction.
- Time is one of the vital factors to us. PBF also reduces time to find the code for a specific feature.