Slashdot Mirror


Ruby on Rails 2.0 is Done

Jamie noted that ruby on rails 2.0 is done. In addition to upgrade and installation instructions, the article lists a number of the more interesting new features in the release which appears to be quite extensive.

62 of 385 comments (clear)

  1. ORM still broken? by poet · · Score: 5, Informative

    I wonder if they still disallow proper database design by having a requirement of an autoincrementing number for the primary key.... The Rails developers could learn a thing about databases. Start here: http://en.wikipedia.org/wiki/Database_normalization . Yes I know that a serial/autoincrementing key makes it easy for the app... it makes it a lot harder for the DBA in a lot of cases.

    --
    Get your PostgreSQL here: http://www.commandprompt.com/
    1. Re:ORM still broken? by K.+S.+Kyosuke · · Score: 5, Funny

      Making the huge mistake that everyone would only ever want to do something your way is how you kill a programming language.

      What a relief... As a lisper and rubyist, I'm glad to hear that Python is going to die! Good riddance!
      --
      Ezekiel 23:20
    2. Re:ORM still broken? by FooBarWidget · · Score: 4, Insightful

      People have discussed this over and over and over again. I presume you're talking about support for composite primary keys. They aren't necessarily a good thing. Go read http://rapidapplicationdevelopment.blogspot.com/2007/08/in-case-youre-new-to-series-ive.html

      I don't even consider normalization taken to the extreme, to be a good thing. It's a trade off, just like everything else - what you gain by normalization, you might lose in the form of added application complexity, or perhaps even something else. Just because normalization is "good" according to ivory-tower database theory, doesn't mean that anything that isn't fully normalized is "bad" or "broken".

      "Yes I know that a serial/autoincrementing key makes it easy for the app... it makes it a lot harder for the DBA in a lot of cases."

      Can you explain what exactly it is that makes it a lot harder? (And isn't a DBA paid to do his job?)

    3. Re:ORM still broken? by FooBarWidget · · Score: 5, Insightful

      That's great for you, but Ruby on Rails is not - and isn't intended to be - a framework for redundant distributed DB applications. Ruby on Rails is not trying to be the thing for everybody. And that's exactly what makes it so powerful and easy. Indeed - turning it into something for everybody actually makes it worse. I'd like to see some proof that composite primary keys are so important in web applications. So far I've seen no convincing evidence. Despite all the complaints about composite primary keys, new Rails websites are written everything, even by high-profile organizations like IBM, NASA, Oracle and Yahoo. And they seem to function just fine.

      If you really, really, really, really need composite primary keys, you can still fallback to raw SQL queries in Rails.

    4. Re:ORM still broken? by thammoud · · Score: 4, Interesting

      A DBA that uses composite primary keys does not deserve the title. You should never designate a primary key whose value can change. Use business keys for that.

    5. Re:ORM still broken? by Anonymous Coward · · Score: 3, Interesting

      Getting a *PROGRAMMER'S* opinion on data modeling is probably not a good idea. The view everything as objects or records, which is what they use in their programming. That's a subset of what the relational model allows.

      Here's the simple, easy-to-comprehend reason why surrogate keys should not be used universally: Your logical model should exactly correspond to the client's conceptual model.

      If the client says that "orders have order items, numbered 1,2,3,4..." then your model should have (ORDER#, LINE#) as the compound key for order items. If the client says "customers are identified by an arbitrary customer number", then it's okay to use an artificial ID. If the client says "customers are identified by SSNs" then that's your key.

      Pretty simple concept, but completely lost on programmers who think the database is the "backing store" for their code (which will likely be replaced or rewritten in few year anyway, especially stuff like PHP, Ruby, etc). No, the database is the foundation of the business. It should be properly designed.

      BUT, it's true, today's SQL databases are pathetic. They don't make this stuff easy. The don't let you create a data type that automatically renumbers the "LINE#" field if entries are deleted or removed. They don't let you create fully updateable views, making it trivial to create alternative key structures on top of your properly designed base tables. They make it hard to refactor and transition schema (views are like methods in OO code.. they let you encapsulate). They make joins expensive. So yes, there's a tradeoff and usually I give up and use surrogate keys most of the time (not ALL of the time though.. depends).

      It's not WRONG to be faithful to the conceptual model 100%. It's a limitation of TODAY'S tools. But the programmers continue to spew their nonsense, the database vendors put out products optimized for programmers... it's a vicious circle.

      Also, I don't know why you're bringing normalization into this discussion. I suspect your knowledge of "ivory-tower " database theory is limited, thus you incorrectly label all ad-hoc design rules as "normalization". (What exactly do you use to when working with databases, if you don't like theory?) Normalization has to do with key dependencies, not the structure of the keys, and is not required by the relational model because it is a *design* concept.

      But since you bring it up, denormalization ALWAYS results in either a loss of data integrity, or a loss of performance. If you denormalize without maintaining integrity (the usual way), then you've fundamentally changed your model (what's allowed in the DB is different now). You better BE DAMN SURE you need it, and you better DOCUMENT IT out the ass. If you denormalize, but add constraints to maintain integrity, then you've killed performance for no reason (however this is useful when transition from denormalized designs back to normalized designs).

    6. Re:ORM still broken? by FooBarWidget · · Score: 2, Insightful

      Yeah, blame it on the programmers. Taking elitism (or perhaps "anti-programmer-ism" is a better word) to a whole new height.

      Yes, my database theory knowledge is limited. I admit it. I passed the 'database systems' course, but I'm not a professor in database systems, so *of course* my database theory knowledge is limited. That's why DBAs exist and why they are paid to do their job in the first place.
      But you know what, the database isn't the only thing that exists. There's also the actual application. If, by normalizing stuff to the extreme, makes the application 6 times harder to write (= missed deadlines, potentially more bugs, harder to maintain, etc) then I don't mind de-normalizing some stuff after carefully weighting the pros and cons.

      As for "ivory tower database theory", consider the following scenario (this is based on a question from the "database systems" exam):
      We have a 'teachers' table with columns (first_name, last_name, address, city, phone_numbers). Here, phone_numbers is a set. We are asked to normalize the table. One of the obvious things to do here would be to change the 'phone_numbers' column into a table, and add a one-to-many relation from the 'teachers' table to the 'phone_numbers' table.
      The professor, however, took normalization to the extreme: he even introduced a 'numbers' table. So a 'phone_number' table has a one-to-many relationship with the 'numbers' table. (Or something like that; I can't remember the question completely.)
      Great. Perfect normalization. But I would never write such a database schema. I don't even want to think about the huge, ugly, and hard to maintain SQL queries that result from this. And this is what I mean by ivory tower: great in theory, but makes things a total pain in practice for 99% of the applications.

    7. Re:ORM still broken? by crayz · · Score: 5, Interesting

      If you do a search for "composite keys rails", hit #1 is this, a gem written by a fairly prominent ruby programmer that makes it trivially easy to use composite primary keys within ActiveRecord. My guess is if you actually cared about this issue, rather than just raising it as a canard to bash Rails with, you would have found this solution to your problem and wouldn't be posting here

    8. Re:ORM still broken? by crayz · · Score: 2, Informative

      And I'll admit, SQL databases don't exactly make it easy for anybody (how about letting DBAs create a VIEW with the "Rails design", on top of a properly designed database? That's what views are for! Codd is rolling in his grave).

      Go for it - I've done it more than once when I needed to get data out of legacy(and very poorly designed) databases. Rails supports this and it works just fine. The one point you make that I really agree with you on is ActiveRecord's inability to detect changed attributes and save only them to the database. You may want to take a look at DataMapper, a bit of a different take on a Ruby ORM

    9. Re:ORM still broken? by jadavis · · Score: 2, Interesting

      Yup, 5th normal form is a tad much, but there is no reason to don't go 3rd.

      "A tad much"? Either you're being facetious, or you have a profound misunderstanding of normalization.

      In many cases, a relation in 3NF is in 5NF. In fact, you have to be somewhat creative to think of a practical example of something in 3NF but not in 5NF.

      "Normalization" is highly misunderstood. There is no such thing as "extreme normalization". If you see an example of something in 2NF, and then see a 3NF design side by side, you would probably think to yourself "yeah, the 3NF design looks better to me".

      --
      Social scientists are inspired by theories; scientists are humbled by facts.
    10. Re:ORM still broken? by coryking · · Score: 4, Insightful

      That stored procedure is awesome (well, it actually isn't very good sql, but it doesn't matter right now). As the developer, you just need to worry about passing the monster name and the database spits out everything you want.

      If you do most of the logic in your stored procedures, it makes it easy to bolt on new features written in various languages. If you decide to have a perl script for a cron job, you just call the same stored procedures your ruby app is calling. If you want a windows front end for your admin staff, the windows app calls the same stored procedure too.

      Once you bury the database logic in the application code, you have to rewrite it for every application. It is, in a way, a very evil form of copy & paste programming. Now every change in the database requires you to go into every single application and change something. Kinda like when you get slutty with your code and copy & paste it rather than abstract it out into a library.

      And I'm aware stored procedures don't play nice if you are worried about cross-database issues because you sell the software. This only works when you get complete control over the application & database stack.

      PS: MySQL stored procedures suck. Use a real database with a better stored procedure language.

    11. Re:ORM still broken? by orasio · · Score: 2, Insightful

      While theoretically you are correct, it doesn't apply to 99% of the web applications. Most web applications are very CRUD-like and deal with small to moderate amount of data. Most software on this planet is written to be used internally by an organization. Not everybody is building the next MySpace or the next Google search engine. Some software on this planet might be very CRUD-like. In my experience, all web aplications, specially those for internal use, are CRUD apps with a twist. I haven't seen any CRUD-like app that I could solve in a straightforward way. In general, that twist takes longer to implement than the CRUD part does. In fact, it takes longer to define accurately. Development time is important, but not even that important. The strength of using JEE, or any other big, flexible technology, is that you can define (or get people to define) stuff without thinking about the implementation, and it won't be that hard adapting the tools to what you designed. You can even map preexistent database tables (very common for internal apps) using ORM, although that can affect performance for big datasets.

      Not everybody is working on small shops, on non mission critical apps. When you have big stuff, or big clients, you need to be very flexible, because you can't control everything. You can get the database shoved down your throat, communication protocols, unneeded specs, everything. That is what flexibility is for. A consultant can come and say that you need a high availability distributed architecture, you might have to change stuff for security reasons, for performance. Flexible frameworks let you do that.

      Of course, it's nice that there is stuff like ROR for those who don't need to deal with medium to big projects, but I don't think they are 99% of anything.
    12. Re:ORM still broken? by CarpetShark · · Score: 4, Insightful

      A DBA that uses composite primary keys does not deserve the title. You should never designate a primary key whose value can change.


      You're assuming that all composite primary keys use values that do change. That's highly unlikely, given the number of tables in the world filled with historical data. That said, I agree (for other reasons) that surrogate keys are much better.
    13. Re:ORM still broken? by FooBarWidget · · Score: 2, Interesting

      "You're wrong, and you're guessing based on your own apparently very limited experience. Why not just admit that for "simple" CRUD applications ROR is great, for some it still works well, and that for other applications it may not be a good fit... or not work at all."

      I don't know what you've been reading, but that was my point all along!

      And there is nothing wrong with that. Most of the web apps that I make are CRUD-like. I'd still rather choose RoR for its productivity boost over your theoretically-better-and-can-be-used-for-everything-but-totally-pain-in-the-pass-to-work-with $FAVORITE_FRAMEWORK.

    14. Re:ORM still broken? by FooBarWidget · · Score: 3, Insightful

      "Holy. Crap. You're not the guy that writes Active Record, are you?"

      If you're referring to DHH, then no, I'm not him. My stance isn't as extreme as his ("database is just a big hash") but I do agree with some of his points. Transactions = good. Foreign key constraints = good. Stored procedures = only use when absolutely necessary. Normalization = weight between pros and cons in application code complexity and data redundancies. Etc.

      "The thing a lot of OSS developers seem to forget is that many applications are primarily for data processing with user interfaces thrown on top. I.e. Not every damn "web app" is a blog or wiki, where it's primary purpose is to be a web app."

      Not every, but *a lot* of them are. Very often they're systems for displaying, storing and retrieving small to moderate amount of information (unless you're working on a really really big multi-million system).

      "Fact is that, if Rails wants greater acceptance (and, yes, I realize it is already widely accepted -- I'm talking about continued growth), then it's going to need to support things like composite keys. Why? Because people use them, and the application may have come years before the web interface."

      I don't think so. I'm pretty sure that people complain about composite primary keys because it's so easy to complain about. Most of them probably wouldn't consider using Rails even if it fixes all its "flaws". *
      There was a time when I took all Internet complaints very seriously. I worked very, very, very hard to meet peoples' demand, and I did it for free. In the end, it didn't help. Whenever I publish a fix for one complaint, they complain about other things. It's an endless cycle. The complainers can never be satisfied no matter what I do.
      For example, people complain about memory usage in Rails. I've developed a way to reduce the memory usage by 30%, and look - very few people are interested! The people interested in my work are extremely disproportional to the number of people complaining.

      * But by fixing Rails "flaws", you've just made it worse. The reason why Rails is so great in the first place is because it's a very specialized framework. It's not trying to be the thing for everything, like J2EE. If you make it the thing for everything it'll be a lot more painful to work with. It's like saying that your television can't wash your clothes. While it's possible to make a television that does that, it would be a royal pain to make and to work with.

    15. Re:ORM still broken? by Bill,+Shooter+of+Bul · · Score: 2, Insightful

      Just curious: why isn't performance even mentioned in this thread? It should be a tradeoff between (application code complexity, normalization, and performance). Choose the most important one and design accordingly, sacrificing the others only when necessary.

      --
      Well.. maybe. Or Maybe not. But Definitely not sort of.
    16. Re:ORM still broken? by soloha · · Score: 2, Informative

      Obviously those people were inexperienced with Ruby and or Rails. You can add new methods, or override the methods in any class you want. It's very easy to change they way any object behaves. And the concept of code blocks is extremely powerful and flexible (yes, yes, not an original idea - borrowed from Small Talk)...

    17. Re:ORM still broken? by Ilan+Volow · · Score: 4, Insightful

      When you as a DBA use anything other than a surrogate primary key, you are making the exceptionally dangerous assumption that the client has the correct understanding of what their model entails, that there will be no exceptions to the rules of that model, and that the model they gave you will never, ever change.

      Borrowing from your SSN example, let's say that your client tells you the main way they identify customers is through the SSN, and you go by that, and then there's a case of identity theft and the customer's SSN number has to be changed? Now you've got potentially thousands of records with a bad primary key that you have to change (and mitigate constraint issues as well). What if privacy issues require the company dropping SSN's as an identifier, and now the company will be forbidden from asking customers their SSN's? You'll no longer be able to generate primary keys compatible with the same ones used before.

      What truly separates a good DBA from a bad one is the good DBA's ability to anticipate change, design for change, insulate existing stuff from change, and basically save the client from any flaws in their own conceptual model (while making it look like they've followed the client's conceptual model to the letter). A bad DBA simply trusts whatever his client says and believes it to be correct and forever immutable.

      --
      Ergonomica Auctorita Illico!
    18. Re:ORM still broken? by dubl-u · · Score: 2, Insightful

      If you do most of the logic in your stored procedures, it makes it easy to bolt on new features written in various languages. If you decide to have a perl script for a cron job, you just call the same stored procedures your ruby app is calling. [...] Once you bury the database logic in the application code, you have to rewrite it for every application. It is, in a way, a very evil form of copy & paste programming.

      That's a good point, but I think you're learning the wrong lesson from it.

      Yes, duplicating your database schemas across multiple code bases is bad, as it makes it approximately impossible to update things. But pushing all the brains into your database leaves you with four problems. One, you're generally locked into exactly one vendor. Two, the variety and quality of development tools is poorer. Three, if there's some other storage technology you want to use, you're generally screwed. And four, your various code bases are still tied to specific stored-procedure calls, which last I looked didn't have much in the way of protocol versioning.

      I think the better option is to follow the OO approach, where you keep behavior and data together. You make yourself a tidy service layer in some convenient protocol like RESTful HTTP with XML or JSON. (Rails has nice support for that, BTW.) Give it a little versioning, so that you can transparently extend your APIs. That gives you the same kind of isolation your stored procedures do, but a much wider range of tools for both client- and server-side development.

      In my view, that gives you the same clean boundary and exactly one code base mucking with raw data, but a lot more flexibility over the long haul.

    19. Re:ORM still broken? by Allador · · Score: 4, Insightful

      If the client says that "orders have order items, numbered 1,2,3,4..." then your model should have (ORDER#, LINE#) as the compound key for order items. If the client says "customers are identified by an arbitrary customer number", then it's okay to use an artificial ID. If the client says "customers are identified by SSNs" then that's your key. I hate to feed the cowards, but I just cant let this go.

      You are completely incorrect.

      If your domain model describes the way an actor finds an entry is by Order# and Line#, that should in no way, shape, or form decree what your technical artifacts look like.

      The correct thing to do in that case is to have a unique, opaque, identity key (numeric or guid, just so long as its unrelated to the record data, and has no additional meaning beyond the unique value of that record).

      Then you can also add unique constraints or indexes to the composite key, and/or you can enforce that unique constraint in the application. Or both, for the smart ones.

      But you need to have a unique way to identify the record THAT IS NOT SUBJECT TO CHANGE. In your example, you could re-order the lines, or one line could have been a mistake and you need to move it to a different order.

      If you've used composite keys on order# and line#, then you've got alot of cleanup work to do after your change.

      If you've used proper opaque identity keys, then you just change the data, and there are no side effects.

      Since in that case your joins are also done on the identity keys, your relatinoships are stable even when you change order# or line#.

      The SSN one is even worse. I can guarantee you that if you do that, someone will have the wrong SSN, and it will need to be changed in your data.

      If you've used SSN as the primary key, then its a pain in the ass, and you have to do data integrity cleanup.

      If you've used a proper opaque identity key, then you just change the SSN, and there are no side effects.

      This is stuff you learn the first time you write an app as a junior developer without a mentor, and use SSN as a key. A year or two later you come to regret it, and the lesson is learned for a lifetime.

  2. Fresh Meat! by TechyImmigrant · · Score: 2, Interesting

    Fresh Meat, full of bugs, for the hackers to hack.

    If you desire a secure system, do not place a large, immature body of code in the line of fire on the internet.

    --
    Evil people are out to get you.
  3. I don't understand the fuss. by Russ+Nelson · · Score: 4, Interesting

    I don't understand the fuss behind Ruby on Rails. Ruby is a programming language. Rails is a framework. Frameworks are a dime a dozen. Is RoR all that wonderful or are we being marketed-to?

    --
    Don't piss off The Angry Economist
    1. Re:I don't understand the fuss. by JudicatorX · · Score: 4, Insightful

      You are, or at least so far as hype == marketing.

      --
      "It is a good divine that follows his own instructions" - Portia, The Merchant of Venice
    2. Re:I don't understand the fuss. by FooBarWidget · · Score: 3, Interesting

      "Sure, but that's because Ruby is a real VHLL. You could also have achieved that effect by switching to Perl or, if you don't mind thinking in object-oriented terms about absolutely everything (and can put up with syntactically significant whitespace), Python. That doesn't answer the question about Rails."

      Uhm no I don't. I've programmed in Perl far longer than I've programmed in Ruby. I only started with Ruby about 2 years ago. I have experience with mod_perl and stuff like Template Toolkit. I have experience with Python. And Ruby on Rails *still* beats everything else I've used.

      It isn't just Ruby, it's also Rails. It's the entire package. Rails is not just any framework, it's an entire design philosophy. It's opinionated software. It's Don't-Repeat-Yourself. It's REST. It's convention-over-configuration. All this stuff together makes me much, much more productive. Ruby on Rails actually makes web application programming more fun than desktop application programming.

    3. Re:I don't understand the fuss. by pestilence669 · · Score: 4, Interesting

      "Web guys" will never understand the hype behind RoR. For the average PHP coder, RoR is slower and more restrictive... A hindrance. To a software engineer, however, RoR's great use of design patterns and best practices compliments what they should be doing already. Just as an example, if you're not writing unit tests, then you aren't very serious about your software to begin with. RoR's test facilities will bore you and nag you death. What Rails does is force you to consciously decide to not do something you should probably be doing, like testing. If MVC and encapsulation mean nothing to you, then RoR can't help you much. You still need you own discipline, or you can still write abominable code. RoR embodies many practices from how the big boys write software, few from the basement hackers.

    4. Re:I don't understand the fuss. by CastrTroy · · Score: 2, Informative

      Yeah, but PHP is one of the least productive environments there is, at least as far as web development goes. You could switch to .Net, and you would increase your productivity 10 fold. That is, if you stick to the .Net way of doing things. You're application might not scale that great, and you might not have any idea what's going on under the hood, and you might have a 20K viewstate submitted with every form, but you will be really productive in the sense that you can turn out a lot of features in a very small amount of time. Comparing raw PHP to rails isn't really something you should be comparing. Make your own custom framework in PHP, that fits the needs of whatever project you are working on, and you can probably turn out features extremely quickly. And your own framework will actually need what you need it to do, instead of you having to make compromises for the shortcomings of the framework.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    5. Re:I don't understand the fuss. by CastrTroy · · Score: 2, Informative

      But you could do the same thing in PHP. The fact that most people don't doesn't really say anything bad about PHP, but just bad about people who generally use it. A lot of people who write PHP leave SQL injection problems. That doesn't mean that it can't be used properly. A lot of people use screwdrivers to stir paint, that doesn't mean that the screwdriver is a terrible tool. You can do unit testing, MVC, and encapsulation all that other recommended stuff in PHP. Just because most people don't, doesn't mean it's a bad tool. If you need a tool to hold your hand and force you to adhere to best practices, then you aren't a very good developer.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    6. Re:I don't understand the fuss. by crayz · · Score: 4, Insightful

      Please just try Rails for a little while. While Rails has its flaws, overall it's a highly productive framework - and much of the credit for the terrific code clarity goes to Ruby, which is much more powerful and dynamic than almost any other mainstream language(other than maybe Javascript)

      Some things to read about and try within Rails:
      * ActiveRecord's ability to introspect the DB schema at runtime. e.g. autocreating the method to allow: User.find_by_name('Joe')
      * ActiveRecord's magic-fields, e.g. created_at/updated_at
      * the ActiveRecord associations, and the easy DB queries that come with them, e.g. @user.posts.find(:all, :conditions => {:status => 'pending'})
      * the scope_out plugin, which provides some nice additions to 'with_scope'. e.g. in the Post model you could do scope_out :pending, :conditions => {:status => :pending}, and then be able to change the previous example to:
      @user.posts.pending
      * ActiveRecord callbacks and the controller before/after filters
      * the RESTful routing and easy links that come with it, e.g. link_to(@user.name, @user) will create a hyperlink to the correct URL for that user record's 'show' page
      * the form/field helpers which also integrate with the routing, so you can now do just form_for(@user) - it will create a proper form tag for hitting either the create or update method for that @user, depending on whether the record has already been saved to the database - the form_for/fields_for block syntax is also very powerful, especially when you add your own form helper methods
      * all the convenience methods provided by active_support, like 5.minutes or 1.month.ago
      * Ruby itself - Ruby is simply a joy to code in. even if I were going to dump Rails, I would now strongly prefer to find a new Ruby framework(like Merb) than using another language

      I'd strongly urge you to pick one or more of the PHP MVC frameworks to look at while you read about Rails. Most of them are copies or at least inspired off Rails to some degree, so they often use similar conventions. You'll see the difference between what's possible in PHP and Ruby - PHP doesn't come out looking too good at the end

    7. Re:I don't understand the fuss. by SilentBob0727 · · Score: 2

      I truly enjoy writing Rails applications, and Ruby is my preferred *nix scripting language. I've even written a few desktop applications in Ruby.

      That said, the kind of evangelism you get from some Ruby on Rails supporters really kind of bugs me. For one, all the "feel-good" language that doesn't really mean anything. You don't HAVE to write RESTful, DRY code in RoR if you don't want to. It's also not the only framework in the world. You *CAN* develop equivalent applications in ASP, J2EE, LAMP, or what have you (see Church-Turing Thesis), sometimes just as easily, sometimes more easily.

      Honestly, it's the right tool for the right job. Sometimes it's a case of all you have is a hammer and everything looks like a nail. Then you get a power screwdriver and feel totally liberated over how much more productive you've become. Suddenly all those nails start looking suspiciously like screws and you think to yourself, hmm, I wonder.... and while you're busy either pounding in the nail with the back of the drill or etching a makeshift screw drive into its head and threading it with a soldering iron, your opponent is running circles around you hammering nails in with that hammer you are so quick to decry.

      An experienced developer can write well-designed apps in any framework. An inexperienced developer can royally fuck over, yes, even a Rails app.

      --
      Life would be easier if I had the source code.
  4. Re:Compound Keys by poet · · Score: 2, Interesting

    I doubt it.. Rails has never been known for actually using the database for more than a flat file... One of the reasons it can't scale.

    --
    Get your PostgreSQL here: http://www.commandprompt.com/
  5. RRN? by raftpeople · · Score: 4, Insightful

    Back when I was a young whippersnapper, we called that thing a relative record number!

    1. Re:RRN? by skoaldipper · · Score: 2, Funny

      Why in my day we called that a hanging chad in a group of punchcards.

      --
      I hope, when they die, cartoon characters have to answer for their sins.
  6. Sites Moved to Rails? by markmcb · · Score: 4, Interesting

    OmniNerd.com, a site I do hobby development for, is running on Rails 2.0. We switched over from PHP this fall and site maintenance has been a dream since. Our site has even survived a few Slashdottings and Diggs since the switch, which used to murder it before. (Granted, the PHP code wasn't the best.) I've heard the "doesn't scale" debate a million times, but I'm curious if there is anyone out there who has recently moved a project from one language/framework to Ruby/Rails and whether you're glad you did or if it's been a nightmare. We're a medium-to-low traffic site with big surges every few weeks and it's worked well for us.

    --
    Mark A. McBride -- OmniNerd.com
    1. Re:Sites Moved to Rails? by Anonymous Coward · · Score: 2, Insightful

      They have no freaking idea what they are talking about. I run sites for a network of radio stations that is all rails, and we have the fastest, most stable sites of any competing media in our markets at least. Looking around, I'm always comparing our sites to the big dogs in New York and LA, and we still destroy them on content and speed.

      The thing is, it takes a lot of planning and a ton of benchmarking to make it work. Fragment caching, more efficient queries, and not picking up every associated item will get most people 50% there. Most rails guys seem more interested in getting the flashy crap figured out and not enough time with optimization. They give all Rails devs a bad name because their crap is unstable and slow.

      [logansbro@gmail.com]

    2. Re:Sites Moved to Rails? by Davorama · · Score: 3, Funny

      11,000 requests in one second.... wow, that's huge!

      How many did the system respond to?

      --

      Davo -- Free speech, free software, AND free beer.

    3. Re:Sites Moved to Rails? by OverlordQ · · Score: 2, Funny

      Status: 500 Internal Server Error?

      If throwing random crap to the script causes that, then yes, you have a serious problem.

      --
      Your hair look like poop, Bob! - Wanker.
  7. Scaling matters if you're Digg. Are you Digg? by patio11 · · Score: 4, Insightful

    While Rails might not be my first framework of choice to implement Digg in, I prefer to build sites which actually, you know, make money by solving problems for paying customers. When you do that, you don't really have to worry about scaling to infinity and beyond, but you do have to worry about expressiveness, maintainability, and time to market. (If you have too many customers relative to servers, heck, easy solution there -- the engineer in me says "just throw up more boxes", but the businessman in me says "pay somebody to worry about it so I can go back to counting my benjamins".)

    I have a Rails site, my first (hopefully of many) for my small business, which plugs along at about 20 requests a second in tests. If I could saturate those 20 requests a second, I would quit my day job on the spot. Scaling? Eh, who cares.

    (P.S. Day job is writing enterprise level crud apps for Japanese universities on the J2EE stack. They worry a bit about, e.g., getting hit with 8k users signing in simultaneously during class registration. You know what we do? Exactly what I'd do for a Rails app in the same situation ("don't do anything stupid like an n+1 queries loop, cache the important stuff, and buy enough hardware for the job"). Only difference in Rails is I have never wanted to poke my eye out with a spoon while writing it.

  8. Re:Scaling matters if you're Digg. Are you Digg? by pestilence669 · · Score: 4, Insightful

    Ever notice how those most "concerned" about scalability tend to have never profiled or benchmarked their own code? ... or understand why you want to scale horizontally, rather than vertically? Whenever I build services that can handle 120,000 requests/sec., they usually just end up being 99% underutilized. Everyone likes to think THEY will be the next MySpace, with no server budget apparently. I highly doubt that any who argue Rails can't scale has ever had to deal with real distributed clusters. The database cluster will have many more scalablity issues than the webservers. This is such a non-issue, I cannot believe it. If you can scale JAVA!!!... You know what I mean.

  9. Science by Cache22x · · Score: 3, Interesting

    Okay, all I see on here is negative comments, what ever happened to the concept of "the right tool for the job"? Ruby on Rails is a gem (excuse the pun) in the realm of bioinformatics and chemical informatics. I don't need to be concerned with "scaling" when I am building a site with a maximum of 10 users. For labs and small companies everywhere needing to create and support small or large databases, RoR is fast and easy. It also has major industry backing from the likes of IBM and Apple. It may be a bigger problem for high-volume sites, but I have found it extremely useful. I am using it on the backend (for data management - the data is exported from the database to the legacy perl system daily) for sites like http://www.drugbank.ca/ http://www.hmdb.ca/ and on the frontend for sites like http://hmdb.med.ualberta.ca/foodb/.

  10. Re:You don't have to use ActiveRecord by Bill,+Shooter+of+Bul · · Score: 4, Insightful

    Yeah, and thats what I don't really like about frameworks in general. They have all of these awesome cool fast easy to use things built in. But sometimes you discover that your needs are too complex for the framework, and someone instantly replies " you don't have to use feature X". Well sooner or later you aren't using many of the cool features of the framework anymore. So why are you using the framework?

    --
    Well.. maybe. Or Maybe not. But Definitely not sort of.
  11. I guess they didn't fix the scalability issues by ThinkFr33ly · · Score: 4, Funny

    Perhaps a web development framework's web site should be designed in such a way that it can handle a burst of traffic from Slashdot.org and Digg.com.

    Otherwise, one might think that RoR doesn't scale.

    1. Re:I guess they didn't fix the scalability issues by abigor · · Score: 2, Interesting

      That's why I'm curious as to why Django (Python framework) doesn't get more press. It's fast and, unlike Rails, it's been proven to scale (ie washingtonpost.com). The languages have more similarities than differences, so it can't be that. Better marketing/hype, maybe?

    2. Re:I guess they didn't fix the scalability issues by ibbie · · Score: 2, Interesting

      That's why I'm curious as to why Django (Python framework) doesn't get more press. It's fast and, unlike Rails, it's been proven to scale (ie washingtonpost.com). The languages have more similarities than differences, so it can't be that. Better marketing/hype, maybe?

      I think you hit the nail on its head. Django fricken rocks, in my experience, in both speed and usability.

      It just doesn't have the hype engine going for it the way RoR does. It's for this reason that I'm hoping the Perl on Rails thing that the BBC wrote gets some momentum - the MCV/MTV approach is a Good Thing, for web-based development. It's not a change in language, so much as a change in how it's laid out. One must note that CGI::Application (found here) has existed for Perl for quite some time, and yet very few people (even Perl programmers) know about it, in comparison to RoR.

      I do have to note that, having had experience with both Perl and Python, Ruby isn't bad at all. It's different in some ways, yeah, but so is Java, or C++, or C#. It's more a matter of taste, for a developer.

      And scalability. (:
      --
      The wise follow a damned path, for to know is to be forsaken.
    3. Re:I guess they didn't fix the scalability issues by pavera · · Score: 3, Interesting

      I prefer django over RoR hands down. I drank the RoR cool aid about 8 months ago, started working on a couple projects... after the initial "oh wow, that was easy to get started" RoR got significantly more difficult, I didn't find the documentation particularly helpful, and things that I thought intuitively would work and made sense were "not allowed" because the RoR conventions forbade them.

      Enter django. Wow, all the power, none of the "Hansson said this is how it should be, so no other way is possible" handcuffs.

      To me django is a much better designed framework, it has in my opinion a much more powerful database abstraction layer, it is more intuitive too. working in Rails for > 4 months I still had to look up the syntax for doing activerecord queries every single time. django's query syntax just makes sense to me, and is much more intuitive. And what can I say, I've never enjoyed making HTML forms more than using the newforms library that builds them for you (oh yeah, and validates them for you, and marshals form input into objects automatically...).

      Also, the simplicity of setting up a production django server is so much easier than RoR. Sure, once you start having lots of traffic, building a fully scalable system is probably going to be similar. But to set up a single server for a low traffic site, or a small company intranet, apache+mod_python is great. mod_ruby has huge performance issues, ror+fastcgi in apache is atrocious, mongrel can be ok.. but then you still have to set up apache in front of it, and its not a simple apache set up as you have to configure all the proxy stuff...

      Besides the fact that python is ~10 times faster than ruby (just at the interpreter level) and you've got yourself a nice little powerful system with django.

      Maybe once django hits version 1.0 they'll get a bit more hype, but I've actually seen more posts on this story saying "check out django" than I've seen people saying they absolutely love rails.

  12. Re:Scaling matters if you're Digg. Are you Digg? by crayz · · Score: 2, Funny

    What language do you use that's more readable and expressive than Ruby?

  13. Re:Scaling matters if you're Digg. Are you Digg? by crayz · · Score: 2, Insightful

    Exactly. The fact is, Ruby is slow. Rails is slower. This is a very accurate complaint about Rails as a web framework, although in the real world it's generally not much of a problem. Somehow though, people have confused speed with scalability, and start claiming the Rails isn't scalable. In fact Rails tends to encourage or at least make fairly easy a shared-nothing architecture which allows a trivial "throw more servers at it" solution to scaling

    That said, because of Rails speed, you will wind up needing to scale it sooner and larger than you would a site written in Django, say. If people want to complain about the hardware costs of running a real-world Rails site, I encourage them to do so and put up real numbers regarding the money they spend on developer time and other company expenses vs. server costs, and how Rails being so CPU-hungry is killing their bottom line. So far I've seen none of that, just uninformed whining

  14. Does it still require Mongrel? by ibbie · · Score: 2, Insightful

    Or rather, since I haven't been keeping up with the development process, perhaps I should ask, is there a viable apache 2.x module for ruby that allows one to run RoR sites without relying on mongrel/other web servers?

    Because, frankly, if it can't be run on apache 2.x, I (and the company I work for) won't touch it. We have already seen the scalability nightmare that RoR was, of course, so obviously we're a bit skeptical about performance optimizations. (:

    Note: I have nothing against using new technology, even if it requires learning a new language, but when one has a hundreds of sites that require web server A, and a framework requires the shoehorning of web server B, well, the aforementioned framework loses its appeal.

    --
    The wise follow a damned path, for to know is to be forsaken.
  15. At this point...JAF by sigzero · · Score: 2, Interesting

    RoR is just another framework now. Almost everything has caught up to it. The biggest question to ask yourself is "Do I want to program in Ruby?". If the answer is "no" then meh who cares about this.

  16. Re:Scaling matters if you're Digg. Are you Digg? by slaingod · · Score: 5, Interesting

    Every time a RoR article hits Slashdot, there is a scale/speed question that gets raised. Realistically, there are a ton of things you can do to get performance where you want it to be. The first is to dump mongrel and use FastCGI or similar. FastCGI is 3-5x faster than mongrel. Mongrel is great for low traffic sites, and for dev, don't get me wrong.

    The upper limit I see with RoR/FCGI is around 2500 requests per sec, for a 'is the server alive' ping, that simply returns 'Yes'. Typical, results are in the ~100 requests per second range with moderate db access, and rendering to xml or html. 100 requests per second was enough to handle a 24 hour media buy on the frontpage of myspace for example (100,000k unique visitors-ish).

    Moving your static assets off of your server and on to S3 or another CDN is obviously a big help here, so your server/bandwidth is only taken up with requests that need/affect the db. From the example above, with the MySpace media buy, the total for that day was $20-30 I believe in bandwidth costs, and this was a site with a video mixer that had tons of images/video/mp3 and large flash objects. Obviously, mongrel shouldn't be delivering your assets locally anyway, apache/lighty etc should be.

    Ultimately it comes down to design and caching when it comes to getting that top performance out of it. My 100 requests/sec wasn't using MemCached or fragment caching, and the mysql db was local. Caching in Rails is a little less than helpful for highly customized for each user sites, but there are plugins that extend it like extended_fragment_cache(ing?), that allow you to templatize things like ID's, etc. Think of say a forum topic listing, where only the topics change as you paginate. With extended fragment caching, you basically draw the page once, and then pass in a hash of the variables that replace the placeholders each time you draw a new page.

    Another big thing with ajax sites, is to use link_to_remote with the :update => 'some_div', rather than using the rjs/render :update stuff in the controller. escape_javascript is one of the BIG performance issues in Rails, as it is basically just multiple gsubs. Designing around that is a big win. A native C escape_javascript should be a high priority for the rails/ruby devs, with optimization for the memory allocations (ie. scan the string to see how much it will grow, allocate, and just do one pass to expand).

    --
    http://blog.slaingod.com
  17. Re:You don't have to use ActiveRecord by smackjer · · Score: 5, Funny

    I agree. That's why I build all of my computers by hand with raw transistors and whatnot.

    --

    This is my sig. There are many like it, but this one is mine.
  18. It's new tech for people who weren't aware of... by CarpetShark · · Score: 2, Informative

    You're absolutely right: Rails is just a framework on top of Ruby, and neither are very special. Except in that a lot of people were still using crap coding techniques like mixed PHP and HTML, until frameworks like RoR and Django introduced them to MVC, ORMs, templates, and Unit Testing --- AND the speedups and elegance that go with those things, once you have an actual framework that does the boilerplate for you.

    There's nothing special about RoR, no. But compared to tools like PHP, it's a godsend.

  19. It is a pity ... by jopet · · Score: 2, Interesting

    that one cannot simply deploy RoR on Apache. That is what remains the big advantage of perl and especially PHP-based solutions and frameworks.

  20. Comment removed by account_deleted · · Score: 5, Interesting

    Comment removed based on user account deletion

  21. Stored prodcedures can improve performance by Knetzar · · Score: 2, Informative

    Stored procedures can improve performance by reducing the amount of data that needs to be returned from the DB. Instead of getting a ton of data from the DB, the application can make a call and only get the data it wants. This simplifies application development and improves performance. You can think of things like MAX, MIN, etc... as stored procedures (I don't know if they are or not)

    I have been at places were the DBAs have found very expensive calls to turn into stored procedures and the net result has always been an increase in performance and resulted in a simpler application.
    Example:
    Get all shoes
    for each shoe {
        get all skus for that particular shoe type (these would be different sizes/colors)
        calculate the minimum and maximum price of the skus that are in stock
    }
    return shoe name, shoe desc, price range
    (This might be a bad example, since good SQL and a good DB might be able to speed this up...but I'm not an expert)

    Note: I am an (C/C++/Java) application developer, not a DBA

  22. Why the hate? by devjj · · Score: 2, Insightful

    Seriously.. why does Ruby on Rails get so many people so fired up? If you don't like it, don't use it. If you do like it, feel free. There's no one-size-fits-all solution, but for many people Rails comes pretty close. If you're not one of those people, there are plenty of other frameworks and languages.

    Why do people in any kind of IT have such huge egos? It's counterproductive and at the end of the day, if you're making the client happy, and that makes your boss happy, you've done your job.

    1. Re:Why the hate? by Anonymous Coward · · Score: 2, Interesting

      It's easy.

      RoR is so over hyped by the zealots that use it and make mythical, false claims. Have you ever noticed how they spit back quotes straight from the site or books or whatnot? If I had mormons and jehovah's knocking on my door daily, I'd be pissed off at them too.

      Why the backlash? False promises lead to adoption and shift job markets. Hype convinces the non technical to make technical choices. Don't any of you remember all the Java hype of yesterday?

      Unfortunately it's not so easy to just ignore and go about your life programming in your language of choice. If you're a perl coder, python coder, php coder, etc and you web develop, then RoR is your enemy. Maybe python should be getting all the attention and hype and the majority of php coders should be moving up not down. Then we'd have better scaling systems anyway. Is python/django so much harder to user than RoR? I'm not convinced that it is. I know for a FACT that it's damn faster.

    2. Re:Why the hate? by devjj · · Score: 2, Insightful

      I can't take you seriously when you claim that all Rails developers are "zealots." You wear your bias on your sleeve.

      As a Rails developer myself, I know for a fact I'm not out there making "mythical, false claims." When I develop solutions for clients, I sell them just that: solutions. I don't sell them Ruby on Rails solutions. I just sell them solutions. My experience is unless a client has a specific desire to use a particular framework or language (.NET and J2EE are popular requests), they don't really care. So long as the finished product does what they ask, the actual technology behind it doesn't seem to matter. I certainly see that for the not-Rails coder that Rails is your competition, but if the only reason you don't like it is because it gives someone else an opportunity, perhaps what you should be doing is picking up a book and learning what it's actually about, instead of pointing fingers.

      My experience with Rails developers is that they're excited about the framework because they feel it delivers on a lot of its promise. That's certainly how I feel, although anyone who's used it for any kind of professional work will know that it isn't the be-all-end-all and that you still have to do a lot of work to get a product you're happy with. That's true for most good frameworks. They make the job easier; they don't do it for you.

      Rails almost certainly isn't the first challenge of its kind you'll have faced, and it isn't going to be the last. You can't expect to code PHP and have PHP be the be-all-end-all for the rest of your career. It just doesn't work that way. New things come out, and some people adopt those things. Fighting your competition with name-calling isn't going to get you anywhere. At the end of the day, Rails hasn't seen the kind of adoption it has solely because of good marketing. At the end of the day, product actually matters, and Rails has chops.

    3. Re:Why the hate? by devjj · · Score: 2, Insightful

      Rails was borne of a production application: Basecamp. It didn't come into existence because they "hated EVERYONE!" The application had already been built in Ruby, and DHH saw that there was a lot of the system that could be reused. He packaged it up, and released it under the name "Ruby on Rails."

      Rails has gotten hyped, no question, but the level of rhetoric leveled against it has gotten to the point where people are unwilling to acknowledge that it is a capable framework. Great marketing only gets you so far, and like so many other wildly popular "products," at the end of the day people tend to use what works for them. There aren't many examples - open-source or closed - of things that get lots of acclaim without deserving any of it. Your dislike of Rails has nothing to do with Rails itself, but rather how you perceive it to be portrayed. We all remember the Java hype. We all remember the .NET hype. Hype surrounds everything new, and Rails is new. The hype will die down, and when it does, what you'll find is that it will settle into its own area of web application development, right alongside all of the other great frameworks, languages, etc. Java didn't really revolutionize the world the way we were told it would. It did, however, become a very capable branch of application development, and thousands of developers make an excellent living doing it.

      Sure, we sometimes joke about Ruby on Rails being "better" than the alternatives, but for professional Rails developers it's more about having a good time than anything else. It might even happen to have something to do with so many of us liking Macs - we Mac-users are a rather devoted bunch. Sometimes it's easy to read too much into it, and I think that's what has happened here. I attended RailsConf this year, and for the most part the people I met were enthusiastic developers who were making web applications and having a pretty good time doing it. If the work you're doing with not-Rails is working, there is little reason to believe that the existence of Rails or even the current enthusiasm for it is going to translate into competitive pressure you won't be able to handle. If you're good at what you do, and already have development tools and practices that work for you, none of that is going to change, and that doesn't mean you don't stand to benefit from it. Just take a look at CakePHP.

      Any negative impact Rails has will be felt by the people on the fringe. Those who don't really know how to develop applications, and are ill-suited to the tasks with which they are currently tasked. Every time something comes along that attempts to elevate the discussion, there will be those unable to keep up.

      That does not mean that you stop innovating. That's simply the nature of competition. If you have confidence in your work, you have nothing to fear, and more importantly, no reason to hate.

  23. Re:You don't have to use ActiveRecord by Bill,+Shooter+of+Bul · · Score: 2, Insightful

    Yeah, I do too. I think its very worthwhile for anyone in IT to actually build circuits from time to time, just to understand how. I understand the criticism you're making and its somewhat valid. I'm not trying to espouse the Not invented here syndrome. You have to make a real world decision in every non trivial application what existing tools can be used, and which ones will have to be created. I like the idea of libraries, and thats what I think a good "framework" should be. Sort of a scaffolding, where there is a well defined interface between components, allowing you to easily replace part of the "framework" with a different one, without introducing any bad hacks, and allowing all of the logically distinct parts of the "framework" to continue working with your replacement part.

    --
    Well.. maybe. Or Maybe not. But Definitely not sort of.
  24. Re:Python on Rails... instead.. by pavera · · Score: 3, Informative

    Check out django. As that article mentions MVC efforts can become overly restrictive very easily. If you ask me, Ruby on Rails has already crossed that line. django is mvc as well so someday might go down this path, but it hasn't yet.

    django provides all of the ease of Ruby on Rails, it is powerful, it provides even more tools than Ruby on Rails in my opinion specifically for web work. And I don't feel like I have handcuffs on when I'm developing in it.

    I started building 2 projects in Ruby on Rails ~8 months ago. These were existing PHP systems which had become overly cumbersome and were in serious need of a redesign/rewrite. Rails seemed to provide everything I needed, began porting... got about 30% done and started running into serious roadblocks that were there by design in Rails.... I aborted the porting, and started looking for another framework, found django... the 2 projects are now 100% ported (took less than 1 month each).

    django was also significantly easier to set up for production than my experiences with rails (apache? lighthttpd? mongrel? the recommended web server for rails changes every week...) modpython+apache is dead simple to set up and rock solid (apache+rails requires fastcgi which was constantly crashing, unstable, and basically doesn't work)

    obviously I'll get flamed for this as RoR has way too many fanboys, but as far as a concise, powerful, well documented, easy to use, flexible, and enjoyable development experience nothing gets close to the last 2-3 months working with django.

  25. There's a more generic saying on this: by Qbertino · · Score: 2, Insightful

    "If you have a scaling problem, you don't have a problem."

    Which basically means if you've got 200 000 hits a day and your existing setup is folding under the load, you've found a glory hole on the webbernet. And you're likely to find the funding required to scale the site - even if that means moving to an entirely new technology alltogether.

    --
    We suffer more in our imagination than in reality. - Seneca
  26. Re:You don't have to use ActiveRecord by jozeph78 · · Score: 2, Informative

    Yeah, and thats what I don't really like about frameworks in general. They have all of these awesome cool fast easy to use things built in. But sometimes you discover that your needs are too complex for the framework, and someone instantly replies " you don't have to use feature X". Well sooner or later you aren't using many of the cool features of the framework anymore. So why are you using the framework?
    Spring is the only framework flexible enough to get around the corners that things like rails back you into. If you find their JDBC classes not useful, you might still find their transaction management useful. However, their JDBC classes have helpers ranging from give me an object and I'll generate the SQL to having classes which allow your SQL to be ran with their improved exception handling. The really nailed the framework in the sense it provides some level of support no matter how complex your case may be.
    --
    Ever done a `man` on `top` ?