Log In · Register

 
Learn Ruby, Koans
Uronacid
post Jun 16 2011, 06:54 AM
Post #1


Senior Member
******

Group: Official Member
Posts: 1,574
Joined: Aug 2007
Member No: 555,438



Hello All,

So I've been trying to learn a new programming language (Ruby). It's like the anti-python. They're both scripting languages. However, where python tends to be very ridged and strict with regards to syntax, ruby is very lenient. In fact, I can see many programmers hating it for that very reason. Sometimes the code you write in this language can be so loose, but black magic will allow it to run properly.

Anyway, there is a great tutorial which cover a good amount of the ruby language, syntax, structure, and a few functions/libraries. I encourage you all to install the language on your desktop and install Ruby Koans.

Ruby works on any operating system, and the base syntax is the same for each. There are a few functions that are custom to an OS. In fact, Ruby on windows is really sweet because it is very easy to access WMI.

Install: http://www.ruby-lang.org/en/downloads/
Koans: http://rubykoans.com/

I'm on the koan "about_iteration.rb". I love this language. Figured I'd share it with you guys.
 
 
Start new topic
Replies
mipadi
post Jun 20 2011, 12:55 PM
Post #2


Senior Member
******

Group: Administrator
Posts: 2,648
Joined: Apr 2008
Member No: 639,265



Despite the fact that I learned Python first, and work as a Python programmer, I still favor Ruby over Python. I don't get caught up in the minor syntax issues (such as Python's more rigid syntax), but there are some glaring reasons why I prefer Ruby:
  1. Object-oriented programming support: Python's OO constructs seem to be bolted on as an afterthought. You have to explicitly specify the target object as the first parameter to a method (a vestige of Python's poor scoping rules). There are no access protection mechanisms like "private" and "protected". Ruby has nice message-passing semantics reminiscent of Smalltalk.
  2. Consistent syntax: Despite the fact that everything in Python is an object, sometimes you call things using a function instead of a method -- for example, to get the length of an array, you call len(array) instead of array.length(). Ruby's method calling is consistent.
  3. Regular expressions: Ruby has syntactical support for regular expressions. Python doesn't.
  4. Packaging: Ruby has better packaging tools. RubyGems is better than the various Python packaging tools. RVM is better than Virtualenv.
  5. Web Tools: Ruby's web development tools are better; for example, Capistrano is a lot nicer than Fabric.
  6. Flexible syntax: Ruby's flexible syntax allows for nicer DSLs. Optional parentheses are nice, too.
  7. Shell commands: Ruby has syntactical support for calling shell commands, which makes it a lot nicer for scripting than Python.
  8. Alternative VMs: Ruby's "alternative" VMs, like Rubinius, are more mature and working to improve performance.
  9. MacRuby: Ruby has a decent compiler in MacRuby, which Python lacks.
 

Posts in this topic
Uronacid   Learn Ruby   Jun 16 2011, 06:54 AM
boot   python > ruby   Jun 16 2011, 04:12 PM
Uronacid   QUOTE(boot @ Jun 16 2011, 05:12 PM) pytho...   Jun 17 2011, 06:52 AM
serotonin   white > other   Jun 16 2011, 10:56 PM
boot   I don't necessarily think python is better, I ...   Jun 18 2011, 06:10 PM
Uronacid   QUOTE(boot @ Jun 18 2011, 07:10 PM) I don...   Jun 20 2011, 08:50 AM
mipadi   Despite the fact that I learned Python first, and ...   Jun 20 2011, 12:55 PM
Uronacid   QUOTE(mipadi @ Jun 20 2011, 01:55 PM) Con...   Jun 21 2011, 07:40 AM
mipadi   I did this for about_scoring_project: CODEdef sco...   Jun 21 2011, 02:00 PM
Uronacid   QUOTE(mipadi @ Jun 21 2011, 03:00 PM) I d...   Jun 21 2011, 02:36 PM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: