View previous topic :: View next topic |
Author |
Message |
dentharg Guru
Joined: 10 Aug 2004 Posts: 438 Location: /poland/wroclaw
|
Posted: Mon Mar 19, 2007 2:26 pm Post subject: Ruby vs Python startup |
|
|
Hi!
I know that this might cause some heat so please just describe your experiences..
I am about to start learning some "scripting" language and hesitating between Ruby or Python.
It would be used to write small non-UI apps and web-apps. I know that for Ruby there is RoR and for Python there is Django or TurboGears.
Which language has "more" future? Which gives more positive programming experience
(ie. you can focus on writing instead of fighting language barriers)?
Is Ruby something more than RubyOnRails? Is Python something more than Zope and Django?
Thanks! |
|
Back to top |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Mon Mar 19, 2007 3:24 pm Post subject: |
|
|
I've never used Ruby, so I can't give you a reliable comparison.
My opinion on Python is, it's a very elegant, very easy to learn language, so it's well suited for beginners, but at the same time it's also extremely powerful, so advanced users won't get bored with it ever. Without knowing much Python (but having experience in other languages of course), I wrote a small web app that emulates a telnet session in the web browser (naturally it has to use AJAX for that as well, so it's not a pure Python, but Python and Javascript app). Python manages the telnet connection and keeps the browser up to date with a data format that JavaScript can actually handle.
I've never uses Ruby on Rails / Django / Turbogears so I can't comment on these frameworks. There is a page http://the.rubydevelopers.net/ that advertises Ruby on Rails, but it is actually done in Drupal (which is a PHP/MySQL CMS), which is about the worst way of advertising (or best way of discouraging people from using) a web app system.
There's not everything shiny with Python though; the language itself is very nice, but when it comes to the implementation of the Python standard library, things can get ugly or at least not-so-intuitive at times. For example with a simple shell script app that does nothing but print some text on the screen; if the text is encoded UTF-8, it will print fine when just executing './myscript.py', but it will throw an error when using it in conjunction with a pipe './myscript.py > output'. Or, when handling TCP/IP connections, if you kill your program you won't be able to restart it, because the port your program used to listen for connections will still be blocked for another minute. This is not intuitive at all, the behaviour is not easy to change either, and this is also where you start throwing code into your program you found somewhere on the web but don't really understand yourself.
Of course there is a reason to all of this (I'm tired of reading all the discussions really), you could say that each language has its own oddities.
I don't know how easy it is to get started with Ruby, but it's very easy with Python, so unless you're completely short on time, I suggest you just give both languages a try and make a decision after a couple of days. Huge part of it should be a matter of taste really; by looking at example Ruby code alone I can tell you that I don't like 'end' tags. Others totally dislike the semantic indentation of Python. *shrug* |
|
Back to top |
|
|
didl Retired Dev
Joined: 09 Sep 2003 Posts: 1106 Location: Pittsburgh, PA
|
Posted: Mon Mar 19, 2007 4:10 pm Post subject: |
|
|
I second the above: If you have the time, try them both and choose whichever one you like
best. Both of them are great scripting languages but you will likely find
that one of them renders you more productive (for whatever reason).
I used to do all my scripting in python, but as soon as I tried out
ruby I fell in love with it and haven't gone back to python ever since |
|
Back to top |
|
|
dentharg Guru
Joined: 10 Aug 2004 Posts: 438 Location: /poland/wroclaw
|
Posted: Tue Mar 20, 2007 11:07 am Post subject: |
|
|
Ok. I would like to write a small desktop app that is able to connect to a website, fill some forms with data given by the user in simple UI (preferably QT) and based on server answer open another page.
How much work would it be in both of these languages? |
|
Back to top |
|
|
Dralnu Veteran
Joined: 24 May 2006 Posts: 1919
|
Posted: Tue Mar 20, 2007 3:48 pm Post subject: |
|
|
With some minor experiance with Ruby, I'll chime in some on it.
The syntax is very friendly, you're not tied down to how you intent things (thats the only complaint I have about Python), and you can make quick work of applications. It has an IRC channel on freenode with some helpful people there, as well, so support is fairly easy to get.
Maybe a short snippet is in order:
Code: | if ((a >= b) and (b >= c)) then
puts "A is greater than C"
else
if ((a >=b) and (b <= c)) then
puts "A is greater than B"
end
end |
It reads like it executes.
Personally, I'd suggest trying them both out. The PickAxe (Programming Ruby by Dave Thomas printed by The Pragmatic Programmer) as well as The Ruby Way are good refrences to have. _________________ The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner. |
|
Back to top |
|
|
jt_ n00b
Joined: 15 Mar 2007 Posts: 61
|
Posted: Tue Mar 20, 2007 4:09 pm Post subject: |
|
|
Come on, no Perl?
Ruby is rather nice. I haven't been overly eager to play with Python since Ruby and Perl do it for me (PHP for web stuff. Yes, PHP. Ignore the slashdot-php-haters.). |
|
Back to top |
|
|
Dralnu Veteran
Joined: 24 May 2006 Posts: 1919
|
Posted: Tue Mar 20, 2007 4:58 pm Post subject: |
|
|
I'd look into both of them, honestly. I figure a scripting language or two and a hard-coded language make for a good basis when working with *nix. Gives you a few options to tinker with. _________________ The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner. |
|
Back to top |
|
|
dentharg Guru
Joined: 10 Aug 2004 Posts: 438 Location: /poland/wroclaw
|
Posted: Tue Mar 20, 2007 7:26 pm Post subject: |
|
|
I am *very* impressed by the possibilities of RubyOnRails after watching some demo movies.
I'll have to also try Django (advertised by some Pythoneers).
I've did some work with Python for minor file workings (e.g. looking for specific files and modifying them; same I would do with bash/awk/sed) and it looks kinda good; however the library is vast and not so easy to use. With Ruby - I have yet to try it.
Tomorrow is the big day too - I'm getting my bran'new Core2Duo
Do you know any good (and cheapest) online book shop where I can get suggested books? I'm afraid that these proposed here are not available in Poland and in Polish lang. |
|
Back to top |
|
|
vandien Tux's lil' helper
Joined: 03 May 2006 Posts: 137
|
Posted: Tue Mar 20, 2007 8:43 pm Post subject: |
|
|
I'll put in a vote for perl!
I've experimented with PHP and ruby and always end up falling back to perl. I recommend it for command line scripts as well as Apache+mod_perl for web apps :) |
|
Back to top |
|
|
jt_ n00b
Joined: 15 Mar 2007 Posts: 61
|
Posted: Tue Mar 20, 2007 10:33 pm Post subject: |
|
|
vandien wrote: | as well as Apache+mod_perl for web apps |
I'm torn here.
It takes 10 times as long to do thing in Perl than it does in PHP for web apps, otherwise I'd agree. |
|
Back to top |
|
|
|