luna icon indicating copy to clipboard operation
luna copied to clipboard

Discussion: Cohesive package naming conventions

Open notjuanortiz opened this issue 5 years ago • 1 comments

I would like to discuss moving towards a more cohesive package naming convention for the entire project.

There's typically two schools of thought on this topic. The first being package by layer. Naming your packages according to their function architecturally rather than their identity according to the business domain. Our packages would be horizontal slices rather than vertical. Example(s):

  • io.luna.game.item responsible for business logic
  • io.luna.database.item responsible for CRUD operations
  • io.luna.network.item contains network messages
  • io.luna.ui.item contains UI components and interactions

And the second being package by feature. Naming your packages according to their business domain identity. Doing so, we'd be putting every class that has to do with that vertical slice of functionality into that package. Example(s):

  • io.luna.item.container.shop
  • io.luna.item.container.bank
  • io.luna.item.container.inventory

The current state of the project is a culmination of both approaches which makes deciding which package to add new features to a bit confusing. Where would I add a persistence implementation for shops when the business logic for shop is in io.luna.game.shop and all persistence implementations are in io.luna.game.mob.persistence? It would be great if we could pick a single approach, making contributions a bit more intuitive.

notjuanortiz avatar Nov 07 '19 04:11 notjuanortiz

This is somewhat related to #56 and #74.

notjuanortiz avatar Nov 07 '19 04:11 notjuanortiz