JRuby on Grails?

19 views
Skip to first unread message

Abdullah Jibaly

unread,
Apr 29, 2007, 4:05:21 PM4/29/07
to Google-We...@googlegroups.com
Hello All,

This is part of an email to the Grails list and I was hoping to get
some feedback from the GWT community as well. Thanks...

I've also been looking at GWT a lot lately, very impressed by it. It
kind of forces you to rethink the whole client/server approach in a
way so I don't think there are any frameworks out there that take
advantage of it yet. I'm thinking if something like the following
would be the most suitable for it:

Server side (very similar to grails):
Hibernate
Guice
Java/Groovy/JRuby
DWR?

Client side:
Groovy/JRuby wrapper for GWT or Java
Guice

A lot of the server based stuff like session management now can be
handled on the client side, so the server side will be more like a
data access layer. So far I think the best serialization mechanism is
JSON and that makes it easy if you have a .toJSON method or something
similar. Anyways if you guys have any opinions on this you'd like to
share I'd appreciate it.

Thanks a lot,
Abdullah

Andrés Testi

unread,
Apr 29, 2007, 8:54:34 PM4/29/07
to Google Web Toolkit
There is a JSON serializator http://code.google.com/p/gwt-jsonizer

Reinier Zwitserloot

unread,
Apr 30, 2007, 12:22:03 AM4/30/07
to Google Web Toolkit
You hit the nail on the head, Abdullah: GWT turns your server into a
dumb terminal for data.

All tasks for your server basically fall into this trivial mechanism:

1. verify integrity of incoming request*.
2. obtain requested data, which usually means: do a Database query.
3. return these results without modifying them in any way (wash them
through a jsonizer, that's all)
4. there is no 4.

Given that it's -that- simple, why are you messing with DWR, Guice,
and Hibernate? Straight servlets with straight JDBC or lightly wrapped
JDBC (RIFE's wrapper or spring's simple wrapper come to mind, not a
big gun like hibernate). With all respect to Guice, what are you going
to inject into such a system? I mean, I can come up with plenty of
good reasons, but all other things being equal, it's overkill.

Straight Servlets are no longer an inconvenient mess to work with in
this model; they actually lend themselves quite well to the above
simple process. If you don't program much java and just plain prefer
ruby or groovy, by all means. However, if you like ruby better for
this, why don't you just use ruby? Screw JRuby - keep it simple, go
with the real deal. There are plenty of good reasons to use JRuby,
again, but in this circumstance, I'm not seeing any. As you say, JSON
is simple, and JSON doesn't bind you to any server architecture. You
can use seaside, PHP, RoR**, straight servlets, faces**, web.py,
django**, turbogears**, and many many others. Personally I'm very
capable at java so I go with straight servlets, but it depends
entirely on what you like working with.

DWR aims to solve similar issues as GWT. Using them both is asking for
problems.

**) Total overkill in combination with GWT. Not really recommended.

*) You can't TRUST your clients. They will be trying to hack you. For
example, if fulfilling the data request from the client would mean you
send 8 gigabytes of data, obviously, don't even run the query. You'll
also need to verify authenticity for every request as web is
stateless. Here the session primitives of most of those frameworks
actually help you, but rolling your own session management is a
trivial exercise in the extreme: 1 database table, 1 simple 'lookup'
method that makes the appropriate query, and have all your servlets
extend a custom servlet that contains this method, et voila.

Reply all
Reply to author
Forward
0 new messages