Better performance in App Engine with new Lisp language Clojure
This post is part of the Who's
@ Google I/O, a series of blog posts that give a closer look at developers who'll be
speaking or demoing at Google
I/O. This guest post is written by Stefan Richter, founder of freiheit.com
technologies and creator of TheDeadline, an intelligent to-do manager running on Google App
Engine. TheDeadline will be demoing as part of the Developer
Sandbox.On Google App Engine, Google's cloud
computing platform, developers can officially choose between two languages -- Python and Java.
In the last couple of years, a large number of new programming languages were created and
existing popular languages like Ruby were ported to run on the JVM. The good news: now almost
any programming language that runs on the JVM should run under Google App Engine, too.
When I read Paul Graham's Book "Hackers & Painters" back in 2004, I
was especially fascinated by his essay "
Beating the averages" about his
start-up company that was using Lisp as the main programming language.
In 2009, when we
started
TheDeadline, we chose Clojure, a new Lisp language running on the JVM, as our main programming
language, and we decided to use the Google App Engine Cloud Computing infrastructure to run
our system.
Paul Graham was right. Here is what we have learned:
1.
Functional Programming with Clojure really makes you more
productive. We have a small team of three people with a background in Haskell and
Common Lisp. We release a new version once a week and we estimate that we only write 30% of
the code we would have to write in Java and about 50% of the code we would have to write in
Python. Writing less code requires less time.
2.
Clojure gives
you powerful functional abstractions over simple data structures. Writing less code
means that this code must be much more powerful. As opposed to object-oriented programming
where you build complex object-graphs using inheritance and composition, in functional
programming, you are using simple data structures and powerful functional operators that work
on these data structures. Internally TheDeadline uses a set of specialized mini-languages,
also called Domain Specific Languages (DSL). We are using these mini-languages as the
higher-level building blocks for our application.
3.
Using
Clojure on Google App Engine feels very natural. It is very easy to access the App
Engine SDK from Clojure as well as to integrate other existing Java libraries. App Engine's
datastore fits especially well with Clojure as we use simple maps as data structures. These
can be stored directly into Google's distributed key-value datastore.
If you want to learn more, I invite you to read a
more
detailed technical posting on our Hackers with Attitude blog about a very simple
Clojure mini-language to access the App Engine datastore.
Clojure in
combination with Google App Engine became a competitive advantage for us. We are able to build
new features quickly with a small team. With Google App Engine we have a zero-maintenance,
low-cost cloud computing infrastructure designed for large-scale applications.
If you are curious now and would like to try out TheDeadline, you can
sign up here. For more Clojure and App
Engine related posts, you can follow our blog
H.W.A. If you're attending Google
I/O 2010, you can chat with us about Google App Engine, Clojure and the Universe in the
Developer Sandbox on
May 19 and 20. We look forward to seeing you there.
by Stefan
Richter, founder of freiheit.com