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 ?
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?
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.