Slashdot Mirror


Ruby Off the Rails

An anonymous reader writes "IBM DeveloperWorks has an interesting writeup on Ruby that takes a look at the programming language as a stand-alone solution rather than defining it in terms of Rails. From the article: 'Ruby on Rails is just one facet of what makes Ruby great, just like EJB is only part of the Java enterprise platform. Andrew Glover digs beneath the hype for a look at what Java developers can do with Ruby, all by itself. Ruby's syntax is quite different from that of the Java language, but it's amazingly easy to pick up. Moreover, some things are just plain easier to do in Ruby than they are in the Java language.'"

22 of 325 comments (clear)

  1. Re:So, what's it like? by Decaff · · Score: 4, Insightful

    Why? The speed of C and C++ are hardly needed for most applications

    This is the same excuse I have heard for decades when fans of a language try and 'justify' it's lack of performance. Sooner or later a lack of performance really does become a problem - if it wasn't then many Ruby developers would not be working on high-performance VMs for the language.

    There are situations where performance doesn't matter, but this is not true for 'most' applications.

    I really like Ruby, but I will find much wider use for it when it is truly fast.

  2. Re:What I need to know by Decaff · · Score: 2, Insightful

    why spend more time developing a program in Java, when you could develop it faster in Ruby?

    Because not getting the best performance out of hardware, no matter how old or new it is, puts your application at a disadvantage compared to your competitors. No matter how much you may try and justify things, your users don't care about the language you use to develop - they care about performance.

    There are alternatives - you can use both Ruby and Java together (JRuby works on the JVM). I think this 'mix and match' approach will be more widely used in the future.

  3. Erm, hello by m50d · · Score: 4, Insightful
    Moreover, some things are just plain easier to do in Ruby than they are in the Java language.

    That goes for any sane modern language.

    --
    I am trolling
    1. Re:Erm, hello by cnerd2025 · · Score: 2, Insightful

      Java is easy to use, but the creators had a bit of diarrhea of the fingers: it takes like 10 lines to write something that would take about 3 in C/C++. Also, some of the "built-ins" are just freakin' arbitrary. Java, though, isn't as arbitrary as C++. So Java is like the little brother of C++ who still doesn't implement OOP quite well enough, while talking far too much. It had support of its mother to make it known (Sun Microsystems), and it utilizes centralized documentation/codification (a blessing and hinderance). Ruby is truly object-oriented and is in the spirit of Smalltalk, with features not simply academic in nature. After learning Java, I really had a bitter taste for OOP. When I learned Ruby, it was like walking from Kansas to Oz.

  4. Re:Ruby & Java == Moriarity & Holmes by BACbKA · · Score: 4, Insightful

    Wasn't Java itself once defined mostly in terms of C++, and isn't C# now defined in terms of Java?

    --

    VKh

  5. Smalltalk's inheritance by soundofthemoon · · Score: 4, Insightful

    Most of the things I love about Ruby are qualities that it inherits from the Smalltalk programming language. Typing objects instead of variables, everything is an object, object-based encapsulation, blocks as objects, polymorphic collections with enumerators, and the overall style of programming. Ruby is the first language since Smalltalk that I could really grow to love. It adds a lot that Smalltalk doesn't have, like regular expression syntax and better case statements, modues and mixins, and easier access to metaprogramming.

    In some ways Ruby is a bit too dynamic - one of the strengths of Smalltalk is its simplicity and the predictability of your code. With Ruby it's easy to adopt a programming style that makes it difficult to predict what will happen when you do something in your code. Experienced programmers should be able to avoid those pitfalls, but I worry that some of the features will ecourage neophytes to create code that is difficult to maintain or understand.

  6. Re:So, what's it like? by Dare+nMc · · Score: 4, Insightful

    > Sooner or later a lack of performance really does become a problem
    my limited history of languages says, a lack of performance is taken care of by compiler/VM writers when a market for such comes about.

    C was unacceptable, and is now the standard for speed. C++ was way too slow now their are 100's of optimizers to turn off all the features that cause it to be slower than C.
    Java started out with horrible performance, but this story talks many times about how fast it is, it has compilers now, and a hundred different optimized VM venders to speed it up.
    I see no reason why Ruby would be slower as a language, except the lack of optimizers, perhaps due to the lack of time in the spotlight, and thus the lack of a market requesting it.

  7. Isn't anything off the rails... by Jeff+DeMaagd · · Score: 2, Insightful

    ...the basic definition of being derailed?

  8. Rails hobbles Ruby by MarkusQ · · Score: 2, Insightful

    I like Rails, but I love Ruby. The hardest part of learning Rails was (for me, an experienced Ruby coder) learning all of the things that you lose when you go to Rails. (One example out of many: in Ruby when you create a Hash you can provide a default function (rather than just a default value) to be used when an element is missing; with Rails, this generally doesn't work since the functions don't serialize).

    Conversely, if you like Rails you really should explore standalone-Ruby to see what you are missing.

    --MarkusQ

  9. Re:Loving complexity for complexity's sake by Decaff · · Score: 2, Insightful

    Just recently I saw the project that was basically just a few web pages and it was realized as a tasty soup of custom MVC framework, JSPs, JSP tag libs, Velocity (by itself and (horror) inside taglibs), Spring and XML/XSLT thrown in for a good measure.

    Just because some developers make bad choices does not mean that this is any fault of the language, or is a general fault of all developers in this language. Such messes can occur in any language - I have seen some real VB horrors.

  10. Re:What is .Net's competition? by Anonymous Coward · · Score: 1, Insightful

    It's because .NET is a platform, not a specific language. Microsoft also has a vested interest in making the platform more suitable for dynamic languages; see IronPython for an example.

    The JVM was designed around the notion of Java as a language, whereas .NET was designed as a platform for multiple languages. That difference in approach changes how .NET competition and comparisons are formed.

  11. Re:What I need to know by Scarblac · · Score: 4, Insightful

    Because not getting the best performance out of hardware, no matter how old or new it is, puts your application at a disadvantage compared to your competitors. No matter how much you may try and justify things, your users don't care about the language you use to develop - they care about performance.

    Simply not true. 95% of software is developed in-house, by small development teams that don't exactly have time to spare. Managers care about productivity, about getting more features implemented in the same time. An extra server costs what, the same as hiring a programmer for a single month?

    --
    I believe posters are recognized by their sig. So I made one.
  12. Re:Flamewar.....NOW! by Tablizer · · Score: 2, Insightful

    Python better add the features that Ruby hypers won't shut up about or risk getting left in the popularity dust. It is not that Ruby is better, but if people keep talking about certain features then people will *expect* them because they hear about them, not necessarily because they really are a Silver Bullet. Hype works, I am sorry to say.

  13. Re:What I need to know by arevos · · Score: 2, Insightful
    You can say that your experience is different, but it doesn't invalidate my evidence. My evidence is based on the study of a large number of projects from many people.

    But if I find that a project done in Rails is N times faster than a Java project of a similar nature I've done in the past, I'm hardly going to discount it based on the unseen evidence of someone on Slashdot. If, in my experience, Ruby proves to be a far faster development language than Java, I'm not going to hum and say, well, what about those project managers who decided language wasn't a deciding factor.

    Add to this the fact that there are many experienced developers who take the opposite of your position; Paul Graham, as I've already mentioned, and quite a few of the chaps at Google. I'd dig up more examples, but it's Christmas Eve and decidedly late.

    In my opinion, people should try out both languages and decide for themselves based on the results, rather than rely upon the experience of others. Wouldn't you agree?

  14. Re:Ruby & Java == Moriarity & Holmes by JanneM · · Score: 2, Insightful

    The ruby crowd positions themselves as none other than mortal enemies of Java and anyone stupid enough to still be using that pathetic excuse for a language!

    When looking at who is "positioning" Ruby that way, it seems to be mostly Java users, actually - at times to belittle Ruby (there seems to be a few developers that feel threatened by the Rails framework) but mostly, it seems, as a basis from which to highlight shortcomings in Java. Ruby developers don't seem all that interested in these comparisons.

    --
    Trust the Computer. The Computer is your friend.
  15. Re:Purpose of being verbose by Hiro+Antagonist · · Score: 1, Insightful

    Managers like Java because Java was a language designed to be impressive to managers. Writing Java code is painful, because you have to do so much repetition, and because Java goes absolutely apeshit if you don't play ball.

    You know what I want out of a language and application framework? I want to be able to repeat myself as little as possible, have a simple codebase with built-in hooks for unit testing, be able to run my code anywhere, and be able to produce a working program in a rapid fashion. Java doesn't give me this, and I'm not sure if Ruby does just yet, but it seems a lot nicer.

    I've just started looking at Ruby, and insofar, I'm impressed -- it feels like a mix of Perl and Python, with a dash of Lisp thrown in. It could certainly be faster (and the next VM looks very nice), but overall, the language has a very good design, and it is a joy to work with. I feel the same way I did when I discovered Perl (4), only now I get all the OO goodness that feels so hacked-on and kludgy in Perl, but without the indentation madness of Python.

    --

    --
    I Hit the Karma Cap, and All I Got Was This Lousy .sig.
  16. Re:Purpose of being verbose by tunah · · Score: 4, Insightful

    StringTokenizer st = new StringTokenizer(s);

    --
    Free Java games for your phone: Tontie, Sokoban
  17. Re:Loving complexity for complexity's sake by Joey+Vegetables · · Score: 3, Insightful

    Only crappy developers. The better ones understand that software development (not just coding, but analysis, architecture, and design) is actually a process of documenting, managing, and reducing complexity, to the greatest extent possible.

  18. Re:Ruby is what Perl and Python want to be by Anonymous Coward · · Score: 0, Insightful

    Python does not want to be Ruby. And I pray that will always remain so.

    Ruby is more readable than Perl no doubt, ANYTHING is more readable than Perl, but Python has as big a readability advantage over ruby as Ruby has over Perl. And that advantage far outweights the few little things in which ruby is "easier".

  19. Re:So, what's it like? by juhaz · · Score: 1, Insightful

    The article is the first time I've actually seen any Ruby. Looks nice... but some of the examples are quickly turning into code soup on the level of perl or c++. I don't want to be the compiler and have to decipher some compact syntax.... verbosity is not necessarily a bad thing. I would argue that for code maintenance it's better to be more explicit than not.

    If you think Ruby looks nice, but is too much of a "code soup", you definitely should take a look at Python. It has most of the advantages, but is IMHO, considerably more clean. Creator or Ruby likes Perl, and it shows.

  20. Re:So, what's it like? by lahi · · Score: 2, Insightful

    I must conclude that you don't think

    i++; /* increment i */ is silly either.

    Let's just leave it there, then.

    -Lasse

  21. Re:Purpose of being verbose by mav[LAG] · · Score: 3, Insightful

    Bullshit. Managers like Java because it helps their team achieve their business objectives better than the other languages you describe.

    Hmmm, this attitude sounds somewhat familiar. Oh yeah, Paul Graham has written about it at length in this essay:

    The pointy-haired boss miraculously combines two qualities that are common by themselves, but rarely seen together: (a) he knows nothing whatsoever about technology, and (b) he has very strong opinions about it.

    Suppose, for example, you need to write a piece of software. The pointy-haired boss has no idea how this software has to work, and can't tell one programming language from another, and yet he knows what language you should write it in. Exactly. He thinks you should write it in Java.

    Why does he think this? Let's take a look inside the brain of the pointy-haired boss. What he's thinking is something like this. Java is a standard. I know it must be, because I read about it in the press all the time. Since it is a standard, I won't get in trouble for using it. And that also means there will always be lots of Java programmers, so if the programmers working for me now quit, as programmers working for me mysteriously always do, I can easily replace them.

    On your own dime, go jump in leaf piles, run through a field of flowers, play with Python, Ruby or whatever is good for your spiritual wellbeing, but when you're working to pull a paycheck, you don't get to put your own flights of fancy before things which make your team (not you as an individual performer, but your team as a whole) more effective in achieving business objectives.

    Horseshit. Python and Ruby and Lisp are real-world workhorses that don't need tens of millions of dollars in hype to be successful. For instance I have tens of thousands of lines of Python code out on the field doing real work, 24 hours a day, seven days a week for really demanding clients, including governments and advertising agencies. In one case, I finished a project in a third of the time it took three Java programmers - and mine was smaller, faster and more maintainable for the guys who took it over. Time is money and succinctness is power in software development and Java doesn't make the cut on either. Oh sure, it's a great tool to allow development by the lowest common denominator (money quote from James Gosling) but the really smart teams I know despise it for the ugly hack it really is. When I expressed this opinion in a column for a local computing mag, I was assailed with all kinds of outraged squeals from the local Java gurus. But none of them could answer my points honestly.

    If readers disagree, answer honestly with words rather than modpoints. I've tried Java. I really have. I found it ugly, slow, anal and seriously limiting to work with. And I don't seem to be allowed to fix flaws in it either. That's not good.

    --
    --- Hot Shot City is particularly good.