Vaadin 8 on Grails 3
  • Introduction
  • Project setup
    • Environment setup
      • Unix based systems
      • Windows
    • Creating Project
      • Command line
      • IntelliJ IDEA
    • Plugin Configuration
      • UI class
      • URL mapping
      • Production mode
      • Async support
      • Themes
      • SASS compilation
      • Widgetset compilation
      • Servlet class
      • Spring component scan
      • UI provider
      • Open session in view
    • Clean up
    • Best Practices
  • Database
    • GORM
      • Create Domain Model
      • Transactions
      • LazyInitializationException
      • Open Session In View I.
      • Open Session In View II.
      • Table Container
    • Groovy SQL
      • Create Sql Bean
      • Execute SQLs
    • MyBatis
      • MyBatis Configuration
      • Reading Data with MyBatis
    • JdbcTemplate
      • Create JdbcTemplate Beans
      • Using JdbcTemplate
    • Clean Up When Using Alternatives
  • UI
Powered by GitBook
On this page
  • Keep work with GORM in Services
  • CompileStatic
  • Types

Was this helpful?

  1. Project setup

Best Practices

Keep work with GORM in Services

Never work with GORM in Vaadin code, use services or any other layer, like DAO, to encapsulate work with database. It will keep your Vaadin and database code separated, which will make the application code more readable and maintainable.

CompileStatic

Use @CompileStatic annotation everywhere you can. The exception not to use the annotation is dynamic code where you need to utilize dynamic features of Grails, for example, to access variables that are not visible during compilation.

Types

Use def only when it is required, because it always good to know type of a variable. Together with @CompileStatic annotation, you will know about compilation errors during compilation, not during runtime.

PreviousClean upNextDatabase

Last updated 5 years ago

Was this helpful?