PBF(Package by Feature), no more PBL(Package by Layer)

Avijit Karmakar
MindOrks
2 min readMay 3, 2017

--

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.

Folder Structure for Package by Feature(PBF)

Benefits:

  1. Understandability: Everyone can get to know about the features of the app only by seeing the folder structure.
  2. 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.
  3. 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.
  4. 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.
  5. Scalability: It increases the scalability of the project. We can easily scale up and scale down the project.
  6. 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.
  7. 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.
  8. 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.
  9. Time is one of the vital factors to us. PBF also reduces time to find the code for a specific feature.

Thanks for reading this article. Be sure to click 👏 below to applause this article if you found it helpful. It means a lot to me.

To get more programming related articles, follow me so that you’ll get notified when I write new posts.

Also, Let’s become friends on LinkedIn, Github and Facebook.

--

--