Slashdot Mirror


What's the Secret Sauce in Ruby on Rails?

An anonymous reader writes "Ruby on Rails seems to be a lightning rod for controversy. At the heart of most of the controversy lies amazing productivity claims. Rails isn't a better hammer; it's a different kind of tool. This article explores the compromises and design decisions that went into making Rails so productive within its niche."

74 of 414 comments (clear)

  1. A question... by $1uck · · Score: 2, Insightful

    I've not seen a lot of RoR, but what I have seen reminded me a lot of ASP and JSP with lots of scriplets. Which I thought was bad form (code mixed with html). Have I just been looking at bad (or simple) examples? The article seems to hint that RoR does support MVC.

    1. Re:A question... by BorgCopyeditor · · Score: 2, Insightful

      You've been looking only at the 'V' part of it all. Some people put things in V that belong in M or C. That's not Rails' fault.

      --
      Shop as usual. And avoid panic buying.
    2. Re:A question... by masklinn · · Score: 4, Informative

      Fact is that Rails template (rhtml files, the views) are scripted directly using Ruby (there is no specific view/template language). This means that they can be abused, not that they should.

      When used well, Rails views are actually quite clean due to the high readability of Ruby itself and the ability to rapidly create so-called Helpers (Ruby methods that you can call from your views, to build specific HTML structures from generic datum, since you come from JSP land think Taglibs, but much simpler to define & use)

      Seems like DHH found Ruby simple enough to just use it as a templating language (and it works quite well), that's his choice, other frameworks in other languages picked a different one (Python's Django has a template-specific language for example, much simpler and less powerful than full blown Ruby but much less prone to abuse either)

      --
      "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
    3. Re:A question... by $1uck · · Score: 2, Interesting

      I should've figured as much before posting. I've just heard so much about RoR being the greatest thing since sliced bread. I really haven't been exposed to it, until I started looking into using AJAX for work (doing .NET and Java). When I saw some code and it reminded me of old ASP and JSP + Scriplets, I was just shocked.

      As to your sig, I can't say I have any love for VB (especially after being forced to use it), but after trying to deal with the MFC and doing GUI aps in C++ on a windows machine, I understand why it was created. Still think they should've just done a better job with the MFC or created something less retarded than VB.

    4. Re:A question... by FuzzzyLogik · · Score: 2, Informative

      You can use a lot of different templating languages here. A few off hand... Liquid Markaby You can write your own in fact. There's actually two that come in Rails, Builder for creating xml files (rxml) and the other you normally see for building html pages (rhtml suffix)

  2. It's Ruby by LABob · · Score: 3, Insightful

    I've only used Rails a bit, but I've used Ruby a lot. It's by far the most flexible language I've ever used. It allows programmers to modify the most fundmental aspects of the language. Some argue this is a bad thing, and it may be. However, having the freedom to do that is very empowering. Don't get me wrong, other OO scripting languages are great too... Python for example. And, they share many concepts with Ruby. The things that make Ruby stand out (to me) are the ease of modification and syntax flexibility. IMO, Ruby is a wonderul toolkit that will allow one to build most anything, even more specialized tools like Rails.

    1. Re:It's Ruby by Nicolay77 · · Score: 2, Funny

      It's by far the most flexible language I've ever used. It allows programmers to modify the most fundmental aspects of the language.

      I guess you will love LISP macros.

      --
      We are Turing O-Machines. The Oracle is out there.
    2. Re:It's Ruby by x2A · · Score: 2, Informative

      I think you need to read the post you replied to again, especially how the second sentence (beginning "Everything") changes the meaning of the first sentence, which you replied to as if the second one wasn't even there.

      --
      The revolution will not be televised... but it will have a page on Wikipedia
    3. Re:It's Ruby by penguin-collective · · Score: 2, Interesting

      Then what is Java, if not just another C++ with less features.

      Actually, Java has considerably more features than C++, including garbage collection, runtime safety, well-defined dynamic loading, full reflection, and runtime code generation.

      With a tool like Ruby, someone has created these "library" routines for him.

      Ruby's libraries are poor compared to Perl's or Python's, so if it all were up to library code, Ruby wouldn't be popular.

      so, what innovation did C/C++ give us? General Purpose tools. The fact that these can turn their hand to anything, is, IMHO, the reason they're so popular today compared to any other language that can do X, Y, or Z better.

      Neither C nor C++ were the first general purpose languages by a long shot, nor have they ever been the best. The thing that made C popular was that it was free with UNIX to universities and was easy to implement. The thing that made C++ popular was that it was a simple (simplistic, as it turned out) extension of C that was fully backwards compatible. That's all. There was no innovation in either of those languages.

  3. Re:Nice Summary. by Sky+Cry · · Score: 2, Funny

    Nice summary. Too bad it's stolen verbatim from TFA.

    I bet noone would realize, since nobody ever reads TFA. It's a sad world, when people steal summaries from the articles they link to.

  4. It's multiparadigm. by Anonymous Coward · · Score: 2, Informative

    The big benefit is that it's multiparadigm. It draws the best from the OO world of Smalltalk, while also offering very solid functional features. These are the traits of languages that are suitable for high-quality, fast-turnaround software development.

    We can see Ruby applications that are comparable functionality-wise (and portability-wise) to C++ programs, but written in a 1/10 of the time with 1/20 the number of lines of code. That's why Ruby-based solutions are effective and popular.

    1. Re:It's multiparadigm. by Abcd1234 · · Score: 2, Interesting

      It draws the best from the OO world of Smalltalk, while also offering very solid functional features.

      Uhh, dude... that is Smalltalk. Smalltalk was specifically designed to meld OO development methodologies with the power of functional languages like LISP. Why do you think that blocks and functions are first class objects in Smalltalk? Or that it has proper lexical closures?

      In fact, every time I look at Ruby, all I see is a pale reflection of Smalltalk. I've yet to see anything new it brings to the table.

    2. Re:It's multiparadigm. by Tablizer · · Score: 2

      We can see Ruby applications that are comparable functionality-wise (and portability-wise) to C++ programs, but written in a 1/10 of the time with 1/20 the number of lines of code.

      That's not hard to do. Almost every scriptish language beats C and C++ in those regards. C/C++ claim to fame is hardware closeness and machine speed, NOT human productivity.

    3. Re:It's multiparadigm. by rossifer · · Score: 4, Insightful

      In fact, every time I look at Ruby, all I see is a pale reflection of Smalltalk. I've yet to see anything new it brings to the table.

      Deliverable packaging. Extracting a Smalltalk program from the development environment for distribution is, to be generous, annoying. Which is one of the reasons why Smalltalk works so well in an academic environment, but never caught on for commercial work. Ruby, on the other hand, is about as tough for someone else to deploy as Perl (it isn't).

      This is one of the places where Java really changed things and is IMHO, the big reason for why Java has become so popular. .jar files (and the variations on that theme: .war, .ear, etc.) can package up lots of different things, and as long as people know what VM version to run it on, they're good.

      Regards,
      Ross

  5. Relentlessly applying best practices by Scarblac · · Score: 5, Informative

    As far as I've seen, there isn't that much actually new in RoR. But it's obvious that someone has had a great idea how a whole bunch of known stuff should fit together, in a way that encourages best practices (like a lot of testing, and code reuse). It has near perfect design.


    The language Ruby wasn't new; Active Record wasn't new, nor was the idea, but it fits with Ruby really well. MVC was old, but the tiny bits of boilerplate needed makes it look like magic now and then. Everybody knows testing is essential, but I hadn't seen it integrated into a web framework so well before. The idea of "sensible defaults" can't have been new, but the switch from reams of XML (in Java web programming) to near invisible config is great. The object-oriented Javascript libraries it uses weren't new, nor are template languages, but the way in which they're added together is pretty seamless. Et cetera.


    No wonder every web programming language community out there is rushing to put together it's own version of Rails... but the libraries don't always fit together as seamlessly. I think that Hansson's main achievements are recognizing that all the known best practices can be put together really well, and that Ruby and its libraries were a great fit for that.

    --
    I believe posters are recognized by their sig. So I made one.
    1. Re:Relentlessly applying best practices by SpacetimeComputing · · Score: 3, Interesting
      As far as I've seen, there isn't that much actually new in RoR. But it's obvious that someone has had a great idea how a whole bunch of known stuff should fit together

      Am I the only one who was reminded of Ajax at this point? Old technologies put together, lots of hype...
      --
      :wq
    2. Re:Relentlessly applying best practices by Decaff · · Score: 4, Interesting

      As far as I've seen, there isn't that much actually new in RoR. But it's obvious that someone has had a great idea how a whole bunch of known stuff should fit together, in a way that encourages best practices (like a lot of testing, and code reuse). It has near perfect design.

      No, it really doesn't, and to claim it does is to ignore the wide range of uses of object persistence. What it has is a great design for getting web interfaces up and running quickly on databases. It has a very poor design for long-term maintenance and growth of applications.

      The ActiveRecord pattern is of limited use, especially as implemented in Rails. Your code is not isolated from major changes in the schema, and the dynamic nature of Ruby means that the consequences of such changes can't be tracked by compilation or refactoring tools; especially as the model classes don't even exist as code. Tests are a good way to help with this, but try and design tests to deal with potential schema changes for a large application that may have transactions involving thousands of records...

      To see what a good persistence system should be like, take a look at Kodo or Xcalia - very high performance persistence system that allow exactly the same code and queries (which are automatically highly optimised for the particular database - not some minimal portable subset of SQL as in Rails) to be run on small embedded databases and high-end clustered systems. Unlike Rails, these systems can handle transactions of hundreds of thousands of records (something that is not that uncommon for commercial work) without thrashing disk or memory. You can also use the same code to persist and read to XML, LDAP and many other types of store. And yes, these systems also have 'convention over configuration' like Rails - they got there first, and had it years before RoR.

      RoR has some great ideas, and definitely has its uses, but to claim it has near perfect design is way out, and sorry, but best practise in data model design in object oriented languages like Ruby does not involve basing things on non-OOP relational tables!

    3. Re:Relentlessly applying best practices by aldheorte · · Score: 4, Interesting

      Yes as to hype, no as to technical merit.

      AJAX is based on technologies with extremely poor design and implementation, such as browsers, JavaScript, and HTML (poorly designed for this application, perfectly ok for marking up documents). Rails takes lessons learned from a decade of server-side Web development, as well as the catastrophe that has become J2EE through over-engineering, and simplifies it to the essential mechanisms. Built on top of Ruby, which is itself a pretty thin simplification wrapper over C++, it combines the simplification of Web site development best practices (MVC, proper tiers, etc.) with the power of an high level development language overlaid directly on top of a low level near-assembly language, with the ability to perforate the abstraction layer (first through modifying Rails source in Ruby, then through C extensions) if needed for performance or other reasons.

      Short, brutal version: AJAX built on crap by script kiddies, Rails on bedrock by software engineers.

    4. Re:Relentlessly applying best practices by I+Like+Pudding · · Score: 5, Insightful

      AJAX is based on technologies with extremely poor design and implementation, such as browsers, JavaScript, and HTML (poorly designed for this application, perfectly ok for marking up documents)

      The only part of that I'll give you is the poor IE implementation of CSS. Browsers' main problem lies in their non-compliance with standards. Solution: test in multiple browsers. WOW, THAT WAS HARD. Next up: JavaScript. Poor design? I was shocked at how powerful the language is when I finally started digging into it after years of avoidance. Poor imlpementation? Not really - just many different implementations. Of course, this can and has already been worked around with libs that abstract the differences away for you. HTML? It still is used as a basic markup language, with all the heavy lifting being pushed into the CSS. Now, CSS is nowhere near perfect, but it does function admirably in the scope of AJAX (when not using IE's broken ass implementation).

      Rails takes lessons learned from a decade of server-side Web development, as well as the catastrophe that has become J2EE through over-engineering, and simplifies it to the essential mechanisms.

      I half-agree. You imply a minimalism that isn't present. The framework is quite complicated in places and does a lot of tricky things. You see, programming with just the essential mechanisms sucks; you've gone back to CGI.pm. What Rails does is provide a massive lever with which to move your problem. The Actual Work Done Per Line of Code metric exceeds any other framework I have used before. Code efficiency is the watchword, not simplicity.

      Built on top of Ruby, which is itself a pretty thin simplification wrapper over C++,

      No it isn't. Ruby's implementation is a big, slow VM that doesn't act much like C++ at all. Really, the poor performance is the only thing I dont like about the language.

      it combines the simplification of Web site development best practices (MVC, proper tiers, etc.) with the power of an high level development language overlaid directly on top of a low level near-assembly language, with the ability to perforate the abstraction layer (first through modifying Rails source in Ruby, then through C extensions) if needed for performance or other reasons.

      That sounds like marketroid speak, and is about 3/4ths BS. Perforate the abstraction layer? Jesus. And just who is running around writing C++ extensions for web apps? Almost nobody. Takes too damn long, and isn't as safe as running through the VM.

      Short, brutal version: AJAX built on crap by script kiddies, Rails on bedrock by software engineers.

      DHH is something closer to a hacker, not to mention the fact that rails utilizes AJAX and, more generally, javascript all over the place. Does that make AJAX apps built on top Rails rock? Or does all that terrible, awful AJAX stuff diminish Rails? Maybe they, I don't know, utilise the same foundation technologies and standards and complement each other quite nicely? Maybe you are an idiot?

  6. Re:Rails zealots aren't hammers, they're just tool by sbrown123 · · Score: 3, Interesting

    I tried Rails for a bit. Found it nice. I found the language Ruby more interesting than the Rails framework. Rails code I looked at looked very much like JSP/ASP/PHP gone bad. All sorts of code in HTML land. Then their was the compilation oddities.

    I still believe that Java and PHP are better though. They also perform a hell of a lot faster and scale much better. For example, a friend was creating a site with Rails and wanted to put in integrated search. Several people attempted creating something like Apache's Lucene in Ruby but found that the Ruby's poor performance made the search incredible slow (you could time out before it finished getting your search results).

    What I would think would be really cool is a Lua plugin for Apache. That would be sweet.

  7. Re:Nice Summary. by Anonymous Coward · · Score: 2, Insightful
    Nice summary. Too bad it's stolen verbatim from TFA.


    So what? A summary should summarize the article (duh!). If the article itself does a good job at that, why reinvent the wheel?

  8. What Java can learn from RoR by tunabomber · · Score: 2, Interesting
    From TFA:
    • Enable hot deploy where it will shorten the development feedback loop or support frameworks that enable hot deploy. This priority should be much higher on the Java side than it is now.

    Amen to that. I think on-the-fly reinterpration of code is the biggest thing that Rails (or just about any other interpreted scripting language) provides that is a severe handicap for Java. I configure tomcat on my dev system to continuously rescan bytecode files for changes, but what is really needed is an easy, standardized way to make minor modifications to classes on production appserver without having to bring the whole thing down. I know some Java appservers support things like this, but I said "easy and standardized" meaning it can be done via an ant task that figures out exactly what classes have been changed, then notifies the appserver of this so that they get reloaded efficiently.

    • Use less XML and more convention. Conventions don't rule out configuration because you can use conventions to specify meaningful defaults and configuration to override convention. Using this approach, as Rails does, you get the best of both worlds: concise code with less repetition without sacrificing flexibility.

    I think the introduction of annotations with Java 1.5 also does a great job of cutting back on the amount of configuration files necessary. In addition, they leverage Java's biggest advantage over competing languages*- typesafety.

    *yes, C# has typesafety as well, but that's basically the same language.

    • Work to incorporate more scripting languages, including BeanShell (see Resources), for exploring Java classes during the debugging process.

    Eclipse's debugger does pretty much all I need, although things do get difficult when AOP or other bytecode modification is being used.

    --

    pi = 3.141592653589793helpimtrappedinauniversefactory71 ...
    1. Re:What Java can learn from RoR by CastrTroy · · Score: 3, Interesting

      That's one of the biggest things going against Java for the casual developer market too. Most shared hosts don't support Java for this very reason. You can't have users bringing down the server every time they need to update their code. This is probably the biggest reason why PHP is still as popular as it is. It's where a lot of developers get their start. I would love to use Java for my web development uses, but I'm not about to spend the money necessary to have web hosting that supports Java. I've also heard that there's some shared hosting companies that support Java, but they restart the server every night in order to accomodate this.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
  9. That or TurboGears. by cduffy · · Score: 4, Insightful

    (Django has been in use on high-volume production websites longer than Rails has existed, incidentally -- something which might be worthwhile when bringing it up in this kind of context).

    After evaluating Rails and Django, my company ended up going with TurboGears for some of our toolage (our main product is a Java Servlet-based application, and that's not changing). The reasons:

    • Rails and Django are very tightly integrated -- whereas with TurboGears the toolkit is loose enough that one can easily pull just one piece out for a project which doesn't need the framework as a whole. Our department does a lot of small and varied projects (many of which aren't webapps but which still could use an XML-based template engine or a simple OR mapper or a simple servlet-like API for handling requests independent of any content generation), so this was important to us.
    • We have more people in-house who know Python than Ruby.
    • TurboGears appears to be under more active development than Django.

    The opposing reasons:

    • Django and Rails have more high-volume production sites using them.
    • The OR mapper used by TurboGears, SQLObject, lacks some functionality and useful design attributes provided by others. This doesn't impact us for our little in-house projects, and is less relevant now that TurboGears 0.9 is adding support for using SQLAlchemy as an alternative to SQLObject.

    Anyhow -- Rails is nifty. Django is nifty. TurboGears is nifty. Quite likely all three of them have a place; I'd just like to urge people not to get so caught up in the hype over Rails that they forego evaluating other options.

  10. Re:Nice Summary. by CableModemSniper · · Score: 2, Informative

    Then it's been a sad world for a very long time.

    --
    Why not fork?
  11. The secret sauce is ... by Anonymous Coward · · Score: 3, Interesting

    thar RoR is using Ruby, a programming language that:

    a. is fully object-oriented (not a hybrid like c++ or java). For example, you can have "hello".length() or 5.inspect() which means easier debugging and easy extensibility when you can ("can" != "should") add methods to any class at runtime.

    b. supports mixins (flexibility of multiple inheritance without the complexity)

    c. supports blocks and closures (if you've never used a language that supports blocks and closures, then you don't know what you're missing. I've coded professionally for more than a decade using assembly (intel & motorola chips), c, c++, cobol (ugh), delphi, java, python, etc. and when I discovered how to use blocks and closures in Ruby last year, I almost fainted because it makes coding so much more productive)

    d. practical for both one-liners like perl and large/complex applications with a GUI interface

    When I discovered Ruby last year and tried RoR for the first time this month (stayed away due to dislike of hype), it felt like I was previously chopping trees with a plastic spoon all this time instead of using a chainsaw--Ruby succeeds because it takes so many great features from other languages and combines them in a cohesive manner. RoR succeeds because it uses Ruby and provides a framework that encourages good coding (by providing MVC for example).

    But there is a price for all of this. Speed. In order to provide so many productivity features, the performance will never reach that of c, c++, and many other languages. And I don't know when/if a compiler will ever be practical or available (like gcj for java producing huge binaries to print hello world).

    Other drawbacks include poor release management (remember the ruby 1.8.3 fiasco) and poor support for wxWidgets (Ruby has better support for Fox toolkkit, but I use wxWidgets with C++ so this isn't ideal for me).

    Anyway, I hope another new language comes along that'll blow away Ruby and another new web framework comes out that'll blow away RoR.

    Blind loyalty to language/os/software/etc is for idiots who are afraid of change. Be aggressively disloyal to your products and force their developers to improve or fade away.

  12. Re:i thought Ruby on Rails by Krimszon · · Score: 3, Informative

    To enable some of the RAD Ruby will infer much information from simple syntax and naming schemes. So if you start a class naming it Person, Ruby will look at a table called People to try to figure out the different fields/properties for that class. That's why it comes with some knowledge about plurals built-in.

    It's probably not that disturbing if you are used to it, and it is exactly what makes Ruby so fast for development. It's convention over configuration. In a different toolset, you might have to make a mapping from class to table using XML for instance.

  13. Rabid IP Hoarders and their Sauces by nead · · Score: 4, Insightful

    It really is tiresome to see people constantly ask "what's the special sauce" when in many instances it is clearly "nothing".

    Sometimes good people use good methods to build well conceived applications that work precisely as their audience expects they should. Because these well-formed applications do not fail randomly, scale well and are easily supported marketing and business types presume that there absolutely must be something patentable in the mix.

    One of the reasons I loath the term "Web 2.0" is because people presume there is some new wave of innovation occuring in application development when every Slashdot reader know's this isn't true.

    Technologies mature, standards mature and hopefully people mature. The result is better software, not an abundance of new and novel special sauces.

  14. Podcast with Author Bruce Tate by muchawi · · Score: 3, Interesting
    SHAMELESS PLUG:

    I interviewed the article's author, Bruce Tate, for the Ruby on Rails Podcast. He's a brilliant thinker and has taken bold steps to embrace Ruby inspite of his fame in the Java community.

    Rails Podcast with Bruce Tate

  15. Special sauce? by BorgCopyeditor · · Score: 4, Funny
    Farnsworth: Hmm. Let me see that vial, Bender. [He takes it and puts it in a microwave-like machine. A readout prints and he looks at it and gasps.] Good Lord! According to the spectrolizer, Spargle's magic ingredient was ... water. Ordinary water!

    [Everyone gasps.]

    Hermes: No!

    Fry: Ah, so the real gift Spargle gave you was confidence. The confidence to be your best.

    Farnsworth: Yes, ordinary water.... Laced with nothing more than a few spoonfuls of LSD.

    --
    Shop as usual. And avoid panic buying.
  16. Hidden reasons why ROR works so well... by smug_lisp_weenie · · Score: 4, Informative

    1. It's easy to build hash tables in Ruby- At any level of a hierarchical structure like HTML you can have an arbitrary number of child elements or attributes, all identified by a type tag. This happens to map perfectly onto ruby's hash tables, so to create an HTML link you can say:


    link_to :id => 'add user', :class => 'shiny button', :action => 'add_user'

    2. Lack of superfluous syntax It is very elegant how every programming idea in ruby seems to require only a single syntax concept at a single location to put it into practice- For instance, if you need a class member variable, you just create a name starting with "@" (like @firstname) without having to declare the variable in a separate location in the file. This is taken advantage of very cleanly by the ROR system, so that programming web pages has a very "WYSIWYG-ish" feel- Every concept in you web site has a clear, understandable equivalent embodiment in the Ruby code

    3. Dynamically detects missing methods- I don't know exactly how it works, but ruby classes are able to know when a method on an object is called at runtime that doesn't exist- So you can essentially enhance the functions an object supports at runtime... this allows Ruby toolkits, such as Rails, to essentially shoehorn their own custom language ideas into ruby (not quite at the level of Lisp's "defmacro", of course)

    4. It was scalable from day one- Right from the start, ROR was designed to scale- In fact, it was already part of a commercial app before it even existed as a stand-alone product. This means it already overcame the greatest hurdle of any web-development framework from day one- Most Scheme/Lisp frameworks, for instance, still haven't achieved the level of scalabilty that ROR had right from the start.

    5. It has a whiff of that mystical Scandinavian software guru-ism in it that make for seriously powerful software Creating a comprehensive web development system is a messy undertaking- ROR is the product of an obsessive Northern European fanaticism that somehow manages to combine an incredible pragmaticism and also manages to handle all of the many ways that web frameworks fail with the utmost of effectiveness. It isn't brilliant because it makes it easier to do complex things, as other frameworks try to- It's brilliant because it makes things that are already easy so much easier that all the complexity, though still complex, floats to the surface of your code and isn't obscured by the many "easy" parts.

    6. No pre-processor Many of the more advanced web-frameworks, as in JAVA, require pre-processing of HTML templates with embedded JAVA- The dynamicity of Ruby makes this step hidden- Explicit preprocessors are practically and cognitively difficult for programmers to deal with.

    These, I think, are some of the non-obvious reasons that give ROR the edge over other web frameworks.

    1. Re:Hidden reasons why ROR works so well... by Fweeky · · Score: 2, Informative
      If a method doesn't exist, Ruby calls method_missing:
      irb(main):001:0> class Foo
      irb(main):002:1> def method_missing(method, *args)
      irb(main):003:2> puts "Called #{method.inspect}(#{args.inspect})"
      irb(main):004 :2> end
      irb(main):005:1> end
      => nil
      irb(main):006:0> Foo.new.bla(1,2,:moo => 'bla')
      Called :bla([1, 2, {:moo=>"bla"}])
      => nil
    2. Re:Hidden reasons why ROR works so well... by killjoe · · Score: 3, Interesting

      What's great about rails? Well other people have talked about it, basically it encourages good software practices. Test first, DRY, MVC etc.

      What's great about Ruby? Community, community, community. The ruby community seems to be adopting the mantra of DRY (don't repeat yourself). If any project comes along and it shows superiority then the whole community gets behind it and it quickly becomes a de-facto standard. That's what happened with rails even though there were/are competing frameworks. Same thing with Mutt for example.

      Lastly the Ruby community early on were not afraid to take great ideas from the ecosystem. Gems for example is the ruby version of CPAN (the best thing about perl is CPAN). The python guys still haven't figured out why CPAN and gem are important. Ruby community doesn't seem to suffer from the not invented here syndrome.

      --
      evil is as evil does
    3. Re:Hidden reasons why ROR works so well... by shmert · · Score: 2, Interesting

      I think a lot of the benefits of RoR mentioned in the article can be achieved with a good IDE like IntelliJ.

      I can recompile any changed java classes on the fly (unless changing class structure). No need to recompile and restart the entire application.

      Autocomplete kicks ass. When invoking a method that takes a Foo object, autocomplete can show a list of all methods that return Foo or its subclasses. This is impossible in rails for several reasons. Lack of type-safety means you can pass any object as a parameter. Also, the auto-magic method names in ruby (like find_by_last_name_and_department) make this impossible, since the methods don't really even exist until invoked.

      Immediate feedback about syntax errors: If I misspell a method name, the editor flags it instantly. Contrast to a rails application where you won't see the bug until you invoke the action.

      Compile catches bugs at compile-time instead of runtime. If I refactor a method and it's still used somewhere, the compiler will find it. I suppose writing good tests in your rails app should catch this, if you have 100% test method coverage, but that seems like a pretty steep tradeoff.

      Namespace conflict! This single issue pretty much soured a friend of mine who was trying to learn ruby on rails. He was writing a simple test app for a trouble ticketing system. On the request edit page, he defined a @request global var, which mucked up the @request used by rails. Unclear "missing method" error messages popped up, and it took quite a while to figure out.

      There are some serious benefits to rails as well, the list you have is a good overview of the subtler advantages. I love the way you generate XML in rails, it fits the language so perfectly, because of the variable args, code blocks, and on-the-fly hashtable generation. It's definitely gratifying to see how much you can do with how little code, although in some places (like error checking) I think the concepts may have been overextended a bit. After evaluating my list of gripes with rails, and how it could be fixed, I came right back to what looked pretty much like WebObjects + IntelliJ (except for the hideous URLs in WO apps).

      --
      You drank my drink, you drunk!
  17. Re:Nice Summary. by Anonymous Coward · · Score: 4, Funny

    Nice comment. Too bad its stolen verbatim from the article AND the summary.

  18. Still no Unicode by shutdown+-p+now · · Score: 4, Informative
    The biggest problem with Ruby - and, by extension, Rails - in my book is almost complete lack of Unicode support. See for yourself:
    Please note that right now Rails basically knows nothing about Unicode and pretends everything is just bytes. It means that validates_length_of for multibyte characters will trigger errors at the wrong places, various kinds of Unicode whitespaces are not going to get trimmed and sometimes Rails will cut right into your characters. Absolute most of Rails internals makes no notion that multibyte text even exists, Rails just delegates all to the Ruby string handling code (which in current Ruby is all single-byte).

    This is being looked at, but in the meantime you use UTF8 encoded strings at your own risk and you can expect (and wil get) bugs and problems.

    It might not look like a big deal to English-speaking people, maybe also for Western Europe (they can usually get away with Latin-1). But the rest of us do need it... that, or going back to multiple charset/encoding hell.

    So, for now, it's Java or Python, and associated frameworks for me. But not RoR.

    1. Re:Still no Unicode by Dom2 · · Score: 4, Interesting
      That's pretty ironic given that ruby was developed by Japanese developers. I wonder what they did to deal with japanese characters.
      There's a well-known dislike of Unicode in Japan. They mostly use other character encoding schemes, such as SJIS. For more information on how to use UTF-8 in Rails so far, see HowToUseUnicodeStrings on the rails wiki.

      -Dom

  19. Re:i thought Ruby on Rails by arevos · · Score: 2, Insightful

    So you're not using Rails because it can pluralize "person" correctly? You'd prefer it to pluralize words incorrectly?

    For those unfamiliar with Rails, the it pluralizes the name of an activerecord class to get the name of the associated table. So if your class was named "Person", it would, by default, link it to the database table called "people". This is only default behaviour and, unsurprisingly, this can be overridden. It's a feature of the Rails framework, and nothing to do with Ruby.

  20. Re:My problem Ruby on Rails by rudedog · · Score: 2, Informative

    A reasonably up-to-date version of Rails (1.1.0) is directly installable in Debian testing and unstable; just use "apt-get install rails".

    If you're using Debian stable or prefer to use Rubygems to get the most up-to-date stuff, add this to your sources.list:

    deb http://www.sgtpepper.net/hyspro/deb unstable/
    deb-src http://www.sgtpepper.net/hyspro/deb unstable/

    Then "apt-get install rubygems".

    Then "gem install rails".

    Then set GEM_HOME to "/var/lib/gems/1.8" and add "/var/lib/gems/1.8/bin" to your path.

    Then do "rails my_new_project" and have fun.

  21. Zealotry, or simply inexperience? by Anonymous+Brave+Guy · · Score: 3, Informative

    Reading TFA, I wouldn't use words like zealotry or fanaticism to describe either the article or the attitude of the Java programmers it seems to be aimed at. What I do see, though, is a terribly narrow-minded view of programming, and an obvious lack of broader experience. Let's take a few choice quotes.

    From the About this series box, before we even get to the article itself:

    In the Crossing borders series, author Bruce Tate advances the notion that today's Java programmers are well served by learning other approaches and languages. The programming landscape has changed since Java technology was the obvious best choice for all development projects.

    Surely most of us would agree that any programmer is well-served by familiarity with a variety of languages, programming styles and tools, and by choosing the most appropriate for any given job. Which, despite the absurd claim above, has never been Java in all, or even most, cases.

    From the "Hype and skepticism" section:

    Rails proponents boast of incredible productivity, with some claims of 10 to 1 over Java development. As a Java programmer, your knee-jerk response is to dismiss any wild productivity claims because you've likely heard them before and been disappointed.

    No-one who's looked into a wide range of programming languages (and I don't mean Java, C++, C# and Visual Basic.Net) would find those claims particularly surprising or implausible. The functional programming world has been outclassing workhorse industrial languages like C++, Delphi, Java and co. in productivity by an order of magnitude for a long time, at least for the kind of application that lends itself to a functional style. So-called scripting languages, which cut away much of the boilerplate baggage required by the workhorses, have proven to be a much more efficient tool for many kinds of project as well, often due to relatively simple features like supporting common data structures as first-class entities.

    Moving on to the Rails philosophies, we see things like "Don't Repeat Yourself" being highlighted as "core opinions pervasive within Rails". Surely abstracting common code and data structures into reusable units is a basic principle of sound programming in pretty much any language?

    Then we get to the "niche" for Rails:

    I'd guess that as many as half of the applications built today are database-backed, Web-enabled applications.

    I'd guess that's wildly optimistic, though it's certainly a common conceit among Java programmers IME. Not everything in the programming world is web-enabled, and much of it has no interest in becoming so either. Why would a high-performance scientific application, a CAD/CAM/CAE package, a FPS or the firmware in your washing machine care about database-backing and Web-enabling?

    All-in-all, this seems to be an article aimed at die-hard Java programmers with little experience of the wider programming world. Its arguments support wider exposure to programming and good general programming principles, though it forgets to mention that Ruby on Rails is far from the only way of achieving those ends.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  22. Re:Nice Summary. by Alterion · · Score: 2, Funny

    exactly, this improves the amount of the article that most /.'ers will read by 100%

  23. Re:Conservative, not liberal. by Discordantus · · Score: 2, Informative

    Insightful? Good grief; someone misunderstands a word, turns it into a politics discussion, and gets modded insightful. Amazing. I especially like how he thinks the founding fathers were conservative. Haven't heard one like *that* in a while.

    First point: "liberal" has more meanings than just "Democrat". It's use in the grandparent post was to refer to the fairly liberal (generous, ample, unlimited (see http://answers.com/liberal) qualities of the MIT license. A conservative license is more like a corporate license; "conservative" means "restrained; cautious, moderate; favoring traditional values; preservative" (see http://answers.com/conservative). A restrained license? doesn't sound very like liberty to me.

    Second point: The founding fathers were conservative? Please describe for me how they were cautious? Or restrained? They certainly didn't favor traditional values; no, they were revolutionaries, who rebelled strongly and bravely against the traditional governments of Kings and Lords. They favored ":maximizing each individuals rights and minimizing the role of the state" in their lives. They "believed in free will", and the fundamental right of a person to have the opportunity to create their own place in history. This, by definition (see http://answers.com/libertarian) makes them libertarian, not conservative or liberal.

    Sorry for the off-topic second point, but not replying to things like that are impossible.

  24. Re:Liberal license by Abcd1234 · · Score: 4, Interesting

    Actually, I think the vast majority of developers out there are far more interested in getting their damn job done, and couldn't care less if Sun GPL'd the Java sources. 'course, you'll never hear that because they're too busy *getting their damn job done*, instead of bitching about licenses on Slashdot.

  25. Re:Yes, but can Ruby do this? by otomo_1001 · · Score: 2, Informative

    Well with your weird example, here is what I would use (not really because it violates lots of say what you mean rules).

    ruby -e 'puts 0 ? 0 : "not zero"'

    Have to take out the warnings because you are doing something weird. You do know that ONLY false, 1, and nil derive to a failing condition right?

    I like perl too, but your example isn't hard to come up with an equivalent. If you mean ruby can't do as many one liners from the command line, you are wrong there too.

    Anyway I need food.

  26. RoR hype == good product + good marketing. Period. by Qbertino · · Score: 4, Interesting

    RoR is a good OS product that helps people solve problems that really bug them. It doesn't - contrary to lot's of other OSS projects - have a website that looks and works like crap . It's lead developers actually have social skills (and running businesses) and can talk coherently in a way that normal people actually understand them. They are tight with the blogging community and are smart enough not to be arrogant and thus convince even the most fanatic Java people to check out their toy. They started the whole webcast thing and built RoR for an actual real life business project they wanted to do (www.basecamphq.com) before going OSS.

    Technology wise there is not that much new. Zope is still lightyears ahead of everything else (including RoR) but only last year did their website stop looking and acting like a total pile of doo-doo. Yet still Zope.org's Navigation is somewhat '99ish and much more intimidating and overwelming than the friendly and straightforward RoR Site.

    Then there's Django. Which is very neat, partly even better than RoR (and friends with the RoR project), but went OSS a little later than RoR and thus needs to catch up on awareness a little. Symfony is PHPs late answer to the RoR induced MVC frenzy and still to new to gain awareness momentum. CakePHP and P4A seem ok but don't have the marketing stance to be of any significance anytime in the future. They're both so nineties it hurts and thus will wither and die.

    Bottom line: RoR are a OSS project that isn't just good at coding or using exotic technologies, they actually have the skill to market it aswell. And they were the first in the framework camp. It's that simple.

    --
    We suffer more in our imagination than in reality. - Seneca
  27. Re:i thought Ruby on Rails by James+Kilton · · Score: 2, Informative

    Wow, frankly I'm glad people like you aren't joining the Ruby community. If you even spent 1 minute looking through the Rails code, you would have found the Inflector class that does this "magic". Ruby itself doesn't do that! and you're either naive, ignorant, or both to think that it would.

  28. Re:What is retarded about VB? by atokata · · Score: 2, Insightful

    You know, I'm not sure that it's really so much the langauge, but the utter crap that people write in it. It's...disappointing....to download what you think might be a cool/useful/whatever program, only to find that it's a barely functional VB nightmare that crashes if your screen resolution is set wrong.

    Of course, it all depends on the programmer, in the same way that, say, carpenters can do both good work and bad. Good just takes so much longer, and is a lot more challenging.

  29. Re:Nice Summary. by rubycodez · · Score: 2, Insightful

    So the source should be attributed and the text placed in quotes. Out in the real world, stealing someone's work and pretending it's your own can be illegal and also make people look down on you

  30. Re:i thought Ruby on Rails by misleb · · Score: 3, Funny

    Yeah, next thing you know it will try to pluralize "dog" as "dogs" or something crazy and unpredictable like that!

    -matthew

    --
    "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
  31. Re:Liberal license by GigsVT · · Score: 2, Informative

    Until Sun gets bought by some "we sue people for a living" company, like SCO did. Then they'll be a big scramble to make a third party JVM (and libraries) that doesn't suck and is clean of Sun IP.

    Will they pull it off in time? Who knows. It's still a huge risk to have invested years into an application that can have the rug pulled out from under it at any time.

    --
    I've had enough abrasive sigs. Kittens are cute and fuzzy.
  32. It's the retards that use it. by HornWumpus · · Score: 2, Insightful
    I agree with the sib poster. It's the apps that make VB look so bad.

    Only Access has consistantly worse apps. All languages have some stinkers, but there is something to be said for learning curves keeping PHBs from blowing their own peckers off.

    That being said you can be very productive in VB if you're not a retard.

    --
    John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
  33. Re:Yes, Ruby's semantics are sweet. by tehshen · · Score: 2

    what in Ruby's syntax is borrowed from Perl?

    $_

    --
    Guy asked me for a quarter for a cup of coffee. So I bit him.
  34. Posted on IBM by zlogic · · Score: 2, Informative

    This article is hosted at IBM, and IBM invests heavily in Java (SWT, Eclipse, etc.) So this article should be taken with a grain of salt. It's like Microsoft comparing .NET with Java (remember Microsoft's ".NET is X times faster than Java" statements?)
    However it's nice to see that IBM knows that Ruby exists and knows its strong points - so that they may borrow the good stuff into Java.

    1. Re:Posted on IBM by misleb · · Score: 2, Insightful

      Umm, TFA was actually making a good case for Ruby on Rails. So if they are being biased, it is in the opposite way that you would expect given IBM's interest in Java.

      -matthew

      --
      "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
  35. Re:i thought Ruby on Rails by baadger · · Score: 2, Insightful

    It's not a particuarly useful feature when you have a complex class and still want normalised database schema, considering when I last looked, Rails didn't support Class Table Inheritance very well. Instant turn off.

  36. Re:What's the Secret Sauce in Ruby on Rails? by mikaelhg · · Score: 2, Interesting

    Ruby on Rails - the Bush administration of web frameworks.

    This is what they do. They spam their marketing materials on one forum after another, glossing over finer points like the lack of Unicode and threading support, along with quite a number of tools professionals need in their development, and then use their meat or sock puppet accounts to downmod messages they don't want to reach their target marketing audience.

  37. RAILS is a different tool? by Anonymous Coward · · Score: 2, Interesting

    After using Ruby for several years, for general purpose scripting, and various other web development frameworks in Java/Perl/PHP/C#, etc... It seems clear to me that ROR really isn't another 'kind' of tool at all. It's simply a well desgined web framework, expressing some of the philosophy of the Ruby programming language.

    The programming techniques ROR promotes aren't new, they're not crazy, or magical. They're not in the least 'different'.

    The article lists:

    1.) Seamless integration
    2.) Convention 'over' configuration.
    3.) Low Repetition.
    4.) Immediate Feedback.

    What web-framework would not want the framework they're using to work well with the underlying language? And Convention over configuration doesn't mean a lack of configuration, it simply means that intelligent defaults are generated. It makes common things easy, and uncommon things possible. And DRY is a main goal of software engineering, of design patterns, of object oriented programming--- which all have been in practice for over twenty years.

    In this article, the author points out that it's based on an underlying MVC architecture. This isn't anything new for any other web development framework, for instance Struts. And even outside of an environment which starts with this design by default, software engineers are wise to follow design patterns. It seems he views the philosophy of convention over configuration as somehow making ROR inflexable, and incapable of solving some imagined wide range of web-development programs. Sure, 50% of applications are web-based and database backed--- but ROR programs don't have to be database backed (See Rails Recipes, page 57). And, I figure if a person is using a web-development framework, the lack of configurability in the expression of the application as being web-based is acceptable (although I suppose it's possible to replace the view portion of the application as well).

    It's clear, from some messages I've read here--- several people choose 'not' to adhere to MVC, and code the majority of their application in the view portion. ROR really does little to 'enforce' the user to do one thing, or another, it merely provides tools that aid a person in producing a scalable, modularized, and reuseable, web-application.

    Ruby is a fully object oriented programming language, that was built from the ground up on the principle of least surprise. Language constructs aren't built directly into the syntax, as they are in perl--- it adheres very closely to the smalltalk view of a truly object oriented language being composed of objects, and messages. The script isn't being augmented with a new 'breakpoint' keyword, but instead with a breakpoint function. There's very little that's magical about what ROR does, and most everything it does can be extended upon, reused, or changed.

    It's not a new 'kind' of tool, it's just a clean integration of existing tools. It's an environment that has integrated a great deal of the components that have been in wide use by other web-development platforms for years, and provides a clean way to generate a template project using those pieces.

  38. Re:Rails is nice, but definitely limited... by misleb · · Score: 2, Insightful

    You want a site that hooks/controls multiple DBs, or want to stray too far from the paradigm? Not so much.

    This is by design, obviously. And in a way it can actually encourage good modular design. Where someone doing Java or PHP might be tempted to write one monster application that controls two DBs, the Rails developer is encouraged to write separate applications that communicate with each other trough a well defined interface. And if the two databases don't represent two differnt modules/applications, maybe they shouldn't be different databases.

    That said, I agree, Rails is limited and there will always be a place for other frameworks or unstructured freeform coding such as one might do in PHP.

    -matthew

    --
    "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
  39. Re:What's the Secret Sauce in Ruby on Rails? by arevos · · Score: 2, Insightful
    This is what they do. They spam their marketing materials on one forum after another, glossing over finer points like the lack of Unicode and threading support, along with quite a number of tools professionals need in their development, and then use their meat or sock puppet accounts to downmod messages they don't want to reach their target marketing audience.

    What on earth are you talking about? Sure, Rails isn't appropriate for some projects, but it certainly is appropriate for others. Rails isn't missing any critical feature that makes it useless for web development in general, and it makes good on its promise of rapid development. Rails performs well in its (sizable) niche; take it outside that niche and of course you'll have problems, but that doesn't imply that it's useless for all applications.

  40. Re:Liberal license by penguin-collective · · Score: 2, Insightful

    I think the vast majority of developers out there are far more interested in getting their damn job done, and couldn't care less if Sun GPL'd the Java sources.

    Yes, I'm sure many young real-world developers think that way. Now, they should think about what happens when Sun goes out of business, or when they sell Java to Microsoft, or when they just can't afford to pour money into Java anymore, or any of a number of other possibilities. Think it can't happen?

    Well, back in the day, we didn't think it would happen to companies like DEC or Symbolics, but it did. That's why real-world developers, after getting screwed by companies like Sun, decided to rely increasingly on open source software, because in the long run, it gets the job done more predictably and with less risk.

    Using and contributing to open source software for most people is just business: it primarily reduces risk by ensuring long-term availability and stability of a platform, in a way that no company has ever been able to.

  41. Re:Liberal license by VGPowerlord · · Score: 2, Insightful

    IBM has made JVMs in the past. I wouldn't put it past them to make them again if Sun becomes Sue.

    --
    GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
  42. Ruby is slow by SanityInAnarchy · · Score: 3, Insightful

    When it comes to Ruby, I have one wish:

    Compile it. For the love of God and all that is holy, Ruby is at least as slow as JavaScript, if not slower -- at least you can compile JavaScript into Java!

    Perl6 shows some promise in that area, but I have some serious doubts. Ruby, as a language, does far too many things that simply assume it's a "scripting" language. For instance, it's possible to modify any class at runtime -- thus many core libraries probably rely on that feature. Also, all names in Ruby are kept around at runtime. I'm pretty sure that it actually is doing a hash lookup every time. For instance:

    irb(main):026:0> class Fixnum
    irb(main):027:1> def method_missing (name, *args )
    irb(main):028:2> print 'Attempt to call '
    irb(main):029:2> puts name
    irb(main):030:2> end
    irb(main):031:1> end
    => nil
    irb(main):032:0> 5.foo
    Attempt to call foo
    => nil
    irb(main):033:0>

    I'm sure that someone will find a much simpler / more efficient way of doing the above, but the point is the same. Obviously, whenever Ruby executes code that attempts to call '5.foo', or even '5 + 5' (which becomes something like 5.+(5)), it actually stores the code for the call as a call to a given name, and then looks up that name at runtime.

    Now, good OO design generally involves making lots and lots of small classes, and even the bigger classes will have lots and lots of small methods. Good programming design in general tells us to refactor mercilessly, which will, in any language, tend to reduce the amount of code per method and increase the number of method calls. And even if you go the other way, and don't use any methods at all, the simplest line in Ruby (since it's a pure OO language) will break down into 5 or 10 method calls, at the very least.

    What all this means is, Ruby is back to that old argument of developer time vs. application run time, and I hate that. I really love it when we can break out of that mold -- when we find that, most of the time, a compiler will produce better code than handcoded assembly, or a language-based garbage collector can actually run as fast or faster than a hand-coded, application specific refcounting scheme. Or when we find that Java, despite being bytecode, will, once you JIT it, run as fast or faster than equivalent C++. Or when we find that mod_perl can be close enough to the speed of a C program that it's not even worth considering using C instead.

    But when it comes to choosing a language, they all have their performance wrinkles. C++ probably uses more memory than C, and always seems to take far longer to compile. Perl isn't anywhere near as fast as C, so whenever we find something where we need that extra speed, we rewrite chunks of a Perl module in C. Python is the same way, though Psyco looks promising, but Psyco is also x86 only, not even amd64. Java is as fast as anything, once a program starts, which takes far longer than anything else even if you've gcj'd it -- plus, the language sucks compared to Ruby. C# is as fast as Java, and so far seems to load much faster, but the language sucks (really a rehash of Java/C++), IronPython is nowhere near done, and even IronPython isn't as nice as Ruby -- plus, the platform is controlled by Microsoft.

    Ruby has absolutely awesome syntax, can be 10x faster to develop in than most other languages, but due to the language design itself, it will always be much, much slower than Perl, and that's saying something. And it's just depressing when you find you can make a chunk of your program run 10x faster by porting from Ruby to C, only it will take 50x more code.

    I guess what would make me happy is an insanely intelligent compiler for Ruby, that targeted the .net environment. Performance comparable to C#, developer time comparable to normal Ruby, bytecode obfuscated enough to use in commercial products.

    But that's depressing, too, because in the amount of time it would take me to learn enough about Ruby and .net to do that, not to mention the programming of that insane compiler, I could write hundreds of useful Ruby programs.

    --
    Don't thank God, thank a doctor!
  43. Re:RoR hype == good product + good marketing. Peri by killjoe · · Score: 2, Interesting

    Zope is the single largest waste of talent and innovation in the history of computer science. It's an amazingly well thought product, it solves every problem you might have when designing dynamic web sites, it solves problems you didn't even know, it comes functional out of the box, it takes seconds to install and get going, yadda yadda yadda.

    Never in the history of computing science has so much innovation been so impossible to deal with. No real documentation, the simplest things are difficult, a buttload of half finished products none of which have any documentation to speak of. Most (yes MOST) zope products have no documentation other then it's name. You want to see a joke, go the zope collective on sourceforge. Now there is a crackup.

    Dear Zope Community. I love the technology you have built, please make it so that I can use it. While you are at it please make it perform better then 1/10th of the speed of apache, php. You don't have to make it as fast, just don't make it like a joke.

    While I am asking. Please create a sourforge or a CPAN for zope products so I can just install products without wading knee deep into dependency hell. Make it easy for me to keep my products updated. For examples of how to do this please see perl CPAN, ruby gems, apt, and yum.

    Do this in time for zope3 so that the effort that went into that won't end up being a waste too.

    Sorry if I am coming across a little harsh, I really love the ideas behind zope, I run a zope(plone) site, but it's much harder then it needs to be. Much harder then ROR for example.

    --
    evil is as evil does
  44. Re:CRUD screen secrets - Data Dictionaries by killjoe · · Score: 2, Insightful

    Why not provide a couple links to a couple of projects using DDs so we can check them out.

    In ROR the database IS your DD.

    --
    evil is as evil does
  45. Re:What about PHP? by misleb · · Score: 2, Insightful

    I read TFA expecting to learn something about why people talk so much about Ruby today. Unfortunately, there was only a comparison between RoR and Java. So, if the only reason to use Ruby is that it allows an agile development method to be used, sorry, Ruby came too late for that. I have been using PHP with phpGroupWare/eGroupware, which has every one of the advantages cited in the article, plus some more.

    phpGroupware? You've got to be kidding! There is just no comparison.

    One reason why I have so much impedance against Ruby is the different syntax. PHP has a C-like syntax, which makes it very easy to catch for someone who knows C and Perl.

    Try Ruby for a week, seriously. I came from a mostly Perl/C/PHP syntax background and had little trouble picking up on Ruby. Once you start using code blocks, closures, true OO design, and all the Ruby nicities, you'll never want to fart around with PHP again. Here is an example of some really slick (in my opinion) ruby code. Lets say you have two arrays of objects that you want to add together, remove duplicates, and sort by an arbitrary attribute:

    combined = (array1 + array2).uniq.sort_by { |obj| obj.someattribute }

    What's wrong with Ruby's syntax? Well, the dangling "end", for instance. It's too FORTRAN-like for my taste. "end" what? With curly braces, there is never any doubt on the block structure if you use a modern editor, with Ruby's "end" you can never be sure of what ends where. I also prefer the curly braces instead of "begin"/"end" for the simple reason that it means less ink on paper, less clutter, easier to read listings. They say the Ruby syntax is "flexible", well so is Forth.

    Of all the trivial complaints, that has to top them all.

    Using Ruby instead of Java, OK, I can see why it's better. But I'm still waiting to see a good explanation why should someone use Ruby instead of PHP, or Perl, or Python, the three languages that have become so much associated with the "agile development" trend of software development.

    Of the 3 you mention, only Python really matches Ruby. Perl is still king for processing text, but it is somewhat specialized in that. PHP is more or less just the lowest common denomonator among modern web programming languages. As a language it is nothing special and in many ways it is sloppy on inconsistent. I haven't used PHP 5 much, but last tiem I checked, object oriented PHP was a complete joke. Its only advantages are that it is easy to learn and runs just about anywhere.

    -matthew

    --
    "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
  46. Lisp, Smalltalk, and...Tcl! by DavidNWelton · · Score: 2, Informative

    Perhaps you should look at Lisp/Smalltalk/Your favorite academic language not being able to market their way out of a wet paper back:-) If they've had since the 70ies to build something that'll take off, and they haven't, they're doing something wrong, and it sure isn't the languages themselves, because they are very nice indeed.

    Changing subjects, one of *my* favorite "cheap Lisp imitations" (it's Lisp, not LISP) is Tcl:

    http://antirez.com/articoli/tclmisunderstood.html

    which is in some ways more flexible than Ruby - you can redefine existing control structures like if and while, or create new ones of your own (such as do ... while, which is not part of the core language).

  47. Perl vs. Ruby: sigils by Santana · · Score: 2, Informative

    The heavy use of sigils is not Ruby's fault, it's yours. I've written a lot of Ruby code and have rarely used sigils.

    Sigils in Perl are mandatory and define whether a variable is a $scalar, a %hash, an @array or a &block of code. Ruby's sigils define scope: local (no sigil), @instance, @@class or $global variable, which is a good approach since it let's you know instantly whether a variable is local to the block of code or comes from another scope, which is far more important than its type.

    So, unless you're using a lot of global variables, you shouldn't be heavily using sigils.

    Finally, I don't see anything wrong with having regular expressions as part of the language. But if you don't like that, nothing stops you from using Regexp and Match objects.

    --
    The best way to predict the future is to invent it
  48. Re:Nice Summary. by dorkygeek · · Score: 2, Insightful
    I definitely prefer a verbatim copy of a summary over the sensationalist, misleading or sometimes even plain wrong summaries we use to see here at/..

    --
    Windows is like decaf - it tastes like the real thing, but it won't get you through the day.
  49. Easy one by arodland · · Score: 2, Funny

    The secret sauce is "Hype". And if you lift the bun, you find that there's more secret sauce than meat.

  50. 5 to 10x more productive than Java? by Anonymous Coward · · Score: 3, Insightful
    If you know java, I simply find that hard to believe. If you don't know it, maybe you've taken a class, read some books on JSP, you "can write it." It starts to be more reasonable. There might be some O(1) type operations like the initial setup that can be done in Rails in a hour vs. the full work day for Java or something like that but very little in terms of actual production.


    The crux of the problem with that argument was brought up by the author of webwork, if I'm not mistaken. If you're coding so much that you really can get a 10x improvment then you're clearly not doing enough design work to be making an app that's worth shit, regardless of the tool. Rails doesn't cut down on the thought time.


    DHH kind of tries to disown that comment when he's challenged on it. It's just rails marketing and hype, someone has whispered "10x faster" and they repeat it but they don't stand behind it. One thing that you can bank on, there is a lot of hype around rails, the people who make it are responsible for contributing to that hype and there is very little in the way of concrete information about these outlandish claims.


    It's okay at what it does. I personally don't care for the hype and I generally distrust when all you have is hype.


    Something else to consider, rails by design scales by pushing everything in to the database. They have some minimal caching at the web tier but none at the db tier. You need to render more pages, buy a bigger database, that's the quick answer and they suggest that it works because "yahoo does it that way" This is kind of an, um, interesting way to address scalability. I like how they make sure that they compare rails to what yahoo does too, it's just a quick and subtle comparison but it works and leads you to believe that you could do something yahoo like in rails, when it couldn't be further from the truth. Activerecord doesn't exactly conserve queries, some fairly simple joins seem to result in a lot of queries and it's kind of heavy. It's sales and marketing's way of saying they haven't really addressed the issue. To be pragmatic about this, why on earth are there all the elaborate caching schemes in EJB and J2EE and JDO? Surely people didn't just think it was something fun to build, I know the rails crowd seems to hate java but don't they think anyone with any real skill worked on it ever? I buy the j2ee is complex argument but I need to understand their argument for the complexity being unneeded. If you're planning to move on to a different project before it actually has to scale, that's not really an argument. From my own experience building clustered j2ee apps, scaling by just shoving everything into the db and hitting it for each page simply isn't a practical option if you have any real traffic.

  51. Talking out my ass... by localman · · Score: 2, Insightful

    I haven't used Ruby or Rails. I only read the ten minute tutorial that got posted here a while back. Actually reminds me a lot of a object wrapper I wrote for perl that built class heirarchies automatically from a DB schema. It was pretty cool if I do say so myself, and so is Ruby on Rails.

    However: I don't think it matters. In my experience it doesn't matter that much what programming language or model you use. Object oriented or procedural, strongly typed or loosely typed, monolithic or microscopic, chocolate or vanilla. Everything eventually bows to the reality of inherent complexity. I've seen each style done right and wrong, and if they're done right, the differences sort of wash out over time. My prediction is that Ruby on Rails is great for prototyping, but if you ever have a large buisness project that grows and develops for years it'll end up no more productive and maintainable than any other competently written code base, and probably no less productive either.

    I'm not saying none of these choices matter: they do. There are certain things I've written that are much more sensible OO than procedural and visa-versa. In the end you make decisions on how to go about a particular project, and if you've made the right ones five years later you can still carefully move at a crawl and bring new people into the codebase with only a few weeks of training. And I don't think any technology shift will notably beat that. I'm still a believer that there's no silver bullet that will make development (especially long term development) a breeze.

    But what do I know? Use what makes sense to you.

    Cheers.

  52. Re:What about PHP? by misleb · · Score: 2, Insightful

    Ah, but array_unique() only works on arrays with integers or strings for values. I looked it up. Check out the documentation on php.net for the array_unique() function and see all the ugly hacks that people have come up with to do what you could do with 1 or 2 lines of Ruby. My Ruby oneliner would work with any arbitrary object type. The reason the Ruby version is so much more powerful is because strings and integers are just objects like everything else. As long has you implement the == method for an object, it can be uniq'd or sorted (and many other operations) just as easily as an integer. In PHP you have to have special functions to do even simple things.

    Sorry, I don't mean to sound like such a Ruby fanboy. I am really not. It is just that it frustrates me when people like the grand parent shut themselves out to learning something new. He says that he doesn't want to "waste a minute" on Ruby but he doesn't realize that he's probably already wasted countless hours writing PHP hacks that aren't even very reusable.

    -matthew

    --
    "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
  53. Re:What is retarded about VB? by Nataku564 · · Score: 2, Informative

    Indeed. Despite the touted benefits of .Net, and how it would rid us of all the system dependencies problems had with previous Microsoft technologies. Just a week ago or so I had the pleasure of running into a C# app that operated differently on 2 boxes. It was run from the same clean network directory, same version of the .Net runtime, same OS, all patched, and fetching data from an application server. There was absolutely no reason for it to behave differently, yet it did ...

    People wonder why I like Perl so much ...

  54. Biggest downfall of rails is not even mentioned by Jondo · · Score: 3, Informative

    I've used rails for only a few months, but already have quite a good understanding of how everything works, and have even done some hacking/patching on the backend. I've also used ActiveRecord with some applications that are not web-based, all with good success. I love every convention in Rails, except for one, which I dearly hate.

    ActiveRecord was designed quite obviously from the perspective of a MySQL user. The train of thought that a DB should only be a place to dump your data and nothing more is extremely prevalent with ActiveRecord. Things like referential constraints on foreign keys are completely ignored/not used, instead being defined in entirety in the model code. Perhaps my biggest aggrivation with ActiveRecord however is that it assumes I implement enumerations as varchar datatypes. I find this just plain wrong. Here's an example:

    ActiveRecord way:
    CREATE TABLE Users (
        id integer primary key,
        username varchar,
        usertype varchar
    );

    ActiveRecord will then use its single-table inheritance logic and each subclass of User eg "Administrator" will have that name in the usertype field, stored as a string. From a data-modelling perspective, I find this so wrong. I naturally implement this using an extra table of usertypes and a foreign key in Users:

    CREATE TABLE UserTypes ( id integer primary key, type varchar);
    CREATE TABLE Users (
    id integer primary key,
    usertype integer references UserTypes(id)
    );

    I have managed to get ActiveRecord to play somewhat nicely with these types of constructions by redefining some class methods in ActiveRecord::Base, but I'm definately violating DRY.

    This all said, and including the time I needed to spend hacking around in the ActiveRecord code, I am still more productive with Rails. Highly recommended, just with a hint of caution towards ActiveRecord paradigms and database integrity.