Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 921965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:57:03+00:00 2026-05-15T18:57:03+00:00

A little while ago, I saw a question answered here regarding the fine-grained organization

  • 0

A little while ago, I saw a question answered here regarding the fine-grained organization of Java packages. For example, my.project.util, my.project.factory, my.project.service, etc.

Are there best practices with regards to the organization of packages in Java and what goes in them?

How do you organize your classes in your Java project?

For instance, a project I’m working on with a few people has a package called beans. It started out being a project containing simple beans, but it has ended up (through poor experience and lack of time) containing everything (almost). I’ve cleaned them up a little, by putting some factory classes in a factory package (classes with static methods that create beans), but we have other classes that do business logic and others that do simple processing (not with business logic) like retrieving a message for a code from a properties file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:57:03+00:00Added an answer on May 15, 2026 at 6:57 pm

    Package organization or package structuring is usually a heated discussion. Below are some simple guidelines for package naming and structuring:

    • Follow Java package naming conventions
    • Structure your packages according to their functional role as well as their business role
      • Break down your packages according to their functionality or modules. e.g. com.company.product.modulea
      • Further break down could be based on layers in your software. But don’t go overboard if you have only few classes in the package, then it makes sense to have everything in the package. e.g. com.company.product.module.web or com.company.product.module.util etc.
      • Avoid going overboard with structuring, IMO avoid separate packaging for exceptions, factories, etc. unless there’s a pressing need.
    • If your project is small, keep it simple with few packages. e.g. com.company.product.model and com.company.product.util, etc.
    • Take a look at some of the popular open source projects out there on Apache projects. See how they use structuring, for various sized projects.
    • Also consider build and distribution when naming (allowing you to distribute your API or SDK in a different package, see the servlet API)

    After a few experiments and trials, you should be able to come up with a structuring that you are comfortable with. Don’t be fixated on one convention, be open to changes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I asked a question a little while ago: Over here that asked the
Authenticating to our Ubuntu EC2 instance worked fine until a little while ago. All
This question is related to this initial question asked a little while ago. Now,
A while ago I developed a little LAN chat app. in Java which allows
I'm just rephrasing the question I asked a little while ago. I have a
I asked a little while ago a question about rollback, I have a new
Im taking over a project someone started a while ago. Im having a little
A little while ago I created a class to deal with my LAN networking
I had this weird problem a little while ago and haven't been able to
I bought The D Programming Language a little while ago. Great book, very educational.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.