Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Grails suitable for complex applications?

Our organization is planning to use Grails to realize a complex application with a REST interface. I have concerns on the scalability of the framework, given that:

  • domain classes will for sure make heavy use of polymorphism. I heard people have trouble with inheritance in Grails, for instance because of this problem on JIRA.

  • Trees of objects will be saved in the database. In GORM this would be something like:

    class Node
    {
      static def hasMany = [children: Node]
    }
    

    I thought we could benefit of cascading operation to manage dependencies, but I am not sure how it would work in this case.

  • the database is supposed to grow to store millions of objects and should work with Oracle, SQL Server and PostgreSQL. How realistic is it to count on Grails DB mapping to have this compatibility for free?

  • we plan to leverage custom domain constraints to check the consistency of domain objects. But I have the feeling that what you can do in a validator is limited (I am not sure if you can, for instance, load a set of other objects)

  • business logic implemented in services will be multi-threaded

Most examples in books and on the web show very simple application with CRUD operation on independent sets of objects.

I am afraid that I end up using a very small subset of the feature of Grails when the application grows, as scaffolding, web flows, ajax, or even the DB schema generated by domain classes may not correspond exactly to the needs of my application.

Has anybody experience to share on using Grails for such an application?

like image 239
Antoine Avatar asked Nov 30 '22 16:11

Antoine


1 Answers

domain classes will for sure make heavy use of polymorphism. I heard people have trouble with inheritance in Grails, for instance because of this problem on JIRA.

Inheritance has improved in Grails 2.0. See the section on Abstract Inheritance. The issue mentioned in the JIRA bug reported can be worked around via declaring the property as transient.

Trees of objects will be saved in the database. In GORM this would be something like:

Self referential relationships are fine. For more info, see Grails in Action chapter 3.

the database is supposed to grow to store millions of objects and should work with Oracle, SQL Server and PostgreSQL. How realistic is it to count on Grails DB mapping to have this compatibility for free?

Grails is built on Hibernate, an enterprise quality ORM layer used in a variety of large J2EE applications. Depending on the types of queries you're running, you may need to use criteria and tweak things at that level, but Grails provides no inherent limitations that keep it from scaling.

we plan to leverage the custom domain constraint mechanism to check the consistency of domain objects. But I have the feeling what you can do in a validator is limited (I am not sure if you can, for instance, load a set of other objects)

You can do cross-field validation with this. You can also define your own custom validator classes.

business logic implemented in services will be multi-threaded

It is recommended not to store state in services, but you can use them in multi-threaded operations as there are different scopes available. Of course, the onus is then on you to control concurrent access.

Our organization is planning to use Grails to realize a complex application with a REST interface.

REST interfaces are fairly fun and easy with Grails. See Grails in Action Chapter 11 or Chapter 9/13 of Beginning Groovy and Grails from Novice to Professional.

Grails is built on tried and proven J2EE technologies like Spring and Hibernate. While the "out of the box" may only take you so far, the framework is configurable at various levels to meet your needs. So you're essentially asking if J2EE scales nicely. Many people seem to say yes.

like image 107
Visionary Software Solutions Avatar answered Dec 04 '22 08:12

Visionary Software Solutions