| Advanced Rails | |
| author | Brad Ediger |
| pages | 357 |
| publisher | O'Reilly |
| rating | 10 |
| reviewer | Ben Munat |
| ISBN | 0596510322 |
| summary | Extensive reference for advanced topics in Ruby on Rails development |
All trademarks and copyrights on this page are owned by their respective owners. Comments are owned by the Poster. The Rest © 1997-2009 Geeknet, Inc.
I'd recommend the Rails Cookbox instead (Score:4, Informative)
Re: (Score:2, Informative)
Good old RubyOnRails (Score:4, Funny)
Re:Good old RubyOnRails (Score:5, Interesting)
Parent
Re: (Score:3, Insightful)
Really boring example of Rails money $100/hr (Score:4, Informative)
Could I have written it in PHP? Sure. Could I have done it as quickly? Probably not. The problem screams Rails Me -- little application, not all that much complexity (probably under 500 LOC outside of the view templates, which are 99% HTML), and its performance requirements are quite modest. (It typically deals with about a thousand visitors a day, although the application could chug through that in about 10 seconds in my tests, with caching turned off.) As for the exhorbitant hardware costs of the system, I was forced to move up from $7 shared hosting to a $20 VPS so that I could continue doing $1,500 in sales every month. Oh noes.
Anyhow, like I said, pretty boring. I anticipate, on the basis of the increase in traffic and trial downloads that I've had since launching, that the rewrite will be worth about $100 in additional profits for every hour I worked within the first two months. I keep adding new little features, too -- spent an hour yesterday adding Javascript graphs on the back end -- and it is some of the easiest web programming I've ever done. (I do Big Freaking Enterprise Apps in Java by day.)
Incidentally, a big "Heck yes" to parent when they said "The real money, however, is in developing your own stuff and then selling it on as a going concern." Why take a fraction of the revenue of your client's website once when you can operate the website yourself and take all of it on an ongoing basis. (And if it gets to be too much work, you hire out the boring stuff to folks who think $10, $50, or $100 an hour is a lot of money.)
Parent
Re: (Score:2)
Re: (Score:3, Interesting)
Also, a friend's company now has more Rails projects coming through the door than Java ones.
Here's a nice post [pivotallabs.com] from a company doing more than just paying the bills.
Re:Good old RubyOnRails (Score:4, Interesting)
Parent
Re: (Score:2, Insightful)
So I ask: Why the bashing?
Re:Good old RubyOnRails (Score:5, Interesting)
Parent
Re:Good old RubyOnRails (Score:4, Insightful)
There's a simpler reason for bashing Rails: it's a threat. It's just that simple. Any time something comes along that can feasibly put market pressure on existing technologies, there's going to be bashing.
Rails pays my bills. I honestly don't give a damn what anyone else thinks if it's meeting my clients' needs. Simple as that.
Parent
Re: (Score:3, Interesting)
This is where Groovy and Grails comes in. I just attended a conference with a bunch of Java developers and the Groovy/Grails sessions were all packed, and they were the talk of the sh
Re: (Score:3, Insightful)
You honestly think that any app you write is going to be better than its analog built in Rails? That you are a better developer in your chosen language/framework than every other Rails developer on the planet?
And you call Rails guys arrogant?
Re:Good old RubyOnRails (Score:5, Insightful)
And upon what do you base this claim? The fact you're directly comparing Rails (a framework) to PHP (a language) is telling. It'd make a lot more sense to say "I think any app written in Rails could be written better in CakePHP" although that claim is obviously rather dubious, as well. To be truly appropriate, you ought to talk Ruby vs PHP. And if you get to that point you're going to have to justify what "better" actually means. What it means to you isn't what it's going to mean to anybody else and vice versa.
In the end, this debate ends up being Mac vs PC vs Linux vs Whatever. Everyone's got their opinions. What works for you is the right solution for you.
Parent
Re:Good old RubyOnRails (Score:4, Informative)
Yeah. Those few lines of code that load the actual framework really muddy the waters. The fact that you're talking about "framework specific handlers" as an attempt to criticize a framework is a good indication to me that you've never tried Rails at all and just assume you're right about everything. If you never use any framework in any language, congratulations. On the other hand there are those of us who think a couple hundred K of memory used by persistent processes is worth significantly (by your own admission, perhaps 50%) reduced development time and thus cost.
As far as "indirection" via AR, if you don't want it you're free to not use it. It's one of the truly magnificent things about Rails. On the other hand if there's a particularly cumbersome query you're quite free to write it in raw SQL. There's a performance boost to be had there, yes. To the vast majority of web applications it's negligible, and that means that its benefits again outweigh its drawbacks. Rails isn't the perfect solution for EVERY project, but a handful of exceptions doesn't make it a bad rule.
Yet another irrefutable clue you made up your mind without ever bothering to try anything yourself. Or that you're a pompous ass, either way. Comparisons of scalability are ABSOLUTELY MEANINGLESS if you only provide one of the two items to be compared. Thus your statement is absolutely meaningless. Given the rest of your post, and your previous ones, that seems to be par for the course.
Rails handles scaling well. It probably handles less before it NEEDS to scale in MOST cases, particularly when it is (unfairly) compared to languages rather than other frameworks. If you really are on the border where Rails means you need an extra machine and (say) PHP doesn't, then maybe this is one of those areas where Rails isn't your solution. If you're already into the realm of needing to add hardware to handle load, Rails provides a lot of great solutions for doing that. And once again, it's going to be simple to implement.
I'm not simply talking out of my ass. I've worked on some projects for major clients including ESPN that were done in Rails and are humming along beautifully. Worse yet, some of these projects were extremely time-sensitive, by which I mean that most of the day they do very little work but when the work comes it comes in a huge swarm in a short time window. IE, the worst-case scenario as far as loading servers. It's still working fine, and we got to charge ESPN half as much as we would have for development of a PHP solution. They're already sending us more business, so I guess evil, evil Rails didn't destroy their company too badly. There are obviously many similar stories of huge sites working just fine on Rails, such as yellowpages.com.
To sum it up: Yes, a framework has some additional overhead compared to a simple language such as PHP. An interpreted language won't run as fast as a compiled language like Java or .NET (to bytecode). These are facts. What's in dispute is whether this makes a significant difference, and my experience with popular projects for major clients is that a well-coded Rails solution holds up fine.
You're right that development cost is sunk and electricity (and similar) costs are ongoing, but before that matters you have to be talking about MAJOR projects that are very probably billed minimum in the tens of thousands of dollars range and, realistically, probably over the hundred thousand dollar threshhold. At this point, your 100% more development time is a significant cost that is likely to take many years to balance. Even a $5,000 a year difference in marginal cost if you're talking a $25,000 or $50,000 difference in developemnt cost is
Parent
Re: (Score:3, Interesting)
You make some good points about Rails's flaws, although I'd argue that many of them are related to ORM in general and have less to do with ActiveRecord's implementation than the concept as a whole. Your mention of "interpreted" gives me pause, as it almost sounds like you're arguing that interpreted languages are inherently flawed. I'm not say that's what you're saying, but I think you can see how that could be, well, interpreted.
Of the things you pointed out, I'll candidly say that Rails deployment is
Re:Good old RubyOnRails (Score:4, Informative)
But just look at a couple [rubyhitsquad.com] examples [robbyonrails.com] of why people run away from the community. (For those who don't know, the second example is DHH, creator of Rails.)
Parent
Re: (Score:3, Interesting)
I find this argument amusing every time I hear it. Those in the Rails community are often called arrogant for insisting on things being done "The Rails Way", when it's often your own arrogance that won't allow you to do something any other way. In either case, it's the people you have a problem with. There are far fewer legitimate complaints about the Rails Framework than there are about Rails people. You can dissociate yourself from the people and still have a capable framework.
If you don't want to d
Re: (Score:3, Interesting)
I agree entirely, although occasionally some of the more arrogant things that I don't agree with make it into the Rails Framework.
So far, enough people think like me that it hasn't been a problem -- there's always a plugin or set of scripts somewhere to help me out. A recent example: Schema Validations. While not all validations can be reflected in
Re: (Score:2)
Alternative theory: it's a nice framework, but its adherents insist that it's a marvel of engineering the likes of which have never been seen before, nor will ever grace us again, and that it completely obsoletes all other methods of developing web applications. They base this on the fact that you can pick up a Rails book and bang out a trivial application really quickly.
In
Re: (Score:3, Informative)
Rails is *nice*. I like it. I just don't get the obsession with it. And, let's be honest, it's not in widespread use. From a purely *financial* perspective, you're much better of learning the in-and-outs of something like ASP.net or PHP. Or, hell, even Perl. Those are all more widely used, and better supported.
Re:Good old RubyOnRails (Score:5, Insightful)
Parent
Threads workaround (Score:3, Informative)
Yes, it takes more effort to set up, but that also makes it really easy to scale since the component parts of a Rails deployment (Load Balancer / Web Server / App Server / DB Server) are each very sc
Re: (Score:3, Informative)
Rails has paid my bills since 9/2005. And I'm a lot happier than I was coding Java.
It would pay the bills for two other people too, but we can't find anyone to take a full-time job in it. It seems that anyone who knows Rails right now in SF is contracting at $125/hr.
Not to say Rails doesn't have its problems as a technology and a community...
Re: (Score:3, Informative)
Also, I was a full-time rails developer for nine months.
Re: (Score:3, Funny)
Chapter 10 - Large Projects (Score:4, Insightful)
Perhaps the fellow readers can give some more insight into this?
Re:Chapter 10 - Large Projects (Score:4, Interesting)
> trying anything close to what I would consider 'large' projects.
I've found that Ruby has a way of making large projects into small ones. Going from 250 KLOC in Java to 10 KLOC in Ruby would not surprise me.
> RoR is not the right tool for many significant sized project, especially in the enterprise environment.
Most enterprise environments are a morass of battling departments, entrenched legacy technologies, and outdated, inefficient processes. While that significant-sized 30 person project is bogged down for two months negotiating more app server licenses, the 3 person Rails team can knock out a fully tested application that does the job.
Parent
Re: (Score:2)
However, it's not serving zillions of requests per second (it's an internal application). Our public-facing Rails apps are much smaller, and don't face huge traffic either. The
Re: (Score:2)
> deployment were all huge pains two years ago.
Yup. Judicious Capistrano + mongrel_cluster + monit usage make a difference these days, but it would still be nice to have fewer moving parts. Maybe Rubinious will get us there.
Incidentally, "cap deploy:check" totally rocks.
Re: (Score:2)
Heh, nice one.
Re: (Score:2)
Re: (Score:2)
Sure. It's still patently ridiculous to claim that most large projects are written in PHP (even if we are just talking about web projects).
I also happen to think that PHP makes writing "powerful well-designed apps" a bit harder than necessary, but that's just me.
Re:Chapter 10 - Large Projects (Score:4, Funny)
Large scale projects are usually written in Java or
Parent
Re: (Score:3, Interesting)
Is there any sort of evidence for this? All I'm hearing is that RoR is having a lot of trouble scaling with complexity.
Which makes sense, since it's designed to make really trivial applications really easy to write - nothing wrong with that, really, it's a useful niche.
Rails and its ilk really emphasize the start-up cost, those first couple of days that are essentially irrelevant in a large project.
Re: (Score:2)
"Advanced" for RoR is routine for everyone else. (Score:5, Insightful)
The book isn't poorly written, and the information it conveys is useful to some people, I'm sure. But I don't consider the topics it covers to be "advanced" by any means.
Using triggers and rules, for instance, are not really advanced concepts. Nor are plugin-based architectures. REST techniques are pretty basic, as well.
I was hoping for this book to really discuss pushing RoR to the max, allowing us to do what we can't currently do easily with J2EE or
Re: (Score:3, Insightful)
From what I can say, there's still some things that RoR routinely does more easily than J2EE or .NET -- it's just that good ideas tend to propagate, so I suspect it's not as dramatic a difference anymore.
Please O PLEASE stop the Ruby hype (Score:2, Interesting)
Re: (Score:3, Funny)
Re: (Score:2)
Probably.
Re: (Score:3, Insightful)
I'm seeing more Anti-Ruby/Rails FUD here than pro-Ruby/Rails hype.
Would you say the same thing if it was a
Re: (Score:3, Insightful)
What to do? (Score:5, Funny)
Move to Java?
I kid, I kid! Ow, ow, ow!
Re: (Score:3, Funny)
Required reading (Score:3, Interesting)
> as to label it required reading
I've been doing Rails for about two years and still found this book to be very helpful. It should be called "Rails For Real Projects" or something, because he covers stuff you _will_ run into. The nice thing about this book is that he doesn't waste time explaining what 'puts' does and such; he gets right down to business. The section on modifications that Rails makes to the Ruby standard library is worth the price alone.
Referencing? I smell a rat (Score:2)
Its spamming and should be banned from slashdot.
Re: (Score:3, Insightful)
The price is the same for those buying it. I don't see what the problem is.
Can some kind soul explain REST? (Score:3, Interesting)
But what's the excitement all about? I would think that for most site owners, this would be a disaster, not a boon.
It sounds like a graven invitation for others to do stuff with your site
Furthermore, it seems like something that makes trying to break your site much easier since crack efforts can be done using standard methods for which the weaknesses are well known. So some smart guy can find a weakness in the REST code and all of a sudden everyone who's followed the rules can be automatically exploited.
Google encourages you to use their maps, because it builds loyalty to them, and you are probably using their ad network anyway so they don't lose much revenue. But for most sites, mashups are going to virtually eliminate revenue, cost bandwidth and overall make your life miserable. They are the modern equivalent of linking to images on someone else's site
So tell me, what does REST do for me, as a site owner and developer, as opposed to what it does for others, such as people creating mashups and the like?
Are there any ways in which mashups can be made profitable or worth encouraging, for people who don't own their own ad networks?
D