What are "Groovy" and "Grails" and what kinds of applications are built using them?
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?
-
What is Groovy on Grails?
It doesn't exist under this name anymore. It's simply called Grails now.
-
What is Groovy?
Originally, a dynamic language for the JVM. However, since Groovy 2.0, both static and dynamic typing are supported.
-
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.
-
What kind of Applications are built using "
Groovy onGrails"?Grails is used to build web applications that run on the JVM.
-
What are the advantages of
Groovy onGrails?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.)
-
Why would one want to use
Groovy onGrails when we have standard programming languages like C/C++, Java/J2EE, and .NET/C#?Because of point 5.
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.
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)