13

Is there any convention regarding groovy script files naming?

Should I name the script file in camelcase form, like if it was a regular class (i.e. FooBar.groovy)?

Or will it be better to name it using small case letters and underscores (i.e. foo_bar.groovy)?

Roman
  • 64,384
  • 92
  • 238
  • 332
  • CamelCase is preferable. Eventually a groovy script is compiled to a class with the file name as the class name. So CamelCase would make more sense. – dmahapatro Mar 03 '14 at 01:19

1 Answers1

7

I have seen suggestions that say groovy class files should be the camel case just like Java classes, but for groovy scripts, the recommendation was lower case names, at least the first letter. The idea is that you can very easily get an idea of what file is when looking in a directory list or Windows explorer, just by the case of the filename - so scripts starting with lower-case is a good clue.

mikemil
  • 1,213
  • 10
  • 21
  • 2
    Do you have any official or semi-official sources to back this up? – M. Justin Nov 05 '15 at 22:28
  • 1
    I believe Ken Kousen recommended that in either his book, Making Java Groovy or in one of his NoFluffJustStuff talks on Groovy. Either way, it is just someone's opinion... – mikemil Nov 05 '15 at 23:11