Life continues at a breakneck pace. Despite my best laid plans, the surest way of getting things done at the moment is in a sort of out-order manner. However I did want to share a brief update on my journey into the Python and web application development world. Instead of separate long form articles, I will briefly touch upon various topics. (Note that this post itself has been in my work queue for over 3 weeks. Mea culpae.)
The Python Scene in Toronto: Django Toronto and PyCon
I’ve now gone to two Django Toronto meetups and really enjoyed meeting with the Python community in Toronto. The majority of web application developers in Toronto, deal with Java, Ruby or PHP (and of course Javascript). However the Python community is there and growing. They are very welcoming, and I have enjoyed each of the Django Toronto meetups I have gone to. Also I feel like everytime I go there, I learn a lot and come back a better (or at least better informed) developer. At the last meetup, I gained a deeper insight into crafting REST web services. Something that I immediately applied to my day job the next day. The one funny thing about Django Toronto, is that while the Django framework is an amazing platform, many Python developers move away from it once they scale up. That is reflected in the meetups, since the topic of different platforms such as Flask come up.
The most exciting thing that is happening in the Toronto area for Python developers is PyCon. This will be the first year that PyCon comes to Toronto. I will definitely be there and I have been preparing by working on some real world Python applications. If you will be there, I’d love to meet up with you!
How I Stopped Worrying and Started to Like Javascript
Javascript has been a language and platform I have avoided as much as possible. If I can I try to stick to fancy tricks that one can pull off HTML5 and CSS3. However one can only go so far without adding scripting to a web application. Plain old Javascript still is a pain in the neck in a browser environment. In other environments, it might be different as a scripting language. However in such cases, I usually reach for Python rather than Javascript. In a web app environment most of my experience has been with Sencha ExtJS. While ExtJS is a remarkably powerful and flexible platform, it is problematic. Aside from the licensing confusion of the original versions of ExtJS, I found that ExtJS contains a lot of automagic. Building a ExtJS application consists more of configuring a number of components, and getting them to do more or less what you want to do. Finding the right configuration has resulted in many stressful hours for myself and many other developers that I know. Given all that developing with Javascript has left a bad taste in my mouth, until recently.
Two main things have changed my mind about Javascript. Aside from the fact any sort of more advanced web application requires a full-on Javascript powered client, Javascript is not an entirely evil language for the web. Doug Crawford (of JSLint fame) makes a good claim in his book Javascript: The Good Parts, that Javascript has some nice parts. Yes, there are some ugly parts and needs a lot of love in the coming version. But it is quite good for what is essentially a Schema-like functional/prototype language with Java-ish syntax. Especially considering how quickly it was created at Netscape, it is not a terrible language. If you are not convinced, I highly recommend watching the video below:
The other thing that changed my mind about Javascript is jQuery. After fighting with ExtJS, the minimalist approach to Javascript development espoused in jQuery is refreshing. I essentially learned the basics of jQuery overnight, trying to firefight a work project where office politics had gone amok. (Aside: My take on politics in general is avoid it. Get stuff done, not argue about it.) Yes you have to know what you are doing with jQuery, and you don’t get a fancy MVC/MVT/etc. framework with jQuery. But if you don’t fear writing Javascript by hand, and you want a library that abstracts the cross-browser stupidity, then jQuery is the answer. For the next big web application that I am currently writing I will definitely be using jQuery.
Lots of REST and JSON
As mentioned earlier in the post, I have been dealing with a lot of REST service and JSON. It is an infinitely nicer and simpler manner to talk with a server application, than via SOAP and XML. (XML has its place, but it has been overused and abused in the Java world.) When working with Java I’ve worked with Jersey and SpringMVC for building REST services. Spring in general just works better, aside from its crazy arcane configuration. In Python I’ve started working with Flask to handle building REST services, which I find a lot lighter than Django that sort of thing. Also JSON is an awesome idea. More people should use it for more of their data interchange needs. 🙂
IntelliJ IDEA Makes It All Better
Not to sound like a promotional campaign (since I work in what essentially amounts to the advertising industry, it happens more often I’d like) but one of the best decisions I’ve made recently is to switch IDEs. I used to swear by Eclipse as the be-all-end-all of development environments. Then I discovered PyCharm for Python. Soon after that I got to meet Jessamyn Smith at a Django Toronto meetup. While were talking about the joys of switching away from Subversion to Git–Jessamyn wrote a great article about her own experiences of migrating to Git–she convinced me to look into IntelliJ IDEA as it had a better interface for managing Git operations. She was pretty convincing, as that is my primary IDE nowadays. No more mucking around and wasting time with Eclipse’s temperamental setup. Things. Just. Work. Meaning I can do work.
Hitting the Flask
Somethings die hard. One of those things is my own insistence on having lots of control over my computing environment and development platforms. This led me to using Linux late in high school. After playing around with Django, and wanting to build my own applications I found myself hunting down various odd ways to get around Django’s defaults. Do not get me wrong, Django has a ton of nice pre-build features and default that just work. Unfortunately being a web application developer, I have my own experiences, expectations and assumptions. They are not always right. However I prefer frameworks that I can plug-and-play and give me a finer grain of control. (Hence I prefer using Spring in my Java web apps.) So I’ve discovered Flask, a great micro-framework for Python. I like how it makes web programming easy, without making a whole wack-load of design assumptions. It very much reminds of me of the best parts of Spring, and apparently it is very “Ruby on Rails” like.