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 7746711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:20:55+00:00 2026-06-01T10:20:55+00:00

I am working on my first Grails application, which involves porting over an old

  • 0

I am working on my first Grails application, which involves porting over an old struts web appliction. There is a lot of existing functionality, and as I move things over I’m having a really hard time deciding what should go in a service and what should be included directly on the model?

Coming from a background of mostly Ruby on Rails development I feel strongly inclined to put almost everything in the domain class that it’s related to. But, with an application as large as the one I’m porting, some classes will end up being thousands upon thousands of lines long.

How do you decide what should go in the domain versus what should go in a service? Are there any established best practices? I’ve done some looking around, but most people just seem to acknowledge the issue.

  • 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-06-01T10:20:56+00:00Added an answer on June 1, 2026 at 10:20 am

    In general, the main guideline I follow is:

    If a chunk of logic relates to more than one domain class, put it in a service, otherwise it goes in the domain class.

    Without more details about what sort of logic you are dealing with, it’s hard to go much deeper than that, but here’s a few more general thoughts:

    1. For things that relate to view presentation, those go in tag libs (or perhaps services)
    2. For things that deal with figuring out what to send to a view and what view to send it to, that goes in the controllers (or perhaps services)
    3. For things that talk to external entities (ie. the file system, queues, etc.), those go in services

    In general, I tend to err on the side of having too many services than having things too lumped together. In the end, it’s all about what makes the most sense to you and how you think about the code and how you want to maintain it.

    The one thing I would look out for, however, is that there’s probably a high level of code duplication in what you are porting over. With Grails being built on Groovy and having access to more powerful programming methods like Closures, it’s likely that you can clean up and simplify much of your code.

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

Sidebar

Related Questions

I'm still working on my first Grails application. This time, my problem is to
Hi am just started working on grails.. developed my first application in grails can
I am taking my first steps with Ajax while working on a Grails application.
I am working on a grails application for the first time and I now
I am new to wpf and i am working on first application i have
I have a gae application (created via GRAILS) which loaded up fine, though my
For some weird reason, the codes below are first working, then website is redirecting
Working on my first Rails project, I used Ryan Bates' Nifty-Generators to create the
I working on my first ASP.net MVC project and and i got some problems
I'm working on my first object oriented bit of python and I have the

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.