Monday, February 13, 2012

Stepping out of my comfort zone, trying different languages and web frameworks.

For the longest time, I've been developing on the Microsoft technology stack, with MVC using C# for web application development, WCF for web services, MS SQL server for the database, and of course, Windows and IIS for the OS and web server.

But I then started asking myself... is this the best way to develop? What are some of the other languages and web frameworks like?  Easier? Harder?

I knew I didn't want to really mess around with PHP, just because I don't like how the code feels like spaghetti code of classic ASP.  Another reason for not going PHP is due to performance benchmarks.

Here's a neat site that shows how programming languages compare in performance:

I decided to try out the Python language, using the Django web framework thinking that it would perform fairly quickly due to the fact that it creates "compiled" files, but found that simple web pages rendered slowly.  This of course could be due to the Django framework slowing it down too.  However, I did really like programming in it and found that the MVC model closely matched that of Microsoft MVC making it fairly simple to transition.

I then started to read a lot of hype over the Lift framework, and it helped to have a big name like foursquare using it too. It uses the Scala programming language which I then started to practice with a few tutorials.  The source I used primarily for learning was this easy to follow eBook called "Programming Scala" written by Dean Wampler and Alex Payne.  Lift uses an interesting approach where you decorate your view with CSS classes and your code targets those classes.  The concepts really seemed nice on paper, but trying to actually use it is really hard with their poor documentation.  Many of the documentation pages still say "TODO" or "FIXME".

Getting back to scala... scala is a mix of functional and object oriented programming. By default, it uses the Java VM to run so the performance should be comparable to Java. The nice thing about it is that you can run scala on the .NET runtime.  It also seems to be getting a lot of hype so I thought it'd be worthwhile to invest some time to learn.  Not being thrilled with the lackluster documentation that lift has, I found another framework that runs on scala, which is the Play framework. Play originally runs on Java, but you can download the scala module and create a scala based project.

Play's current support (version 1.2.4) for scala isn't quite up to par with the Java support however, version 2.0 will be built for scala.  Play so far has been my favorite.  It does have a very similar feel to MVC, and the convention over configuration model made it really easy.  I looked at Struts and Spring MVC a while back and was turned off by how much configuration it required and the poor template engine.  Play MVC realizes that their is already a language built for the web which is HTML/JavaScript and doesn't try to hide that.  They do have a few helper methods for creating form elements and script references, but they don't create a bunch of non-standard tags for your markup unlike other frameworks.  Play's library make it easy to create comet actions, or web sockets for your web apps too.

Not to mention, the performance isn't too bad.  When combined with an alternative template engine such as "fastergt" or "japid", the performance is even better.

After doing some research, I think Play is going to be what I'm going to play around with (no pun intended) to expand my horizons and get a feel for a different product.  I am pleased with it so far.  Even though Scala is the big thing right now, the current version of Play doesn't have the same support level as it does for Java, so I've decided to use Java.  It's also easier to program in Java coming from C#.

As far as IDEs go, I've been playing around with a few different ones, primarily, eclipse, Netbeans and IntelliJ.  I've already used eclipse before for Java/Android development so I'm familiar with it already.  Netbeans was ok, but just didn't feel like it had all the features.  Finally, I was hesitant to try IntelliJ because it's not a free product, but I do like JetBrains (the maker of IntelliJ) because they make a great product for the .NET world called ReSharper. I gave it a try and I must say I really like it.  It has great intellisense (not sure if that's the term they use, but that's what it's called in Visual Studio), and it already has support for the Play framework. The support mostly consists of having auto completion for the template tags and having a built in Play console. I'm currently using the trial version, but hoping I will be able to get a free copy with their open-source license, or I'll probably just end up buying it at their discounted academic price.

I'll keep you updated on my findings.  If you have any other ideas or suggestions for other languages and frameworks to consider, I'd love to hear it.