This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

putting many classes in one file

 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Groovy experts and authors suggest to have many classes one in a script file for performance reason. This is because groovy parses the entire script file before the code gets executed and classes in the script file are more easily availble than when put in another script file. So we do we organize code - Doesn't script file bloat ?
 
Dierk K├Ânig
author
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Prad Dip:
Groovy experts and authors suggest to have many classes one in a script file for performance reason. This is because groovy parses the entire script file before the code gets executed and classes in the script file are more easily availble than when put in another script file. So we do we organize code - Doesn't script file bloat ?


I'm not sure what you mean by "suggest". It is certainly not a general "best practice" and particularly not adviced because of performance considerations.

Could you please link to what expert or author you refer to?

cheers
Dierk
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry If I understood wrongly. Quoting from Groovy in action

In
Groovy, the preferred way is not meshing together numerous script files, but
instead grouping reusable components in classes such as Book. Remember that
such a class remains fully scriptable; you can modify Groovy code, and the
changes are instantly available without further action.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic