Grails for prototyping

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Grails for prototyping

Eric Williams-3
I gave a demo of Grails to our dev team today. They really liked it
because of all the RoR-alikes out there, this one not only gets it right
(instant updating without deployment, domain-centric instead of
database-centric, etc) but also allows us to stay in the Java universe,
where we already live.

But there was one question they seemed most concerned about: Can you
generate Java from Groovy?

My response was that you shouldn't, that Groovy is meant as a companion
to Java, that it compiles into Java bytecode, etc... but they did raise
some good points. I can appreciate their desire to take an existing Java
class and generate Grails artifacts from it instead of having to write a
new version in Groovy, just like I can appreciate their desire to take
scripts written in Groovy and generate Java from them, because we're
considering Grails (and similar technologies) strictly for prototyping
purposes.

In other words, we want very rapid prototyping that can use as much of
our business domain code as possible, including code that is already
written, with the easiest migration possible between the Grails
prototype and the full-on Java+Struts+Spring+EJB (or whatever)
application. I realize we can use all of our business libraries/EJBs/etc
from Groovy, but what if I already have a Java class I want CRUD for?
What if I already have persistence for it and just want controllers and
views? How can I mix and match what I already have with what Grails
provides without having to re-invent anything?

Firstly, do you have any suggestions on how Grails might fit into our
organization, given our use case? I bet we're not the only company with
this concern...

Secondly, if Grails cannot easily accommodate this use case, do you have
a good argument for using it anyway? Do we completely misunderstand its
benefits?

We'd really love to leverage the power of something like RoR to
eliminate the repetitive tasks of development and make prototyping
easier. But we're a Java shop with a large, preexisting codebase. Is
Grails the answer?

Thanks,
Eric
Reply | Threaded
Open this post in threaded view
|

Re: Grails for prototyping

graemer
On 4/21/06, Eric Williams <[hidden email]> wrote:
> I gave a demo of Grails to our dev team today. They really liked it
> because of all the RoR-alikes out there, this one not only gets it right
> (instant updating without deployment, domain-centric instead of
> database-centric, etc) but also allows us to stay in the Java universe,
> where we already live.
>
> But there was one question they seemed most concerned about: Can you
> generate Java from Groovy?
I don't believe this is possibly at the moment no, you can compile to
java byte code but there is no tool to convert back.

>
> My response was that you shouldn't, that Groovy is meant as a companion
> to Java, that it compiles into Java bytecode, etc... but they did raise
> some good points. I can appreciate their desire to take an existing Java
> class and generate Grails artifacts from it instead of having to write a
> new version in Groovy, just like I can appreciate their desire to take
> scripts written in Groovy and generate Java from them, because we're
> considering Grails (and similar technologies) strictly for prototyping
> purposes.
>
> In other words, we want very rapid prototyping that can use as much of
> our business domain code as possible, including code that is already
> written, with the easiest migration possible between the Grails
> prototype and the full-on Java+Struts+Spring+EJB (or whatever)
> application. I realize we can use all of our business libraries/EJBs/etc
> from Groovy, but what if I already have a Java class I want CRUD for?
Grails allows you to write you domain model in Java and map it with
hibernate (which is quite easy with hibernate annotations). You can
then still use all of the dynamic methods etc on the java class as if
it was a regular GORM domain class.

You can even take an existing domain model developed in hibernate and use that.

> What if I already have persistence for it and just want controllers and
> views?
You can just use the view/controller layer.

> How can I mix and match what I already have with what Grails
> provides without having to re-invent anything?
See above.

>
> Firstly, do you have any suggestions on how Grails might fit into our
> organization, given our use case? I bet we're not the only company with
> this concern...
Grails as a view/controller layer may fit your organisation's needs
quite well. We're making Grails so that you don't have to use the
whole stack. At the moment you can't disable the hibernate session
factory creation for a data source.. but we should add this.

>
> Secondly, if Grails cannot easily accommodate this use case, do you have
> a good argument for using it anyway? Do we completely misunderstand its
> benefits?
I'm a believer of using a blended approach to development with some
dynamically-typed groovy and some static-typed java code.

Grails fit in with this quite well, but grails is also about code
generation and speed of development. I'm developing an application
with it now and there is no way i could have done it as quick with a
java based web layer.

>
> We'd really love to leverage the power of something like RoR to
> eliminate the repetitive tasks of development and make prototyping
> easier. But we're a Java shop with a large, preexisting codebase. Is
> Grails the answer?
Quite possibly. Grails integrates nicely with java and as I said your
domain model doesn't have to use GORM and you could even run other web
application frameworks like webwork alongside grails in the same
container if you wish to use it for some thihngs but not others.

I imagine this being a use case if you had a specific need, say using
Cocoon for xml publish and grails for logic for example

Graeme

>
> Thanks,
> Eric
>
Reply | Threaded
Open this post in threaded view
|

Re: Grails for prototyping

Jochen Theodorou
Graeme Rocher wrote:

> On 4/21/06, Eric Williams <[hidden email]> wrote:
>
>>I gave a demo of Grails to our dev team today. They really liked it
>>because of all the RoR-alikes out there, this one not only gets it right
>>(instant updating without deployment, domain-centric instead of
>>database-centric, etc) but also allows us to stay in the Java universe,
>>where we already live.
>>
>>But there was one question they seemed most concerned about: Can you
>>generate Java from Groovy?
>
> I don't believe this is possibly at the moment no, you can compile to
> java byte code but there is no tool to convert back.

it is hardly possible since groovy allows some things Java doesn't. And
even if we could ship around the problems the resulting code would be
unreadable

bye blackdrag

Reply | Threaded
Open this post in threaded view
|

RE: Grails for prototyping

Eric Williams-3
In reply to this post by Eric Williams-3
Thanks for all the information.

So I should be able to create POJOs, annotate them w/Hibernate
annotations, and then Grails will be able to make controllers and views?
Nice.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf
Of Graeme Rocher
Sent: Friday, April 21, 2006 2:30 AM
To: [hidden email]
Subject: Re: [grails-user] Grails for prototyping

[snipped]

Grails allows you to write you domain model in Java and map it with
hibernate (which is quite easy with hibernate annotations). You can
then still use all of the dynamic methods etc on the java class as if
it was a regular GORM domain class.

You can even take an existing domain model developed in hibernate and
use that.

[snipped]
Reply | Threaded
Open this post in threaded view
|

Re: Grails for prototyping

graemer
On 4/21/06, Eric Williams <[hidden email]> wrote:
> Thanks for all the information.
>
> So I should be able to create POJOs, annotate them w/Hibernate
> annotations, and then Grails will be able to make controllers and views?
> Nice.
That is correct :-)

generated views are sometimes not perfect because clearly there is a
lot more flexibility in hibernate mapping than in GORM

Graeme

>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of Graeme Rocher
> Sent: Friday, April 21, 2006 2:30 AM
> To: [hidden email]
> Subject: Re: [grails-user] Grails for prototyping
>
> [snipped]
>
> Grails allows you to write you domain model in Java and map it with
> hibernate (which is quite easy with hibernate annotations). You can
> then still use all of the dynamic methods etc on the java class as if
> it was a regular GORM domain class.
>
> You can even take an existing domain model developed in hibernate and
> use that.
>
> [snipped]
>