// you’re reading...

Education

Ruby – best introductory programming language

Ruby - a programmer's best friend

I am often asked – “what is the best computer programming language to learn?” And for years the reflex response was Ruby. Ruby is elegant, Ruby is easy to understand, it’s creative, it’s expressive, it’s powerful, flexible, and robust. Ruby is enjoyable to work with, and is applicable both as a first programming language to learn, and scales well for enterprise level development. Ruby should be taught in schools.

But why? If I had to summarize this into a single point, it would be: IRB – Interactive Ruby Shell. Run through a shell (a command prompt for those using Windows), IRB interprets the syntax as it is typed in, one line at a time, and displays output as soon as there is any.

Hello World with Ruby Interactive Interpreter

This creates a Ruby playground of sorts, and I can’t think of a better way to prompt learning than letting students play around with their objects, methods, and code blocks. All too often I’ve seen students get really frustrated trying to get their entire program to compile and work as a whole, right away. Lacking experience to debug through a screen full of code, it is often discouraging to explore the language, fearing more bugs and unknowns. As Ruby’s interpreter will execute one block at a time, and often as little as a single line of code – mistakes become apparent. Suddenly the problems are narrowed down from “my program doesn’t work” to “the line I’ve just entered doesn’t work”.

Ruby IRB - catching mistakes

What I like the best in terms of learning with this programming language, is that everything is an object, and when asked – it will describe itself. What it is, what methods it has. Best of all one doesn’t need to set up and compile a whole program just to confirm that 42 is indeed an instance of a Fixnum class – instant interactivity is the key.

Ruby IRB - integer methods

Though that’s over 100 methods that can be performed on a static number, other classes have even more options. I’d think that a MethodFinder will be a selling point to a lot of students. Knowing what you start off with, and what you want to end up with as a result, this cleaver call will suggest all the available methods that will get you there!

gem install what_methods
Ruby MethodFinder - what?

Knowing that “hello” is 5 letters long, the methods list is crunched down to just “size” and “length” – both produce the desired result. This is simply amazing for students starting out, as they could now concentrate on understanding the concepts of operations, and be reminded of the proper syntax when needed.

Ruby is helpful and interactive. It encourages students to try things out, and explore the programming language on their own. One of the themes that came up in Keeping students interested in Computer Science was a requirement for engaging examples. Loading various classes into this Ruby playground would quite literally put students into a role of a Matrix master, having complete control over every object in their virtual domain. Programming is art, and it is best learned through practice of logical expression of creative thoughts.

I think that Ruby makes an excellent choice for a first programming language to be taught. How does it compare to what you’ve learned first?

Read more



Discussion

  1. Posted by Clayton | April 17, 2007, 5:12 pm

    First off, I have to agree with you 110% Tony. Ruby is an extremly cool language that is great for even beginners. Now, you said Ruby should be taught in schools, and I agree with you there. However, the fact that there’s no “standard” graphics library easily available for students to use would probably set Ruby back. Unfortunately, many students don’t want to learn algorithms, they want to make games (although most of them don’t realize that they need those algorithms in their games).

    Reply to comment

  2. Posted by Ilya Grigorik | April 17, 2007, 6:35 pm

    I’m definitely a Ruby convert, evangelist even.. But, I’m not sure if Ruby is the best starting language for a CS student. Perhaps this is just my bias, but I’ve come to appreciate and really understand many of the Ruby constructs/idiosyncrasies only because of my earlier exposure to strongly typed languages (C/C /etc.)

    I guess my counter argument is.. Ruby simplifies the task of writing code (immensely), and personally, I found it to be amazingly liberating. But, in the context of developing games, or any other software, writing code is only a means to an end. If you don’t understand the algorithms, why you should use hashes, how you work with/around filesystems, etc., then Ruby is just a gold hammer – it won’t make you a better carpenter.

    Once you wrap your head around linked lists, char pointers, memory addressing, etc., only then should you move on to higher level languages. Ruby obscures these things, but I do believe that you have to understand them first. The hard part is trying to explain this to the freshman, who don’t much care for the payoff four years down the road. Everybody wants immediate gratification these days!

    P.S. Sorry for the rant!

    Reply to comment

  3. Posted by Mike Minutillo | April 17, 2007, 8:20 pm

    “Already our minds are becoming like one!” – Puss in Boots (Shrek 2)

    I could not agree more with this statement. The thing I like THE MOST about teaching Ruby to a newbie is that there are no *Leaps of Faith*. What do I mean by that?

    Well, when you teach someone C, you have to explain header files. When you teach Java, it gets worse, you need to have 6 lines or so of unrelated crud which you back up with “We’ll explain what all of that means later”.

    In Ruby they say, “everything is an object”, and they mean it. “Hello World” is a single line program as it should be. So when you come to the bit where you say “Everything in Ruby is an object” you get to talk about mixins and *why* Hello World can be one line and still retain that “everything is an object” stance.

    It’s actually harder to explain this idea than it is to teach someone Ruby :)

    Reply to comment

  4. Posted by Satish Talim | April 17, 2007, 9:34 pm

    Ruby is cool. I have been trying to convince the University to introduce Ruby as a full time course for the various computer science students and have been lucky that one Institute did so. See this -
    http://www.puneruby.com/blog/?p=104

    Reply to comment

  5. Posted by Tony | April 18, 2007, 12:14 am

    @Clayton, Ilya – you both bring up the topic of “immediate gratification”, though while Clayton says there is not enough (graphics?), Ilya points out that there is too much. So which one is it guys? ;)

    Students don’t want to learn algorithms? Students need to learn algorithms! How about some inline C?

    @Mike, Ilya – once again a collision of thought. Ruby takes away a lot of complexities. So between starting out Ruby or C , and then moving on to the other – what’s a better off situation? Ruby might initially provide too nice of an environment, but with C there will be a lot of “Leaps of Faith” going on.

    Considering that high school computer science is not even required to major in CS at University, would it really matter what specific language is taught at this earlier stage? I don’t recall being taught pointers, or complex data structures. I guess I’d rather not have others be turned off with unnecessary complexities.

    Reply to comment

  6. Posted by Bashar | April 18, 2007, 2:14 am

    My first language was C followed by Java. I believe Ruby is awesome I’m just starting to get really into it. I never thought of it as best language for beginner, but now that I look at it, it could. It could do very well for beginner sequential procedural programming, and then when the guy wants to go advanced on Rails, he could see the benefit of MVC.

    In my case I learned C first as I said, then I moved to OO kind of language that is much more strict and cleaner. I could see the difference, and chose what I like. However I believe that if you show young people the beauty of Ruby, they may not accept the C/C hassle afterwards. While they may not have to deal with it really in their professional career, trying it first really gave me good insight on the power of it, it’s problems, and made me really appreciate the advancements in new languages :)

    Reply to comment

  7. Posted by Mike Minutillo | April 18, 2007, 2:15 am

    I was taught pointers and even linked lists in high-school computer science! Maybe that’s why we had a class of 4. Mind you, for some reason it seemed harder when I moved from Pascal to C.

    The reason why this stuff is so difficult to teach is definitely because of the approach. I’ve seen pointers taught using a whiteboard and even I have had difficulties in these situations. I have also seen pointers taught with twelve metres of string and four volunteers from the class. Which would you remember at exam time.

    If you bring me 6 wooden bricks, a ball of twine, and some nails, I will teach doubly linked lists to a class of small children. And they will understand it! I’ve seen a six year old solve the towers of hanoi in a few minutes.

    Pointers and other advanced concepts from computer science don’t need to be hard. They don’t even need to be boring. Long live the McGyver method of teaching!

    Reply to comment

  8. Posted by Frithjof | April 18, 2007, 4:47 am

    I fully agree with your “Ruby should be taught in schools”. But I think even Ruby isn’t that easy to teach to children. Children know how to play games on their computers. Few of them know what a command line processor (link cmd.exe in Windows) is good for, not to mention irb. So before being able to teach Ruby come all the things that we developers are familiar with by default but kids usually don’t, like setting up a clean development environment, typing to a shell box, setting environment variables and the like.

    But after this hurdles are taken, yes, Ruby is very smart to teach compared to others. My approach to do this to my children is to hide _real_ Ruby as long as possible by providing natural method names and some mixins via a special _require_ that I use from the very first “Hello World!”-like programm.

    Reply to comment

  9. Posted by Tony | April 18, 2007, 10:51 am

    @Bashar

    if you show young people the beauty of Ruby, they may not accept the C/C hassle afterwards

    Ilya and Mike have kind of touched on the topic, and this is what I want to figure out right now: is one less likely to accept the complexities of C /Java after exposure to Ruby, than after no exposure to programming at all?

    @Mike – I’m jealous! My grade 12 computer science class was 2 people the entire hockey team (their favourite coach happened to also teach programming). We were more likely to talk play strategy than pointers. *sigh*

    @Frithjof – interesting, although my intend was aimed at high school students – I would expect them to know how to use a computer, or at least be able to pick up on such basic concepts as loading an application through a shell.

    A further point for discussion:
    So Ruby might not be the best choice for a CS major, but lets talk high school. Consider that high schools use languages such as Turing, Pascal, or even *gasp* VB6, are light on algorithms, and don’t get to pointers until the senior year, if at all. How would Ruby do instead? So far I stand by my opinion that more students will walk away with greater knowledge after almost playing with Ruby, than if they were all to be exposed to all the complexities of programming too early.

    Reply to comment

  10. Posted by Curtis Batt | April 18, 2007, 11:32 am

    I’m not sure whether one language or another is more or less appropriate for teaching programming. I do know that a sense of play and exploration was what got me interested in programming. I think that this can be achieved with just about any language or platform.

    As for graphics and games and stuff… I believe that this needs to be addressed in the course’s first class. You need to provide an orientation and overview of what the goals of the class are and WHY. They can’t run before they can walk and it needs to be clear that games (even fairly simplistic ones) require a lot of fundamental knowledge. Then all you have to do is put the fun into fundamentals.

    Reply to comment

  11. Posted by Masklinn | April 18, 2007, 11:42 am

    > My approach to do this to my children is to hide _real_ Ruby as long as possible by providing natural method names and some mixins via a special _require_ that I use from the very first “Hello World!”-like programm.

    I’m not sure it’s a very good approach. The basis of Ruby is not *that* complex, and children don’t have to understand all the intricacies of the language to be able to use it. If “raw” Python can be taught to a 6 years old child (http://davidbau.com/archives/2005/07/27/a_programming_question.html) then surely Ruby can, too.

    tony > I think that if the shell/REPL is to be taken in account, then Python is a much better learning language than Ruby (everything else forgotten): the base CLI REPL is much better than irb (without even considering iPython) and the IDLE graphical REPL is miles ahead of any windowed Ruby repl I’ve been able to find (and there aren’t many, most of them being “IRB in a window”): syntactic coloration, autoindentation (and indentation that actually works), autocompletion, …

    Plus of course IDLE doubles up as a fairly nice editor, and easily links to the python documentation (press F1, get documentation)

    Reply to comment

  12. Posted by mabayona | April 18, 2007, 12:14 pm

    Well, TCL had the things you are talking about (including, shell, portability, …) plus ease of use, multiplatform, GUI, ease of extension, performance, dedicated IDE, OO, … and it has become almost irrelevant today.

    I supose is the typical not nbeing in the right place at the right moment…

    Reply to comment

  13. Posted by slabounty | April 18, 2007, 12:42 pm

    The problem with IRB is that unlike most environments like it, you can’t save and/or restore things from it. So, if someone types in a class to test it out, there’s no clean way to save it to a file for actual use. Similarly, you can’t pull a class in from a file for testing within IRB (OK, you can probably cut/paste).

    Reply to comment

  14. Posted by herval | April 18, 2007, 12:47 pm

    I really don’t think ruby is a great choice for beginners, for the very same reasons you think it IS: it is more flexible than most languages, it’s syntax is clearer than most and the process of doing anything on it is shorter (just write and run). Learning programming should really be done the other way around: get a good grip on the hardest thing, and then everything else will come out easily. This said, I still consider C/C the best ones for teaching newbies. If you are interested on having great developers, that is…
    I’d say Demosthenes would agree ;)
    http://en.wikipedia.org/wiki/Demosthenes

    Reply to comment

  15. Posted by Paul | April 18, 2007, 2:05 pm

    I was recently helping a friend learn to code and my first instinct was to use Ruby. In the end we moved to Java because we are preparing for a competition (no Ruby allowed :( ), but it was a good way to get started with the interactive console and simple syntax.

    The only downside is that, as was mentioned, once you have used Ruby you don’t really want to go to a language like Java or C .

    Reply to comment

  16. Posted by Tony | April 18, 2007, 4:12 pm

    @Masklinn – irb has syntax highlight, auto indentation, and auto completion. Some might require inclusion of gems though. Though I’ll take a look into Python, thx.

    @slabounty – irb, most certainly, allows one to load files. I’ll admit that saving it’s state is a trickier task (here one can copy/paste as well ;) ), but with an assumption that IRB is used to play and test things out, such feature is not as applicable.

    @herval – yes, there still needs to be that difficult/complex/down-and-dirty-but-with-understanding stage in learning programming. My stance is that starting off with that will act as too soon of a cut off point for many. Paul and others argue that Ruby will spoil students too much to want to care about C or Java, though running for loops in Ruby, and building data structures with pointers in C are fairly separate concepts to stand independent.

    Reply to comment

  17. Posted by David Koontz | April 18, 2007, 5:03 pm

    I can comment on this with some authority as I actually do teach programming and I am using Ruby, well sort of. I’m using a subset of Ruby that doesn’t include much OO. The reason is that Ruby, for non-programmers is simply too big a pill to swallow. Masklinn said “The basis of Ruby is not *that* complex, and children don’t have to understand all the intricacies of the language to be able to use it.” Blocks are integral to doing anything useful in Ruby. Try telling a new student what those things inside the | and | are. Method parameters? Hah, you can’t even bring up methods for several weeks, much less the anonymous lambda form.

    No, if you’re going to use Ruby, and like my students you’re starting from absolute zero, then you’re going to have quite a few weeks of “this is what a variable is” and “this is the idea of a reference” before you get anywhere near methods. Given a long enough class (15 weeks) you could conceivably introduce objects, and then finally blocks, but that’s a long road to get one of the basic aspects of Ruby down. In the meantime you’ve either said “just type this and don’t worry about all this extra stuff” which is what people complain about C/Java/etc. for or you just ignore the standard library. Neither are good options. Luckily with the syntactic sugar of [] and {} you can actually get pretty far in terms of teaching basic data structures and operations on them.

    So, Ruby is a fantastic language, Ruby is what I choose to program in when I get a choice, Ruby is how I make my living, but Ruby is not the best language to teach. It has far too many concepts to get through all at once, which is useful in the real world, but hindering in an academic setting. Well mr-smart-pants-know-it-all what is the best language then? Assembly. Yep, a home grown simplified assembly (the interpreter implemented in Ruby of course). With only copy, some basic arithmetic and jumps there is too little to get confused (much). You only have 9 or so commands and a few registers. You can get some pretty advanced things done too, finding the largest values in lists, complex conditional logic, etc. I use my pseudo-assembly for the first few weeks of the class to get people into the mindset of solving problems and then show them Ruby, at which point they are very grateful to have such a powerful tool. They understand a lot of the concepts like references better as well. If anyone is interested in seeing more detail you can see my writeup here (http://www.koontzfamily.org/david/blog/?p=356).

    Reply to comment

  18. Posted by Darren | April 18, 2007, 5:23 pm

    I have to agree. As others have said programming isn’t always clean and easy but trying to show friends the basic principals of programming in any other language is like shooting myself in the foot.
    Because of its easy readability and the fact it doesn’t need compiling means the beginner can concentrate on the absolute fundamentals such as using loops and getting to grips with OOP.
    I first began programming in Ruby and I tend to play around with it when I’m bored to get my mind off things.

    Reply to comment

  19. Posted by masklinn | April 18, 2007, 5:58 pm

    > irb has syntax highlight, auto indentation, and auto completion. Some might require inclusion of gems though.

    Probably all of them in fact, because none of my “sock” irbs — be it under Windows or OSX — has auto-indentation (they don’t even allow me to indent, really), auto-completion or syntax highlighting.

    And the few “windowed” irbs I’ve tried (fxri and Freeride’s irb shell) don’t have coloration or completion, and when they have auto indentation they only have that and don’t allow me to indent how I want stuff to be indented

    Reply to comment

  20. Posted by Tony | April 18, 2007, 8:45 pm

    @David – that’s an interesting approach. Assembly? Yes, there is less to get confused about, but just as much to get excited about too. I suppose that once students get through this stage, they will appreciate Ruby that much more, but until then it would require that much more dedication. Though it’s great to hear that someone is using Ruby for academic purposes :)

    @Darren – thx for bringing this up. Ruby’s readability is very natural. One can often easily follow code samples, even with new classes and methods.

    @masklinn – there’s ‘irb/completion’, IRB.conf[:AUTO_INDENT]=true, and ‘wirble’. Autocompletion works well, though Windows’ console might have problems with others.

    @slabounty – IRB could also be configured to save history to a file. Running the saved file at a later time will effectively restore the shell’s state.

    Reply to comment

  21. Posted by Andy Kant | April 19, 2007, 5:16 pm

    Although I agree that Ruby is an excellent language and a great playground for those new to programming, it is an extremely poor choice as a first language for computer science programs. There has recently been a trend of schools using Java, C#, and other high level languages to teach instead of using a lower level language like C or C . The problem with this is that it is much more difficult to learn C/C after learning a higher level language than it is the other way around. Starting with C/C (or even Assembler) gives students a great knowledge base in how languages actually *work* (the big thing being how memory is handled). This knowledge can then be applied to higher level languages and you will get more out of them. There is a great dependency on C/C in the workplace still, and students that don’t start out on it will never learn it.

    That being said, I use higher level languages like Ruby/C#/PHP/JavaScript for most of my work, but the background I have in low level languages has been invaluable. The school I went to actually switched to Java a couple years and that resulted in a distinct difference in quality between those started on ASM/C/C and those started on Java.

    Reply to comment

  22. Posted by wtd | April 20, 2007, 12:24 am

    The real question here is: do we place greater importance on students understanding things like memory management, or do we place greater importance on understanding things like how to write well-organized code.

    Languages like C and Pascal provide the former. Languages like Ruby, by virtue of the ease of experimentation aid in the latter. In my experience they do so by making it easy for students to do things, and to get the mistakes out of the way fast.

    IRB is a great example, and the lack of easy saving of code snippets from it is probably an advantage. The more time a student invests in a piece of code, the more likely they are to take pride in it, and the code a student is most likely to invest a large amount of time into is the first code they write, and most likely the worst. Cut down the time they spend writing bad code, and I believe students will be more receptive to new, presumably better ideas.

    Reply to comment

  23. Posted by ljm | April 20, 2007, 12:20 pm

    I agree that there needs to be an easy integration with graphics ala Logo. I’ve taught young kids Logo and it is amazing to watch.

    Now for older kids, they’ve already had so much exposure to graphical UI’s – they don’t know what a command prompt is – that a Logo-like experience is the way to hook them as well.

    Reply to comment

  24. Posted by Bart Braem | April 22, 2007, 12:42 pm

    I fully agree with Mike here: you do not have to explain anything special to get output from ruby.
    And about the graphical output: it does not matter. I know it for sure, I’ve tried it a couple of months ago :-)
    These were 16 year old students with no programming experience. Yet in the end, and based on a small framework, they delivered their own RPG. With lots of nice things. And they were very excited about it. It took us 4 days, starting with learning ruby on day 1. You’ve got to love teaching a programming language if things go that way…
    If you want to know more about our results feel free to contact me at bart dot braem at gmail dot com.

    Reply to comment

  25. Posted by Matt Helms | May 2, 2007, 8:53 am

    Ever hear of XNA?It’s good that you guys are teaching children programming—-wish they would do it where i’m from—but why not teach them something that might actually be usefull in their future? Ruby—not even sure if I’ve ever seen a program made with it….but I have seen and have used programs made with python…even though I don’t like it one little bit.

    About XNA —it is known that Adults of my age learn new things slower than a child of 6 yet I’m having fun at programming for the first time, learning Microsoft’s XNA.

    Reply to comment

  26. Posted by Tony | May 2, 2007, 12:37 pm

    Matt – yes, I heard of XNA. It’s alright for putting together games with C#. Fun as a hobby, not so sure about the industry implementation…

    Ruby on the other hand is fairly well established. Ever heard of Basecamp or Twitter?

    Reply to comment

  27. Posted by Justin Belanger | May 17, 2007, 8:20 pm

    The language I’m currently teething on is Turing. After checking out some examples of other languages (Ruby included), I’ve begun to think that while Turing seems fairly easy to understand, it doesn’t seem to be as practical or as versatile (as in translation to other languages for example) as Ruby or another language would be, especially if it’s someone’s first language.

    Reply to comment

  28. Posted by Patrick Cruce | September 4, 2007, 4:43 pm

    I’m not sure I see a reason to prefer ruby over another interpreted language.

    Python is interpreted and object oriented…

    Lisp(or Scheme) is interpreted, and although not object oriented in its most basic forms, it is probably the most elegant and consistent language out there.

    What makes ruby better than these other high level alternatives?

    Reply to comment

  29. Posted by Tony | September 4, 2007, 5:08 pm

    Although similar, Python is still a different language than Ruby is. A preference can be taken in any subtle detail. Is there something in Python or Lisp or Scheme that is significantly better than in Ruby?

    Reply to comment

  30. Posted by Stanley | September 19, 2007, 11:46 pm

    After reading your article, i have several things to say. Firstly, you are immensely correct about Ruby being a good fist language to learn. It provides an easy way to learn algorithms, build logic, and introduce programming. However, I do want to say that i don’t think it would be a very good language to teach in schools. My first language was Java and, although at first i had no idea what was going on, once we started talking about objects and OO programming, and we finally got to under stand what all this public static void main(String [] args) crap was supposed to mean, things got a lot better. And also, to those people who are saying that CS students drop out simply because they aren’t producing high quality 3d games right off the bat isn’t entirely true. At the end of my first year of high school CS, we were given an open ended project to do whatever we want for our final grade. Me and friend of mine partnered up, downloaded the java3d API and simply by looking at the documentation and the included examples, we were able to develop a 3d pong game with networking code in 3 weeks. There were bugs, to be sure. The collision algorithms were spotty and the networking didn’t always work with the firewall and everything, but we were pretty impressed for doing it all in 3wks time with no prior experience. Most students will find that they CAN develop 3d games after a year or two, it just takes extra work on their part and a certain willingness to teach themselves.:)

    Reply to comment

  31. Posted by Tony | September 20, 2007, 12:04 am

    I think that

    at first i had no idea what was going on

    is the important part of the story.

    There is a lot of overhead with Java, and it doesn’t really get any easier once you figure out what “public static void” is.

    Reply to comment

  32. Posted by Mike Minutillo | September 20, 2007, 3:40 am

    And the issue with most languages is that if they have an easy “Hello World” it is usually a hack of some description. With Ruby, as you gain more and more knowledge the fact that puts “Hello World!” is actually object oriented becomes quite clear.

    This is part of beauty of the Convention Over Configuration paradigm. In fact, once you do know what you’re doing with Ruby you can run your app in an environment such that the 1 line Hello World trick doesn’t work.

    Reply to comment

  33. Posted by Patrick Cruce | October 19, 2007, 7:54 pm

    In response to #29

    I think the point I was trying to draw in my original post(28) is that if the claim is made that “ruby is the best introductory programming language”. Then the burden of proof lies upon the person making the claim, to show there is some aspect of ruby that other languages don’t have.

    I personally think scheme is a great first language because in addition to having an interpreter that allows users to play around in, it also has a syntax that forces users to approach problems in a unique way that happens to be particularly well suited to promoting the understanding of computer science and algorithms.

    While I had “learned” several languages before learning scheme, it was when I learned scheme in my first programming course at berkeley, that something suddenly clicked and I started to think about problems like a programmer. I began approaching problems in an abstract algorithmic way, and began to understand the many different ways that a programmer can approach a problem and how the differences in those approaches changed the programs that I produced.

    That said, there is a bit of a hump that users have to get over when learning scheme. First students of other languages may have an easier time with those languages, but at the same time, they may end up developing coding practices that are fundamentally limited.

    Reply to comment

  34. Posted by Greg Wilson | December 28, 2007, 8:27 am

    Whenever I hear someone claim that PQR is the best programming language for XYZ, I ask them to cite their data — after all, if someone claimed that phenyltrioxyalanine was the best treatment for halitosis, you’d expect them to have done the science to back up their claim. “It’s obvious” doesn’t cut it: to other smart, honest, well-informed people, it’s obvious that Haskell, C, or Java is best. And yes, such studies would be difficult and expensive to do, but (a) no more difficult or expensive than studies of how children learn to read or do math, and (b) if there *are* significant differences, the economic impact would more than repay the cost of the study.

    See also http://pyre.third-bit.com/blog/archives/1271.html.

    Reply to comment

  35. Posted by Chicken Nuggets » I’m getting old. | December 28, 2007, 10:52 am

    [...] like this just ticks me off: Ruby – best introductory programming language. Not because Ruby wouldn’t make a good starter language, but rather because all the arguments [...]

  36. Posted by jw | December 28, 2007, 2:11 pm

    Perhaps this is just my bias, but I’ve come to appreciate and really understand many of the Ruby constructs/idiosyncrasies only because of my earlier exposure to strongly typed languages (C/C /etc.)

    Actually, this is reversed. Ruby is a strongly typed language; C is a weakly typed language, with casts, coercison, void, varargs, and other holes in its type system. Ruby is implicitly typed, while C is explicitly typed, requiring you to associate type specifications with each variable declaration, but implicit typing does not mean that the typing is absent. It just means that the compiler or interpreter is handling the bookkeeping for you, which is a feature of many higher level languages like Haskell, ML, Python, and Ruby.

    Reply to comment

  37. Posted by jw | December 28, 2007, 2:16 pm

    Whenever I hear someone claim that PQR is the best programming language for XYZ, I ask them to cite their data

    There are many studies on the best introductory programming language in the ACM SIGCSE conference proceedings. You have to subscribe to the ACM digital library or join SIGCSE to gain access to those proceedings, but if you’re at a university, your library might already have purchased access for you.

    Reply to comment

  38. Posted by Peter | January 10, 2008, 3:35 am

    Great article, it really turned me on to Ruby. I found some videos and it seems extremely intuitive…

    Now, how do i start? Can anyone recommend any books, tutorials, websites and what not to someone who has extremely little programming experience?

    Reply to comment

  39. Posted by wtd | January 10, 2008, 2:19 pm

    http://tryruby.hobix.com might be one to look at. Compsci.ca also has a Ruby tutorials forum. http://compsci.ca/v3/viewforum.php?f=59

    Reply to comment

  40. Posted by Peter | January 11, 2008, 4:08 am

    thanks for snappy reply :)

    Reply to comment

  41. Posted by she | March 29, 2008, 8:17 am

    I am using ruby since 5 years almost exclusively, with a little bit C here or there. (And a bit trying out other languages)

    For me, ruby is currently the best language for several reasons.

    But I would still recommend either C or C or Java first.

    Why?
    Simple.

    Ruby is actually so easy that you can learn it at ANY time. I was past 20 when i started learning Ruby.

    However, once you know Ruby, it makes learning i.e. C harder. Because you could do 99% of what C can do in plain Ruby a lot easier shorter and better!

    Its only when you want to do low level stuff or legacy stuff you really need the full power of C, including attaching to libraries at will and pointer manipulations

    Reply to comment

  42. Posted by Andrew Porter | April 4, 2008, 7:06 am

    I think the way I learned to program is an ideal way.

    Start of with a basic BASIC to the point you get frustrated with it’s lack of performance and ability to do “”cool stuff”.
    Learn Assembley language and realise just how a computer actually works
    Learn C because now you know how assembley works you can appreciate a slightly higher level language to aid the repetition, but you can still visualise the resulting machine code. You also learn a load of useful algorithms.
    Spend years learning loads of other languages, a plethora of 4th generation frameworks, PHP and html/css, avoid perl c and java
    And finally stumble across ruby by virtue of rubyonrails

    I think it helps to understand what is going on at a lower level when you type ['banana', 'apple', 'orange', 'grapefruit'].sort – at least you can identify sub-optimal methods.

    Reply to comment

  43. Posted by stevo | April 4, 2008, 11:47 pm

    I don’t Ruby, but you asked about first languages. The languages I learned, in order, were Basic, Fortran, some Algol, then Pascal, Snobol, APL, Lisp, Forth, and a little Visual Basic.

    Of those, I like APL, then Forth, and Pascal.

    Now all of my ‘programming’ is in Excel.

    stevo

    Reply to comment

  44. Posted by Bruno Guedes (Toupeira Profisisonal) | April 9, 2008, 6:43 am

    Given your arguments, why not using Python instead? It equally provides an interpretor with prompt and you can use “dir” to ask an object to describe itself, then “help” to understand what the hell that stagne named function does.

    But I’m still a defendant of teaching C as introductory programming language. At best, Pascal, but I still think it’s not as stimulating. I think learning programming is about learning concepts, not exactly syntax or success. Maybe Assembly would be even better, but I wouldn’t know…

    Also, starting with an object-oriented language is just wrong… it’s like learning to read with Shakespeare, we’re leaping a few steps here.

    Reply to comment

  45. Posted by Tony | April 10, 2008, 7:35 pm

    I’ve already addressed this in another comment above, but given that Python’s offering is “equally” as good, then why not use Ruby?

    I don’t think that Assembly should be a choice for exploring computer science concepts, but you are completely right that it shouldn’t be about syntax either. That’s why it’s really exciting to see Universities switching from Java to Scheme.

    Reply to comment

  46. Posted by Mike Minutillo | April 10, 2008, 10:00 pm

    A year and this post still generates comments! I think Tony should open a social networking site around it :p

    Seriously though, seeing new comments here has made me consider that Boo would also be an excellent university-level CS language. Boo is a Open Source .NET language based on Python. I have been playing with Boo a lot lately and here’s why I think I would teach it if I were running a class:

    1) The Ruby HelloWorld being object oriented trick that I keep harping on about holds true for Boo as well as for Ruby
    2) Boo has an interpreted environment (interactive and batch) as well as a compilation system
    3) Boo is open-source and free (like Ruby) with SharpDevelop or MonoDevelop as free Open Source IDEs as well.
    4) Boo has a flexible compiler system (we want to teach compiler theory eventually right?)
    5) Boo is built on .NET so library knowledge won’t be lost when students decide to change language. This is especially great with F# coming on strong (want to teach functional programming too right).
    6) Boo will work in Linux and Mac (on Mono) and Windows systems on .NET.

    It’s all very Ruby-esque but I really like the flexible compiler (you can create a class that acts as a new keyword in the project you are currently compiling :o ). Boo FTW!

    If you’re tired of people evangelizing Ruby at you all the time but still want to try something different then I can heartily recommend Boo

    Reply to comment

  47. Posted by Mike Minutillo | April 10, 2008, 10:04 pm

    7) Static Typing at runtime but with strong Type Inference

    I mean it. Look at Boo. It might make the Chicken Nuggets guy happy.

    Reply to comment

  48. Posted by blu3man | April 17, 2008, 9:19 am

    It would be a hell lot better then VB which is what is getting taught in High school software design at the moment. VB teaches horrible programming practices and is generally messy.

    Some schools even stick with basic and qbasic.

    I heard some schools are doing some python which is nice because it is a quite handy language to create some automotive scripts with.

    I am yet to jump aboard this Ruby bandwagon but im leaning closer.

    Reply to comment

  49. Posted by SEO Web Tips | May 22, 2008, 3:36 pm

    Ruby has always been a very interesting and exciting language for me. The only problem is that I never find a time to look into it further. Usually I go to their site, read about it for a while but never really get to the point of trying it… But I’m sure I will one day. But for now, it’s C/C , PHP/MySQL and CSS/XHTML/XML for me…

    Reply to comment

  50. Posted by Dave | July 15, 2008, 3:19 am

    So! I started my programming experience when I was 14. The first language I started learning was C I was learning it online, so I didn’t have a teacher or anything. And I have to say that was a very nice starting language, for me. Sometimes it got hard to stay working with it though, being young and not having someone there to make sure I was doing what I needed to be doing, but I often countered that by telling myself “I wonder what I can learn today…” But I’d have to say that it wasn’t THAT difficult to comprehend.

    After C, I started to learn a little bit of python, learned the *very* basics of it, then went to Assembly. After learning about that, everything that I had learned before had made much more sense.

    Next language was Pascal. It was somewhat similar to C, but there were some differences…

    Then XHTML and CSS. Those were both a very nice break, considering they’re pretty simple (to a degree.) Not exactly software development, but they’re languages…

    Now I’m currently working with VB.NET and C#. VB can get veryyyyy messy, but it could be a good starter language for youngsters just because there is that visual sense to it. I would think that in a younger age group, just knowing “Ooo, I get to move a button right here!” would distract their mind from the actual code to be written. Not distracted enough that they wouldn’t learn what the code meant, how it worked, or the procrastination aspect, but distracted enough that it would keep them motivated to want to make that button actually do something.

    And just FYI, I’m still in high school. So with some determination and effort, I’m positive kids can learn AT LEAST one language and understand it enough to write good, efficient code.

    So my vote? VB.NET or C.

    Oh, and I haven’t tried Ruby yet, so maybe my opinion in this article is void? Kinda like saying hamburgers are better than tacos, but have never had a taco in your life (which, btw isn’t true, but that’s beside the point at hand.)

    But that’s just my opinion, of course.

    Reply to comment

  51. Posted by Tony | July 15, 2008, 11:51 am

    @Dave — if you haven’t seen Ruby, then think Python.

    Personally, I would disagree about VB. You are right that younger students are interested in getting something to the screen quickly, but graphical tools for UI layout should not be it. I’ve been to a high school class using VB, and a lot of students would focus just on the layout of their GUI elements. Then they wouldn’t know what code to put behind which of their many elements available.

    So if the visual-feedback type of approach is called for, look into easily usable graphics libraries, not GUI design tools. Maybe something like Processing.

    Reply to comment

  52. Posted by Mike Minutillo | July 15, 2008, 6:25 pm

    @Dave, Tony – Drag, drop, double-click can lead to some difficult to understand code. Try out Shoes by why the lucky stiff (don’t ask) and while you’re there have a look at the Hackety Hack idea. It’s a really cool idea and philosophy. _why wants to build an IDE (sort of) which teaches kids how to program.

    Reply to comment

  53. Posted by Gadgets | July 31, 2008, 12:12 pm

    I never really caught on to ruby. PHP just seems so much easier – why switch?

    Reply to comment

  54. Posted by first_language [strchr.com] | October 13, 2009, 6:59 pm

    [...] Ruby – best introductory programming language by Tony Targonski. [...]

  55. Posted by Brandon | September 30, 2020, 8:31 am

Post a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>