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.'"
Of Dupe!
www.2ya.us
It's quite obvious that the concept of the automatic code generation done in Ruby On Rails was either not completely grasped or completely missed by the author. The whole purpose of the code being generated was to give you a basic structure to take and change until it was what you needed it to be. This is precisely why it is called 'scaffolding', because it gives you the framework to get started with.
As far as the Ruby On Rails framework itself is concerned, it is extremely capable and flexible for handling a great deal of web application projects. Of course there will be specific functionality that Ruby On Rails will not handle very well -- there never are perfect solutions.
I wouldn't consider the reviewers objections completely devoid of import, just misguided. You must always be careful about anything you didn't do yourself, but you must exert the same care and attention to the stuff that you do create yourself! Often we put far too much confidence in our own coding skills.
So, in the end, the concept of Ruby On Rails is simply to alleviate the mundane, rote programming that goes into the basics, particularly the structure and minimalistic database interaction, and make it surprisingly simple.
Deal or no Deal?
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.
Rails is _not_ a code generation framework. Note the period on that sentence. Rails may provide the some simple scaffold generation, but that's only there if you _want_ to use it, and it happens to fit the way you'd like a particular part of your app to work. The code produced is concise, easy-to-follow, and thus easy-to-maintain. For my own applications, I barely ever use scaffolding. It works well for simple admin screens where I just want 'something' that works for now, then will spend some effort on designing it a little better, later. Rails is as maintainable as you make it. If you're a poor programmer, you're likely to write unmaintainable code, no matter what language or framework you have to help you. Rails helps point you in the right direction, but in the end, it's up to the _developer_ how maintainable his/her code is.
a sad 30rld. At
MOD THE TROLL DOWN!!!
This is a generic resonse, which has nothing to do with the article. The guy who posted it posted at least one other generic "Rails" response, having absolutely zilch to do with the article.
Too bad Python wasn't even given the slightest mention; all of the wonderful features the article raved about have been staple features of both langugages for quite some time now. I'd jump on the Ruby train myself, except that the Perl-like use of strange punctuation sort of turns me off when one of my biggest reasons for the jump to Python was readability. Then again, this guy kinda sounds like one of those many hardcore Java programmers who'd finally given it up and mass exodused to Ruby...
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
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.
To the best of my knowledge, I have never used a Ruby application. Are Ruby applications slow and resource excessive like Java ones? I don't like Java applications and I don't want anything like them from any language.
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++!
So, does Ruby blow goats like Java does or what?
Wow, they have Ruby off the Rails now?
With apologies to Homer Simpson...
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 =14310517
...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
That goes for any sane modern language.
I am trolling
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.
.Net doesn't seem to have such competition?
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
I'm a big tall mofo.
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.
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.
Robot or no robot, you're still copying highly-modded posts from previous threads and passing them off as your own, which is reprehensible.
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.
...the basic definition of being derailed?
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
not going home of Jordan Hubbard Posts. Therefore FrreBSD core team clear she couldn't
The language was created by Yukihiro "Matz" Matsumoto, who started working on Ruby on February 24, 1993 and released it to the public in 1995.
g uage
That is about the same time Java took off.
http://en.wikipedia.org/wiki/Ruby_programming_lan
http://groups.google.com/group/comp.lang.ruby/brow se_thread/thread/71e50a25544210a9/
www.rubyholic.com
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.
I mean, it isn't ALL about performance. Maintainability is probably the #1 coding related issue I hear about. Performance always matters. It just isn't always the primary concern. As a developer in internal and B2B IT systems to 8 years, performance is usually far down on the list. The hired help can wait an extra second for a system response to save development and maintenance costs.
Blar.
This may be more active and more complete: http://rubygarden.org/ruby?RubyUserGroups.
Java is the blue pill
Choose the red pill
How come whenever someone mentions Ruby on Rails a get a picture of the Monopoly Guy hanging out of a train on that "Goto Pacific Railroad" (or whatever) chance card?
I've worked on enough jobs where the previous author wrote in shorthand and didn't follow good coding practices. The end result is the next person writing the code has to spend a lot of timer figuring out exactly what the heck the code does. Dynamic languages are great and they provide a lot of ways of saving typing, but what a programmers goals are is different than a company. A company wants the code well documented and easy for someone new to understand. This makes sure the company isn't at the mercy of a single programmer. Should a programmer leave, a company wants to make sure someone else can pick up the code and be productive quickly.
For all those eletist who think, "I want to write a few lines as possible", the reason why managers and executives like Java is the verboseness + strong emphasis on good coding practices. That is the primary contribution of Sun to the programming world.
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.
I used Ruby for a while a few years ago, enough to fall in love with it and wish I had more uses for it. I was unable to think of anything that I could do in Perl and not do more readably in Ruby, or anything I could do in Python and not do more easily in Ruby.
Then again, I like Common Lisp and my Christmas list this year included an open-source Miranda compiler.
Agreed. The main reason that Rails's limitations don't sink it for me is how easy Ruby makes it to extend / modify the base to suit your needs. I didn't like the way ActiveRecord serialized some objects--so I wrote my own serialization in a few dozen lines of code.
--MarkusQ
Furthermore, he gives Ruby an attaboy for allowing him to define both classes in one file. I'm not sure why that would be terribly important to him, but it can be done rather simply in java too. The rule is one public class per file. There's nothing wrong with multiple package classes in the same file, so if you aren't producing a library for others to use, write your whole darned program in one file if that floats your boat. He could even do multiple public classes by making them inner classes of the named class. But honestly, I don't understand why packing two classes into one file qualifies as a major achievement. Finally, when he gets into the filtering code, I notice a glaring omission; Import statements of some kind. Am I to understand it's back to C style name collisions with Ruby?
Aside from showing how 'terse' Ruby can be, about the only praise he has for the language is that it is dynamically typed. In other words, you don't need a Java interface to call a method. I can still do that in Java with reflection: java.lang.reflect.Method Strong typing isn't the huge PITA a lot of people try to make it out to be. Casting and RTTI gets old sure. If you're doing a lot of casting and RTTI though, then it's a pretty good sign that you need to refactor your code.
I'm not trying to pooh pooh Ruby here guys, but this doesn't seem like a very persuasive sermon to convert all the Java programmers of the world. In short, I still fail to see what all the fuss is about.
At my university we currently have a software project running. Or rather, it's part of the curriculum that during basic studies every CS student has to do a one-year project, which changes every year. Our assignment is to redesign the IEEE Reengineering Bibliography (how fitting) using Java. The best solution is to be used by the IEEE - no wonder, since the old site was put together by the lecturer responsible for the project (he also maintains it and is responsible for 90% of the entries. It's not a very popular site). Put together rather badly, I might add - the site went live in 1995, wasn't updated design-wise a single time (do you remember what passed as good site design back in 1995? The site barely lives up to that) and on the server side is a horrible hodgepodge of awk, sed, CGI/C++ and Bourne shell scripts. Using CVS to backup the database, which happens to reside in two text files, one being a BibTeX document and the other one apparently in a custom format.
I'm not saying that awk, sed, the Bourne shell, C++, CVS and BibTeX are bad, but mixing them in a live application creates something vaguely resembling a Rube Goldberg device. Ugh.
USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
I just googled for a Haskell implementation in Java. I'm in the development team of an (admittedly comatose) project to create a Java-based game RAD environment (we are (were) aiming for something like the RPG Maker XP, if you happen to know it) and one of the key features is "script in any language you please (as long as it's on the list)". Java interpreters for script languages like Rhino or JRuby would plug into a defined interface and the scripts would be saved with metadata indicating dependencies like the interpreter version. This vening I thought how cool (although mostly impractical) it would be to script a game in Haskell.
Although, of course, for math-heavy games (economy simulations?) Haskell would suddenly turn into the epitome of elegance. I think that Haskell only really shines when it's used to do stuff that would be expressed as formulae anyway. But it really does shine, then.
I'm sorry that I can't offer deeper insight into Lisp, but I could make a generic comment about parentheses.
USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
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++!
;)
Someone better tell the Gentoo guys to redo Portage in C++. Obviously the current implementation does not have the performance neccessary for the critical job of zero-latency package management.
Of course I'm kidding. No one would develop in a language like C++, which was developed for schools in order to make learning real languages like PHP, Visual Prolog or Objective-Befunge easier.
USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
Its on par with C for speed.
I love Ruby and Python, but in the general discussion of dynamic languages, be sure to mention Tcl. Tcl was heavily supported by Sun, until Sun decided to throw its full weight behind Java. Between Sun, AOL, and several other companies over the years, the language had enough development money poured into it to make it easily in the same league as Python, Perl, Ruby, and even Java. I realize that the topic here is Ruby, but since the general discussion has drifted to dynamic languages in general, Tcl should also be mentioned. If anyone is interested in learning more, I think the best place to start is the Tcl'ers Wiki: http://wiki.tcl.tk
"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."
Then why are you developing in java and its huge memory and cpu costs? To do anything in such limited language, you have to load tons of class libraries, running in the same runtime. By constrast, ruby has many good specialised data types and operators builtin, which do away with many uses for libs, and its libraries are thin wrappers to C compiled stuff running natively...
"There are alternatives - you can use both Ruby and Java together (JRuby works on the JVM)."
It sounds stupid to me to build a runtime on top of another runtime, if the goal is performance.
If your users demand performance above anything else, i suggest you deliver your software without a slow, bulky runtime and have good, experienced programmers who can recognize bottlenecks and fix them, rather than rely on stupid compiler optimizations for things that can't be optimized (i.e: bad algorithms ). Of course, you have all the time in the world in your hands, since performance comes above all...
I don't feel like it...
In Python, to loop through an array:
for item in array
print item
Can Ruby do this in 2 lines?
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)
Ah. The joys of previewing and still missing silly mistakes. And although English isn't my native language, I don't think that counts for much of an excuse.
"where often teased with": read "were often teased about". Or something like that anyway.
-Lasse
I haven't explored Ruby much, but as I read through each of the features touted the article, one thing that came to mind was how similar many of them are to Perl both in syntax and in usefulness. (Background: generally I use Java at work and LAMP(erl) for managing my own websites.) So let's do a little closer comparison of the three languages. If any Ruby experts want to jump in and correct anything, I'd be interested in hearing it.
Syntactically, Ruby seems to be much closer to Perl than Java - this feels like a apples-and-oranges article. I know Java and Perl both compile to bytecode, both approach native speed in practice, and both have a extensive set of libraries. I would only assume that Ruby is the same.
I'm sure I'm missing many of the intermediate-to-advanced features of Ruby, but what would make me choose Ruby over Perl? Anyone else feel like diving in?
Ruby is nothing like Java! Granted, the two languages to both have frameworks for web applications, but this article, of course, has nothing to do with web applications. Ruby as a language should be compared with Perl, Python, Smalltalk, etc. Java was designed for completely different things. It's apples to oranges.
Because it wasn't done at the time XP was released (2001). Since it was released, they have, however, made it available as an optional component via Windows Update. They will of course be including it with every new operating system: the Compact Framework has already been included since Pocket PC 2003, it's in Server 2003 and it sure as hell will be in Vista.
As a developer of consumer software, I'm loath to burden my 6 MB download with the 20MB millstone of the .NET framework
Many of the smaller Java applications don't bundle the JVM either (although some include it as an option), and it's worked out just fine for them. If a user can download your software (if you're on a slow modem, 6MB is nothing to sneeze at), they sure as hell can download one (1) executable file and go through the painful process of double-clicking it to install the framework. I'm pretty sure if you can't walk your grandmother through that, you won't walk her through installing your software, either.
May Peace Prevail On Earth
As with C++, Java owes far more to Simula-67 than Smalltalk.
I'm not going to change your sheets again, Mr. Hastings.
Afaik, Simula-67 had no JIT and Virtual Machine (or did it?), while Smalltalk did. And JIT and Virtual Machine is the basis of Java's success. I meant not just the language itself but more a solution here.
May Peace Prevail On Earth
My comment was based on the Java language rather than how certain implementations of it work (not all Java compilers target byte code for a VM -- some directly emit native codes).
And in any case, Smalltalk was far from being the first language to use a VM. LISP and some COBOL systems had them in the late 1950s, and a wide variety appeared during the 1960s and 1970s. Note that I am not talking about interpreters here, but compilers that emitted byte codes which are run by a "software CPU" that is then implemented on a variety of platforms. As for JITs, those found their way into some Smalltalk implementations _after_ they appeared for Java, not before.
I would therefore contend that Java owes little if anything to Smalltalk. Its syntax and semantics are based on C++, which in its turn was heavily influenced by Simula-67; its use of a VM can be traced back to systems that predate Smalltalk by decades; and it uses a traditional "edit in any text editor, save the file, compile it, repeat" cycle rather than the Smalltalk method of programming by environmental extension.
I'm not going to change your sheets again, Mr. Hastings.
I know this is a bit a of a flame, but Java is anything but fast. I've seen too many bloated Java app servers to know of its 'speed'. If you have fast box and gobbs of memory, then Java runs adequately. Im sure Ruby is not a speed burning language either, but I would accept the tradeoff of easier and quicker development. I would like to see some examples of some larger scale Ruby web apps however.
What about JRuby, Ruby written in java so you can call the java stuff from it.