Wednesday, February 2, 2011

Lightning Talk - gtugbh - Feb, 03 2011

What is GWT?
It's a web toolkit provided by Google. It allows developers to implement rich web applications using the Java language. A compiler converts the Java code into pure Javascript+HTML code. The generated code is browser agnostic and highly optimized.
As most web apps, GWT apps usually needs to make calls to some HTTP server to retrieve or post some data. GWT uses Ajax to do this task. There are three types of client server communication in GWT:
  • Pure HTTP calls: usually transfer data using the JSON format. The problem with JSON is that GWT client code is Java. Java is statically typed so convert JSON data into Java objects is not easy and results in ugly code.
  • GWT-RPC: uses a proprietary format to invoke server side GWT specific servlets using Java code in both sides. This looks like a better solution but the developer must be very careful about the objects transfered from/to this services because they have to be serializable according to the proprietary GWT format.
  • RequestFactory: starting at GWT 2.1 this feature improves the GWT-RPC for service oriented apps. But I think it requires lots of redundant code to expose server side objects to the client code.
What is Roo?
Spring Roo is a command line tool that uses round trip code generation and Aspect Oriented programming to create Java Enterprise Applications in a very productive way. It's hard to explain what Roo really is so I suggest you guys to take a look at this tech talk.
I think Roo can help to solve the client server communication issues related to entity types serialization and integration with server side business logic. Roo uses the new GWT 2.1 RequestFactory for client server communication. All redundant code is generated by Roo.
The GWT+Roo integration is a very new feature and I haven't tried in real World apps yet but it looks promising. Compared to other Roo stuff the GWT integration is not really aspect oriented so is hard to customize the scaffolded UI. There is no documentation on this topic and for now I think Roo team is using GWT to give some attention to the project.
I am looking forward for improvements on this Roo feature because right now looks like it only works for very simple CRUD UI's.
For more info

1 comment:

Adimir Colen said...

Congrats, muito bom o post, vou dar uma pesquisada melhor, hj trabalho com Ruby on Rails, e na sua palestra deu pra dar uma sacada que tem semelhanças com rails. Muito bom ta de parabéns.