Chariot Training Classes

Training Courses

I run Chariot's training and mentoring services. We provide training in AngularJS, HTML5, Spring, Hibernate, Maven, Scala, and more.

Chariot Education Services

Technology

Chariot Emerging Tech

Learn about upcoming technologies and trends from my colleagues at Chariot Solutions.

Resources

Chariot Conferences

Podcasts

Entries in grails (17)

Tuesday
Jun012010

Rod Johnson Speech at Philly JUG - Recap : It's Roo and Grails FTW

Disclaimer:  I am a co-author of the upcoming Manning book, Spring Roo in Action, and a consultant for Chariot Solutions, a SpringSource partner.  That said, I'm normally not a cheerleader. These are my thoughts around the recent speech by Rod Johnson of SpringSource.  - Ken Rimple

Rod Johnson spoke last Thursday at the Philadelphia area Java User Group.  Although I got called away for a family matter at the end (darn!) I heard what I hoped to be the case: that VMWare has a strong interest in improving developer productivity, in general, for cloud computing and for mobile applications, and to that end, invested in SpringSource, which is also leading SpringSource to invest heavily in both Grails and Spring Roo.

I am a fan of both platforms.  Grails, with the Groovy language, is one of the best things to happen to dynamic programming on the Java VM in a long time.  With access to any Java library or framework, including the built-in Spring and Hibernate platforms, it gives new meaning to "Rapid Application Development."  

Spring Roo, on the other hand, solves the productivity problem more unconventionally.  Pop quiz:  when you hear the words "Aspect-J" and "Rapid Application Development" together, does it make sense?  Most people view Aspect-J as powerful and complicated.  While this is generally somewhat undeserved, Aspect-J, applied too liberally, can make a mess of an otherwise well-organized project.  Most junior to mid-level developers fail to grasp it, and senior developers usually apply it surgically to do some really great things.  Spring, in fact, uses aspect-oriented programming behind the scenes, when it does things like write dynamic Java Proxies to handle transaction management and security.

Roo is different because it uses a new feature of Aspect-J : Inter-Type Declarations.  Using Aspect-J class files, developers can weave features from various aspect files into a single class at compile time.  For example, Spring Roo Entities are comprised of at least four different class fragments - the entity class itself, with the fields of the entity, the JavaBean file, which contains setters/getters, the configurable, which adds the @Configurable annotation, and the Entity Aspect, which contains all of the methods to persist, find, query and remove entities from the database.

Rod's statement about how the Java platform has a short period of time to really take over the cloud computing industry was interesting.  He stated that Java developers are "really smart, and that's a good thing," and then something along the lines of, "The problem is that Java developers think they are really smart, which is a bad thing."  Probably paraphrased wrong, but rather hilarious.  He put a hypothetical scenario in front of us stating that, given a moderate problem to solve, a Java, Ruby and .NET developer would go about it different ways:

First, the  Ruby developer would get done on time.  The .NET developer would also finish, but the Java developer would have reviewed ALL OF THE OPTIONS and not necessarily have coded a single thing.  He says that is our problem, and that there are so many choices (a point I've argued a lot) that it makes it difficult for us to make decisions.  I've seen a great talk by Scott Davis years ago that mentioned the "tyranny of choice" - when our combinations of choices go up, we begin to 'vapor lock' and paralyze ourselves with decisions.  BTW because of Scott (and also Andy Hunt) there is a book on my reading list, "The Paradox of Choice."

So, we on Java have to get more rapid in our application development.  And hopefully, that's where Spring Roo leads us.  I developed on PowerBuilder back in the 90's for five years.  Why?  Because the alternatives for building business applications weren't so good:  VB 2.0?  terrible.  FoxPro?  What?  C++? Come on!  And then entered the web and Java, and we've been on the complexity train for a long time.  Spring has done a ton to make this easier, but we have to do better.   We must get to the point where it becomes trivial to boot up an application platform, to add persistence to our applications, to write a web application, to send emails, etc...  Grails and Roo should get us closer to that goal.

I left at the point where Rod was laying out the mobile strategy.  However, I see that Roo just got updated to 1.1.0.M1, which contains the starting point for building GWT applications (as well as Google App Engine back-ends).  It certainly looks promising for the 1.1.0 GA release.  But at least I think I've put decent bets on two good horses for rapid development on the Java platform with Grails and Roo.

Here's to what looks like an interesting 6-12 months on the Java platform.

 

Thursday
Oct222009

SpringSource Tool Suite 2.2.0 and Grails

Note - this is potentially a second option.  According to this link you just have to select both plugins (for some reason when I downloaded the tool suite and tried the artifact wasn't there for the codehaus groovy core plugin).  Try the above link first, then if that doesn't work, go ahead and follow the instructions below.

Ken

[original message]

Correlated with this STS forums post:

http://forum.springsource.org/showthread.php?t=79409

Grails is not included automatically in the new STS 2.2.0 release just issued on Wednesday 10/12.  You have to go to the Add New Software menu and add it from the optional STS tools menu.

If you're having trouble with installing Grails because it complains about a missing dependency, add the following repository (in Add New Software) and restart STS:

http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.5/

If that doesn't work, manually add the groovy core feature from that library while adding Grails.  At that point you should be off to the races.

It's not IntelliJ Idea yet, but they are committed to getting things working in the IDE.  Right now, based on my own hacking, I see you can:

  • Hit Command-G (CTRL-G for non-apple people) and get the 'enter a grails command' yellow tool popup.  This is great for any create-domain-class etc.
  • Run as Grails Command (run-app), Groovy Shell, added to right click menu.
  • Run as JUnit Test for Grails test classes
  • Although the debugger complains that it can't debug, due to missing line number information, click the ignore future warnings checkbox - it works fine.  Got it to debug a bootstrap and a controller method.

That's it so far, pretty impressive.  I noted you have to hit F5 if you add a plugin or other artifact, as it didn't seem to refresh the file system (gdsflex adds a views/flex and views/swf directory, for example).  However I think you can turn an auto-refresh setting on in the IDE.

Now if I could just configure the flex plugin from Adobe on the same instance, I could actually get a flex and grails project working in a single IDE instance.  Yeah…  Time to try to break my configuration!

 

Friday
Apr172009

Google App Engine - Now with Java "Freshness"

In the past two weeks, Google has announced support for Java and Groovy on the Google App Engine.  Various frameworks are supported, and the team at SpringSource is hard at work with a git repository fork of Grails for AppEngine.  

What does that mean for us Java-heads?

 

  • You will now be able to deploy a Java-based application to Google App Engine for free up to a certain number of page views per month (rumored to be somewhere near 5 million views per month)
  • You can use some major Java frameworks, including Spring, some of Spring MVC (apparently they are sorting through the spring: tag lib), etc...
  • You will have to code differently (just as the Python developers using the original App Engine did), because you're running on a non-relational data store (BigTable).  However, you can use JDO and most of the features of JPA.

 

This is an interesting announcement.  For quick applications (especially Grails-based) that you want to get out there for immediate feedback, you now have a place to drop them, free.  Of course, coding for App Engine puts some pretty hard limitations on your architecture; you'd have to figure out whether or not you'd want to do something like that and whether it fits your ultimate goals.  But for UI prototyping, quick burst apps like Facebook surveys, etc., it's an interesting alternative.

Even better, the Groovy team released Groovy 1.6.1, which is compatible with GAE.  There are sample applications using Groovy Ant builder running around.  Check here for a great article by Guillaume LaForge. Also see this, and this.  A good message board exists on the Google Groups page.

 

Tuesday
Mar172009

Interesting Plugin for Grails - javascript validation

Anyone who has programmed in Grails realizes the power of the domain-centric design pattern, including validation rules embedded as constraints in the Domain class.

Someone has written a plugin that dynamically generates Apache Commons Validator code on the fly.  It's called the javascript validator plugin and it is enabled in three steps:

Install the plugin:

grails install-plugin javascript-validator

Add to a given form with:

<jv:generateValidation domain="Employee" form="employeeForm">

Set up the form to include validation

<form id="employeeForm" onSubmit="return validateForm(this);" ... >

I'm going to give this a shot. Interesting how simple it could be to add client-side validation without re-architecting your whole code base. This is why Grails rocks!

Thursday
Mar052009

Good blog post on Grails in a recession

See the post on GrailsBlog.com. Good reasoning for using Grails to save money by improving productivity and agility.