So, I have. Been for fun, and for my life easier. I used Ruby as the main scripting language on my PC for a few months. Been very good so far. But...
Okay, so Ruby is pretty cool. The syntax is user-friendly. Everything is an object. And things like:
100.times do
something
end
look just plain sexy.
That, and with all the hype about Ruby on Rails (RoR) being the next best thing since the color LCD monitor. Why am I breaking up? It's probably RoR actually. Someone said this before: "Rails is the biggest curse of Ruby". Whenever you hear Ruby, it's probably about Rails.
Rails, and many Ruby add-ons can be a nightmare to setup, and deploy on Windows. I use Linux at home, but at work, I am stuck with Windows. I need simple GUI based installers that do NOT load stuff from the net. Most of Ruby uses "gem", which is okay, but has a very hard time working behind corporate firewalls and proxies. I had some very hard time connecting Ruby with MySQL natively. It only worked with MySQL ODBC. I also could not get eRuby to work at all. Apache integration is a nightmare. GUI programming is not that good. There is also no good GNU or Open Source IDE and debugger. I used Notepad++ and Vim.
But you see I do not want Rails. I want a good general purpose scripting language, with plenty of stable libraries for handling files, maybe GUI, and simple Web apps. But mostly, I want one that is Windows friendly. If there is a good IDE and Debugger, then that is a plus.
I went to have another look at Python. It is very Windows friendly. Most packages come with a GUI based installer that does everything. But I hardly needed any of them. Python has the "batteries included" philosophy. I downloaded and installed the Apache Python module and got it working in 3 minutes. I got Python talking to MySQL natively and ODBC in 1 minute with very simple examples and easy module installers.
Initially, I was put off by the weird syntax and indentation needs of the language. The above loop will look like the following in Python:
for i in range(10):
something()
The indentation is a must. There is no begin/end or {} in Python. That was very weird, and really put me off initially. But come to think of it, I already did that indentation in Ruby!! DUH! And Python saves me from the trailing end. Once your code is more than 30 lines, you will see many ends in Ruby code. Python indentation is a very good idea, that enforces code readability.
As for the OO. Python is different than Ruby in that in Ruby you use my_string.size, but in python you use len(my_string). It does not look too OO, but that is a difference I can get used to. Heck, I use COBOL and TAL for a living, so Python is still much better!
Python is also very good for OO and procedural development. Just like Ruby. Unlike Ruby, Python does not have Rails. And that is very good. You have a LOT of option with Python. And in case you need a web framework, there are at least two very good and very popular ones: Django and TurboGears. If you only need simple HTML with some Python in them (what eRuby is supposed to be) then Python also has many options.
I installed and created the Django tutorial app in less than one hour. Installation was a breeze, and the framework is very cool and high-level MVC type. TurboGears also looks very slick.
There is also the PyDev eclipse IDE. I just used it now, and it is very cool. Debugging works like you expect it, and it has very good (but not perfect) auto-complete and help for Python
So, give Python a try. Make sure to get the 2.4 version, not the latest 2.5.
Either way, Ruby / Python / JavaScript there are a lot op options for scripting. And that is always a Good Thing (tm)
1 comment:
Knowing you Ayman, I kinda saw this coming :)
I agree with your points about Ruby on Rails. I've tried it and the model is neat but in a life where visual studio is all over the place, RoR is totally out of focus
Post a Comment