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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:49:12+00:00 2026-06-17T20:49:12+00:00

What is the standard coding convention for Groovy? In Java the method naming is

  • 0

What is the standard coding convention for Groovy?

In Java the method naming is done using camel case notation.

public void calculateTotal() {}

In Ruby on which Groovy is based, underscores are preferred.

def calculate_total()
end

Which of the above two styles would be considered more Groovyist?

Personally I’m more inclined to use the Ruby style. Is there a standard document/general consensus among the Groovy community as to what is preferable?

  • 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-17T20:49:13+00:00Added an answer on June 17, 2026 at 8:49 pm

    The first one. Groovy took a lot from Ruby, but its main focus is to be a dynamic and powerful language that plays well with Java. Therefore, most Java coding conventions and coding styles apply to Groovy as well.

    About naming conventions, while I also prefer the underscore_separated_words style of Ruby/Python and others, I think sticking to convention and being consistent with the surrounding environment is much more important than personal preference in these kind-of-superfluous matters (there are other things, like preferring a functional style over imperative constructs or vice versa, that I think are more interesting to discuss.

    So, always use camelCasing for Groovy methods. The Groovy documentation uses them; all the methods from the standard library use them.

    Finally, here’s a nice Groovy coding conventions guide. It doesn’t do any mention about naming conventions or formatting, but it introduces many of Groovy’s nice syntactic additions and explains when it’s preferred to use them

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

Sidebar

Related Questions

What is the standard when coding in Java, when do you use camel case
What's the PSR-2 Standard coding convention for initialization of arrays and method chaining? $foo
Is there an Android standard or coding convention / best practice that says whether
I recently came across a coding standard claiming that you should never use public
I am getting the above error. I am coding in C and using standard
The IDesign coding standard states Do not provide public event member variables. Use event
Before starting, I'm not asking about standard coding practice or etiquette. My question is
Is there a Coding Standard document available for download from Microsoft ? I want
We have a coding standard that says all shared (static) fields and methods must
Is there a coding standard for HTML? Please suggest links that have the coding

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.