103

Nowadays I hear a lot about "Groovy on Grails" and I want to know more about it:

  • What is Groovy?
  • What is Grails?
  • What kind of applications are built using Groovy on Grails?
Ken Liu
  • 22,503
  • 19
  • 75
  • 98
Rachel
  • 100,387
  • 116
  • 269
  • 365
  • 6
    Also, it's just Grails. Not Groovy on Grails (that makes no sense..). You're lucky Marc Palmer hasn't seen this question :) – leebutts Oct 04 '09 at 22:52
  • 23
    Grails = Groovy on Rails – Pascal Thivent Oct 04 '09 at 23:18
  • 2
    Actually, there was quite some controversy around the "Groovy on Rails" moniker, which is why Grails is NOT called Groovy on Rails anymore. It's just Grails. – mxk Nov 05 '09 at 08:59
  • 4
    Yes, 5 years ago in 2006 the Ruby on Rails guys complained and the framework that was called 'Groovy on Rails' was renamed to just Grails. It's never been called Groovy on Grails except by confused recruiters and their victims. – Burt Beckwith Mar 16 '11 at 01:49

4 Answers4

192
  1. What is Groovy on Grails?

    It doesn't exist under this name anymore. It's simply called Grails now.

  2. What is Groovy?

    Originally, a dynamic language for the JVM. However, since Groovy 2.0, both static and dynamic typing are supported.

  3. What is Grails?

    Grails (previously known as "Groovy on Grails") is a programming framework based on Groovy and inspired by Ruby on Rails (there are differences, but there are lots of similarities too). Like RoR, Grails promotes "coding by convention", development best practices, and is meant to be highly productive.

  4. What kind of Applications are built using "Groovy on Grails"?

    Grails is used to build web applications that run on the JVM.

  5. What are the advantages of Groovy on Grails?

    High productivity, focusing on business instead of plumbing. (Note that I wouldn't recommend to use Grails with an existing data model. The reason behind this is that Grails encourages a top-down approach where the databases ER model arises as result of the Domain classes. If you are using a legacy database, you cannot take this approach. You must map the database to the domain classes, and probably the naming convention won't match, making necessary the use of hbm.xml Hibernate configuration files or annotations. IMO, this is not a trivial change in the workflow, it can become really cumbersome and you end up losing most of the advantages of Grails.)

  6. Why would one want to use Groovy on Grails when we have standard programming languages like C/C++, Java/J2EE, and .NET/C#?

    Because of point 5.

Ofer Zelig
  • 17,068
  • 9
  • 59
  • 93
Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
  • 1
    Can you explain more why you wouldn't recommend using grails with an existing data model? – Todd Hunter Oct 05 '09 at 00:22
  • 1
    Can you explain more on what you mean by `High productivity, focusing on business instead of plumbing.`? what is `plumbing`? – Thang Pham Jul 15 '11 at 19:26
  • @HarryPham - Boilerplate code and dealing with "how things are done" rather than "what things do we do" of implementation – cdeszaq Nov 04 '11 at 18:30
  • @Pascal Thivent - I might end up rewriting someone else's program from scratch, and if it weren't for your point about not recommending using Grails with an existing data model, Grails would be the clear winner for the framework to use. I haven't seen the program's DB architecture yet, but I imagine it's fairly simple given the program's straightforward functionality. Would your recommendation change at all if the existing DB architecture is simple? Could the cumbersome workflow be avoided by migrating the data in the legacy DB to a new DB, and if so would this be hard to do? Thanks. – Daniel Apr 08 '15 at 04:41
  • Since Grails 3, there are different profiles that you can use, to customize the Grails framework for your specific needs. It is no longer solely a web framework, it can successfully be used to develop lightweight REST microservices, without the footprint of a templating engine, or even an ORM layer. http://grails.github.io/grails-doc/latest/guide/single.html#profiles – Luis Muñiz Nov 19 '15 at 22:30
24

Groovy is an object-oriented programming language for the Java platform. It is a dynamic language with features similar to those of Python, Ruby, Perl, and Smalltalk. It can be used as a scripting language for the Java Platform. Groovy has a Java-like syntax and works seamlessly with Java bytecode.

Other features include:

  • Easy learning curve
  • Support for domain-specific languages
  • Compact syntax
  • Support for dynamic typing
  • Powerful processing primitives
  • Ease of Web application development
  • Support for unit testing.

Grails is an open source web application framework which uses the Groovy programming language. It is intended to be a high-productivity framework by following the "coding by convention" paradigm, providing a stand-alone development environment and hiding much of the configuration detail from the developer.

Like Rails, Grails seems to be what I call "Strongly Grained". If you do things the Grails way, development is easy (and generally quite fast). The framework tends to have a preferred way of doing most things. On the other hand, if you need to go against the grain, you'll have a comparably rough time of it.

And don't say Groovy on Grails(doesn't exist), for reasons refer to this blog.

Jainendra
  • 24,713
  • 30
  • 122
  • 169
12

Grails is directly analogous to Ruby on Rails, but running with Groovy. What's Groovy ? It's a scripting language that runs on the Java Virtual Machine (JVM).

So you can make use of Java libraries that you already have or are available (since they're compiled to bytecode and thus run on a JVM), plus the power of the JVM (for garbage collection, speed via JIT compilation etc.) and the conciseness of Groovy. The learning curve for a Java programmer to pick up Groovy is supposed to be pretty small (thus leveraging off the huge number of available Java programmers).

It's a very different way of creating web apps to the standard Java mechanisms of servlet programming, JSPs, Java Server Faces etc. Grails (like Ruby on Rails) promises a more dynamic and iterative development environment than the standard development mechanisms (whether that's true in practise, I can't advise)

Brian Agnew
  • 268,207
  • 37
  • 334
  • 440
  • Brain, your statements contradicts, you say it is a scripting language, yet in next paragraph you say its compiled to byte code. I am a .NET programmer, and scripting languages such as javascript etc are not compiled but just interpreted. Could you please explain what you mean by those contradictory statements – Jasmine Jan 22 '15 at 04:50
  • 1
    Groovy can be used both ways. Groovy program can be executed as a simple script line by line, like javascript. It can be compiled as well using groovy compiler to bytecode class which can be executed using JVM. – pRmdk Aug 24 '17 at 12:43
0

Grails- MVC framework for developing a web application and a ready to code platform with DRY (Don't repeat yourself) built on the top of Spring+Hibernate. Grails platform takes care of the infrastructure and dependencies to run a web app such that the developers can concentrate on building the functionalities for the product. Grails -a great framework for the startup organizations to launch the product from the development mode to production mode.