The right tools for the job
From Coder's Log
Over the years I've tried every programming language and framework that I came across, some where great to start with others provided infinite room for growth. In the end all of them had their short comings and they always will. After some time of from consulting and the startup world, I found my self in need to write a small utility to manage some of my personal data. I didn't want to use Java since it was definitely an over kill, plus I wanted this to be more in the spirit of Linux and wanted to get access to standard Linux libraries. I thought about using Ruby on Rails but then I thought, well i don't really need a website or a ui, all I really need is a simple place to process data, and delegate some tasks to other tools, sed for text processing, store the data in an actual relational database, some image rendering, and so on. I decided to work backwords I googled for the libraries that I wanted to use to see what had the bindings for them, at some point I came across python. Not that I've never heard good things about it, but I've always felt I knew enough languages to do what I need to do, and deep down inside I wanted just one perfect language and one perfect stack to do it all. In the end I remembered a moment in my life when I first started windsurfing. I was at the shop tunning my board, when the shop owner saw use a wrong sized screwed driver(they all kinda fit...) and he said "Come one man, you gotta have the right tool for the job" Thats when I decided to give up on the idea of the perfect language and just use the right tools for the job, and there aren't that many that I need, and I already know most of them. Here is what I've come up with and a couple of lines why.
- Java/Spring - Medium to Enterprise scale project(more than 2 developers) DAO layer is always an if, Hibernate if its up to the task something custom if its not.
- Ruby on Rails - Startup to Medium sized website with some sort of funding
- PHP - One-off websites with low maintenance cost
- Python - Personal development/internal dev tools(build servers, automated tasks, etc)
No big surprise about Java/Spring being used for large projects, but why for something with only a couple of developers. This is where I am going to get heat from the RoR community, but Java/Spring is really a great stack, with proper AOP support and some decent architecture design thats not crippled by J2EE or other overloaded specs, it can also be a more robust backend architecture. RoR will always be a lighter weight on the UI, but in the back end you want a staticly typed language, you want an interface thats fixed. Any time you have a project with 2 developers the likelyhood of it growing into a real system with 5 or more developers is quite real. And as much as we would like for everyone to work in pairs and know about every other part of the system, sooner or later reality hits and you end up with pices of code that somebody didn't properly test and now nobody knows if its even used anymore. Atleast in Java you can settle on an interface as shared point and everyone can go and implement their code. and if its not used then delete it see if it compiles again and all you gotta do is validate the spring context to make sure everything was properly loaded(There will be a seperate post on how to do that effectively)
I already said why I didn't like RoR for large projects, but here is why i think its great for small ones. RoR changed many things for many people, after building a couple of websites my approach to writing Java code was forever changed. Convention over configuration isn't that hard of concept to grasp, but to apply effectively takes a little creativity. I've built some sites using RoR and I've seen others build them and RoR had the shortest learning curve and the best results. There is one downside to using RoR and thats deployment. You still have to deploy it into a server enviroment and it doesn't play well with apache other than through mod_proxy. I've seen a number of approaches to make things better but ultimatly the preferred method of deployment is via a custom http server. Which puts a certain amount of restrictions on where you can host the site.
Which brings me to PHP. The first website I ever built was in PHP and it was PHP3 I might add. Yes I've been at this for a while now. That was the only site I built in PHP and it wasn't something I particularly enjoyed, but in the end it out lived the Java sites and when it was time to deploy it into a less than managed hosting enviroment it worked great. Java code needed lots of processing power to do things, would berely run in a virtual enviroment unless it was XEN due to Virtual Memeory restrictions. RoR would have been easy to migrate if RoR 1 was still supported, but it seems that only RoR2 is available by major hosting providers. And when it comes to scaling PHP is probably the easiest of all to scale, it might not be as efficient at high ends as Java or Ruby on Rails, but it by requires a lot less effort by far, as livejournal was kind enough to show in their open architecture document.
The last of my tools is Python, its not the easiest tool to learn, mostly because of lacking documentation, things tend to be trial and error mostly, but once you get the hang of it, its great. I can't see it as a tool for building websites a the moment just because of a low critical mass, RoR is a better alternative for the time being. I also don't see it hitting the production enviroments in the enterprise market, although I see it as a potential for server management scripts. But for internal development I couldn't ask for a better tool. As a language the design is great, you have the flexibility to do as much or as little in the object model, the AOP concepts in Java are built right into the language, it has support for multiple inheritance, and very mature set of libraries that integrate well with other tools, what more could you want. Some how I don't see myself writing bash scripts that interact with the database short of mysqldump.
