Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Back and in need of some Ruby Advice
Index -> Programming, Ruby -> Ruby Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
QuantumPhysics




PostPosted: Sun Dec 23, 2012 3:21 am   Post subject: Back and in need of some Ruby Advice

I am back everyone. I was very busy recently in extending my knowledge with 'C' Programming, Java, Vb-classic, FASM and Win32 AP GUI (which i am very well acquainted with right now). I took the advice Mirhagk gave me on Facebook and moved on it. I am now looking to learn what the world of developing really is - anyways. For 3 hours now I have been researching comparisons between python and ruby (which one is better than then other and why) because I am looking to start programming more in one or the other. I have already been scripting in python for almost 2 years but I found it very slow in many ways and decided to give ruby a chance (for many reasons). After doing all that research I have been faced with a new challenge. I ask myself now, which is better Ruby or Rails. I looked up some answers that people gave on some forums and I have come to realize that rails was made in ruby (ruby being the native language) as C/C++ is to python. I found out that rails more aimed towards web application frameworks and well what I want to ask in this thread is as follows. Can ruby be used for the frameworks as well, since rails inherits functions from ruby? Is ruby truly better than python (scripting/programming wise), what about speed wise? Also, can ruby be used to interact with your machine like python? Lastly, what are the key purposes for ruby in the world today (generally asking what does it do for current day developers)?

Thank you!
Sincerely,
~ QP Canada
Sponsor
Sponsor
Sponsor
sponsor
TerranceN




PostPosted: Sun Dec 23, 2012 3:30 pm   Post subject: Re: Back and in need of some Ruby Advice

Quote:
rails was made in ruby (ruby being the native language) as C/C++ is to python


Rails isn't a different language, it's just a web framework written in/for ruby. A better comparison would be Rails is to Ruby what Django is to Python.

Quote:
Is ruby truly better than python (scripting/programming wise), what about speed wise?


I haven't used Ruby so I can't give you a comparison myself but here's what I found:

For a general comparison, I would look here. And here's another resource I found.

As for runtime speeds, they're very close. I wouldn't worry about speed too much, they're fast enough for most things. For example, github uses Rails and does just fine.

As someone said on the SO question: "It's probably impossible to make a bad decision here."

Quote:
Also, can ruby be used to interact with your machine like python?


Not quite sure what you mean. Either way, both support C extensions so you can always expose C functionality to either language.

Quote:
Lastly, what are the key purposes for ruby in the world today (generally asking what does it do for current day developers)


Both can be used as a general purpose programming language, but Ruby is typically used for web development with Rails.
Tony




PostPosted: Sun Dec 23, 2012 10:21 pm   Post subject: RE:Back and in need of some Ruby Advice

Ruby and Python are very similar. It doesn't really matter which one you pick, as long as you are familiar with one of them.

Ruby's main strengths are the Rails framework. Python's web frameworks are largely inspired by Rails, but they are simply not as mature at this point. There are certainly some high profile web apps that run on Python though.

I also prefer Ruby's grammar, especially when it comes to functional aspects.
Quote:

ruby-1.9.3-p0 :001 > [1,2,3,4,5].map{|i| i*2}
=> [2, 4, 6, 8, 10]

vs. python
Quote:

>>> [i*2 for i in [1,2,3,4,5]]
[2, 4, 6, 8, 10]

or more generally (also python)
Quote:

>>> map((lambda i: i*2), [1,2,3,4,5])
[2, 4, 6, 8, 10]


A python chain of functions would read from right to left, which seems unnatural.

Though I hear that Python's strength is in its selection of libraries. If you are going for some specific task (scientific computation, machine learning, etc.) there's a chance that Python might give you a better set of tools to import.

Posted Image, might have been reduced in size. Click Image to view fullscreen.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
QuantumPhysics




PostPosted: Tue Dec 25, 2012 5:17 am   Post subject: RE:Back and in need of some Ruby Advice

Thank you guys for the great advice. For my purposes, I chose to stay with python. I really loved that little comic - tony. Thank you both very much! Terrance, I found those links quite fun to read and to understand more. Some of the peoples' quotes were quite humorous.
Cancer Sol




PostPosted: Sun Mar 17, 2013 8:22 pm   Post subject: Re: Back and in need of some Ruby Advice

Yeah, that comic was so interesting Razz
But really? What does import.antigravity do? Is it just made up? Razz
Or does it actually do something?

Edit: I don't know anything about Python, other than how to output"Hello World" now Very Happy
Tony




PostPosted: Sun Mar 17, 2013 8:55 pm   Post subject: RE:Back and in need of some Ruby Advice

The paragraph above the comic explains the context.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
wtd




PostPosted: Sun Mar 17, 2013 8:57 pm   Post subject: RE:Back and in need of some Ruby Advice

Old, but will get you a bit further than "Hello, world".

http://compsci.ca/v3/viewtopic.php?t=6509
Display posts from previous:   
   Index -> Programming, Ruby -> Ruby Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: