Thursday, September 2, 2010

Streamlining Appengine Development

So I have a few apps on appengine. I have my beautiful wife to thank for that. I never planned on deploying anything other than a silly blog on it before she came in my life, coming up with awesome ideas. She would mention in passing, "I wish there was an app for x on my ipad". Chances are, there would be, but it would cost a dollar or two. I know that does not sound like much, but I always look for an opportunity to expand the brain a little. So I write her apps.

All my apps prefice with 1337, which I coined the leet suite:

  • 1337 Shop list: Your standard shopping list app. You can share with people, and anyone with a Google account can use it.
  • 1337 Flashcard: Your standard flashcard app that uses html 5 transitions, and stuff.
  • 1337 Todo list: Your standard todo list with Google Calendar integration (which actually is not done yet).

They all support a mobile (specifically iPhone) version, and a desktop version. Through out all this, I have made several libraries to help roll these guys out, and I was using eclipse to build and deploy the builds. I will digress now.

Eclipse is a monster. On my Macbook pro, eclispe alone consumes 1 gig of the 1.7 gigs I have available. This is the cool thing about Eclipse: it dies when there is no memory left to consume.

So I was in this frustrating cycle of coding, watching that blasted beach ball, coding, crashing, launching eclipse, waiting, waiting, waiting, coding, watching the beach ball, crashing.

There has got to be a better way, right!? There is! Over the past year, I have converted all the home grown scala projects to use sbt.

The sbt/git eco-system, is very inviting. My biggest complaint about coding Scala in vim was the lack of auto (method/field) complete ability, and seeing compile errors as I typed.

But I figured it was time to grow up. I combined terminal multiplexing (screen) with vim and sbt. I now code, compile (build), and deploy all from the command-line. This type of work environment has alleviated a lot of the memory over head to run eclipse, combined with the fact that I learned a few things about vim and screen.

Now all I have to do to roll out a new appengine app with all my libraries, is:

git clone ssh://user@domain/var/git/appengine_scaffolding.git new_app
cd new_app
git rm -rf .git
sbt
[info] Building project appengine_scaffolding 1.0 against Scala 2.8.0
[info]    using AppengineScaffoldingProject with sbt 0.7.4 and Scala 2.7.7
> update
> dev-appserver-start -p 8888

Direct my browser to http://localhost:8888, and bam! That is all.

Some immediate advantages:

  • Learning more about sbt. I love that build tool. You configure your build and dependencies all through Scala code.
  • Learning more about screen. I have used screen for years. I love screen. On a day to day basis, I could get by with few open terminals, create, remove, rename, etc. Screen is very complicated. It allows you to split your view horizontally or vertically. This feature is very nice with sbt. I can reload or compile in sbt, and have the source file in my view right above it.
  • Learning more about vim. Vim is something else I used for years. I learn something new about it every week, it seems.
  • The appengine sbt plugin. A must get if you plan on doing similiar sbt/scala appengine development.

I realize this post was more about advertising than anything. Sorry if it bored you to death.

-- Philip

No comments:

Post a Comment