tadhg.com
tadhg.com
 

sfmagic.org Rewrite in Python

09:34 Sun 16 Dec 2007
[, , ]

While I’m generally averse to complete rewrites, I’m nevertheless going to redo sfmagic.org in Python.

There are a few reasons for this. The first is that the site needs a serious upgrade, and I just don’t want to write that upgrade in PHP. I plan to use a proper Model-View-Controller approach this time around, and this means that a lot of rewriting would be required anyway. If I’m going to be doing a lot of rewriting anyway, I might as well switch to a language I’m more interested in.

I’m using Python at work and want to learn it better, so the rewrite will serve an educational purpose for me.

Thus far, I like Python quite a lot. I first used it way back in 2000 or 2001, literally writing a few lines of it for some work project, and didn’t really get it then. Coming back to it seven years later, it seems great. The fact that whitespace matters in it (a big barier for many potential Python converts, apparently) doesn’t bug me at all (possibly because I’ve made myself use proper code indentation for years), and many things about it just feel “natural”. Also, its built-in dict object is extremely similar to JSON, a bonus since I plan to use JSON data structures at the application level.

Finally, it has some good framework support in Pylons, which I like from my exposure to it at work. I’ll talk more about that in my next post.

The rewrite was always likely to be in a language other than PHP, although object-oriented PHP was a possibility. The real contenders were Python and Ruby, with outside shots by some server-side JavaScript implementation or something like Groovy. Python gets the nod over Ruby because I’m currently working in it, and because I have incentives to get to know it better right now (the outside shots are too experimental right now for me to really consider them).

Leave a Reply