Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Programming Technology

Rolling With Ruby On Rails 406

Bart Braem writes "The Ruby community is abuzz about Rails, a web application framework that makes database-backed apps dead simple. What's the fuss? Is it worth the hype? Curt Hibbs shows off Rails at ONLamp, building a simple application that even non-Rubyists can follow."
This discussion has been archived. No new comments can be posted.

Rolling With Ruby On Rails

Comments Filter:
  • by Baldrson ( 78598 ) * on Friday January 21, 2005 @01:16PM (#11433226) Homepage Journal
    Rails is a big deal from the stand point of a world where Java frameworks are considered state of the art. However, the big breakthrough with Rails will come when a Rails-based REST web services generator presents the database schema to a client-side ECMAScript XForms/templating solution.
  • by leonmergen ( 807379 ) * <lmergenNO@SPAMgmail.com> on Friday January 21, 2005 @01:17PM (#11433239) Homepage

    Besides, if you do things The Right Way, when programming in OOP, the design takes a huge part of your time... and I don't really see how Java or Ruby differ in that...

  • by Anonymous Coward on Friday January 21, 2005 @01:39PM (#11433462)
    Wow, you obviously haven't used Rails. It *IS* much faster than Java. Hell, anything is much faster than Java.

    When you add something to Java (a new controller let's say), you have to configure it in a big XML file (with most if not all of the frameworks). Or a new template. Or a new model object. In rails you don't have to do any of that, it dynamically finds it! You literally *fly* in Rails (partly because of Rails, partly because of Ruby).
  • by Tobias Luetke ( 707936 ) on Friday January 21, 2005 @01:46PM (#11433543)

    This is not insightful. If you want to see how well it scales look all all [basecamphq.com] the [43things.com] production [tadalist.com] grade [hieraki.org] applications [leetsoft.com] out there. The source to hieraki [hieraki.org] is freely accessible.

    Rails is NOT your run the mill proof of concept framework. Its the next level of programming environment right now and here. Available for you to download under MIT license. The people who use it make applications magnitudes faster than the people who aren't. Single people can be as productive as whole teams.

    There hasn't been an improvement in productivity like this in recent programming-history.

    And don't just put down what you don't understand, give it a try.

    Your attitude will just get you boring jobs.

  • by tundog ( 445786 ) on Friday January 21, 2005 @01:46PM (#11433544) Homepage
    In rails you don't have to do any of that, it dynamically finds it!

    Thats a great concept as long as everything goes as planned. But wait until it 'dynamically finds' the wrong thing. Try debugging that nightmare. (Think VB Script + Option Explicit).
  • by Anonymous Coward on Friday January 21, 2005 @02:05PM (#11433738)
    MODS!!! This isn't "insightful", it's "uninformed".

    It's funny. I was just discussing the bygone days of visual programming the other day. It faded into obscurtity with good reason in the late 80's.

    This isn't "visual programming". What the HELL are you talking about. The article had a lot of visuals, maybe that threw you off!

    This is more like dynamic programming in Lisp from the 60's and 70's, come back with a web app slant. I was just discussing with *my* friends how lame Java and other languages are because you can't factor out chunks of code the way you can in Lisp or Ruby.

    Being able to set up a bunch of boilerplate in just one line is *useful*. Then you go back and fill in the blanks. This is what programming is supposed to be like!

    Take a look at this example. It's incrediblyl complicated and all it does is display a horrible little form that lets you query cookbook recipies!

    Okay, I call your bluff. Write a similar article writing a similar app in your favorite language and framework. Post it here in a slashdot comment. Go on, we'll wait. Remember, you have to start from scratch on an empty Windows box, install the framework, the database, and the web server, and create a simple *readable* *well-factored* app.

    There's no reason for either Ruby or Rail (nice name) today.

    You must be a hard-core Lisp or Scheme programmer. Otherwise you're talking out of your butt. I moved to Ruby a couple years ago and it blew my mind. My programs are short, readable, easy to test, and just as powerful as Java or Python (maybe not quite as *fast* but just wait, Ruby is still v1.x).

    It's not useful for anything bigger than a 'hello world' application.

    Well, as others have pointed out, there are Rails apps that are bigger than "hello world". So your statement is wrong.

    I know, I know. You spent all this time learning JavaSomething or PHPSomethingElse and now somebody's pointed out something that renders all that effort a waste of brain space. I understand. It's the same as folks who cling to MySQL when there's PostgreSQL or who still write CGI apps in C++ because they don't want to drop this cool library they wrote or they still use Perl for OO programming because it took 2 years to figure it out and they don't want to start over. You're in denial. You know you can do everything you need in your favorite framework, so you won't let yourself believe you can do the same, faster, in something else.

  • TMTOWDI (Score:5, Insightful)

    by ryantate ( 97606 ) <ryantate@ryantate.com> on Friday January 21, 2005 @02:09PM (#11433788) Homepage
    Perl has its own rapid application development framework, Maypole. Here are some screenshots [perl.com] from a Perl.com article where Simon Cozens sets up an online sales catalog in 11 lines of code. (Here's a followup article [google.com], and the Maypole home page [google.com].)

    These systems all demo well because the developer gets to decide what functionality to demo, and it not coincidentally happens to be the functionality the framework was designed to easily support. The real test of the system comes when you want to do something the designer did not anticipate, and you find out how flexible the system is and how sensible the designer's instincts are.

    With these environments I think time will tell, with most developers watching the few willing to take the risk of investing the time needed to learn the framework and how to customize it extensively.
  • by Anonymous Coward on Friday January 21, 2005 @02:29PM (#11434011)
    Oh please, not this fallacy. Just put an ad out for a Ruby programmer. Do you really think there are only about 5 or 6 in the world or something?

    And what makes you think Java or PHP or whatever is magically maintainable because the language is familiar? It takes me at least a week to get comfortable with another developer's layout, structure, conventions, etc. It might as well be a different language anyway.

    Besides, any good programmer could learn Ruby in a weekend. It's a *simple* language.
  • by Jerf ( 17166 ) on Friday January 21, 2005 @02:29PM (#11434017) Journal
    I'm actually a Python partisan (like the philosophy and user base better), but the same basic thing applies to Ruby too: If your first criterion for evaluating a tech like this is "Is it written in Java/C++/Visual Basic?" or whatever other legacy language you're thinking of, you've already lost.

    Learning Python or Ruby and using it will pay off in mere weeks vs. Java, C++, Visual Basic, and most other things like that. Pay off might be a month for C#, but only if you use C# like an expert to start with. (Also, if you use C++ like a mega-expert, but even then, to use it that way you lose with the staggering quantity of typing that takes... and I mean keypresses, not object typing!)

    Ruby and Python have done everything they can short of directly downloading themselves into your brain. You have to expect to exert some effort to reap the benefits. And like I said, it pays off in mere weeks, so opportunity-cost-wise, you lose big for delaying it.

    (Note "you" here may be your company, if you only program professionally. In that case, you personally may not have any choice, but the company is still losing big.)
  • Re:Played with it (Score:1, Insightful)

    by Anonymous Coward on Friday January 21, 2005 @02:54PM (#11434330)
    Blocks are great for anything where you need to factor out code that goes around other code (Smalltalk and Lisp programmers are getting bored already, I know, I know).

    For instance:

    Automatically show a busy cursor in a readable, exception-handling-safe way:
    def busy_cursor
    begin
    busy_cursor_on
    yield
    ensure
    busy_cursor_off
    end
    end

    busy_cursor {
    do_something
    do_something_else
    foo_bar_baz
    }
  • Writing SQL statements smack dab in the middle of one's code is generally a bad thing. You want to get the code that talks to the database separated out from the rest of the application.
  • by Paradox ( 13555 ) on Friday January 21, 2005 @03:00PM (#11434417) Homepage Journal
    Well, Rails does lots of things behind the scenes. A simple piece of code like this Object-Relational-Mapping statement:
    class Column < ActiveRecord::Base
    end
    does at the very least, the following:
    1. Pluralizes "Column" into "Columns"
    2. Finds the table "Columns" and requests its schema.
    3. Maps every column into methods.
    4. Provides logging for all SQL sent, all actions undertaken, and also allows for use of the ruby debugger on otherwise external ops
    5. Provides search and iteration methods that you'd otherwise have to write on your own
    6. Caches data for performance
    That's an awful lot of bang for your buck with just 2 lines, especially now that it's loggable and debuggable. I'd say that alone makes it better than inlined SQL.
  • by Jerry ( 6400 ) on Friday January 21, 2005 @03:15PM (#11434583)
    Learning Python or Ruby and using it will pay off in mere weeks vs. Java,


    That is my experience, too.

    I attempted to build an inhouse app using Java and JDev against PostgreSQL. Where I needed to add functionality always ended up in a method which included the phrase "Generated DO NOT EDIT". I spent six months learning Java (including a class, which emphasized text editors for making gui objects. Gui by the blind ???) and attempting to build the inhouse app. I gave up in frustration.

    I decided to try Python and use Boa_Constructor against PostgreSQL. Ten weeks after I began I had learned both Python and Boa_Constructor, and had competed the app. It was 10X faster than the Java app against the same database, had all the features I had wanted to use, including reports, was easier to maintain, and MUCH easier to deploy.

    I liked the fact that ALL the files in your Python/Boa project are ASCII files and Subversion does an excellent job of version control on them. Also, the apps looks and feels the same on Linux as it does on Windows, and I had to change less than a dozen lines to make it so.

  • by Merk ( 25521 ) on Friday January 21, 2005 @03:18PM (#11434630) Homepage

    If so, it seems to leave the db handle, and the cursor handle dangling. That was the main point I was making, is that when wrapped in a block, these things are cleaned up for you when you're done. Other than that though, this is basically a good Python translation of what the Ruby code was doing (although the Ruby version is database-independent, I imagine Python also has a DB abstraction layer).

    Btw, how'd you get the indentation right? Manually inserting &nbsp; entities?

  • by raxx7 ( 205260 ) on Friday January 21, 2005 @03:19PM (#11434651) Homepage
    PostgreSQL at least does.

    Anyway, SQL embebbed in Python/Perl/Ruby is so simple there's nothing to gain from a SQL precompiler except static checking.
  • by JamesOfTheDesert ( 188356 ) on Friday January 21, 2005 @04:26PM (#11435367) Journal
    Besides, if you do things The Right Way, when programming in OOP, the design takes a huge part of your time... and I don't really see how Java or Ruby differ in that...

    Um, yes and no. If your point is that there is a certain amount of abstract thinking required before you write any code, then yes, they will share a comon process. But, after coding in a language for a while, you tend to start thinking in the terms and abstractions the language facilitates.

    So, in perhaps the common case, Java designers will soon be thinking in terms of factories and adaptors and filters and all sort of entities that are often required in Java but which are extraneous in an agile language.

    And the time spent on those extranous objects is not time spent adressing the actual problem, but time wasted working around or through the demands of Java.

  • by supavillain ( 852139 ) on Friday January 21, 2005 @06:20PM (#11436671)
    You can overwrite the default database connection method in individual classes.

    From http://rails.rubyonrails.com:

    "Connection to multiple databases in different models

    Connections are usually created through ActiveRecord::Base.establish_connection and retrieved by ActiveRecord::Base.connection. All classes inheriting from ActiveRecord::Base will use this connection. But you can also set a class-specific connection. For example, if Course is a ActiveRecord::Base, but resides in a different database you can just say Course.establish_connection and Course *and all its subclasses* will use this connection instead.

    This feature is implemented by keeping a connection pool in ActiveRecord::Base that is a Hash indexed by the class. If a connection is requested, the retrieve_connection method will go up the class-hierarchy until a connection is found in the connection pool."

"Here's something to think about: How come you never see a headline like `Psychic Wins Lottery.'" -- Comedian Jay Leno

Working...