You have arrived at the web home of Noah Brier. This is mostly an archive of over a decade of blogging and other writing. You can read more about me or get in touch. If you want more recent writing of mine, most of that is at my BrXnd marketing x AI newsletter and Why Is This Interesting?, a daily email for the intellectually omnivorous.

July, 2013

My Intro to Coding/Python/Django/AppEngine

Transitioning from PHP to Python, and the excitement of using Google AppEngine for coding projects.
When I first learned to write code a few years ago I taught myself PHP. I still contend that was/is the very best choice for someone just starting out as it offers the lowest barrier to entry in making things happen on the web. Between WAMP/MAMP and the fact that most vanilla webhosts support PHP by default, it gives someone just coming into building applications a very simple tool to get started with. This answer is not the most popular with engineers, who (sometimes fairly) see weaknesses and sloppiness in PHP. The counterpoint I offer is that I'm not suggested it's a good language, but rather someone who is just getting started needs as few barriers as possible to getting something up and running. PHP I still contend, is the best tool for that job. Lately, however, as I've moved on (mostly because I'm surrounded by amazing engineers at Percolate every day), I've become a fairly serious fan of Python. It's pretty (instead of the curly brackets of PHP or Javascript - {} - the language uses simple indentations to represent nesting. It's neater to the eye and, once you get the hang of it, a bit more straightforward than PHP (though I'm not close to using either language to it's full capability). The challenge I had with Python early on, however, was the complexity of setup. Whereas PHP was as simple as saving a file and running it, Python has virtualenvs, packages, and other setup stuff that with enough trying I was eventually able to get running on my own. The problem was, all that work was leading me to shy away from writing code when I had an idea. Instead of spending time writing code I knew I'd spend it setting up servers and the such. I tried AWS and even Heroku, and both still left me with what felt like an imbalance between setup and coding. What I started to realize is that as someone who doesn't write code every day, I want tools that optimize the amount of time I actually spend writing code. That, after all, is what I enjoy. (I'm not sure if I've ever written it here, but the feeling I get writing code is pretty unique to any of the other work I've done. There's a beauty in the simplicity of code: While something can always be more optimized or elegant, at the end of the day when it works, it works, and when it doesn't, it tells you why.) Anyway, though I can't remember how I got started, I discovered Google AppEngine about six months ago and it's been a total revelation for me. All of a sudden I'm excited to take idea to Sublime and get busy because I know that I'll waste 0 time doing anything I don't want. Google handles data storage, queuing, routing, and pretty much anything else I ever need and while there are certainly limitations (mostly around package management), the pros outweigh the cons by a huge amount. About two months ago I thought it might be fun to try teaching an introduction to Python class using AppEngine. It would give me a chance to continue to test my theory that the best way to teach people to write code was to start them with GET/POST and, thanks to AppEngine, getting started and getting deployed would be as easy as clicking the buttons in their little OS X app. I made a little repository that I shared with the Percolators who took that class a few months and I thought it might be worth sharing that with everyone else. It's nothing fancy, but it's got the basics of GET, POST, URL routing, and using the data store. Ideally it's a nice little intro to writing code on the web. So, if you're new to AppEngine, Python, or code in general, here's how to get started:
  1. Download AppEngine for Python
  2. Download my intro files from Github
  3. Open AppEngine locally and File > Add Existing Application, then Browse and add the folder you just downloaded.
  4. Hit Run in AppEngine and then Browse, which will open your site (running on your local server) in your browser.
  5. From there open up the files in your favorite editor (I prefer Sublime) and start playing around. Don't worry, you can't really break anything and, when you do, Python will tell you exactly what you did wrong (to the line of code).
That's it. Good luck, enjoy, and let me know how it goes.
July 10, 2013
Noah Brier | Thanks for reading. | Don't fake the funk on a nasty dunk.