What is Ruby?
According to Wikipedia, Ruby is a reflective, dynamic, object-oriented programming language. It combines syntax inspired by Perl with Smalltalk-like object-oriented features, and also shares some features with Python, Lisp, Dylan, and CLU. Ruby is a single-pass interpreted language. Its official implementation is free software written in C.
That may mean something to a real programmer but to me it is about as useful as a kick in the head. Let’s go a bit farther. Again from Wikipedia:
Philosophy
The language’s creator has said that Ruby is designed for programmer productivity and fun, following the principles of good user interface design.[1] He stresses that systems design needs to emphasize human, rather than computer, needs
“Often people, especially computer engineers, focus on the machines. They think, “By doing this, the machine will run faster. By doing this, the machine will run more effectively. By doing this, the machine will something something something.” They are focusing on machines. But in fact we need to focus on humans, on how humans care about doing programming or operating the application of the machines. We are the masters. They are the slaves.”
Translating to designer speak
That makes a bit more sense. Productivity and fun sound good. Emphasizing human needs over those of the computer sounds even better. All these factors should make Ruby easier to learn than older languages and more or less equivalent to Python.
So, put into terms that may not be totally accurate but that reflect my level of understanding, Ruby is a modern programming language that borrows the better parts from its predecessors. It shares certain features with other modern languages that make it a more productive programming environment. And as a programming language is a set of formalized instructions that make a computer do useful and interesting things.
- Ruby is reflective. Huh? Again from Wikipedia: Figuratively speaking, it is then said that the program has the ability to “observe” and possibly to modify its own structure and behavior.That sounds good. If Ruby can “observe” its own actions while doing its program thing then I understand that it is more flexible than some other languages.
- Ruby is object oriented. Apparently there are two main types of programming procedures, object oriented and procedural (functional). The theory seems to be that object oriented or OO programming creates more flexible and maintainable code.One of the problems I’m finding is that most definitions define OO programming in contrast to procedural. Fine, there are differences but for a beginner that kind of definition is pretty useless.
The best I can understand is that a programming object can both store information and interact with other objects. Since Ruby makes everything an object I think that means that anything created or defined in Ruby can act on or be acted upon by anything else.
In procedural languages information blocks are separate from the instructions that manipulate them. One thing happens after another and information blocks don’t interact without specific instructions.
To put objects in more ordinary terms lets consider me walking my dog. I am an object of the class owner. Mollydog is an object of the class pet. Or to be politically correct we are both objects of the class companions. I pick up the leash from the coat rack and Molly starts running in circles and makes excited sounds. My action affects Molly. Later in the walk Molly sees a squirrel and charges after it, pulling on me. Molly affects me. We have both been affected by the actions of yet another object of the class squirrel.
An example of a procedure would be cooking dinner. I follow a recipe and prepare, combine and heat ingredients in a particular order. I perform procedures upon the ingredients, which (unless I burn myself) don’t modify my behavior in return. The end result of the cooking procedure, dinner, if eaten, will modify me but the cooking itself won’t.
- Ruby is a dynamic programming language. Okay, this one I think I understand the basics of. There are two basic types of programming languages, compiled and dynamic. the difference between them is in how they are presented to the operating system. Computers can’t actually understand most programming. Programs have to go through an in-between step between starting them and having the computer actually run them.Compiled languages run through this step before they are ready for use. This is called compiling. Dynamic languages are interpreted for the computer at the time that they are exceuted (runtime).
As with almost any situation there are tradeoffs involved in using one or the other. Compiled languages are much faster. Dynamic languages are typically much easier to learn and use and are usually more flexible. Ruby sacrifices absolute speed for this ease of use and abstraction. Abstraction is the degree to which the programmer is separated from the nitty-gritty of the ones and zeros that computers actually use to compute.
Ruby on Rails adds another level of abstraction to Ruby which equates with another hit is execution speed.
One more thing
There is one more aspect of Ruby that appeals to me, called the principle of least surprise. That simply means the Ruby should behave in such a way that it makes sense to experience programmers. After a short and painful stab at Perl about 7 years ago that is totally appealing. Perl seemed so flexible to me that it bordered on chaotic. A related RoR concept is that of convention over configuration,which promotes doing similar tasks the same way with similar parts of the program in the same place. Every Time.






2 Comments Add your own
1. Programming Tutorials&hellip | September 5th, 2007 at 1:09 am
Programming Tutorials…
I couldn’t understand some parts of this article, but it sounds interesting…
2. virtual receptionist&hellip | July 5th, 2009 at 3:12 pm
virtual receptionist…
A Virtual Receptionist has customer service representatives that handle thousands of calls on a daily basis….
Leave a Comment
You must be logged in to post a comment.
Trackback this post | Subscribe to the comments via RSS Feed