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."
Interesting, but VB.NET is better (Score:2, Funny)
Re:Interesting, but VB.NET is better (Score:2)
I've never used it so I have no idea how good it is, but I'm sure there are similar things, in other languages. But to say that a database app is useless without it is just plain silly.
Re:Interesting, but VB.NET is better (Score:2)
FlexGrid? (Score:5, Funny)
FlexGrid? FLEXGRID?!?!
Implementation of FlexGrids is responsible for extreme stress, male pattern baldness, genital warts, dry heaves, infertility, webbed toes, seeing spots, loss of super powers, carpal tunnel syndrome, diarrhea, dandruff, dispepsia, gas, fingernail rot, yellowy wax buildup, stink foot, Plantars warts, incontinence, communism, crusty boogers, arthritis, bursitis and and cooties. The only treatment is 500mg of Dammitol, fiftytwo times a day.
You, sir, are a maniac.
Nice framework... (Score:2, Interesting)
Re:Nice framework... (Score:2, Insightful)
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...
Re:Nice framework... (Score:2)
Re:Nice framework... (Score:3, Funny)
Re:Nice framework... (Score:4, Insightful)
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.
Re:Nice framework... (Score:2, Insightful)
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).
Re:Nice framework... (Score:3, Insightful)
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).
It's not so bad, Rails is unit tested very well (Score:5, Informative)
Secondly, the author knows that ActiveRecord could be a source of problems, which is why it's got dozens of unit tests, covering nearly every line of code.
Thirdly, even with all that bugs can and will sneak through, which is why ActiveRecord can, upon command, write a detailed log of its attempt to dynamically bind and create the classes you want. The logging is at the message-passing level of Ruby, which is nearly as atomic as you can get (you could hack the interpreter to go further, but that'd be pointless).
The dark ages of hideous bugs in dynamic code are gone my friend. We have the tools and techniques to make code of this type both safe and maintainable. Don't be afraid of it.
Re:Nice framework... (Score:2)
It's not that big a deal, really. I wrote a custom web application framework for an iAnywhere product that did exactly what Rails is doing, but in Java. Basically it mapped the path in a request to a set of classes. The mapping was determined at runtime through reflection. Worked well, you could do some neat stuff using inner/nested classes. The parent always got first crack at a request, so it could do filtering before the child was called and also of the child's results.
The disadvantage of doing this st
Re:Nice framework... (Score:4, Interesting)
If we want to link it to Rails, we'd use the following code:
Yeah. That's really it. And you can specify relations with a simple micro-language in the class declaration (that's based out of ruby syntax). Once you've done this, you can write code like this: And Rails makes the action mappings just as simple. I'd eat my old shoes before I'd believe that there is some lurking JSP/Servlet framework that has evaded my sight (and everyone's sight, really) that can do better. I know Java's limitations pretty well.Hibernate (Score:2)
Re:Nice framework... (Score:2)
While DAO isn't dynamic, there are a good number of DAO generators that will build your classes and interfaces based on your database schema. Then your database access becomes pretty simple. You call up your daofactory to get the sepcific dao object then make the calls to it just as in your example.
I wrote a dao generator for some projects th
But you're missing an important implication (Score:2)
Yeah, you heard me right. Your web app can be depolyed, and you can modify the tables. Need to add a new field? Just do it. You can also (on-the-fly) make new test actions to play with these parts of the database. Of course, deleting or renaming a column can cause a problem with existing code, but Rails still gives you more than most competitiors in this regard.
Being able to debug a web application wit
Re:But you're missing an important implication (Score:3, Interesting)
You call that a feature. I call that a symptom of an inherent design flaw.
The whole Ruby-on-Rails framework seems predicated on the idea that the application (and hence everyone on the internet) has unfettered access to the database. There's no way in HELL I'm granting an untrusted user (someone on the internet) per
Re:But you're missing an important implication (Score:3, Interesting)
Rails does not assume this. Rails only does what you let it; if you write data-reading code, the connection must have read access to the DB, and if your code updates the data, the connection must have write access.
You how structure and delegate this access is up to you.
Re:Nice framework... (Score:2)
There's also ActionPack (http://ap.rubyonrails.org/), which is the View and Controller of the MVC pattern (ActiveRecord being the Model part).
The integration between the two frameworks is what makes Rails so impressive.
Re:Nice framework... (Score:3, Informative)
Re:Nice framework... (Score:4, Insightful)
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:Nice framework... (Score:3, Insightful)
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
Played with it (Score:5, Informative)
Ruby has already inspired a few efforts to duplicate the technology in Java and in
The usual warnings apply. Implicit code is easier 90% of the time, but that other 10% is painful to debug. With large projects you can prototype fast, but maintaining may be much more difficult.
Re:Played with it (Score:3, Interesting)
Not that it's bad, it's just an interesting programming paradigm, and one that would take some getting used to.
Rails seems like an interesting. Am I correct in think it's like mixing mod_ruby with an app framework?
Re:Played with it (Score:5, Informative)
Once you get used to the idea of passing blocks of code around, you'll love it, and won't be able to go back to Python... er... I mean, won't be able to go without it.
The canonical example is the iterator. Given an array pets containing ["dog", "cat", "fish"]:
Will return
dog
cat
fish
If you want to print out the uppercase versions
Or if you want to add some text:
Big deal, right? Not much different from a for loop. But blocks are amazing when dealing with things like a database. You can put all the setup, teardown and error-handling code in a method that's hidden from the user, and all they have to do is pass in the block they want the DB object to execute:
Unfortunately, slashdot eats my indentation, but fortunately, Ruby not being as picky about whitespace as *some languages*, that doesn't matter. Note that all that code is wrapped in a DBI.connect() call, which connects before it starts executing the block, and disconnects after. There's no "close" call required, it's all wrapped up for you.
Somebody mod this up (Score:2)
Re:Played with it (Score:2)
I've been writing in VB for a long time, so the dot notation, and the lack of semicolons have made it a good candidate for the transition. That was the only thing that was driving me nuts...
Hope you get modded up - that was probably one of the most informative Ruby posts I've seen.
Is that your python reimplementation? (Score:3, Insightful)
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 entities?
Re:Played with it (Score:2)
What do you mean by "queries essentially on the pages"?
why onLAMP? (Score:2)
Re:why onLAMP? (Score:2)
REST Web Services w/Client-side XForms (Score:2, Insightful)
Re:REST Web Services w/Client-side XForms (Score:2, Funny)
And "Rails" is yet another buzzword! (Score:2)
Of Rails, XForms and REST web services, REST web services is probably the noisiest of the terms but it is so limited in scope that there probably isn't too m
Seems kind of windows-oriented (Score:2)
Re:Seems kind of windows-oriented (Score:2)
I think they're just using the windows stuff as a sales pitch to Windows people. It says, "In most frameworks, this part of the application can grow pretty messy, tedious, verbose, and error-prone. Rails makes it dead simple!" That's marketing language. The toughest job is convincing non-technical managers. They will often look at something without a simple GUI installer like something from the dark ages. To them, presentation conveys product maturity and professionalism.
Let them chew on RoR on their WinXP
But... But... There's IIS! (Score:4, Funny)
"If you are using Windows though, looks like this could be very useful."
Only if it can match the stability and security of IIS that we've come to depend on. Otherwise it's just another shoddy product built by communists for communists.
Useful Ruby Online Resources (categorized) (Score:5, Informative)
http://www.rubygarden.org/ruby?RubyOnTheNet [rubygarden.org]
Interactive ruby resources:
irc://irc.freenode.net/ruby-lang - the #ruby-lang channel is popular. More info at RubyOnIRC
http://www.ruby-forum.org/bb/ - a forum for ruby novices to ask questions
news://comp.lang.ruby - the ruby newsgroup
Ruby websites:
http://www.ruby-lang.org/ - ruby home
http://www.ruby-doc.org/ - ruby docs and online reference
http://www.rubyforge.org/ - rubyforge ruby projects
http://raa.ruby-lang.org/ - ruby application archive
Ruby Code Examples and Snippets:
http://pleac.sourceforge.net/pleac_ruby/ - ruby pleac
http://www.rubygarden.org/ruby?RubyOnlineCookbo
Popular ruby and ruby-related projects:
http://rubyinstaller.rubyforge.org/wiki/wiki.pl - ruby installer for Windows
http://rubyforge.org/projects/rubygems/ - rubygems ruby package manager
http://www.yaml.org/ - ruby 1.8 includes built-in yaml support
http://www.rubyonrails.com/ - web framework in ruby
http://rubyforge.org/projects/instiki/ - wiki in ruby
Re:Useful Ruby Online Resources (categorized) (Score:2, Funny)
Code, Snort, Code, Snort (Score:3, Funny)
Ruby still needs ISP support (Score:5, Interesting)
I given it a testdrive, and RubyOnRails is an amazingly fast and powerful way to develop webapps, but even so, it's been around for a while and still 99% of webhosts only stick to tomcat & PHP/MySQL, so that's what I code for. Even Python w/o Rails has more ISP support.
My question is: When will RubyOnRails get "popular enough" to make inroads? I'm looking forward to it, because it means I can be way more productive and get a head start on all the other PHP "solution providers" out there.
Re:Ruby still needs ISP support (Score:2, Informative)
Ready, installed, and waiting.
Re:Ruby still needs ISP support (Score:2, Informative)
http://www.modwest.com/ [modwest.com]
What about SCGI? (Score:3, Interesting)
I've been really impressed with SCGI for my own work (a Quixote + Python based web app).
Re:Ruby still needs ISP support (Score:4, Informative)
Fantastic tech support, lots of support for opensource projects, a full ruby on rails implementation. These cats kick ass.
Lurk on the forums [textdrive.com] for a day or so to get a feel for things, it's not a bad place to call ~/
Re:Ruby still needs ISP support (Score:3, Informative)
Re:Ruby still needs ISP support (Score:3, Informative)
There's one host that looks promising: http://www.textdrive.com/ [textdrive.com] -- It's run by Dean Allen (wrote TextPattern), David Heinemeier Hansson (wrote Rails), Matt Mullenweg (wrote WordPress), among others.
Not astroturfing -- I co-lo elsewhere, and almost wish I was willing to do the virtual host thing again to try it out.
Re:Ruby still needs ISP support (Score:3, Informative)
Ruby On Rails (Score:2, Interesting)
It's just a pity (Score:5, Funny)
I develop webpages with LAMR - imagine saying something like that
"Build a better LAMP!" (Score:2)
Re:It's just a pity (Score:2)
LAMROR
Re:It's just a pity (Score:3, Funny)
The alternative being serious, professional names like Plone, Drupal, and Zope?
Okay, so what else does it do? (Score:2)
Does Rails help with that?
Don't get me wrong, I've got some simple PHP lying around this could replace brilliantly, but first impressions are it doesn't help with the really complex stuff.
Re:Okay, so what else does it do? (Score:5, Informative)
http://ar.rubyonrails.org/
You can automatically retrieve data from the database in the form of an object, do manipulations or calculations, display it, modify it, then do a save() method on the object and it'll go right back into the database.
Re:Okay, so what else does it do? (Score:2)
You can do whatever business logic you want after you get the objects.
Rails is just the tip of the iceberg (Score:5, Informative)
Ruby is full of incredible libraries and frameworks like this, especially where text processing and web development are concerned. It's because Ruby has such a rich set of features.
Anyone who likes Rails should dig deeper. Heck, Ruby's standard library comes with some amazing things. Ruby also has a framework called RubyGems [rubyforge.org],
which is very much like Perl's CPAN integration or CommonLisp's ASDF framework.
How does this compare to other stacks? (Score:2, Interesting)
Re:How does this compare to other stacks? (Score:4, Informative)
Rails is awesome (Score:5, Interesting)
In PHP or other related language, probably would've taken me about 80 hours or so to develop the site. In Rails, I've spent maybe 15 hours or so total on it. And I'm charging $8k for the site. Admittedly, that doesn't include time working on the graphics or design of the site, just the backend, search, etc.
So if you look at it from one perspective, I went from making $100 an hour to $533 an hour using Rails!
Re:Rails is awesome (Score:2)
Not trying to knock what you've done, but if I were your client, I might be happier knowing my site was written in a more common language...
Re:Rails is awesome (Score:3, Interesting)
Hell, I probably only spent two days studying Rails prior to creating the site.
Re:Rails is awesome (Score:2, Insightful)
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.
One Click Instalation (Score:2, Funny)
2. Double-click on the downloaded executable and follow the installation instructions. Unless you have some special needs, just press Enter to accept all of the defaults.
Believe me guys, no hype at all
TMTOWDI (Score:5, Insightful)
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.
Real-life applications launched on the Rails (Score:2, Informative)
Basecamp [basecamphq.com] -- The original Rails application from which the framework was extracted. A hosted project management application that combines weblog, todo lists, milestones, file storage, and more to keep everyone on the same page in a project.
43 Things [43things.com] -- The "What do you want to do with your life?" application that lets you enter the 43 t
But is the SQL any good? (Score:2)
Last time Ruby on Rails came up, someone mentioned this example [rubyonrails.com] showing off their object-relational mapping. I observed [slashdot.org] then that it makes way too many queries because the SQL it produces isn't very good. (And too many queries means a lot of slowness, especially when your database server and your webserver aren't on the same machine.)
It's not as obvious here because all of the queries are behind the sce
Yeah, that's been worked on... (Score:2)
It also implements caching at a variety of levels, to further speed things up. The most recent releases of rails are dramatically faster than prior.
Re:But is the SQL any good? (Score:2)
So what's the problem?
LAMP? (Score:2)
Didn't use Linux, used Windows,
Didn't use Apache, used WEBrick,
Didn't use PHP/Perl, used Ruby.
Shouldn't this article be on ONWwmr.com?
For Python, CherryPy is another simple framework (Score:3, Interesting)
For Python, I have been experimenting with CherryPy [cherrypy.org] which is a fairly low level web application framework, but is easy to use for publishing web services using XML-RPC, generating dynamic HTML (it does not have a template language but works with a few Python HTML template packages), etc.
Anyway, CherryPy "seems just about right" - light weight and easy to use - definitely does not have the capability of Rails though.
Ramping up . . . (Score:2)
So, when will they create a competitor to this? Or have I missed it already . . .
Flowgram (Score:2)
Development time (Score:2, Informative)
I originally built Web Collaborator [webcollaborator.com] in 8,000 lines of PHP over a couple of months. In about 16 hours, I had completely rebuilt it from scratch in the Ruby on Rails framework with 1,000 lines of code.
I have since created sites like The Conjuring Cabaret [rufy.com] and S5 Presents [s5presents.com], both with astonishing simplicity and rapid development. Rails gives me short-cuts for almost everything I ever want to do with web development.
weird directory structure (Score:5, Informative)
why can't someone build a decent framework that follows the simple "directories are directories and files are pages" model used by asp, php, cgi, etc.
and what's with the database naming conventions? the author kind of brushes it off at the end with this statement: "Even if you have to use a legacy database that does not use the Rails naming conventions, you don't have to give up the productivity advantages of using Rails--there is still a way to tell Rails explicitly what table and column names to use." personally I would not use those conventions no matter what database i was using, nor would any decent database developer or administrator i have ever known.
at any rate, at work i program in whatever language they tell me- currently asp+jscript, before that php. for personal projects, my current favorite is perl's HTML::Mason. all the benefits of php (and then some) without the awful language conventions.
Re:Ruby (Score:2)
Re:Ruby (Score:2, Funny)
Empire Builder? (Score:2, Funny)
Rabid Empire Builder (and Euro Rails, British Rails, Russian Rails, Iron Dragon, Lunar Rails, India Rails, Australia Rails, Nippon Rails, etc.) fan that I am, I saw the title and thought immediately that Ruby Rails was the next game from MayFair [coolgames.com] which would somehow bridge programming and empire building at the same time. Alas..
you rolled a 1, ha!, didn't compile!
Re:Ruby (Score:2, Funny)
Re:Good for "recipe" queries but little else (Score:4, Informative)
You might want to tell that to Basecamp [basecamphq.com], 43 Things [43things.com], and Tada Lists [tadalist.com], since they obviously have no idea that Rails isn't good for anything of that magnitude. Might also mention it to all the thousands of people that use those sites, daily, and to the handful of developers who built and deployed those sites in a fraction of the time and cost of other web solutions.
Then again, maybe you shouldn't...
Re:Good for "recipe" queries but little else (Score:2)
Re:Good for "recipe" queries but little else (Score:3, Informative)
Re:Good for "recipe" queries but little else (Score:2)
Which is kinda scary.
Re:Good for "recipe" queries but little else (Score:2)
Have you ever programmed a web app before? (Score:5, Informative)
It's extremely cool to watch someone set up a working webapp that fast.
But I have to take issue with:
Half of the darn article is setting up MySql and installing Ruby and Rails from scratch on a windows machine. Do you have any idea how much harder this crap is to write in other frameworks? You'd have to write at least 2x as much code. No one has an Active Record class as good as Rails'. You'd double the code count just doing the SQL linkage!It's one thing to be unimpressed, but it's another to know jack shit about the domain and say it's all worthless. Anyone who's ever made a web application will appreciate it.
Re:Good for "recipe" queries but little else (Score:3, Insightful)
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
Re:Good for "recipe" queries but little else (Score:2)
Explain how this framework is orders of magnitude better than, say, Zope (which I'm most familiar with of the web app frameworks). I skimmed through the Hibbs' demo and wasn't so wowed. I thought it was cool that the framework takes care of the ORB-ing through 'generate' commands and then automatically picks up the changes to the table structure, but Rails isn't alone in making the brokering easy. I might give it a tr
This demo is mediorcre. You might want to check... (Score:2)
You're a Zope fan, which means you're a Python fan. Probably the only language that can compete with Python on even terms is Ruby, and the languages are extremely similar.
I'd highly recommend you check it out. The language should be close enough to Python to learn in a day or two, and Rails is really powerful. It's different from Zope-no doubt about it-but that doesn't mean it's bad.
Re:Good for "recipe" queries but little else (Score:2)
Lets see you do the same thing cleanly with a MVC pattern in any other language/framework in as little effort as you can with Rails.
Re:Good for "recipe" queries but little else (Score:2)
Re:Pay for MySQL front? (Score:2)
Yes, it does, try phpMyAdmin [phpmyadmin.net]
Re:HTML (Score:2)
Rails provides CRUD (Create, Retrieve, Update, Delete) helpers if you want to use them. They're aren't necessary by any means, they just provide an easy, extremely quick way (one line of code) to create forms that will let you operate on a database table.
I'm not sure if the code that it generates is standards-compliant, but I'd imagine that it is.
Yes, but... (Score:2)
In general you do not use those scaffolds in the production app. They're placeholders for you as you program your actions, and in that regard they're very useful.
Re:So great, so slow (Score:2)
Re:Do you know what makes me laugh? (Score:3, Insightful)
Re:Do you know what makes me laugh? (Score:3, Insightful)
does at the very least, the following:
Nope. (Score:3, Informative)
Besides, Ruby doesn't have real continuations. Their continuations are based of longjmp() C call, so it has some limitations that real continuations don't have.
Re:Offtopic - Ruby (Score:3, Informative)
Check out www.rubycentral.org, which has an online ruby book (for 1.6, but it's a place to start). It will take you to all the other sites.
I highly recommend getting in on the mailing list, ruby-talk. It's very interesting.
Re:There's that bloody MVC again (Score:3, Informative)
The controller is responsible for manipulating the objects from the model.
The view is used to display controller data and to send user data back to the controller.
It works very well.