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

  • SEARCH
  • Home
  • 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 4102250
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:48:06+00:00 2026-05-20T20:48:06+00:00

I am picking up an existing codebase that is Groovy and Grails, but the

  • 0

I am picking up an existing codebase that is Groovy and Grails, but the package structure seems very odd to me.

For a domain class they put it in the following package com.company.domain then for the controller of that class it is com.company.controller

That structure seems very off to me since the domain and controller classes are already organized under their own folders in the grails-app folder.

My plan is to redo the packages and group based on actual use such as com.company.billing and com.company.util .

Are there any disadvantages to my plan? Is there anything good about the current package structure that I’m missing?

  • 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-20T20:48:06+00:00Added an answer on May 20, 2026 at 8:48 pm

    I think package names should separate code belonging to different business aspects. For e.g. a shopping website, I’d recommend:

    • com.mycompany.myfancywebsite.product to all product related stuff (e.g. Product domain class, ProductDetailController etc.)
    • com.mycompany.myfancywebsite.cart to all shopping cart related stuff (e.g. CartController, ShippingCostCalculationService etc.)
    • com.mycompany.myfancywebsite.payment to all payment related things

    IMHO it does not make sense to use package names to distinguish the “type” of code (e.g. domain, controller, service…), this simply adds no value to it.

    I’d also recommend carefully using util in package names, this might be a sign that your code is not focussed enought.

    For further reading, see the excellent book “Clean code”. Also see http://weblog.dangertree.net/2008/11/22/grails-package-naming/

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

Sidebar

Related Questions

When picking out contact details, is there a built in domain class they can
An application that has been working well for months has stopped picking up the
Are there any existing AJAX/Javascript Date picker widgets/libraries that also allow you to select
I am currently picking up Grails and Roo. The vast majority of training materials
Here's my PS1 variable: PS1='\u:\W$(__git_ps1 \e[32m\][%s]\e[0m\])$ ' Works great for picking up my Git
I understand that these methods are for pickling/unpickling and have no relation to the
I'm beginning PHP development, and I'm looking at picking brains for ideas and best
When adding WHERE-clause parameters in a DataSource, you can specify an existing form control
I'm sure I am just doing something really dumb and not seeing it but
So I've done unit testing some, and have experience writing tests, but I have

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.