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.'"
Why was this modded up? The article doesn't even mention code generation. It compares Ruby and Java as generic development languages.
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
Ruby is useless to me because it has no unicode support.
e st=all&lang=java&lang2=ruby&sort=fullcpu
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?t
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?
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.
What a great generalisation! Not everything that looks easy is really easy. Not all code can be 'quick fixes'. Ruby on Rails may have its place, but Java and it's frameworks really shine when you need very high performance and a range of scalability options.
...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.
The Army reading list
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!
Ruby could be just an also-ran if it didn't have Java to kick around. After ten years of spotlight, it's not hard to find detractors. The real question is, can ruby be defined on its own terms, and not Java's? Doesn't seem like it so far, which isn't good news for longevity.
Also, what you're forgetting is that some programmers like the clarity of a well-defined class hierarchy, and Java's got that. Ruby has got some pretty muddy classes that try to do too much.
O lord, bless this thy holy hand grenade, that with it thou mayest blow thine enemies to tiny bits, in thy mercy.
The chosen language is one of the things that the Consumer (maybe they not think the same, but, whatever) is most aware of. Let's see... The Consumer wants programs that are:
1 - Efficient (memory, processor, net, and disk usage,...)
2 - Bug-free
3 - Cheap
A low level language leads to 1, but not to 2 and 3. A good hight level language leads to 2 and 3, but not to 1. How well received your programs is depends only on how well it fits the Consumer's expectations (and how fat is your marketing bill), so the language matters.
Also, Ruby + Java doesn't lead to a nice combo. The ideal combinations are with languages of different abstraction levels, like Ruby + C, or Ruby + some excelent hight level framework for web pages, aka Rails. So bad Java doesn't combine well with low level languages.
Rethinking email
http://groups.google.com/group/comp.lang.ruby/brow se_thread/thread/71e50a25544210a9/
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.
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.
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.
But the benchmark you site uses Ruby 1.9 which is unreleased, unfinished, unoptimized and not even beta yet. It was compared to a fully optimized Java release: Java HotSpot(TM) Server VM (build 1.4.2_05-b04, mixed mode).
Attacking a set of benchmarks based on softare versions is not helpful unless you supply measurements that support your point. And please note that Java 1.4.2 is not current. Scientific evaluation rather than hand waving, please.
When I say that Ruby drastically improves programmer productivity compared to Java
I'd accept this based on my experiences with Python. However I think you give that up in testing - especially as the size of the programmer team grows. Dynamically typed languages are subject to more runtime errors than statically typed languages, and run time errors are more expensive to test for and to catch.
I have not yet detected a single memory leak in my c++ apps using runtime tracers after I started using smartpointers (boost) and a c++ lint checking.
That contravales most opinions regarding smart pointers - while they reduce memory management problems in C++, reference miscounts and circular references in smart pointer based code still leave C++ programs more vulnerable to memory leaks than programs with built-in GC implementations that are more robust in handling these conditions.
Actually in an array (it doesn't work so well in a hash) you can just do this:
puts array
That's it.
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.
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.
The article isn't about Rails... in fact it's not even about database-driven websites... or even web programming in general. It's just a comparison of the Ruby and Java languages in general. ORM is neither here nor there.