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.'"

29 of 325 comments (clear)

  1. Re:Get the basic premise right, first by Anonymous Coward · · Score: 4, Funny

    I love it how the Rails fanatics always take great personal insult at even the mere suggestion that code generation isn't its strong point. Even though, surprise surprise, the infamous tutorial video advertises just this very feature throughout pretty much the entire clip. It's like watching a little kid cry and stamp their feet at a grocery store trying to get their parents to buy them cereal.

  2. Re:What I need to know by arevos · · Score: 5, Interesting
    Before I even consider Ruby: is it faster and less memory hungry than Java.
    If the answer is no, then I'm not going to waste any effort on it.

    If speed and memory usage is your only criteria when choosing a language, why not use C or assembly?

  3. Re:It's obvious by Anonymous Coward · · Score: 5, Informative

    ikkibr is a robot that looks for similar past articles and reposts highly-modded comments from those articles. See http://ask.slashdot.org/comments.pl?sid=171820&cid =14310500

  4. Re:What I need to know by the+eric+conspiracy · · Score: 4, Informative

    Ruby is useless to me because it has no unicode support.

    In this shootout it was found that Ruby had lower memory consumption, but also ran much more slowly than Java:

    http://shootout.alioth.debian.org/benchmark.php?te st=all&lang=java&lang2=ruby&sort=fullcpu

  5. Loving complexity for complexity's sake by Man_Holmes · · Score: 4, Interesting

    You just have to love java programmers making the easy more difficult. What I have learned in managing developers is that you have to constantly fight their desire to make things more complicated without a valid reason for doing so.

    He's correct that certain tasks are easier in Ruby than in java, not to mention that the code is more readable. But he is missing in my opinion the most important part of Rails and that the ORM. Use scaffolding or don't use it. But if you bypass Active Record you're just making more work for yourself.

    Man Holmes

    1. Re:Loving complexity for complexity's sake by Decaff · · Score: 3, Informative

      2) Java needs a lot of RAM. If you try to run a java app on a smallish box, chances are it will start swapping.
      3) Swing is Slow, it makes Java GUIs feel cluncky. SWT is much better for the user, it "feels" more responsive.


      Both these are now way out of date. Java memory handling has been tidied up. As even a 'smallish box' these days is more than 128MB, memory really is not going to be a problem at all.

      Swing is hugely faster these days, to the extend where it is often reported to be more responsive than SWT on some platforms (such as Linux). Swing is now by default OpenGL or DirectX accelerated.

    2. 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.

  6. Go Java! by HillaryWBush · · Score: 4, Interesting
    Moreover, some things are just plain easier to do in Ruby than they are in the Java language."

    Congratulations Java, you've finally proven yourself as the new Benchmark(TM). Enjoy a lifetime of groundless belittlement.

    By the way, if moreover isn't on this list, it sure ought to be. Over.

  7. Re:What I need to know by Geoffreyerffoeg · · Score: 3, Interesting

    Before I even consider Ruby: is it faster and less memory hungry than Java.

    Yes on both counts. It's faster for you to write programs, and requires less of a learning curve.

  8. Re:So, what's it like? by arevos · · Score: 3, Informative
    As a side note, why is it the people so quickly forget what these languages are really for. They are Rapid Application Development(RAD) and prototyping languages. You're not supposed to ship products developed with these languages! You're supposed to prototype the application and if it looks viable, develop it in a real language like C or C++!

    Why? The speed of C and C++ are hardly needed for most applications, and languages like Ruby and Python can leverage GUI toolkits like Qt and GTK. If your Qt Ruby application is indistinguishable from your Qt C++ application, why waste time developing in C++ if you don't have to?

  9. The author of the article, Andy Glover... by tcopeland · · Score: 4, Informative

    ...is a good guy to write this sort of thing since he's been programming Java for a long time and has also branched out into "dynamic Java" things like Groovy. He's done a bunch of stuff on dbUnit (including a dbUnit chapter in Java Testing Patterns), too. So he's had enough experience with Java to know what's what.

    I'm probably biased, though, since Andy also wrote the CPD Ant task.

  10. 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.

  11. 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
  12. Re:What I need to know by badfish99 · · Score: 3, Funny
    Aristotle would have wanted Greek, and Jesus would have wanted Aramaic. So no, ISO-8859-1 was not good enough for them. Nor is it much use for the majority of people in the world today.

    As for Shakespeare, he couldn't even spell his own name, so he didn't care.

  13. What is .Net's competition? by bigtallmofo · · Score: 4, Interesting

    I've often heard comparisons of .Net to Java and for a while there it seemed to me like they were two separate but somewhat equal development environments. Now it seems that several languages/environments have been coming up (PHP/Ruby) and many articles I see compare it to Java or explain how it's competing with Java.

    What does the future hold in terms of what environment will "come out on top" when Java seems to be compared to or even competing against so many languages while .Net doesn't seem to have such competition?

    --
    I'm a big tall mofo.
  14. 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

  15. 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.

  16. Use my new language called Booby by Anonymous Coward · · Score: 3, Funny

    It does everything every other language
    does but some things are easier and some things are harder.
    Because its relatively new you get to rewrite a bazillion
    lines of library code and API's that already exists in other languages.
    Furthermore you will become even more multilingual than you used
    to be so you can raise language critique to an even higher (f)art
    form. One profound difference, for example, is that Booby uses braces
    but they are reversed from C++ and Java i.e. the open brace is } instead of {.
    I expect to see a whole book on the ramifications
    of that alone.

  17. Re:Ruby & Java == Moriarity & Holmes by SmallOak · · Score: 3, Informative

    "The real question is, can ruby be defined on its own terms, and not Java's?"

    I'm not sure this is even a issue. the Disussion on Ruby Vs Java seems to happen totaly outside the Ruby 'community'. I read a lot of Ruby programmer blogs and don't see Java mentioned that much.

    Interesting reading

    http://www.artima.com/intv/ruby.html
    The Philosophy of Ruby: A Conversation with Yukihiro Matsumoto

  18. 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.

  19. 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.
  20. Re:So, what's it like? by arevos · · Score: 4, Informative
    With the right tools and a good IDE, Java web development can be fast. Not as fast as getting the initial pages up with Rails scaffolding, sure (although projects like Trails come close), but still fast.

    I'm doubtful. I bump up against the limitations of Java every other day, and it seems like the only way you could get around such things is with an awful lot of code generation.

    For instance, I was recently writing a Java class to convert an XML DOM into a custom object tree. This largely involved writing getters and setters, and for loops to iterate over NodeLists to pull out descendant elements. I couldn't help thinking that with Ruby, I could have written "has_attributes" and "has_descendants" methods, and generated the getters and setters and DOM handling automatically. Instead of my classes being 50 lines apiece, they could have just been 4. It would have taken me far less time in Ruby than I did in Java, because Java hasn't got metaclass-like abilities like Ruby or Python.

  21. How Ruby fits in for my work. by mpn14tech · · Score: 3, Informative

    I work as a java developer, but I still still have plenty of other languages in my toolbox. I have just started with experimenting with Ruby. The biggest thing I see is that Ruby fills gap for me between perl and Beanshell.
    The programming hierarchy I tend to think of for my work,
    1. Shell- Basic scripting. Glueing commands together.
    2. Perl- More powerful sripting features, but not really OO.
    3. Ruby- Still a scripting language, but designed around OO.
    4. BeanShell- Good for quick glueing of java classes together
    5. Java- When I need a full compiled application environment.

    For me each language has its purpose and I use them where it best gets
    the job done.

  22. Ways of Using Ruby by TheUncleD · · Score: 4, Informative
    Also, there's many different ways of using Ruby besides Rails. Rails is ONE freamework. Iowa is another here you can find out . Another is just plain eruby mod_ruby. Another is cgikit, a friend of mine uses it exclusively although it has little english documentation at this time.

    Rails as has been said, is a framework. Ruby is the language, and all rails is just ruby with a design in place to make it easier. Some great tools for using rails are becoming available though, due to its increasing user-base. A lot of people are still "trying it, and going back to php" but its got a core user group now and that's what counts.

  23. Re:Purpose of being verbose by ealar+dlanvuli · · Score: 3, Funny

    I'm sorry. I've probably written 200kloc of Java in my life. I have never noticed this painful repitition? Where is it?

    Thanks,
    Sean

    --
    I live in a giant bucket.
  24. Is Ruby desperate ? by what+about · · Score: 4, Interesting

    Given the number of posts in java.net and slashdot on how Ruby is the greatest thing of all (and no mention at all of any negative side) I start wondering why is Ruby desperate to move Java programmers from Java to Ruby

    Personally I do not trust a language that has no negatives sides (or at least the Ruby people seems to think so), until it becomes clear what is the other side of Ruby I am not going to use it.

    (Yes, I have visited the Ruby website)

  25. Re:Purpose of being verbose by tunah · · Score: 4, Insightful

    StringTokenizer st = new StringTokenizer(s);

    --
    Free Java games for your phone: Tontie, Sokoban
  26. 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.
  27. Re:Purpose of being verbose by mav[LAG] · · Score: 3, Funny
    Well, fuck you too, buddy. Merry Christmas to your ignorant ass.

    Tsk tsk. You're taking this way too personally.

    I'm sure it's easy to copypaste some strawman argument containing hilarious phrases such as "pointy-haired boss" which the children will find irresistible, since they know nothing about the actual merits of the arguments, having never managed anyone, let alone a group of people who work together to achieve objectives such as saving people's lives, or even less noble objectives such as creating a software platform to aid the collective research efforts of thousands of researchers.

    I rest my case. The above paragraph is one sentence! Obviously working with Java's crufty verbosity has affected your writing. I'd suggest taking a course in a more pithy language. By the way, Graham's argument is not a strawman: he's made it clear over a few different essays that because programming languages vary in power, smart coders who use more powerful languages can code circles around those using Java. Also if you're going to drag in logical fallacies then I need to point out yours too: "saving people's lives" and "aiding ... thousands of researchers" has nothing whatever to do with the merits of Java versus other programming languages. It's an emotional red herring.

    I have used hundreds of thousands of dollars on Python code which the author believed to be really maintainable and work really well, but in the reality-based world turned to be such crap that the whole team, including me, had to work a breakneck pace to rewrite it in Java, which has such incredible features as working threading support, no Global Interpreter Lock, actual Oracle and LDAP support that doesn't leak memory like anything, and isn't 20 times slower than the Oracle and LDAP support in other languages, no monkey patches (oh yeah, Python coders seem to think that it's SUCH a good idea to monkeypatch others' code, since after all, SMART people should know without any documentation what's going on, and documentating code is useless anyway, people should just go in and read all of those millions of lines of code if they want to know what's going on) and, you know, clear and accurate documentation and HORDES of pre-existing components which make your life so much easier, if only you're not infected with the dreaded Python community NIH disease.

    Sheesh, I thought the previous sentence was bad but this one takes the cake. Full stops are your friend. So is coherence. Some answers:
    • If you paid hundreds of thousands of dollars for a component written by an idiot in a language your team doesn't use, then you're the bigger idiot.
    • Python does have working threads and the GIL has never bitten me when working with multi-threaded libraries in C.
    • Bummer about Oracle. Try Postgres instead. It's cheaper and better.
    • Monkeypatching is considered harmful by any Python programmer worth his salt.
    • Python comes with batteries included. Of all communities it's the one with the *least* amount of NIH syndome.

    Java does have an additional useful feature: because of its mandatory coding practises and standards it's pretty easy to spot when an amateur has written something really broken, and contain the problem to those components which the amateur has touched. Perhaps this is what has happened to you?

    Entirely possible. But I've seen good Java - really top of the line guru-doing-an-exercise-proposed-by-Martin_Fowler-s tandard type Java - and it was just plain ugly because the language is just plain ugly.

    I've used, in production, Python, Perl, C, C++, Pascal, Java, x86 assembly, a little AutoLisp, and so on. Hundreds of thousands of lines. (The C code I have out there is pretty crappy, for which I apologise, but I was an amateur and thought of my work much as you seem to think now.)

    Can't recall making any comments about your work or even you personally. *Checks* - nope. You

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