Jul 6, 2008

Google's App Engine

I don't know how long this has been around, but I've recently discovered Google's App Engine, which is a free hosted web application system. It's funny, because just the other day I was thinking of creating a small web app for playing a simple game and was wondering, "Where would I host this?" I could use freegamage.com, but since that project has mostly been a failure I doubt I will be renewing the domain.

This is pretty neat. You get 500MB of storage for your app, not sure if this includes databases but most likely. If all you're doing is a basic app with a few images here and there, this is easily enough. You also get enough bandwidth to handle approximately 5 million hits per month. That's more than I'd need for any site I'd make on my own time, and if I was getting 5 million hits per month I'd probably be able to make enough through advertising to host my own site somewhere else.

To use it, you just download a copy of the Google App Engine SDK and extract it. Voila, you have a rudimentary web app! It comes with a basic web server and database, so you don't even need to install anything - except Python, but if you're on Ubuntu it comes with Python anyway. On other platforms it's fairly simple to install Python, just download and run the installer. There are a bunch of scripts too that handle updating the framework to a newer version, uploading your app, etc. And all you need is your Google account.

You get access to Google's webapp framework. This is a simple Python framework that gives you basically everything you need to create a web application, including templating and database support. They say they will be releasing a version for other languages soon, but Python is a good language and I'm more than happy to be using it (this also gives me an excuse to learn Python).
After exposure to Smarty, I decided that I hated templating engines (I don't really consider eRuby a templating engine). However, after making a framework of my own, I thought that maybe a templating engine isn't such a bad thing - especially where efficiency comes in. The webapp framework uses a simple templating engine (same one as Django) that ties in rather well with what you're doing. So no complaints here.

An excellent addition to this is that it ties into Google's user network. If you are making an application that requires authentication, you just use the user's Google account. Since most people have one of these already (and those that don't should have one, Gmail alone is worth it) you don't need to keep track of users and all that. You don't need to write the "forgot password" section, since Google has taken care of that already.

One interesting thing is that they don't use SQL for their database. It's not even a relational database. In fact, they don't even call it a database, it is called a datastore. I'm not really certain how it works internally, but it says it uses "Google's scalable infrastructure", which is good enough for me! The framework provides a little query engine for the database that uses GQL, an SQL-like language. It seems to be a bit more object-oriented than SQL, as instead of rows, the queries return objects. Again, I'm not sure how this all works internally, but I don't really care at this point.

On Python: It's neat. I've used Python here and there in the past, learned the syntax and all that, but this is a bit more in-depth and I'm learning some of the differences between Python and Ruby. Of course, the more annoying aspects are the ones you notice: having to put self in the parameter list for every method, and I always forget to put a colon at the end of block things like if/else.
What do I like? It's hard to find things that I like about it, I haven't really done enough to go "oh, that's neat!" I do like tuples, something that I missed when going from C++ to Ruby (C++ doesn't have tuples, but I liked using std::pair). Python makes this kind of thing fairly elegant compared to C++.
I don't really have any comments on the indentation style of Python. It would probably be annoying if I didn't already indent like Python wants you to. The only difference is not putting the end keyword or closing curly brace, which does tend to make code cleaner and eliminates the annoying syntax errors of "expecting kEND, found $end" or "unexpected end-of-file".
Syntaxes aside, in the Ruby vs. Python debate I would probably say neither is better, they just adopt different philosophies (Python's one-way-to-do-it vs. Ruby's you-can-do-whatever-you-want). And unless you're an advocate of one of these, I suspect that the language you like better is the one you pick up first.

So yeah, I would recommend you check this one out if you're a web developer. It will probably make your life easier, at least if you have a cool idea that you want to try out.

1 comment:

fabjoa said...

Nice post! Good blog title too! I'm just beginning with Google AE, we'll see how much i like it. I agree with you - too bad there is not a Ruby SDK, but Goo looooves python!