Slashdot Mirror


Programming in the Ruby Language

ShoeHorn writes: "Here is a good article (1st of a 4 part series), that introduces you to the Ruby language. If you are currently a programmer coming from the likes of C++, Perl, or Python, you will see some strong similarities (especially to Python)."

4 of 345 comments (clear)

  1. As the guy who wrote the article. by poet · · Score: 5, Informative

    It is important not to judge Ruby on this article.
    The content in the article is specifically designed to look like either Perl or Python. This was to generate a similarity that programmers from other languages can understand.

    The second one, article in the series looks a lot less like Perl and more like Python. This is due to Ruby being a true OO, very similar to Python.

    The third article will (if they let me write it) cover advanced Ruby structures and illustrate them by interfacing with the PostgreSQL database.

    The fourth article will cover Ruby/Qt.

    If you guys want to see these articles you may want to give some decent feedback on the Developer Works site.

    --
    Get your PostgreSQL here: http://www.commandprompt.com/
  2. Re:Strict languages vs. hacked languages by smallpaul · · Score: 5, Interesting
    I notice strong distinctions between those languages that have been developed by actual programming language researchers and those who hack together a language to scratch an itch.
    "Actual programming language researchers" are typically not even interested in designing languages for general purpose use. Often they are just trying to explore a particular idea of aspect of programming.
    Usually the latter turns out to be some baroque conglomeration of features piled on features, creating a very top heavy feeling to the language, while the former classification languages all have a purity to them, e.g. smalltalk, lisp, and c.
    I think you're going to have to define your terms if you want to make this point. How were Kernighan and Richie programming language researchers but not Van Rossum and Wall? By now, the latter two have spent about ten years of their lives thinking about almost nothing other than programming languages.
    Some would defend the "hack languages" as a means to Rapid Application Development, but Smalltalk has been shown to be the most productive language,
    Could you provide a reference to back up that claim? I'd like to see evidence that Smalltalk fares well at system administration or text processing.
    and Ruby/Python/Perl all seem to me to have a BASIC odor to them;
    Now you are really grasping. That claim isn't even solid enough to refute.
    ...I'm wondering if people are afraid to learn a new way of speaking?
    I don't know...are you? If you are into purity and elegance, I would suggest you give either Python or Ruby a real try. There are many Lisp fans that like both and Ruby is especially popular amoung Smalltalk users.
  3. Don't judge ruby based on the article by MeowMeow+Jones · · Score: 5, Interesting
    There's nothing wrong with it, it just doesn't get into any of the crazy stuff that makes ruby ruby. So wait until the other parts come out or check out the Pragmatic Programmers Guide.

    If Python was the result of Lisp and C++ having a baby, Ruby is the result of Perl and Smalltalk having a baby.

    --

    Trolls throughout history:
    Jonathan Swift

  4. Why learn another language? by Dalroth · · Score: 5, Informative

    Well, I see a lot of people complaining as usual... Why should they learn another language? So I thought I would throw in my $0.02 for all a languages (not just Ruby, which I am particularly fond of).

    A lot of you people come from what I call the Computer Science Student mentality. This unfortunately something I've noticed as a side effect of the way computer science is taught in most schools. It's quite unfortunate, because that clearly isn't the aim of the Professor's when they are teaching classes this way.

    I'll use my school as an example. When I started at the University of Dayton, about 7 years ago, every class was taught in ADA. It was a horrible horrible expierence. The ADA compilers were horribly lacking at the time, and anybody who has done any work in ADA will know that it is an extremely strict and picky language. That has it's good and bad sides when it comes to teaching programming, but I'll save that for a different discussion. I had no problems, since, well, I had a good solid 4 years for Pascal and C/C++ programming experience before I even started college, but this seriously affected the other students in my class.

    The problem was, about two years into the program, my school decided (thank god) to switch the department over to C++. This was a great move, because now the students were being taught a language that they could actually apply in the real world (beyond the confines of the Wright Patterson Air Force base anyway). It worked out quite well for the newer students, but my classmates were blindsided. Most of them suffered through half a semester of C (the other half of the semester was 360 assembler) and never even touched upon C++. They should have just been able to pick up a C++ book, apply the concepts they learned from their ADA classes and the syntax from the C++ book and their C course and move on, but most of them had a hard time doing it.

    Why was that? They all knew the concepts. They all knew how to write their algorithms, and their trees, and their stacks and queues. Yeah, they weren't taught how to write real software, but they clearly knew the basics. I spent more time helping others learn these concepts than I did doing my own homework the first two years, so I know what they were capable of from first hand experience.

    The problem was entirely in their minds. C++ is a huge ugly beast, and it is a bit imposing when you first start. But if you've got two solid years of programming behind you, it should be a relatively smooth and easy transition. Most of them didn't realize this though. They were scared of C++, they were scared of new languages, and they suffered as a result.

    The simple fact of the matter is, if you know one language, you know them all. It's not the syntax that makes the difference, it's the concepts that you express within the framework of the language's syntax that are the real guts of programming. My classmates took awhile to realize this (and I'm sure many of them still don't). That's the same thing with Ruby, or Python, or Perl, or just about any language. Unless you are making the jump from procedural to OOP, or OOP to Functional for the first time, you *CAN* pick up a book and learn a new language in a days time. The only thing stopping you is yourself.

    Now, the other part of this is, why would you do that? I love learning new languages, and I love learning new languages for a few reasons. These reasons apply to every programmer, and I honestly don't understand why some people are so opposed to learning something new. I guess that's what seperates a good programmer from a bad programmer. So if you want to know why you should learn Ruby, or LISP, or Haskell, or even Visual Basic, I'll tell you why.

    1. It helps keep your skills in tip top shape. Perusing a computer manual may remind you of algorithms or techniques you haven't used in a long time and forgotten.

    2. You always seem to learn something new. Not some new technical trick that only works in one lanuage (although that definitely happens), but just a different way of approaching problems that sometimes can transcend language boundaries.

    3. You may find a new language that allows you to get the job done faster!

    4. You're enhanced knowlege of languages looks great on your resume no matter what you use as your primary language.

    5. You learn the way other people think. And I don't want to gloss over this one. As a programmer, you frequently have to work with other programmers. Learning new languages is a *GREAT* way to see how other people do things. To learn the way other people think, so to speak. By learning Ruby and Smalltalk, you start to learn why people in those communities are so die hard about OOP programming styles. By learning LISP or Haskell you start to learn why Functional styles even exist! And it all comes back full circle. Techniques I learned from Haskell I now use when writing C++ programs and vice versa. It only made my C++ code better.

    Knowlege is power, and learning new languages is one (of many) ways of increasing your knowlege. Go ahead and try it, even if you think you won't use the language, and even if you're just starting out and don't think the transition from your learning language to a new one will be easy. You just might be surprised by how much you already know, and how much you have yet to learn. That's the real benefit of it.