db4o Developer Community

db4o open source object database, native to Java and .NET
Welcome to db4o Developer Community Sign in | Join
in Search
More Search Options

Carl Rosenberger's web log

Groovy SODA, groovy Groovy

On this blog post Jochen Theodorou uses Groovy features like operator overloading and closures to write SODA queries like the following:

Query query=db.query();
query.constrain(Pilot.class);
query.name == "Michael Schumacher" && query.points == 99
Query query=db.query()
query.constrain(Pilot.class)
query.constrain { it.name.length() < 5 }

Very nice syntactic sugar, very sweet!

I would love to have Groovy functionality available for the work on the db4o core itself but unfortunately we must stay compatible to JDK 1.1.

Published Saturday, September 09, 2006 9:33 PM by Carl Rosenberger

Comments

 

blackdrag said:

I thought I have seen collection classes for 1.1 somewhere.  Using that and some small changes in the compiler, Groovy could run on 1.1

September 9, 2006 6:08 PM
 

Rodrigo B. de Oliveira said:

September 10, 2006 5:11 PM
 

Carl Rosenberger said:

Thanks for the comment Theo (blackdrag).

I agree that it would maybe be possible for us to develop with Groovy inhouse. However we would like a large percentage of our users to be able to read, modify and compile our sources at home and at work, and for now I would believe we would decrease the percentage too much with a switch to Groovy.

It is an asset to be able to take our sources into any JDK 1.1 project and to compile there.

Maybe Groovy could be an option if we would reverse-engineer our sources for the respective platforms from bytecode, quite similar to the way we do it for .NET.

IMHO the success of Groovy is very much dependant upon how good the support of the Eclipse plugin is. We really love automatic refactorings. We have a strong focus on teaching us ways to produce maximum code output with the minimal number of keystrokes in Eclipse.

September 10, 2006 7:56 PM
Anonymous comments are disabled