Everyone always asks: “What is the difference between SproutCore and GWT?”. If you don’t know, GWT is the Ajax library developed by Google. You write Java code, which is translated into JavaScript for you to run in the browser.
I could go into lots of details about the specific strengths or weaknesses of this or that feature, but the big difference between GWT and SproutCore can be summed up with this quote from their from page:
Google Web Toolkit (GWT) makes it easier to write high-performance AJAX applications. You write your front end in the Java programming language and GWT compiles your source into highly optimized JavaScript. Writing web apps today is a tedious and error-prone process. You spend 90% of your time working around browser quirks, and JavaScript’s lack of modularity makes sharing, testing, and reusing AJAX components difficult and fragile. It doesn’t have to be that way.
In other words: we don’t like JavaScript. It’s not Java and it’s hard. Use GWT instead and avoid learning that language altogether!
SproutCore’s approach, as you probably know by now, is quite the opposite. Embrace JavaScript. It’s a good language once you get to know it. The tedious and error-prone part of it is not the fault of JavaScript, its the natural state of the web browsers and their relatively primitive APIs. But that’s what a framework is for.
Here’s the problem with using something like GWT or any other framework or tool that lets you write in <insert favorite language here> and then converts it to JavaScript: they can’t always get it right.
Every framework, even SproutCore, makes some assumptions about the kinds of problems you will need to solve or how your code will need to perform. When you run up against these limits (and you always will) in a platform that tries to isolate you from JavaScript what do you do? Well you have to write the JavaScript yourself. Only now the problem is twice as hard because you have to figure out how to interface with that super-optimized, totally unreadable code generated by your tool as well.
With SproutCore, if you want to do something not anticipated by the framework, well, write a little more JavaScript. It will be easy to interface with the rest of your app because that is what SproutCore does. Better yet, use one of the many libraries already out there to help you. It feels totally natural and normal to do this because you get to stay in the same platform where you belong.
The point is, any framework that tries to help you avoid learning JavaScript, be it GWT, ruby helpers, or anything else, is fine when you have some relatively simple things to do. But if you want to build apps that really shine in the browser, you need to go native. Use the technologies that the browser is made of and you’ll be far happier in the long run.
And that’s the difference between SproutCore and GWT.
Update: I have great respect for the GWT team and what they have built. It’s an amazing feat of technology and very useful for any Java engineer who needs to add a little Ajax love without learning JavaScript. But for the kinds of apps SproutCore is designed for, we differ on the approach. The purpose of this post is to explain that difference.
Tags: Opinion by charles
23 Comments »