Google App Engine Adds Java Support, Groovy Meta-Programming
Zarf writes "Yesterday Google announced that the Google App Engine now supports Java development, and fast on the heels of the Java announcement is an announcement for Groovy support! Groovy is a dynamic programming language for the JVM that is a near super-set of Java. Much Java syntax is valid Groovy syntax, however, Groovy adds powerful meta-programming features, and the new functionality will bring these meta-programming features to App Engine development. Groovy got special attention from the SpringSource Groovy team and the Google App Engine Java team, and it was this collaboration that helped create the changes that were the big secret in the recent Groovy release of 1.6.1."
This really opens the floodgates for cloud computing. I can't wait to port to this platform.
After a cursory glance around the Groovy site the syntax seems like python with brackets, yuck.
But Groovy is NEW! And new is better! Just ask any developer!
There's no -1 for "I don't get it."
Can't get very far without these forbidden features...
I'm curious to know which api's they support.. Sounds like only servlets and mail.. I wonder if its a complete J2EE container, which is pure bloat. Also do they have any standard sql functionality in their hosting solution?
But when will they add Ruby support?
Those are the same restrictions Java Applets have due to the Security Manager, and somehow programmers manage to develop useful applets.
I have no doubt that java and perhaps ruby in the future will be a great cash generator. On GAE you have to pay for processing time, what
better way to generate cash then to run cycle hog java apps on it.
Got Code?
In my programming language of choice, meta-programming is usually seen by laymen as pointless mental masturbation. Let's see what happens here...
Incorrect. The Servlet platform imposes those restrictions already, with the container handling all the messy details of threading and networking. It works just fine in 90%+ of the cases.
Javascript + Nintendo DSi = DSiCade
I'm not sure I fully understand the reason for Groovy? I've read a lot of the documentation, but it doesn't answer the fundamental question ... as a java developer, why would I learn this language when I can just use java? Is it just for the new language features? Can someone illuminate?
Java is my main language, but I definitely see the value in Groovy. For instance, how do you pass functions or other code blocks around in java? You either use very clumsy and verbose anonymous inner classes, or.. or nothing. Groovy handles this gracefully.
Basically Groovy is a scripting language that lets you use java classes. It's not really much different than Jython or JRuby, it's just more java-like in syntax.
RTFA, its from meta-programming! How else would you write meta-programs to run on GAE in the cloud? Just kidding =).
Although I could be way off, I'd assume it allows end-users of your web-app to script additional functionality onto it.
Surely there is a way to make Java even less readable than Groovy. Maybe make the entire language pure regular expressions or allow every character including the . to be an object.
One outcome of Sun's future liquidation is that no-one is around to promote the 1 Jesus language & Java ends up fragmenting into thousands of derivatives like Linux or Fortran.
To the extent Groovy is a "superset" of Java, it is a way to have a shell for doing things in Java without having to build; just type in commands at the prompt, or stick them in a file. One way to look at things might be to think of Java as a way to have compiled Groovy, sort of like Cython is a way to have compiled Python. Whether or not the extra non-Java features Groovy provides are worth using... that is debatable.
Larry
That might be a valid complaint except you clearly haven't ready the summary - they support Java too (actually Java was announced first).
Then again, Groovy is very popular now, where as Scala is becoming (as per the twitter announcement yesterday).
df -h
For all you PHP folks out there, GAE + Java + Quercus means PHP is now on Google App Engine: http://weirdhenge.appspot.com/test.php ... once you have Java on a platform a whole world of tools just opens up!
Still funny.
Groovy is to Java as PERL is to C. Many similarities, plenty of points of comparison, some interactivity, arguably some interchangeability. It is not a "super set" or even an extension. It's a new language, written in another language. It's a scripting tool, written in Java, that optionally generates Java for execution not in a Groovy engine.
It doesn't give you "compiled Java" any more than Java gives you compiled Java, and other tools (like gjc) give you native executables from software written in Java.
It's got good. It's got bad. It's new. It leverages old. If you're going to use it, you've got to learn it.
No magic, just different.
End the FUD
Support for "for i in $array" syntax
Agreed with most of your points, but this one has at least been improved in Java (6?) with:
MyObject[] myObjectArray;
for ( MyObject o : myObjectArray ){
}
You can accomplish anything you set your mind to. The impossible just takes a little longer.
Does this Groovy implementation mean now the end of Jython? If Groovy is so "Pythony", is there a real need to further develop Jython?
What are the relative advantages/disadvantages of Groovy over Jython?
"Sum Ergo Cogito"
Servlets don't restrict network connections, and people do it all the time to talk to their database. I know you're not supposed to spawn threads with EJB (because transaction information is kept in thread local storage), but I don't recall anything about not spawning threads being in the servlet spec. I know of a lot of code that does it in various containers without problems.
Yes, apparently you can now use it on the Google App Engine!
It's open source and not half-assed open spec in a thinly veiled excuse to call itself cross-platform.
It's dynamically typed, which C# doesn't have, though C# 4.0 will have the static type "dynamic".
Other than that, I don't know. P.S., I don't really hate C#.
C#'s spec is fine, Microsoft has a look-but-don't-use "shared source" implementation of the CLR, and officially supports Mono, which supports virtually everything people actually use. What more could you want?
From the spec:
You are right, though. I was thinking about the EJB spec, which explicitly disallows threading. With servlets, it's not forbidden but highly discouraged.
Interestingly, the current spec seems to have lightened up on network connections:
Back before the complete J2EE spec existed, I recall there being a prohibition on making network connections as part of the servlet itself. Generally, you were supposed to use a service of some sort to accomplish tasks that required networked resources. J2EE, of course, provided a number of the required services.
The proper way to do this in a J2EE environment is to configure the connection in the Directory Server, then do a lookup to obtain a reference to the connection pool. I don't have docs yet for how Google is doing DB connections (something about JDO is mentioned in the brochure), but I imagine it's similar.
Javascript + Nintendo DSi = DSiCade
as a java developer, why would I learn this language when I can just use java?
Dude, like, because it has a totally groovy name! ~
Seriously though, mostly because it has some nice language constructs and syntactic sugar for stuff that is painful in plain Java. If you've ever coded in Python and Ruby, you know what I mean. If you haven't, then you should probably give it a try - getting stuck with a single language, even if presently the most popular one, isn't good for career in long-term.
Dynamic languages are gaining popularity extremely fast for a whole host of reasons. If you haven't used a dynamic language then you probably won't understand why they are attractive very easily, but if you have it will probably seem obvious. They do have a lot of downsides and I think the jury is still out to some extent whether the reams of code now being written in them is going to be maintainable down the track.
Groovy is Java made into a dynamic language and with innumerable convenience features added. The best way to describe it is to imagine if java was turned into Ruby.
I suspect one reason Google has focused on it is because of Grails, which is java's main player in the RAD web-app development arena (more or less the equivalent of Django, which they also support for the Python app engine). It doesn't work on App Engine yet, but I strongly suspect that is where they are headed.
This is ./. We don't want your cogent analogies and your evenhanded, unhypeful treatment here. If one half of your X technology vs. Y technology comparison isn't "users of X will burn in hell", then this is no place for you, and you'd better be moseying along, lest something unfortunate were to occur, you filthy centrist.
Anyone who loves or hates any language, platform, or manufacturer, doesn't know what they're talking about.
What more could you want?
Google App Engine.
I just took a quick look. It's not really a RDBMS but it's more just a persistent object store. It's schemaless and uses JDO to access objects.
This seems to be the type of databases that cloud application service providers are going to. Likely because it's easier to scale these than to scale a real RDBMS.
Dual Opteron < $600
Ugly as hell, just like Java.
No strong typing.
Too many things are hidden and implicit.
Not WYSIWYG.
Yeah, it can by dynamically loaded into Java. So you can have this wonderful crazy java application that can modify its own behavior by creating a groovy file and then running it. Self modifying code is awesome. Or alternatively, its runtime behavior can be modified while its running, if you'd prefer. Fix the bug with out taking down the app! Not sure if this would be a good thing in most peoples assessment, but it is in my crazy world.
Well.. maybe. Or Maybe not. But Definitely not sort of.
That's pretty much what I saw as well. (Just got my account approved. Whoohoo!) It looks like the object store is flexible enough to pretend to be a database, so they wrapped it in JDO. Technically, it should be possible to create JDBC drivers for legacy apps as well. Personally, I'm somewhat interested in accessing the object store directly. The API is simple enough to where all the JDO stuff is just cruft when it comes to purpose-built applications. (Good for portability, though.)
Javascript + Nintendo DSi = DSiCade
Do people still use JDBC directly for webapps? I thought most people were using either JDO/JPA. Most of the JDBC stuff is boilerplate and takes a long time if you have a large database.
I have used this DAO Generator a few times and it really cut down development time when using postgresql databases.
Only free one I found that seems to follow the DAO pattern closely. It's a little rough but it works.
Using Google App Engine I guess is a little more like Hibernate, where it's and object relational store, except without the relational part. You need to handle the relations in your code.
Looks like it also supports JPA.
Dual Opteron < $600
Groovy, Scala, etc.
What they all show is that "Java the Virtual Machine" is a wonderful piece of engineering.
Someone asked here in another thread something like "but why do you say Java scales?, can you suddenly sort 1 billion integers faster in Java theyn you could sort them using another language?"
Well... Yes and no. Due the amazingly fast, secure and well-designed JVM (including amazing concurrency support), implementing things such a Map/Reduce becomes a piece of cake in Java.
That's why Java HADOOP won the "1 terabyte sorting contest".
Scalibility on multi-cores machines thanks to incredible JVM design, scalibility across hundreds or thousands of computers because Java was designed that way.
You can't really beat that.
Look at the Twitter/Scala joke: the interview basically says "the JVM rocks, the Java APIs rocks, we use them where the Scala one fails, Scala is great because it runs on the JVM and because when Scala fails we can use the bulletproof Java APIs".
Oh, and zero buffer overflow/overrun in the JVM, otherwise the JVM isn't compliant (the specs makes it impossible to come with a compliant JVM that would allow buffer overflow). The only buffer overflow I've seen with Java on Linux were... Attacking a bug in the (broken) C-written zlib.
How pathetic uh?
If all software were written in Java by competent programmers, the industry would be a different place.
But /. continues to be the "Java haters" kingdom, where people think of 1997 Java applets as Java.
No matter that everytime they make a payment Java is involved in the process, no matter that Java pretty much powers the real world, entire country's medical infrastructure, the Mars rover visualization program on earth, that HADOOP won an amazing speed contest, etc.
No, no matter the evidence they still like in their cave and think that Java sucks.
Wake up, the world won't change to accomodate your views.
In one way, and I mean no disrespect by saying this, it doesn't matter what you think.
Let me elaborate: Java/Groovy support has been one of the most requested features ("starred" ;-) features in the App Engine since it was announced. This means that the reason Google now adds it to app engine, is that the app engine user community has requested it.
About Groovy itself: If you find no reason to learn Groovy, that's ok. I like Groovy, but I mean, it's not a truely great language; it's a nice "perlish" version of java that has closures, and that's about it. On the other hand there are plenty of other languages out there (Scala, Erlang and Haskell comes to mind) that offers genuinely unique features, and it might expand your mind more to learn those than to learn Groovy, so it all comes down to personal needs and tastes ;)
(unlike Lisp naturally, which everyone should learn whatever their needs or tastes are ;-))
There are tons of examples of roll-your-own O/R mapping tools out there. JDBC is the basis for all of them. So if you support JDBC, you know that you can support everything from raw access to JDO and everything in-between. :)
Javascript + Nintendo DSi = DSiCade
Those are the same restrictions Java Applets have due to the Security Manager, and somehow programmers manage to develop useful applets.
Applets can spawn threads and make network connections (as long as the follow the same origin policy).
Throw the bums out!
I'm just going to curl up now
I don't quite grasp the benefits of passing around functions. When I need this type of portability, I can either...
A) Create a utility class with static methods that can be invoked from several different objects.
B) Create a class that encapsulates the functionality of the function, perhaps even make it implement some common interface, and then just pass around that object so that it can perform some given unit of work.
I agree that this doesn't seem as sexy as passing around an actual function, but it gets the job done.
Just a note, I am experienced enough to know that just because I don't see or understand the value, doesn't mean that there isn't value there. For instance, I used to have a similar argument about the Spring container. I thought... what's the big deal here? All it does is manage my objects? But I forced myself to use it and after a couple of weeks the lightbulb clicked on with one of those... "Ahhhhhhhhhhhh!" moments.
I guess I should do the same with Groovy. I'm such a follower.
In our code base of 50+ projects, Not one functions without spawning a thread. Even some of our servlets spawn threads for background cleanup processes.
I'm not sure I fully understand the reason for Groovy? I've read a lot of the documentation, but it doesn't answer the fundamental question ... as a java developer, why would I learn this language when I can just use java? Is it just for the new language features? Can someone illuminate?
try some ruby on rails tutorials, and see how easy activerecord is vs. the typical java way of doing persistence, e.g. spring/hibernate. then try the will-paginate plugin in rails to see how easy it even is to extend the framework while keeping your code clean and simple. then try to make the same in java: you will find out you cannot, because of missing javascript-style dynamic features of the java language. then have a look at Grails, which is a rewrite of rails on Groovy. then you will understand what groovy can offer as a surplus on java. OTOH as Groovy is a dynamic language, you get more runtime errors.
I've been delving into Groovy... it's a paradigm shift and it's very hard not to be so verbose.
.. there are things you cannot do in it (yet) but lots of things you can.
:):
:P
It isn't, as the article suggests, a superset of Java
What I mainly thought when I saw it was "finally, Java has caught up with the rest of the programming world and has a scripting language at last".
When I used it, it became apparent that this was more than a perl to meet C's needs. It was like the cheeky bastard child of Java who can do what his dad can but faster... and you get properly compiled class files out of the compiler.
Anyway I wrote a mud engine that runs groovy scripts to teach myself. The main failing of the groovy package is the Groovy Script Engine. It promises so much and doesn't always deliver. Unfortunately my mud engine is based around the darned thing, so until they fix it properly I'm stuck with it being a bit clunky.
Check it out, and you can muck about with groovy too (please don't laugh at my programming
http://code.google.com/p/groovymud/
"So there he is, risen from the dead. Like that fella, E. T." - Father Ted Crilly
<joke>C'mon Stallman, get an account already!</joke>
I know tobacco is bad for you, so I smoke weed with crack.
No strings (no pun intended) attached, for instance.
I know tobacco is bad for you, so I smoke weed with crack.
And what strings would those be? If Microsoft really wanted to shoot themselves in the foot and sue their own customers, they would've done it by now.
I was insinuating something about their agreement with Novell.
Call me paranoid, but there is not much business sense behind such pure altruism. They are up to something.
I know tobacco is bad for you, so I smoke weed with crack.
Why would they want to sue anyone for using Mono? The official runtime is already free, and they obviously don't care about people using it on other operating systems (see the official OSX Silverlight plugin). Also, suing anyone for Mono would ward people away from .NET by association.
Why was I modded offtopic? I was only reacting to people treating Groovy as the second coming of Java Christ when C# had all of these improvements since forever.
I don't know dude, irrational decisions are characteristic of M$, and I'm just being healthily suspicious.
I know tobacco is bad for you, so I smoke weed with crack.
I don't know dude, irrational decisions are characteristic of M$, and I'm just being healthily suspicious.
Slashdot in a nutshell right there.
Run PHP on your google app engine. See details http://www.webdigi.co.uk/blog/2009/run-php-on-the-google-app-engine/