Image for post
Image for post

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

Avijit Karmakar
May 3, 2017 · 2 min read

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.

Image for post
Image for post
Folder Structure for Package by Feature(PBF)
  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.

MindOrks

Our community publishes stories worth reading on Android…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store