Slashdot Mirror


Is Ruby on Rails Maintainable?

kale77in asks: "I've become a big fan of Ruby over the past few months, but I'm not at all sure about Ruby On Rails. Automatic code generation sets of alarm bells in my mind; so that, to RoR's promise of 'Web Development that Doesn't Hurt', I automatically add '...until you have to maintain it'. On the other hand, some writers and coders I respect (like the Pragmatic Programming mob) seem to be fans. I've mainly written generators in Python, to produce PHP/SQL/Java from SQL files, but I've always gone back to well-constructed objects, where extension and overloading offers more precise and maintainable customization than auto-generation allows. So is Rails just a nice RAD tool for disposable, cookie-cutter apps (which have a place, of course)? Is high-level generation just a bad OO substitute? And what has your experience of Rails' maintainability been?"

348 comments

  1. Article is a troll. by Anonymous Coward · · Score: 0, Troll
    Anyone who'se spent more than 30 minutes with RoR will realize that the automatic code generation really serves the purpose more like examples from books for other frameworks.


    You'll re-write them entirely and check your new code into whatever source-control system you prefer (SVN, Darcs, etc) before your first day is over.

  2. Have you ever used it? by realmolo · · Score: 0, Troll

    You seem to be under the impression that the "scaffolds" in Ruby On Rails are all there is. That's not true.

    Once you abandon the scaffolds, you can do whatever you want. And it's easy to maintain.

    You don't know what you're talking about, in other words.

    1. Re:Have you ever used it? by Anonymous Coward · · Score: 0

      Gosh, I bet you often get mistaken for a Hallmarks' writer. Put the gun down, idiot.

    2. Re:Have you ever used it? by mrlpz · · Score: 1

      Take a pill, robo-coder. He has a valid point. Obviously you're feeling a little religious about all this. Take a moment to go pray to the G_d you do ( or don't ) believe in, and ask for some divine inspiration.

      The person who says that code, any code, is ever "easy to maintain", has never had to maintain their own code. There is a difference between "maintainable" and "easy to maintain". Come back in a while once you've figured that out.

  3. Uhm... by Black+Parrot · · Score: 4, Insightful

    > Automatic code generation sets of alarm bells in my mind

    Do you have a beef with compilers and assemblers?

    --
    Sheesh, evil *and* a jerk. -- Jade
    1. Re:Uhm... by Pxtl · · Score: 5, Insightful

      Well, if you have to do maintenance work on the resulting machine code, then yes, it does alarm me. Otherwise, not so much. Likewise, any code gen environment where you're maintaining the generated code instead of working on the generator should worry people.

    2. Re:Uhm... by eclectro · · Score: 2, Funny

      Do you have a beef with compilers and assemblers?

      No, but interpreters have always slowed me down.

      --
      Take the cheese to sickbay, the doctor should see it as soon as possible - B'Elanna Torres, "Learning Curve"
    3. Re:Uhm... by Bastian · · Score: 4, Insightful

      I think the author is thinking of this from an attitude of generating code using RoR and then maintaining the generated code. Which is the wrong way to do it. If there's a bug in the original RoR code, change the original code. If there's a bug in the generated code, you change code generator.

      If you're writing the original app using a code generator and making all subsequent modifications to the software by modifying the product of the generator, you've sort of missed the point.

    4. Re:Uhm... by chroot_james · · Score: 1

      He clearly means to imply that it's hard and he isn't sure he can handle it. WIMP!

      --
      Reality is nothing but a collective hunch.
    5. Re:Uhm... by SporkLand · · Score: 0, Redundant

      Do you have a beef with Lisp Macros?

    6. Re:Uhm... by Bruce+Perens · · Score: 4, Insightful
      You have two options with scaffolds: let them be generated every time the program starts, or get the code generated into view source code that you can edit from then on. So, you either have code that you don't have to maintain at all, or code that's yours. Pick the best for what you're doing. It's brief and clear code. If you use the generated-every-time option, you can override it method-by-method simply be creating a view source file for that method.

      Bruce

    7. Re:Uhm... by Dracolytch · · Score: 2, Insightful

      So the code generator should be able to automatically generate any potential output? Hmm... I'm not sure I agree with that.

      --
      This sig has been enciphered with a one-time pad. It could say almost anything.
    8. Re:Uhm... by publius_ovidius · · Score: 4, Informative

      Do you have a beef with compilers and assemblers?

      This is a valid question. Quite often when we have a robust low-level language generating high-level language (HLL) code, it's extremely well thought out and tested. However, many are dubious about HLL generating HLL code. I suspect (though I can't prove it) that this is because HLL -> HLL tends to be less widely used and thus is less thoroughly tested and less planned. When done properly -- particularly when covering a restricted and well-defined domain -- it can be extremely powerful. When done improperly, it's a nightmare.

      Rails has a large enough user base that most common bugs have been eradicated but from what I've seen, it appears to have a problem that many fourth generation languages suffer from: if your problem fits its domain, it's a piece of cake to solve. When your problem doesn't fit its domain, it can be extremely difficult to solve (anyone who's ever worked with the 4GL Easystrieve Plus can readily testify to this). Most web-based apps, though, are simple enough that folks working with Ruby generally don't seem to have much of a problem with it. However, I've heard horror stories about people trying to use their custom model in lieu of what Rails natively supports -- though I've not had first-hand experience.

      Compilers and assemblers tend to be general purpose tools which address a fairly wide problem space. HLL -> HLL tools tend to be special purpose tools and trying to get them to solve problems they aren't optimized for can be trying. In the case of Rails, one thing it excels at (CRUD apps) is a well-known problem space and Rails fits quite nicely.

      So I have to say that comparing Rails to compilers or assemblers doesn't quite fit simply due to the differing focus of said tools. However, all of them require that someone trying to work with them understand what they're doing (at least at a high level) and that brings down the maintenance burden quite a bit. Personally, I'm quite impressed with Rails and am happy to see it spread.

    9. Re:Uhm... by Anonymous Coward · · Score: 0

      That is a stupid statement and so far off his actual meaning that it isn't funny.

    10. Re:Uhm... by Jack9 · · Score: 3, Interesting

      Practical question about Rails implementation with Ruby.

      I concede that "scaffolding" is used by EVERY PROGRAMMER. That's the idea behind code reuse. "I'll adapt my authentication I made for a BB system to use as auth for an entire website." "I'll use my pretty table CSS from last year for displaying this data."

      Can you alter the templates generated? If I have coding standards implemented, I have serious doubts the default RoR scaffold templates specifically adhere to mine. If I can't alter these templates, the answer to the article is no. If I can alter these templates (I assume it's possible), the answer to the article is yes.

      How is this article generating all this Ruby-anti-Ruby nonsense when it's a question of Rail implementation? More importantly, why isn't there a PHPoR?

      --

      Often wrong but never in doubt.
      I am Jack9.
      Everyone knows me.
    11. Re:Uhm... by deaddrunk · · Score: 1

      [Valley Girl]OH. MY. GOD[/Valley Girl] I never thought I'd see Easytrieve Plus mentioned on here. Personally I think it's fantastic for what it does and I've been able to convince it to do more than it wants to. It is so so much better than the original Easytrieve though (a colleague of mine christened it Easypeeve ;)).

      --
      Does a Christian soccer team even need a goalkeeper?
    12. Re:Uhm... by CrazedWalrus · · Score: 2, Informative

      There are a few. I've never used them, so I can't speak to their quality, but apparently work is being done on exactly what you ask:

      Biscuit: http://bennolan.com/biscuit/
      Qcodo: http://www.gadgetopia.com/post/4726
      Cake: http://cakephp.org/ ... just to name a few. I just google'd for 'php rails', and got lots of interesting links.

    13. Re:Uhm... by Marillion · · Score: 3, Informative
      RoR has explicit and implicit code generation. Model classes which extend ActiveRecord::Base have amazing amounts of implicit, runtime-generated methods which can be replaced with custom logic if that's what you want.

      The template generators are explicitly called development-generated blocks of code which are intended to be one-time only and edited by hand thereafter to meet business objectives.

      Between the two, I love the former and dislike the later. I usually don't use scaffold built views except for Quick and Dirty lookup table administration. I think the difference between the final view and an empty file is smaller than the scaffold view and the final view.

      --
      This is a boring sig
    14. Re:Uhm... by Bruce+Perens · · Score: 2, Informative
      Can you alter the templates generated?

      Yes. Either completely override the template for a specific method starting from zero with your own code, or get the code generated for that method and then alter it.

      How is this article generating all this Ruby-anti-Ruby nonsense when it's a question of Rail implementation?

      Because this is in part an instance of the perennial compiled-vs-interpreted argument.

      More importantly, why isn't there a PHPoR?

      IMO, because the developers capable of doing something like RoR 1) didn't like the PHP language as much as Ruby and 2) felt they could do better than the existing PHP web environment.

      Thanks

      Bruce

    15. Re:Uhm... by slavemowgli · · Score: 1

      [...] or get the code generated into view source code that you can edit from then on.

      Which, of course, kinda defeats the purpose of automatically generating code in the first place.

      The problem I see is that while generated code is nice in theory, and even nice in practice for a while, there will be a time where there *will* be problems with the generated code. What do you do, then? If you want to continue to rely on the automatic code generation, you'll have to look into the code generator itself to see if you can find and fix the problems (which may not always be an option), or you take the current generated code and fix the bugs in there yourself - but then, you can't profit from future improvements to thte code generator anymore, unless you either forward-port your own fixes to the generated code (assuming that the generator bugs that lead to them were not fixed in the newer version as well).

      Of course, that pretty much *is* exactly the same problem that compilers suffer from as well, but there are two differences:

      • Compilers generally target simple back-end languages (machine code, as opposed to high-level languages), and
      • Compilers are actually a field in computer science that has solid theoretic underpinnings and that has been studied for (literally) decades.

      Neither can be said about RoR, yet. And while I wouldn't dismiss it based on that, it *is* something that I think you should take into account when you consider using it for your specific applications.

      It never hurts to put more thought into something, rather than less thought.

      --
      quidquid latine dictum sit altum videtur.
    16. Re:Uhm... by achacha · · Score: 1

      code gen is NOT a compiler or assembler. compiler is a compiler and assembler is an assembler.

      this is a code gen (written in pyhton):

      import sys;

      print "include ";
      print "class "+sys.argv[1]+" {";
      print "public:";
      print " "+sys.argv[1]+"() { std::cout \"I do not trust developers to write good code.\"; }";
      print "};";
      print "int main() {";
      print " "+sys.argv[1]+" myobj;";
      print " return 0;"
      print "}"

      After codegen you then compile/assemble the code.

    17. Re:Uhm... by Bruce+Perens · · Score: 1
      It's overstating the case to refer to RoR's scaffolding system as a code generator. They are just templates. They implement a few standard view methods. They read like the view code because they aren't much different from that. Only a few things are parameterized.

      You can't compare them to a compiler. They are just a few pages with macros in them. That is a very well understood thing.Bruce

    18. Re:Uhm... by Anonymous Coward · · Score: 0

      >> Automatic code generation sets of alarm bells in my mind

      >Do you have a beef with compilers and assemblers?

      I suppose this person thinks they are being cute but they reveal their lack of knowledge.

      There are still plently of people coding in assembly (my neighbor is one) because they don't trust compilers and/or they find it faster to code closer to machine language. This is especially true for PIC microcontrollers.

    19. Re:Uhm... by Peter+Cooper · · Score: 1

      Scaffolding is temporary. Scaffolding is not meant to be used in production apps. A lot of people in #ror seem to forget this.

    20. Re:Uhm... by pumbers · · Score: 1

      Hmm. It sounds like you're not keen on maintaining the generated code and you don't like having code generated for you that you can't maintain. Kind've a no-win scenario really. But then, the answer is that the scaffold & generators in Rails are just shortcuts. They allow you to get a basic CRUD app up and running very, very quickly and yet still give you the opportunity to customize or even competely replace the generated code. After all, there's no reason you HAVE to use generators - you could just write everything by hand if you want to. Oh, and if you're not happy with the generated code and you don't want to keep changing it every time you generate something new, take a look in the \templates directory under each generator and you can always change the code template if you like. Now that's more flexibility than you get in most code-generating IDEs.

    21. Re:Uhm... by Bastian · · Score: 1

      For the sake of disclosure, here's the background on my previous post:

      I think of code generators as two different things. The first is something that generates a bunch of canned scaffolding to save the programmer from some bitch work. This kind of thing is built into a lot of IDEs. This isn't really what I was thinking of at the time though - of course the output of that is meant to be edited by a developer.

      The second is something that's meant to produce either an entire application or a large portion of an application. I haven't actually worked with Rails, but I think this is what Rails is supposed to do. Sorry if I'm wrong. Anyway, for code generators of this type, I think that a well-designed generator shouldn't be designed so that you should have to its output. Customization should either happen in the code generator's input language, or it should be handled through a system of delegates. If it can't do that for you and you'll be mantaining the app you build with the generator for a long time, it's probably better to avoid the generator for the sake of maintainability.

    22. Re:Uhm... by Q2Serpent · · Score: 1

      I wonder how it would work if you used a version control system:

      - Generated code on one "vendor branch" (to use CVS parlance)
      - Made customizations on the main branch
      - Re-generated updated code on the vendor branch and use
          merges to pull in new generated code mixed with your old
          changes

      Seems the best of both worlds...

    23. Re:Uhm... by Not+The+Real+Me · · Score: 1

      "How is this article generating all this Ruby-anti-Ruby nonsense when it's a question of Rail implementation? More importantly, why isn't there a PHPoR?"

      Not that this matters, but according to http://www.netcraft.com/ http://www.rubyforge.org/ is running *GASP* "66.92.150.242 Linux Apache/1.3.33 Unix mod_gzip/1.3.26.1a PHP/4.4.1 13-Dec-2005"?!

      Like I said, not that it matters that the site pushing Ruby on Rails is running on PHP. I downloaded RoR anyways. We'll see if it runs on FreeBSD 5.4.

    24. Re:Uhm... by Anonymous Coward · · Score: 0

      That means the apache they're running on has mod_php enabled. It does'nt mean the site is written in php.

      And that's not the rails homepage.

    25. Re:Uhm... by Anonymous Coward · · Score: 0

      Rails isn't a code generator, it's a DSL. The article author does'nt seem to have used it.

      Like any DSL, it makes the specific task it was built for easy.

      'Horror stories' is a little excessive.
      All that happens if your db doesn't match Rails ideal (which is mainly 'have an integer primary key') is you have
      to specify what the primary key is.

    26. Re:Uhm... by caseydk · · Score: 2, Interesting

      I did an interview with Mike Ho - the lead developer of QCodo - just a couple weeks ago. He laid out some pretty good differences between RoR & QCodo. Check it out: http://codesnipers.com/?q=node/187

    27. Re:Uhm... by alw53 · · Score: 1

      The author of my PhD dissertation, "Automatic generation of fast optimizing code generators", as well as my dissertation advisor and thousands of Programming Language Design and Implementation conference attendees would probably disagree with you. As would the authors of "Compilers: Principles, Techniques, and Tools" (the Dragon book) where Chapter 9 is entitled "Code Generation". What you have described is traditionally called an "application generator". The problem of hijacking terms already used by others is that it will tend to confuse people and to confound indexing and keyword based searching. CF the term "hacker".

    28. Re:Uhm... by Jack9 · · Score: 1

      Interesting, +1 digg...oops!

      --

      Often wrong but never in doubt.
      I am Jack9.
      Everyone knows me.
    29. Re:Uhm... by mrlpz · · Score: 1

      "Yes. Either completely override the template for a specific method starting from zero with your own code, or get the code generated for that method and then alter it."

      And this does not concern anyone, as to the level of maintainability being any less than just about any other home-grown code-reuse methodology/platform ? I thought RoR claim to fame was "light need" for maintainability. It's been touted in lots of places. In many articles, and yeah,in those 50Mb videos posted up on the RoR website. "You can put together a blog site in 60-something lines of Ruby", so what. If that site isn't going to change much in form or content is going to follow specific strict rules, then great. But you know, and I know that the web doesn't work like that. C'mon. Come to think about it, /. needs a look makeover itself.

      Don't get me wrong, Bruce, I'm hearing what you're saying, and it has it's merit. But just because some of the view template code is autogen, and you can hand rub the parts you want, doesn't make it the "holy grail" ( or Sang Real, for those of you so inclined, not that I am ) it's been touted up to sound like. Hell, I actually like Ruby. It does have it's uses. Still, the fact is that for most other script languages, and some of the not-so-scripted languages, there are code-gen tools out there that will "help you over the hump", and do much of what RoR can do. Much, not all.

      So now, considering that, how exactly does RoR get someone that much more bang per keystroke.

      And frankly, this whole compiled vs. scripted ( nee. interpreted ) thing is ridiculous. Everyone KNOWS that all you have to do is tell your management to just buy more hardware and throw some more ram at the problem, if the site is serving up your applications too slowly.

      .
      .
      .
      .
      never a dull moment here on /.

    30. Re:Uhm... by mrlpz · · Score: 1

      That last paragraph was meant as light-hearted sarcasm. Picked the wrong text type. Oh well...
      .
      .
      .
      never a dull moment here on /.

    31. Re:Uhm... by Bruce+Perens · · Score: 1
      And this does not concern anyone, as to the level of maintainability being any less than just about any other home-grown code-reuse methodology/platform ?

      I'm not sure if there's a question in there. But perhaps it will be educational to paste in a bit of template code. This is the sort of template code that will be "generated". It's part of the scaffold page that would edit a record. The database table "comment" holds blog postings and comments upon those postings. The generator has queried the database for the table field names, and simply created a text field for each record field, using Rails form field methods. This is no more than a simple list of fields, and would be trivial to edit. This code fragment is then wrapped in a few lines that submit the form. It's easy to see it's not "code generation" in the sense of a compiler.



      <%= error_messages_for 'comment' %>

      <!--[form:comment]-->
      <p><label for="comment_title">Title</label><br/>
      <%= text_field 'comment', 'title' %></p>

      <p><label for="comment_state">State</label><br/>
      </p>

      <p><label for="comment_indentation">Indentation</label><br/>
      <%= text_field 'comment', 'indentation' %></p>

      <p><label for="comment_interesting">Interesting</label><br/>
      <%= text_field 'comment', 'interesting' %></p>

      <p><label for="comment_informative">Informative</label><br/>
      <%= text_field 'comment', 'informative' %></p>

      <p><label for="comment_comportment">Comportment</label><br/>
      <%= text_field 'comment', 'comportment' %></p>

      <p><label for="comment_agreement">Agreement</label><br/><%= text_field 'comment', 'agreement' %></p>

      <p><label for="comment_modified_on">Modified on</label><br/>
      </p>

      <p><label for="comment_publish_after">Publish after</label><br/>
      </p>

      <p><label for="comment_created_on">Created on</label><br/>
      </p>

      <p><label for="comment_lock_version">Lock version</label><br/>
      <%= text_field 'comment', 'lock_version' %></p>

      <p><label for="comment_preface">Preface</label><br/>
      <%= text_area 'comment', 'preface' %></p>

      <p><label for="comment_body">Body</label><br/>
      <%= text_area 'comment', 'body' %></p>
      <!--[eoform:comment]-->

    32. Re:Uhm... by drgonzo59 · · Score: 1

      You said that what was presented was not "code generation" but "application generation", but you never explained what the difference is. What should the above fragment look like to make it "code generation"?

    33. Re:Uhm... by mrlpz · · Score: 1

      Fair enough. Then why all the hub-bub about compiler vs. interpreted ? Just the same. The example is still a very specific domain where Ruby can and does address the scope of what's being done rather well.

      I guess I need to see more examples of something other than the things 37signals have come up. So far I think what they have is good, but again, like their scope ( the Fortune 5,000,000 ), isn't always what will work for everyone. Which is, of course, why everyone bickers about this, that, or whatever other Web ( or Web-ish ) development framework.

      Which leads to me to state again. If it weren't for the hype surrounding RoR's originator's offerings, this all wouldn't be an issue. Obviously hype is what turns people's heads, and hopefully makes them look longer than 2 seconds. And this is really where I think the "sanity" is lacking in this, and all discussions surrounding Web-2.whatever "technologies".

      I see the usefulness, Bruce. But to quote Clara Peller of Wendy's fame, "Where's the beef ?". Where's the win here for large scale applications with RoR. How's RoR for maintainability in general where scale goes beyond the needs of a blog-base, or . And if RoR isn't intended for that scale of webapp, someone more important than ME, should come right out and say it openly.

      Obviously I'm opening the door the door to be "proven wrong" here, but then again, that may have been my intention in the first place. Oh, and Bruce....enjoy the miracle of the lights with your family !

    34. Re:Uhm... by drgonzo59 · · Score: 1
      have a robust low-level language generating high-level language (HLL) code

      What are some examples? I can easily think of a high level language generating a lower-level like gcc transforming your C++ into machine language, or java being compiled into bytecode instructions.

      As for a HLL->HLL translation take a look at the PyPy project (which among other things is attempting to write a Python interpreter in Python). here The goal is to generate low level description of the python code that interprets the python code (go figure!). That is what they claim at least...

    35. Re:Uhm... by Bruce+Perens · · Score: 1
      Then why all the hub-bub about compiler vs. interpreted ?

      Oh, the same reason that we had to fight to remove the Morse Code test requirement for Amateur Radio licensing. People tend to stick to the old ways of doing things.

      Regarding the Fortune 0.5M, there are folks using Rails for mission critical applications in much larger enterprises, but not all of them talk about it. There's one publicly known hospital management project, and believe it or not a jail management application. Happy holidays!

      Thanks

      Bruce

    36. Re:Uhm... by publius_ovidius · · Score: 1

      You're absolutely right. I had those backwards. Thanks for the catch.

    37. Re:Uhm... by drinkypoo · · Score: 1

      Here's an edit for you, because I'm too lazy to email it: "How can we get more information on Qcodo, documentation, and examples of working with it?" should be in bold. Have a nice day! :)

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  4. It's obvious... by eruanno · · Score: 5, Informative

    It's quite obvious that the concept of the automatic code generation done in Ruby On Rails was either not completely grasped or completely missed by the author. The whole purpose of the code being generated was to give you a basic structure to take and change until it was what you needed it to be. This is precisely why it is called 'scaffolding', because it gives you the framework to get started with.

    As far as the Ruby On Rails framework itself is concerned, it is extremely capable and flexible for handling a great deal of web application projects. Of course there will be specific functionality that Ruby On Rails will not handle very well — there never are perfect solutions.

    I wouldn't consider the reviewers objections completely devoid of import, just misguided. You must always be careful about anything you didn't do yourself, but you must exert the same care and attention to the stuff that you do create yourself! Often we put far too much confidence in our own coding skills.

    So, in the end, the concept of Ruby On Rails is simply to alleviate the mundane, rote programming that goes into the basics, particularly the structure and minimalistic database interaction, and make it surprisingly simple.

    M.T.

    --
    "Support Bacteria - Its the only culture some people have" - Circa 1985
    1. Re:It's obvious... by qslack · · Score: 5, Interesting

      This is exactly right. The scaffolding is seen as the major feature of Ruby on Rails by far too many people. It's not. In fact, if anyone were making a serious, production-level app, they wouldn't even use the scaffolding. It serves only three purposes: to help newcomers to the language become familiar, to jumpstart a simple Web app, and to look amazing on the screencasts.

      Ruby on Rails is great. At the very least, everybody should try it. It's no silver bullet, but it is a huge improvement over most everything else out there.

      Using Rails is a bit like using a Mac: you always run into these little helpful features that make you think it was created just for you.

    2. Re:It's obvious... by happyemoticon · · Score: 4, Insightful

      Here's how I'd look at the problem. I'm not a developer, but I'm decent with Java, C++, Python, and Perl. If I look at some random Java project, I can pretty much grok what it's saying and make the changes I need. The same is true for many languages I'm not really familiar with, like Lua and php (I've been updating a WoW mod that was dropped by its creator).

      Now, mind you I might just be upset because I looked at RoR and didn't instantly understand everything. But I was generally put off by the amount of things that were being invoked as if by magic, and I'm even less of a magician than I am a developer. At least with some Java project I've got all the code in that directory, and I know which parts of the standard API and which 3rd party modules are being imported. I looked at some of the stack traces that I got and I was totally bewildered.

      One thing that could alleviate this is good documentation. The majority of RoR docs I've found are written by people who either have no intention to truly impart knowledge or don't have the competence, and are directed at non-programmers. They're consummately infuriating. I would much rather hear the ugly truth (I read Programming Perl and Python in a Nutshell for leisure sometimes) than be treated like a child. This pretty much means I have to read the API specs, which ain't no walk in the park.

      What this boils down to is if I were in a management situation, I wouldn't know how to hire or deal with a Ruby dev. First off, I couldn't just get somebody I thought had good character, work ethic, an excellent track record and a portable skill set, I'd have to hire a Ruby on Rails Developer. I mean, there are some times when you really want an expert in the field, but those people are hard to come by. Then if I hired him I'd be like, "Hey John, what's this function over here do?" and he'd be stirring a black pot in a pointy hat while cackling, "Double, double, boil and trouble / Fire burn and cauldron bubble!"

    3. Re:It's obvious... by Anonymous Coward · · Score: 0

      Screencasts? ANOTHER new word? Definition anyone?

    4. Re:It's obvious... by bryanthompson · · Score: 4, Informative

      I agree 100%. The scaffolding should be used to get a feel for how quickly developing *anything* on Rails can be. For newbies or J2ee migrants, the short videos on the Locomotive and rubyonrails.com site shows how scaffolding can be built, modified, etc. There's no way I'd put scaffolding into any site that others will see. It's quick, dirty, and easy. Use and extend it, but don't rely on it!

      Coming from J2ee-land, Rails has been really easy to pick up, and very easy to maintain--so far. If you visit the #rubyonrails irc.freenode.net, it's very active, and there are a ton of Java guys who want to see what RoR is all about. My biggest problem was figuring out the project structure and then figuring out the standards. Parenthesis, semicolon line endings, and block brackets not being required really turned me off at first. It felt sloppy and just weird.

      I think the biggest advantage is that all of the add-ons we were using are included in RoR. Log4j and hibernate, for example, can be hell to set up and maintain. With RoR, the logger is built in, and its migrations are just hibernate-ish enough to get the functionallity I wanted out of it. The pieces you need are there, and they are easy to use. For us OS X guys, Locomotive makes it ridiculously easy to start out also. I don't know about setting up a RoR app in a production environment... From what I've read there looks like a lot of initial configuration, but I had my share of difficulties with Tomcat also.

      Since we're still developing the app, I don't know how easy it will be in the future to maintain. I worry about Ruby updates and how they'll interact with old code. WHat happens when deployed in totally different environments? The API is total suck, and there really isn't a ton of information like there is on J2ee. I want to know the best practices and common ways of doing things, but all I find are blogs and random articles that don't really get into detail. The Programming Ruby and Agile Web Development with Rails books are great, but they don't get into these other areas.

    5. Re:It's obvious... by qslack · · Score: 1

      I'm against the coining of new words without a good reason, but in this instance it makes sense. Ten-plus years ago, "screenshot" might have seemed to be a stupid neologism, but obviously it stuck because we needed a word to describe screenshots. Screencasting is much easier than saying "a video of somebody showing off a product."

    6. Re:It's obvious... by 16K+Ram+Pack · · Score: 1
      I've only tinkered with RoR, but I've looked at the scaffold screens as being very good for working up from a simple prototype. That you can build screens, get some input, validate that it's OK, and then replace the functionality.

      Also, for "back end" screens for maintenance, where it's only going to be the system administrator (ie me) using it, I'll take time saving over prettiness.

    7. Re:It's obvious... by Eric+Savage · · Score: 1

      I think the problem is that scaffolding is sold as the major feature of Ruby on Rails. Most of the articles and demos I've seen focus on doing this fast, not doing them right and certainly not doing them to the level a real app needs. If someone out there could write up something targetted at people who know what writing a real system entails, I think Ruby might be evaluated as a serious choice and not just as a shiny step up from PHP.

      --

      This is not the greatest sig in the world, this is just a tribute.
    8. Re:It's obvious... by Transmogrify_UK · · Score: 1

      I think, or at least I'm hoping, that the "build a blog/CMS/recipe site in 5 minutes using 'scaffold :blog'" sales pitch will eventually die a death. I must admit, it absolutely impressed me when I first saw it, however since doing a little more research into Ruby on Rails, I've discovered it's so much more powerful than that and worthwhile investigating further. A site I'm working on http://kozmo.railsplayground.com/ - which is a simple blog based on the tutorials/screencasts - has taken a little more than 5 minutes (maybe 1/2 hour tops) and has taken 87 lines of coding. Now obviously what I've developed so far is very simple but it works and it's taken no time to develop. It is a new technology and so I suppose the team are trying to wow everyone with how quick and easy it is, but give it a bit more time to mature and I strongly believe we'll see some very impressive work done with ruby on rails.

    9. Re:It's obvious... by Anonymous Coward · · Score: 1, Informative

      I agree about the documentation. Everything seems to just boast about their MVC design, without actually telling you how to use it. I searched the 'net for weeks, reading as much as I possibly could, just trying to understand how things work. I had to piece together what I learned from a couple of tutorials and the associated debugging. It took me a couple weeks tinkering to figure it all out.
      Turns out that it's dead simple. It's not magic, it's just that most of it's either hidden by default, or in a weird subdirectory. Once you get the hang of it, the directory structure is a godsend. It's so easy, and it's so effective. I'm thinking about writing my own description of Rails once I've finished my current project. It won't be a tutorial, it'll just lay out the basics of how things actually work.
      Despite all the empty rhetoric, and lack of descriptive documentation, the IRC community is really helpful, and Rails itself is more than worth the time to learn.

    10. Re:It's obvious... by ibbey · · Score: 1

      Screencasts? ANOTHER new word? Definition anyone?

      Well, maybe if you followed the link, you'd be able to figure out the defionition on your own. Failing that, there's an obscure site called "Google" that I've found very helpful when I need to find information. Hopefully Google will someday become more widely known, but in the meantime I can certainly understand how you might not know about it.

    11. Re:It's obvious... by Anonymous Coward · · Score: 0

      Well, you know, there are a couple of nice books out now...the pickaxe book for ruby itself, which has some web chapters, and a rails book by the same publisher

    12. Re:It's obvious... by EvilNebby · · Score: 1

      Perl still manages to reliably not suck. Catalyst can do magic scaffolding etc..., but lets you get as down and dirty as you want, and scaffolding isn't required. It also has the distinct advantage over other web frameworks in that it can use anything in the CPAN. It doesn't tell you how to do things, just makes them simpler.

      --
      --- Nebulous
    13. Re:It's obvious... by mrlpz · · Score: 1

      "Using Rails is a bit like using a Mac: you always run into these little helpful features that make you think it was created just for you."

      Spoken like a true Mac bigot. How DARE you use my own proclivity against me. Now I can't argue with you just because you're a compadre. Damn.

      Seriously, your's and the parents posts are precisely what I expected to have someone say. Still, the fact is that lots of code-gens for handling served up views of data, are in fact, out there for lots of other languages. The fact is that part of RoR's "personality issue" is because everyone has this idea that the RoR folks are touting it as that Silver Bullet ( not necessarily a trademark of the Coors Brewing Company ). Which I don't think is the case, but it ...does....kinda...come...off...that way sometimes when you read how things are written up about it.

      Personally, I hate hype. Nothing, ever lives up to the hype. So maybe it's just that the RoR folks need to express themselves better ? I saw that a new book about Enterprise level deployment with Ruby/RoR was announced. Maybe this will help with the perception problem, and clarify what domains RoR is a proper solution for.

  5. Yes, very by Bruce+Perens · · Score: 5, Interesting
    Maintainability is a combination of several factors. Most important is: can you read and understand the code? Ruby on Rails wins in this category because it's brief - smaller and thus easier to comprehend than Java - without being cryptic like APL. Second most important is: is it easily modified? Here Rails wins again, because of the say it only once philosophy and because of Ruby's duck typing *. Say-it-once means that you don't have to track down the other places where you've had to say the same thing (as in Java) and change them. Duck typing means you can change an object substantially without the user of that object seeing the change, because the user only knows what methods the object is expected to respond to, not the object's type.

    Bruce

    * Duck typing: If it looks like a duck and sounds like a duck, it's a duck! Object types don't matter to the users of Ruby objects. What matters is that the object responds to a particular collection of methods. This is something like virtual functions, but does not require inheritance from any class or virtual class although inheritance from a Ruby module (sort of an abstract base class) is often the best way to implement those methods. So, a Ruby object might export a collection of methods called Enumerable and would respond positively to an is_enumerable? method to identify that those services are available.

    1. Re:Yes, very by Bruce+Perens · · Score: 0

      Oops. Duck typing is like virtual base classes, not virtual functions.

    2. Re:Yes, very by Atlantic+Wall · · Score: 2, Informative

      If you had to use something more than once in Java, why not just write it once and overload the method or the object. That statement that you have to edit the same thing in different places does not make sense if Java is coded correctly.

      --
      To Hell with the Queen of England!
    3. Re:Yes, very by Bruce+Perens · · Score: 2, Informative
      It's mostly declaration that has to be repeated endlessly, rather than implementation.

      Bruce

    4. Re:Yes, very by CastrTroy · · Score: 1

      On the other hand, just because a person quacks, it doesn't make them a duck. If you have an object with methods that you are calling, just because those methods exist, doesn't mean that they're doing what you want them to. If you have 2 objects with the same 5 functions, who's to say that the implementation of a function in one class has anything to do with the same function in the other class.

      --

      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:Yes, very by jarran · · Score: 4, Insightful

      Of course, Java doesn't require inheritence either. What you have described is exactly what Java interfaces are for.

      Ruby's lack of typing does make it incredibly flexible, but it has significant disadvantages to, namely that a whole class of programming errors which should be found at compile time, go totally unnoticed until the program tries to execute that code path and finds that it has an object of the wrong type.

      Don't get me wrong, I program Java at work and hate it, and I program Ruby for play and love it. But I still think we can do significantly better.

      Languages like O'Caml, manage to get the best of both worlds. For example, you can write a method in O'Caml which takes a object as it's parameter and uses a "compare" method on that object. Elsewhere in your program you try to call this method with an object that doesn't have a compare method. Not only will O'Caml detect this error at compile time, it can do so without forcing the programmer write type declarations everywhere.

      Sadly O'Caml isn't the answer either, it doesn't have a remotely decent web application framework. But I think that combining strong typing with type inference is the way to go for rapid prototyping environments.

    6. Re:Yes, very by Abcd1234 · · Score: 5, Insightful

      Yeah! And if in, say, Java, you have a superclass and subclass, how do you know the subclass didn't override superclass methods to do totally different things!

      It's called not doing stupid stuff. Now, I don't know much about Ruby, but in Objective-C, these things are called Protocols, and in Java, they're called Interfaces, but the rule is that if you implement a given protocol, then you must conform to a given contract. Can a developer deviate from that contract? Yes. Are they fucking retards if they do? Absolutely! If you want to prevent that, your only option is to work with a language like Eiffel which incorporates design-by-contract at the language level... of course, even that isn't foolproof.

    7. Re:Yes, very by Eivind+Eklund · · Score: 2, Interesting
      No, you're not guaranteed that something that respond to the same methods with the same parameter counts is really implementing the same interface. However, while writing an article and a bunch of code for type checking in Ruby, I read've read probably hundreds of discussions on this and certainly thousands of messages. I've not once heard anybody claim that they'd seen this happen or heard of it happening as a problem in practice.

      Eivind.

      --
      Doubting the existence of evolution is like doubting the existence of China: It just shows that you're uninformed.
    8. Re:Yes, very by Bruce+Perens · · Score: 1
      Hm. Is it possible to add DBC to Ruby? Has anyone already done it? There are enough instrumentation entry points in Ruby that you could probably do it without modifying the interpreter.

      Thanks

      Bruce

    9. Re:Yes, very by Hognoxious · · Score: 2, Insightful
      how do you know the subclass didn't override superclass methods to do totally different things!
      And how do you know that a method does what its name implies anyway? Or that it works as intended? At some point, you have to trust the author of them. Or verify the source yourself.
      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    10. Re:Yes, very by the+chao+goes+mu · · Score: 4, Insightful

      Give it time. Ruby and RoR is still young. It takes a while to accumulate a body of stupid coders and the associated body of bad code.

      --
      Boys from the City. Not yet caught by the Whirlwind of Progress. Feed soda pop to the thirsty pigs.
    11. Re:Yes, very by spludge · · Score: 2, Insightful
      Most important is: can you read and understand the code? Ruby on Rails wins in this category because it's brief - smaller and thus easier to comprehend than Java - without being cryptic like APL

      I disagree with this. I recently had to debug some RDoc code to create a custom generator. RDoc a big chunk of mostly uncommented Ruby code. Trying to debug and understand it was somewhat reminiscent of trying to debug Perl. Ruby gives a programmer the same expressiveness that allows them to write highly cryptic short statements that are very difficult to unravel. Not as bad as Perl for sure, but still difficult. The other big problem is that Ruby is so dynamic. I found it very difficult to trace the runtime behaviour of code because it is so easy to modify the runtime behaviour of an object from anywhere in the code!

      I agree that Java can sometimes be so verbose that it is hard to debug, but Ruby does not strike the right balance. I'd prefer to see a statically typed language (for easier debugging and refactoring in the IDE) that is also dynamic, but that enforces that runtime modification is somehow easier to follow.

    12. Re:Yes, very by Anonymous Coward · · Score: 0

      Stop perpetuating the term 'duck typing.' Use 'latent typing.' In the case of Ruby this is 'latent dynamic typing.' In terms of type theory 'untyped' would adequately describe Ruby, but using such terminology would likely send the typical Ruby programmer into a fit.

    13. Re:Yes, very by Bruce+Perens · · Score: 2, Interesting
      Not only will O'Caml detect this error at compile time, it can do so without forcing the programmer [to] write type declarations everywhere.

      Only if the object's type is explicit at some point in the function call tree at compile time, I suppose. I can think of dynamic scenaroios where this would not be knowable at compile time.

      Static checking as you describe would involve propogating type information from the called function up through its callers while that call sequence is being checked. While nobody does this for Ruby (I think Matz's Ruby compiler is still in alpha-test) it's theoretically possible.

      Thanks

      Bruce

    14. Re:Yes, very by Bruce+Perens · · Score: 1
      To be fair to RoR, RDoc isn't part of it.

      Thanks

      Bruce

    15. Re:Yes, very by Bruce+Perens · · Score: 4, Funny

      Hm. Then perhaps the best way to maintain code quality is to change languages every few years :-)

    16. Re:Yes, very by spludge · · Score: 0, Troll

      I am commenting on the Ruby language, not RDoc. The RDoc parser which I was writing an extension for happens to be written in Ruby. It may not be part of RoR, but you can make the same comment on ActiveRecord. It suffers from same issues. It's extremely hard to trace ActiveRecord execution due to the dynamic and cryptic nature of Ruby.

    17. Re:Yes, very by Jasin+Natael · · Score: 1

      Or you could just be incredibly elitist about it and shame bad coders into never publishing stupid crap for other people to see or maintain...

      Jasin Natael
      --
      True science means that when you re-evaluate the evidence, you re-evaluate your faith.
    18. Re:Yes, very by Fahrenheit+450 · · Score: 1

      Sadly O'Caml isn't the answer either, it doesn't have a remotely decent web application framework.

      I honestly don't know if it's something that could be considered remotely decent (I don't do web apps and thus have no first-hand experience with it, or well, anything else in the genre), but have you looked at AS/Xcaml?

      --
      -30-
    19. Re:Yes, very by CableModemSniper · · Score: 2, Informative
      --
      Why not fork?
    20. Re:Yes, very by Anonymous Coward · · Score: 0

      What you describe as "duck typing" is simply static typing as opposed to static classing. For Java-heads static typing is sort of like interface adherence, but more general. Most traditional OO language use classing and sub-classing, and confuse classing with typing.

    21. Re:Yes, very by Anonymous Coward · · Score: 0

      "Only if the object's type is explicit at some point in the function call tree at compile time, I suppose" ...

      Err no. OCaml uses Hindley-Milner typing to *infer* a most general type. There are cases where this doesn't work (polymorphic recursion for example), but they are not that common.

    22. Re:Yes, very by jarran · · Score: 1

      Only if the object's type is explicit at some point in the function call tree at compile time, I suppose.

      Without ever giving the object or any method calls explicit types. For example:

      let foo x = x#bar

      let ok =
            object
                method bar = ()
            end

      let notok =
            object
                method qux = ()
            end

      let _ = foo ok
      let _ = foo notok

      No types are explicitly given, but the last line fails to compile with a type error.

      I can think of dynamic scenaroios where this would not be knowable at compile time.

      Indeed, and such scenarios would not be expressible in O'Caml, as it doesn't allow dynamic typing. Many O'Caml proponents would say that's exactly what you want, and that those programs should simple be re-expressed in a "more O'Caml like way", so that they don't need to be dynamic, and all the types can be statically determined.

      Personally, I say (wrt to your dynamic scenarios) that just because something doesn't work in every situation, doesn't mean it's useless. C has (void *), for when you need to disable type checking. But just because you need to disable type checking sometimes, doesn't mean that it isn't a huge benefit for the 90% of the time that you do use it

      The same with type inference etc in some theoretical Ruby like web-framework: statically excluding type errors from a large proportion of your program would be a huge benefit, even if even you can't catch 100% of the errors.

    23. Re:Yes, very by Anonymous Coward · · Score: 0

      Is that you, Donald Rumsfeld?

    24. Re:Yes, very by pthisis · · Score: 2, Funny

      Or you could just be incredibly elitist about it and shame bad coders into never publishing stupid crap for other people to see or maintain
      No, the key is to have a superficial language feature that has no impact on development time but keeps people away.

      Tons of parentheses seems to work well. Using indentation to delimit is another approach that's still in its infancy.

      --
      rage, rage against the dying of the light
    25. Re:Yes, very by aziegler · · Score: 0

      A fit? No. But Ruby isn't untyped; it is, in fact, very strongly typed. It's just that we don't restrict variables to a single type. We don't even restrict objects from changing their type at runtime (although their class inheritance won't change at runtime...mostly ;). In Ruby, a String is always a String and can't be coerced into something else. Converted, yes. Coerced, no.

      --
      Ni bhionn an rath achx mar a mbionn an smacht (There is no Luck without Discipline)
    26. Re:Yes, very by Anonymous Coward · · Score: 0

      Says the person that hasn't studied type theory but feels the need to comment anyway.

    27. Re:Yes, very by Jobe_br · · Score: 1
      It's called not doing stupid stuff.

      Actually, I think its called the Liskov Substitution Principle

    28. Re:Yes, very by Abcd1234 · · Score: 1

      Now that's just hurtful...

    29. Re:Yes, very by iabervon · · Score: 1

      smaller and thus easier to comprehend than Java

      Most of the ways in which Java is verbose are either pre-1.5 stuff (tons of extra casts, using Iterator for every loop, constructing arrays to pass to functions that need variable argument lists) or library inconveniences (everything in java.lang.reflect takes 6 times as many lines as it ought to; Servlets are misdesigned in such a way as to require a ton of extra stuff). But if you use 1.5, there's no reason you couldn't have a "Java on Rails", that's almost as good. With a good design, all of the verbosity goes into the library, and then the compiler can statically check that things are being done correctly. I do agree, though, that the average Java system is sort of "Java on Sand", and having things streamlined effectively is a huge benefit.

    30. Re:Yes, very by Bruce+Perens · · Score: 2, Interesting
      there's no reason you couldn't have a "Java on Rails", that's almost as good.

      Hibernate, Struts, Spring, and so on add facilities to Java that bring it more in the direction of Rails. There's a famous example of a Java programmer who set out to show that he could write concise code in Java on a par with RoR. He attempted to duplicate an existing RoR program. He sent the result to the RoR creator, claiming success. It's three times the size of the equivalent RoR code. So, I'm still waiting to see someone make Java as concise.

      Bruce

    31. Re:Yes, very by jbolden · · Score: 2, Insightful

      You describe the program as: mostly uncommented, highly cryptic short statements that are very difficult to unravel, modifies the runtime behaviour of an object from anywhere in the code. Why do you think it was written to be maintained by an external author? It seems to me the author hadn't intended a 3rd party to maintain his code. Further my guess is that he was conceptualizing the problem differently than you were. "Highly cryptic" usually means that you need to understand how the programmer viewed the problem before trying to figure out what the program does; that is maintain it like you would translate a poem not fix a broken car.

    32. Re:Yes, very by heinousjay · · Score: 1

      using such terminology would likely send the typical Ruby programmer into a fit.

      Geez, how did you know that?

      --
      Slashdot - where whining about luck is the new way to make the world you want.
    33. Re:Yes, very by Anonymous Coward · · Score: 1, Informative

      What you call duck typing is known in the litterature as structural typing. The alternative, used in languages such as Java and C++ is called name based typing.

      Structural typing is more flexible, because, as you say, if it looks like a duck and quacks like a duck, then it is a duck. The counter argument is that allows compatibility between types that are conceptually completely unrelated. An 18 foot tall robot that attacks while looking like a duck and playing scary QUACK sounds is a duck according to this philosophy.

      Name based typing, as used in Java and C++ and several other languages, will only allow you to consider something a duck if it inherits the "Duck" type. The is-a relation is always explicit.

      And that completes today's lecture on the theory of type systems. You may now flame each other for using structural types instead name based types and vice versa.

    34. Re:Yes, very by spludge · · Score: 1

      I don't know what the author's intentions were here and perhaps I should have given more examples than just RDoc. It was the first that came to mind because I had worked on it recently. I have debugged several other large ruby projects and that type of programming seems endemic.

      Ruby makes it very easy to write code that is cryptic and difficult to follow. With some forethought and planning (and lots of comments) you can write maintainable code in any language, including Ruby. However, just like Perl, Ruby doesn't encourage that type of behaviour. It gives you lots of ways that make your programming life easier, but makes life very difficult for the person that has to maintain or debug your code.

      Oh well. This comment is probably far too late in this thread for anyone to read it :(

    35. Re:Yes, very by ibbey · · Score: 1

      Ruby makes it very easy to write maintainable code, but in the end it's the programmers responsibility to do so. A bad programmer can write unmaintainable code in pretty much any language. Some languages make it harder to do so, but that doesn't necessarily mean that their code is inherently more maintainable.

    36. Re:Yes, very by jbolden · · Score: 1

      However, just like Perl, Ruby doesn't encourage that type of behaviour. It gives you lots of ways that make your programming life easier, but makes life very difficult for the person that has to maintain or debug your code.

      Its not your example I'm disagreeing but rather this point. Let me rephrase slightly:

      However, just like Perl, Ruby doesn't encourage creating programs that are easy to change without deep understanding. It gives you lots of ways of expressing your conception of a program faithfully, that is not as a cookbook "do x then do y then do z". This makes your programming life easier, but makes life very difficult for the person that has to maintain or debug your code quickly with little prior exposure.

      Would you agree I'm being fair on my qualified version?

    37. Re:Yes, very by Anonymous Coward · · Score: 0
      Duck typing: If it looks like a duck and sounds like a duck, it's a duck!

      C++ templates. At least in the sense of:
      template <typename Duck>
      void foo(Duck &it)
      {
        it.lookLikeADuck();
        it.soundLikeADuck();
      }
    38. Re:Yes, very by Eivind+Eklund · · Score: 1
      Yes, it takes time. However, Ruby is 10 years old, and if that problem doesn't occur inside ten years with thousands of programmers, it's - in my opinion - not worth worrying about. Even with more and worse programmers.

      This leaves me with time to worry about real problems in Ruby. Close to what you're talking about is the lack of a global namespaceing system, giving library conflicts. These happen. Or blocks not checking parameter counts. This also gives real errors. And the lack of type declarations can be a documentation problem - it makes it hard to see what set of methods (messages) a parameter is supposed to respond to.

      These are things that happen, things that actually impact code and development. Identical interface signatures for interfaces that really do different things is a mythological "could be" problem.

      Eivind.

      --
      Doubting the existence of evolution is like doubting the existence of China: It just shows that you're uninformed.
    39. Re:Yes, very by Tintagel · · Score: 1

      'Nominal typing' is the more usual way to say 'name based typing'.

      As you say, a nominal type system introduces subtypes simply by declaration, while a structural type system introduces subtypes by some algorithm for matching types' features.

      Can I suggest you're being a bit specific with '...consider something a duck if it inherits the "Duck" type.' ? Nominal typing applies anywhere that a subtyping relationship can be introduced, not just where there's class-based inheritance. Inheritance is merely a mechanism for code reuse and happens to introduce nominal subtypes in Java.[1]

      Of course you know that the obvious non-inheritance-based introduction of nominal subtypes in Java is when a class implements an interface. I think '...consider something a duck if it declares that it is a subtype of the "Duck" type.' is the most general way to put it :-)

      [1] You could imagine an object-based language with no classes or inheritance (they use delegation instead) but still with nominal types. They could arise if the programmer gives an instantiated object a name for itself and also the names of objects that will serve as its supertypes. This would require dynamic typing, though it would still be nominal :-)

    40. Re:Yes, very by the+chao+goes+mu · · Score: 1

      True ruby is a decade old, but it has only had significant attention for about 2 years, perhaps 3. Before it came into (relative) public consciousness, the body of coders was too small to have many fall below that 3 standard deviations mark where the truly miserable coders reside. Now that there are more and more developers beginning to use the language I am sure we'll see much worse code.

      --
      Boys from the City. Not yet caught by the Whirlwind of Progress. Feed soda pop to the thirsty pigs.
    41. Re:Yes, very by Anonymous Coward · · Score: 0

      It's true that you can imagine languages that have both subtyping and class inheritance, where those two things are not related. In practice they are the same thing in almost all nominal typed languages, though. I'd consider Java's interfaces a special kind of classes that happen to be completely abstract, and 'implementing an interface' a special case of multiple inheritance.

      Whether class inheritance is just a mechanism for code reuse, is certainly debatable. I'd argue that in languages such as Java or Beta, their main function is to organize the program conceptually, with code reuse as an (overrated IMHO) side effect. Even if you can only override abstract methods (and thus get no code reuse at all), the notion of class is still a useful one.

      I guess it's just a question of what meaning you assign to the ill-specified word 'inheritance', but you are basically right: subclassing does not necessarily introduce subtypes, and you can have a subtyping relation between things that not instances of classes.

  6. Get the basic premise right, first by blakeyez · · Score: 5, Informative

    Rails is _not_ a code generation framework. Note the period on that sentence.

    Rails may provide the some simple scaffold generation, but that's only there if you _want_ to use it, and it happens to fit the way you'd like a particular part of your app to work. The code produced is concise, easy-to-follow, and thus easy-to-maintain.

    For my own applications, I barely ever use scaffolding. It works well for simple admin screens where I just want 'something' that works for now, then will spend some effort on designing it a little better, later.

    Rails is as maintainable as you make it. If you're a poor programmer, you're likely to write unmaintainable code, no matter what language or framework you have to help you. Rails helps point you in the right direction, but in the end, it's up to the _developer_ how maintainable his/her code is.

    1. Re:Get the basic premise right, first by zaguar · · Score: 1

      You _type_ like _Linus_ _Torvalds_ using _underscores_ for _emphasis_

      --
      "Sure there's porn and piracy on the Web but there's probably a downside too."
  7. Gem up on Ruby First! by Boss,+Pointy+Haired · · Score: 5, Insightful

    Rails has created quite a buzz in the Web 2.0 community, which means a lot of people jump straight into Rails without any prior knowledge of Ruby; and then when they find they can't get very far they blame that on Rails.

    It's like hacking the Linux Kernel without ever having programmed in C. You're bound to think it sucks because you won't have a clue what's going on.

    1. Re:Gem up on Ruby First! by secolactico · · Score: 2

      Somebody mod this guy up!

      Myself, I'm in that situation. I've never done any coding professionally except to support my own work as network admin. Having started in Perl, every problem I come across I try to solve in perl (even when a simpler shell script would suffice).

      Now that I'm giving rails a try, I find myself frustrated because I realize I know nothing of ruby. So next step (for me) is to put aside rails and learn some ruby. Rails will come afterwards.

      If you want rapid application developement, I'd say you are better off with a tool like CodeCharge (http://www.yessoftware.com/products/product_detai l.php?product_id=1 a try. It's not free and it's not very customizable. But you will have a completed app in a very short time.

      --
      No sig
    2. Re:Gem up on Ruby First! by TheRealMindChild · · Score: 1

      Christ, have you to be on smack. Have you ever LOOKED at the Linux Kernel code? There is some CRAP in there. Mountains of it. Solar systems of it.

      --

      "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
    3. Re:Gem up on Ruby First! by fupeg · · Score: 1
      a lot of people jump straight into Rails without any prior knowledge of Ruby
      Ok, but if you go on RoR's official site, you will see several quotes including:
      Ruby on Rails is a breakthrough in lowering the barriers of entry to programming
      Sounds to me that one of RoR's supposed selling points is that people can "jump straight into Rails." I'm sure if the RoR site had a big banner at the top of the page saying "Please go learn Ruby before reading anything else on this site!" then it would not have nearly as much mindshare.

      You can't have it both ways. If you want to "lower the barriers of entry" then you must realize that your target audience includes inexperienced programmers. At least Microsoft understands this, and have created the mother of all mind-numbing IDEs, Visual Studio. If instead you want to say your target audience only includes experienced programmers, then that good ol' barrier to entry just got raised pretty high.
    4. Re:Gem up on Ruby First! by nine-times · · Score: 1
      Rails has created quite a buzz in the Web 2.0 community, which means a lot of people jump straight into Rails without any prior knowledge of Ruby; and then when they find they can't get very far they blame that on Rails.

      I'm with you on this, but the truth is, jumping into Rails without knowing Ruby isn't so bad, so long as you understand and accept that you'll need to pick up some Ruby and general programming principles as you go.

      Myself, I'm not a programmer, but in the past month, I've built myself my own combination forum app/weblog app. Though it's still not "done", but it works. It took a bit of effort and reading on my part, and I still reference Rails documentation regularly, but it's getting there. It'll be usuable for its intended purposes pretty soon. (I might open-source it in the hopes of getting real programmers to fix the stupid things I've done which I don't even know are stupid)

      Point is, I started with scaffolding. I knew some html, so I editing the rhtml to get it to look the way I wanted was easy. The rest, I read a lot about ruby and rails, studies a bit, experimented a bit, and through trial and error, I'm starting to understand. But scaffolding got me started.

      And best of all, it keeps enough of the under-the-hood details under-the hood, where I don't have to worry about them. I can focus on getting things to-- just, in a simple way, "do what I want". What I want isn't that complicated, and a little experimentation with Rails is letting me do far more than I could do before. Maybe I'm just not as bright as the rest of you, but I tried picking up PHP and quit out of frustration/annoyance.

      So a lot of people jumping into Rails without knowing Ruby ahead of time-- I think it's fine. Whether they "can't get very far" depends on how much effort they put into learning it.

    5. Re:Gem up on Ruby First! by Geoffreyerffoeg · · Score: 1

      Why does it require Ruby? Is there a C++ on Rails for normal people? PHP on Rails? VBS (ASP) on Rails?

    6. Re:Gem up on Ruby First! by marcello_dl · · Score: 1

      Rails is a Ruby app, the principle is that you just need to be familiar with some ruby and html to do everything.
      This rules out the possibility that rails developers are going to support other languages, it wouldn't make much sense.

      --
      ---- MISSING MISCELLANEOUS DATA SEGMENT --- [sigdash] trolololol
    7. Re:Gem up on Ruby First! by cyranoVR · · Score: 1

      Not exactly, but some people are building something like it in Java:

      https://trails.dev.java.net/

  8. It isn't really code generation by Anonymous Coward · · Score: 5, Informative

    Ruby on Rails script/generate generates very little code. If you choose "File, New class" in Eclipse, you get the about the same amount of code, as you would get if you used rails generation features. The only difference is that ruby on rails also generates a test class for the model.

    Scaffolding generates a bit more code, but it is never intended to be actually used. It is ment to be slowly replaced, piece by piece, by your own code. So I don't think the disadvantages of code generation really applies here.

    So yes, in my experience a ruby on rails project is maintainable.

    1. Re:It isn't really code generation by btakita · · Score: 1

      I found Rails to also be maintainable. There can be a problem when you have large controllers or views, but you can break up the functionality into supporting classes.

      Unfortunately, Rails does not seem to have a good community convention on where to put these supporting classes. I put them in a directory with the same name as the controller.

      For example,
      app/controllers/a_controller.rb
      app/controllers/a_controller/supporting_class_a.rb
      app/controllers/a_controller/supporting_class_b.rb

      And for views, I use rxml. Most Rails developers use rhtml, but I found that rxml gets me to think more about creating seams to create supporting classes, with unit tests.

      For example,
      app/views/a_controller/view_a.r(x|ht)ml
      app/views/a_controller/view_a/supporting_class.rb

  9. "favoring convention over configuration" by leather_helmet · · Score: 2, Informative

    My limited use of RoR has been favorable - no issues, as of yet, regarding maintainability or spheghetti-O code

    It has worked as promised and I have been pleasantly surprised by its functionality
    btw, my main use was creating a new database for an intranet application

  10. This is your typical dev-versus-admin mentality. by old_skul · · Score: 3, Insightful

    Devs are always looking for ways to reduce the amount of time it takes to code something. Admins are always looking for ways to automate their jobs. RoR is nice for devs but makes the admin tasks pretty hard - unless the admin knows his way around the product about as well as the dev does.

    Now add the additional idea of a custom-designed project that the dev put together - and didn't document (because devs never document, right?). Chaos ensues.

  11. Bad OO Substitute? by cheesedog · · Score: 5, Insightful
    I'll make a bold counter-claim: Object-oriented programming is a bad substitute for straight-forward dynamic binding and typing.

    I've been doing almost pure OO programming for the past 8 years (using mostly C++ and Java), but recently took up Python (for python-twisted and pyWxWindows) and Ruby on Rails (for server-side development), and I can tell you that it is much simpler, easier to debug, and quicker to get done than taking the time to create massive class hierarchies whose inheritance structures and interfaces only exist to satisfy type-safety requirements.

    Don't get me wrong. I like writing class hierarchies as much as the next guy. I've spent years doing it. But when I compare what I can get done in 30 minutes in, say, Python, to what I can't get done in 3 hours in C++, the advantages start to become very clear.

    1. Re:Bad OO Substitute? by leather_helmet · · Score: 1

      100% agreed - I have experienced the same situation/enlightenment - After coding C++ exclusively for about 4years I moved over to python to help with game scripting - It was pretty amazing to me how much I was able to accomplish in much less time

      there are obvious pros and cons for each language, but I enjoyed the experience of moving over to python for a bit and recently being able to code a couple of small DB apps with RoR

    2. Re:Bad OO Substitute? by Bruce+Perens · · Score: 4, Insightful
      Ruby doesn't contradict the Object Oriented programming paradigm. If you go back to the origins of OO in Smalltalk, it was much closer to Ruby than some tightly-typed OO languages like C++ and Java. Perhaps the lesson to be learned is that tight typing of class references isn't that good an idea.

      Thanks

      Bruce

    3. Re:Bad OO Substitute? by radarsat1 · · Score: 1

      I totally agree with you here. I was writing a small configuration program in C and GTK when I had little experience with GTK programming. Been writing in C++ and C for years. After a few days of hacking at it, I switched to PyGTK and finished the thing in one day. Since then I've been trying out Python in all sorts of other situtations, and I'm really impressed. I'm really loving its clarity and dynamic binding, and it's incredibly useful for prototyping ideas even if I end up implementing them in another language, because I can do it so fast.

      However, I fail to see how you don't consider it Object Oriented?

    4. Re:Bad OO Substitute? by the+chao+goes+mu · · Score: 3, Insightful

      Actually Java's biggest problem in my experience is inconsistent typing. Why does the method to fetch a port return an Integer object, but socket connections want an int primitive? Or how about the eight million different date/time object types? I think if that mess were made even a bit more consistent, Java would have a significantly faster development cycle.

      --
      Boys from the City. Not yet caught by the Whirlwind of Progress. Feed soda pop to the thirsty pigs.
    5. Re:Bad OO Substitute? by IamTheRealMike · · Score: 3, Interesting
      Of course it isn't as simple as that. If it was, everybody would use Ruby or Python for everything and Java/C#/C++ would be dead.

      In practice, strong typing and the lack of Ruby-style dynamism allows compilers and runtimes to make optimizations they otherwise couldn't. Those matter, a lot, try looking at the memory usage or execution speed of your average Ruby program sometime! Worse, it's an unfixable problem, at least without modifying the language itself quite heavily.

      I think the way we're going to go with language design, as an industry, is more like Boo - a language which on the surface looks like Python and has many of the clarity and programmer efficiency features that make Python so much fun to use, but under the hood is actually a traditional strong/static typed language. In Boo, type inference is used to let you drop many of the redundant type declarations that normally clutter up Java/C#/C++ style code, and a smart compiler plugin system is used to let you add new features to the language easily. This is traded off against the ability to do things like add/remove methods at runtime which are hard to implement in a time/space efficient manner.

    6. Re:Bad OO Substitute? by grumbel · · Score: 1

      ### and quicker to get done than taking the time to create massive class hierarchies whose inheritance structures and interfaces only exist to satisfy type-safety requirements.

      I totally agree that a lot of coding done in static-typed languages is simply wasted, since it serves no other purpose then to make the compiler happy, however on the other side I love compile-time checks, far to many times I had some piece of Python, Ruby or some other dynamic typed language which ended up just being a *HUGE* pain to refactor, since each refactoring step (renaming a function, moving a member from one class to another, etc.) ended up in a broken programm and errors that could only be catched at runtime. Static typed languages are far easier to refactor, since one can simply rename something and then just compile and jump to the places where function are missing or types missmatch. Sure, unittesting can help a bit with dynamic typed language, but then one is kind of back at square one, only that one now ends up writing plenty of code to do stuff that the compiler would have done in a static language. I wish those dynamic languages out there would try a little bit harder to detect errors at compile time and not just runtime, sure its not always possible, but for lots and lots of cases it should be rather obvious.

    7. Re:Bad OO Substitute? by Anonymous Coward · · Score: 0

      You can try ShedSkin http://shedskin.sourceforge.net/ Python->C++ compiler (currently alpha version).

    8. Re:Bad OO Substitute? by hoggoth · · Score: 1

      > I think if that mess were made even a bit more consistent, Java would have a significantly faster development cycle

      Here here!
      That is exactly why I despise Java.
      It takes forever to get anything done when you start with an object of type StringThatCanHaveBellsOnItsToes and have to convert it to ArbitrarilyLongString and convert that to FunkyStringThatCanDynamicallyGrowAndShrink to feed it to a method that only takes that type.

      --
      - For the complete works of Shakespeare: cat /dev/random (may take some time)
    9. Re:Bad OO Substitute? by droleary · · Score: 1, Flamebait

      I've been doing almost pure OO programming for the past 8 years (using mostly C++ and Java)

      Honestly, anyone using the phrase "pure OO programming" and referencing C++ should probably be shot in the head. All your "bold counter-claim" amounts to is that you had bad teachers and you believed what they told you.

    10. Re:Bad OO Substitute? by cheesedog · · Score: 1
      Honestly, anyone using the phrase "pure OO programming" and referencing C++ should probably be shot in the head.
      :) I'll go ahead and agree with you. I should have said that I've spent the last few years trying very hard to do OO programming in C++ despite its severe OO problems.
    11. Re:Bad OO Substitute? by droleary · · Score: 1

      :) I'll go ahead and agree with you. I should have said that I've spent the last few years trying very hard to do OO programming in C++ despite its severe OO problems.

      Many have and, sadly, many still do. It's a good sign you figured out the error in your ways! :-)

    12. Re:Bad OO Substitute? by IamTheRealMike · · Score: 1

      ShedSkin compiles a language very similar but not equal to Python. It adds some restrictions.

    13. Re:Bad OO Substitute? by blueskies · · Score: 1

      You agree?

      I'll be right over with a gun...

    14. Re:Bad OO Substitute? by kraut · · Score: 1

      If all your unit tests in Python deliver is some approximation of type safety - i.e. what the C++ compiler checks - then you're not writing them right.

      If you're writing them right, then you end up with tests for the functionality. You still need those in C++, or Java, or Eiffel.

      --
      no taxation without representation!
    15. Re:Bad OO Substitute? by Zangief · · Score: 1

      But, you need to try/catch all that!

    16. Re:Bad OO Substitute? by grumbel · · Score: 1

      The point is that I *don't* need them just to get type safity in C++, of course they can do more, but I don't want to be forced to write them in the first place.

    17. Re:Bad OO Substitute? by ceoyoyo · · Score: 1

      I think the way we're going with languages is hybrid environments. Python (interpreted) for 90% of the code, something like C, C++ or Obj-C, assembly, whatever-you-want for the 10% that actually needs to run really, really fast. On the Mac with pyObjC any objective-C classes are automatically bridged to Python. It's really nice to be able to throw together GUI code and stuff, then call some super optimized compiled code to do the real processing.

    18. Re:Bad OO Substitute? by IamTheRealMike · · Score: 1

      I doubt it - for one, bridging languages like that always has a friction cost, and for another, Objective-C isn't really that fast either ;)

    19. Re:Bad OO Substitute? by ceoyoyo · · Score: 1

      So then use C++. Better yet, use C. And you don't use the bridge constantly, you call it when you've got a good chunk of processing that needs to be done. Calling wrapped code doesn't have much of a cost anyway, if it's done properly.

    20. Re:Bad OO Substitute? by IamTheRealMike · · Score: 1

      Look at the arguments over the inclusion of the gnome launch toolbar a few months ago on desktop-devel-list to see an example of why Python really isn't suitable for desktop applications, C or no C.

    21. Re:Bad OO Substitute? by ceoyoyo · · Score: 1

      I don't really have time to go read a flame war on a Gnome mailing list. I can tell you that I develop Python apps on OS X all the time. They work great. You can't tell them from a regular app without inspecting the package contents.

    22. Re:Bad OO Substitute? by IamTheRealMike · · Score: 1

      Briefly, the argument was "20mb of memory overhead is not acceptable for an applet", as they are expected to run all the time. Personally I'd find 20mb of overhead for a very simple program to be unacceptable nearly all the time, as the developer can't know if the user will keep it running or not.

    23. Re:Bad OO Substitute? by ceoyoyo · · Score: 1

      Agreed. I wouldn't want a 20mb toolbar. I can't say exactly whey they ended up with such a large applet but I don't believe the bundling applications for Python are as good on Linux as they are on the Mac and Windows. On the Mac, when you build a self contained app only the essential parts of Python are included, which cuts down the space significantly. Far from 20mb of overhead, I believe the largest Python app I've built on the Mac was about 17mb, which could probably be pared down considerably if I wanted to. It was smaller than comparable apps written in other languages. Of course, if you don't need your program to be self contained (you can depend on the interpreter already being on the system, which is true of OS X and many Linux distros), then you can get away with a few k.

  12. Try Ruby here! In your browser! Painless! by 5n3ak3rp1mp · · Score: 5, Informative

    Try Ruby (the language) here. Integral to understanding much of Rails.

    I released my first production Rails app last month. I like it a lot. I have a background in ASP/SQL Server/PHP. Not having to use Microsoft Windows itself is a huge win. But I like the design of the language and the framework and the built-in separation and a thousand little other things. Check out #rubyonrails on irc.freenode.net, great community there too.

    1. Re:Try Ruby here! In your browser! Painless! by Anonymous Coward · · Score: 0

      Looks like a neat demo, but it is horribly broken. "2 + 6" doesn't even work.

    2. Re:Try Ruby here! In your browser! Painless! by Anonymous Coward · · Score: 0

      Worked fine for me. Safari user? There have been bugs filed with Why? for Safari.

    3. Re:Try Ruby here! In your browser! Painless! by An+Onerous+Coward · · Score: 1

      Wow. This is more fun than Space Invaders!

      --

      You want the truthiness? You can't handle the truthiness!

    4. Re:Try Ruby here! In your browser! Painless! by Anonymous Coward · · Score: 0
      Interactive ruby ready.
      >> 2+6
      => 8
      >> "2+6"
      => "2+6"

      PEBCAK?
  13. Wrong Idea by AntiDragon · · Score: 3, Informative

    The "Automatic Code Generation" is a slight misnomer. It would be better to think of it as "Semi Automatic Code Generation". (Mental image...hehe).

    It's just a part of the system that can *if you so desire* generate basic classes and parts of an MVC system by inspecting your database. It's basic and is designed to give you something to work with while you build the actual application you want.

    The real strength of the Rails framework is the various support libraries and the way it gently encourages you to follow specific coding conventions (Hungarian notation fans, run for the hills!). If anything, this not only speeds development but makes maintenance a breeze - Ruby is a very readable language when not abused.

    Hmm...that does all sound a bit fan-boyish, doesn't it? Well, I'm a PHP convert to Ruby and I have to say I wish I'd decided to take a look sooner.

    Short answer - Rails systems are probably more maintainable than your average ASP/PHP system.

    --
    "...So I hung back and lurked. For 18 months. Can't beat a good old-fashioned lurking."
  14. submitter has no clue by Anonymous Coward · · Score: 0

    The submitter hasn't done the barest of investigation into rails. if he had, he'd know that there's hardly any actual code generation (apart from generating stubs, which is actually useful).

    rails apps (of which i've written several) have the smallest codebase i've ever seen for any application, and are therefore eminently maintainable.

    ruby itself is a significant contributor to the success of rails due to its concise nature, and phenomenal abilities with regard to modification of instances at runtime.

    submitter needs to do some homework.

  15. Get rid of RoR entirely? by Anonymous Coward · · Score: 0
    seem to be under the impression that the "scaffolds" in Ruby On Rails are all there is. That's not true.



    Once you abandon the scaffolds, you can do whatever you want. And it's easy to maintain.



    Very helpful answer. Gee, I can also get rid of RoR and just use Ruby too. So is your answer: RoR - scaffolding is maintainable? Is there other stuff you need to jettison? Any best practices, real world experience? Thought so.



    You don't know what you're talking about, in other words.

    Well this is *Ask* Slashdot, not *Tell* Slashdot. And not that you know much of anything either judging by your entirely useless commentary.

  16. Scaffolding is exactly what it says it is. by Boss,+Pointy+Haired · · Score: 2, Insightful

    Automatic code generation sets of alarm bells in my mind;

    You're reading too much into it. Just like when you're building a house; you put the Scaffolding up to give you something to work from. When you're done building your project, the Scaffolding is gone.

  17. We've been told... by fury88 · · Score: 3, Funny

    To stay FAR FAR AWAY from Ruby on Rails here. In fact, they sent us java developers to the Java conference and we were forbidden to go into any of those seminars. Why? Probably because they don't want us picking up any bad habits.

    1. Re:We've been told... by Daniel_Staal · · Score: 1

      My guess is that it is so you won't revolt.

      --
      'Sensible' is a curse word.
    2. Re:We've been told... by fury88 · · Score: 1

      Yes, I am sure thats part of the reason!

    3. Re:We've been told... by Anonymous Coward · · Score: 0

      You might consider getting a new job. Any employer who discourages her/his employees from learning new things is an idiot.

      You are a bigger idiot for listening.

    4. Re:We've been told... by DrJimbo · · Score: 1
      fury88 wrote:
      ... they sent us java developers to the Java conference and we were forbidden to go into any of those [RoR] seminars. Why? Probably because they don't want us picking up any bad habits.
      I think it is more likely they didn't want to foment a general revolt amongst their Java devs. It kinda sucks to learn you can do the same things in 1/3 the time or less by changing languages.

      But perhaps you meant this all along and I didn't pick up on your subtle humor.

      --
      We don't see the world as it is, we see it as we are.
      -- Anais Nin
    5. Re:We've been told... by fury88 · · Score: 1

      No, you're right. I've looked through RoR on my own time and its a pretty nifty tool. Amazingly fast too. Funny, I use Java here but if I want to put up a website at home, I'm all over PHP, mySQL. Too quick and easy. I don't have time to write classes, compile jars, etc. I just want the damn thing up and running!!

    6. Re:We've been told... by fury88 · · Score: 1

      Oh, I'm no dummy. I know what's out there. But if I get paid well and have flex hours, then I can take some of the crap. Plus it gives me free time to do some other ventures. ;-)

    7. Re:We've been told... by dasil003 · · Score: 1

      LOL, as if you could do thing the ruby way in Java.

    8. Re:We've been told... by Decaff · · Score: 1

      Too quick and easy. I don't have time to write classes, compile jars, etc.

      Then JSP (Java Server Pages) should suit you fine.

    9. Re:We've been told... by fury88 · · Score: 1

      True, JSP can be just as sloppy as PHP if not coded properly. Although JSP is falling by the waist-side for JSF. Another thing we just did hear. Not ready for primetime just yet.

    10. Re:We've been told... by matfud · · Score: 1

      We've just done a few large projects using JSF (actually myfaces) and have found that it is very expensive up front. Design and implementaion take a lot of effort and knowledge to ensure that everything does not "go to shit" later on. By the way the developers are all very experienced (but not in JSF). Whether it is more maintainable in the long term is currently unanswerable as these projects are still new but most of the code is clean well structured java. Much of the up-front work was developing custom JSF components (which makes everything else much cleaner and simpler)

  18. Have you actually USED rails? by Anonymous Coward · · Score: 0

    Yes, there's a lot of "automatic" code generation in the demo video(s), but the reality of rails programming isn't anything like that.

    There isn't little to none code generated when you use the generate script, mostly it just creates the files, class definition, and maybe a default call to 'scaffold'. That's all there is, so you wouldn't have to "re-generate" anything when a new version comes out. And the "scaffolding" is only good while the site is "under construction", you should have implemented all of the methods the scaffold offers yourself by the time the project is ready.

    The only maintenance you'd have to do is when the API changes, and ruby is as vulnerable here as any language.

  19. Code Generation - Negative Image by ajwitte · · Score: 2, Insightful

    I think a lot of the "it's not maintainable or scalable" assessments of Rails come from people who have seen its code generation and "scaffolding" features and think that those are the main advantage of Rails. It's true that one can only do so much with the "scaffolding" which is simple and generic. However, the real power of Rails comes not from the scaffoldings but from the framework Rails provides in which to write custom code. I've written two Rails applications and maintained several others. None of them used the scaffolding provided by Rails - they had all hand-written code inside the bare-bones Rails-generated structure. Those applications have proved to be easily maintainable. It's a shame that most of the introductory tutorials/examples/videos for Rails focus on the scaffolding features, because that leads people without much Rails experience to believe that the scaffolding is all there is to Rails and form a (usually poor) opinion based on that.

    --
    chown -R us ~you/base
    1. Re:Code Generation - Negative Image by CastrTroy · · Score: 1

      Besides the scaffolding, what is it that differentiates RoR from any other language. Most languages have the same constructs when you get down to it. Loops, conditionals, functions, classes, variables. What really sets apart a language is either A) the Framework/API as in Java or .Net, or the ability to quickly generate code to do more complex things quickly. I can learn just about any language in a couple days. It's learning to use the framework/API and the other features of the language such as scaffolding that take longer to get a hang on and use them to your advantage. Even this kind of thing can be learned pretty fast. In the end, every organization has their own way of using the languages and tools at their disposal. I sometimes wonder why organizations even ask for experience with a particular language. In the end, people who know the language spend just about as much time as those who don't learning the intricacies of the ways that things are done at the organization. Learning a language and a framework is nothing compared to this.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
  20. Rails is more then meets the Eye by TheUncleD · · Score: 4, Informative

    Rails provides more then the scaffolding capabilities and simple framework of designing a blog as seen in the video. It provides the structure for fast and organized ruby application development by setting up for the user a foundation of modelling, views and controllers that are easy to use and distinguish. It is not the magic wand to a great web application. The magic wand comes with Ruby programming experience and learning to tie it into Rails application development. You could even go as far as stepping beyond the "narrow view" of what rails is doing and see the bigger picture, understanding that Ruby is supporting all of this webmagic and rails is providing the "rails" as it claims to. One challenge many of the "why is this better than Php?" questioners have difficulty seeing past is the far smaller community rails has, the less clear translation between what php can do and what rails is capable of, and the predefined examples of rails applications in action. Many people leap to using PHP becuase it provides pre-existing code snippets that make the same thing true of many php users, "simple cookie cutter codejobs." Rails offers you a chance at not only using a great framework, but also a great programming language that its built on to make more pragmatic and simpler design tactics to getting your website online and active. Another alternative to rails is Iowa which offers a lighter approach to maintenence, though remains less documented. It can be found here: http://enigo.com/projects/iowa Whatever you choose to do, look deeper into the situation then the surface of what appears to be "cookie cutter" programming and realize that a powerful tool lies beneath all of this: Ruby.

  21. ORM and MVC in the same framework by stelmach · · Score: 2, Informative

    I find it unfortunate that most of the 'newbie' tutorials jump right in to how to generate scaffold code. This code is a bit unmanageable and hard to modify, but I think it has a certain 'WOW' factor associated with it. Once the novelty wears off and you need to develop real applications, you will rarely use the generated scaffold code, and the code you write within the framework will certainly be manageable.

    Where I think Rails comes out on top is the fact that it includes a full blown ORM and an MVC implementation under the same, configuration-less framework. No more XML. No more duplicate java beans...More of this on my blog if interested.

  22. Code Generation in Rails is No Big Deal by fthiess · · Score: 2, Insightful

    I've been using Rails for several months, and I think it's "automatic code generation" is no big deal, and nothing to worry about. If you're worried about maintainability, it the wrong place to focus.

    The only time code gets generated for you automatically is at the very beginning of a project to create "scaffolding". That scaffolding is great, because it lets you get something up and running very quickly, but in my experience, it NEVER survives in the body of the project for long--you always want to do something differently, or more elaborately, than what the scaffolding provides.

    So, I think of Rails' scaffolding as "stub" code that happens to include some (very) basic functionality. Like code stubs, they just provide placeholders for you to use to flesh out your own code.

    Once the project is underway, it's unlikely you will generate any more code automatically--you don't need to.

    It's worth noting that what I've described here is the behavior and usage of code generators that are included as part of Rails. There *are* some cases where people have written code generators that attempt to automatically generate entire subsystems for you in a Rails app--and those generators are the subject of interminable support questions in online forums, and a lot of discussion within the Rails community as to their wisdom. . . which is why no generators like that are included as part of the Rails distribution.

    Beyond code generation, I can't say anything definitive about Rails maintainability because it's so new, but my feeling from having worked with my own code, and from having studied the code of others, is that Rails apps should be wonderfully maintainable. After all, the "opinionated" style of Rails leads all Rails apps to be laid out the same way, with the same directory structure, the same application architecture, coding standards, naming standards, etc.

    From my experience so far, all these things are likely to make Rails a winner from a maintainability standpoint, as well as in terms of productivity and fun!

  23. Is Ruby on Rails Maintainable? by nfstern · · Score: 1

    In short, yes. I have been working with Ruby on Rails since the beginning of November. I found it to be fast, easy to learn & Maintainable. I am working on an application at work where I have had to make several modifications due to changing requirements. In each case, it was very easy to figure out where in the ROR framework to make the changes and apply them. The results (due to Ruby) were instantaneous and the Users loved the rapid turnaround time. My experience w/Ruby has made me a convert.

  24. Nobody even uses the scaffolding anymore by bloodroot · · Score: 3, Funny

    Unless they're making a promotional movie on writing a slashdot replacement in 5 minutes

  25. Here's an AJAX example - how good is RoR for this? by Hugo+Graffiti · · Score: 1
    I've been wondering whether to plunge into RoR for a simple AJAX app I'm planning, but all the talk about automatic code generation and mySQL worries me a bit. For an example of the kind of AJAX interaction my app will perform, imagine a remote file directory browser that does the usual kind of explorer things: you click on a directory and it expands to show what's below etc. The files and directories are on the server of course. The expanding/collapsing of the tree is all done in Javascript by manipulating (eg) nested lists.

    Is that fairly easy to do in RoR or is that not how RoR is meant to be used?

  26. Eh kindof by oGMo · · Score: 1, Interesting

    Rails is OK. It's a great way to get into the language and attract users, and for that I appreciate its existance.

    That said, as a fairly long-time user of Ruby myself, I wouldn't use it. Many of the features it provides are more academic proof-of-concept implementations than well-tested, well-polished ones. It requires you to do a lot of things manually that could easily be done automatically, and you still write bits of SQL in your code. Also, more importantly, it doesn't provide an application layer that entirely abstracts the functionality from the interface. This is bad for any number of reasons. Finally, it's pretty much tied to MySQL, so if you use PgSQL or Oracle (and you should), then you're in for a big headache.

    That said, if you're interested in Ruby and/or Ruby on Rails looks cool to you, check it out and play around with it. It's also not the only thing that ruby provides to develop applications, even web applications. If you're developing a more serious app, you may look at stuff like PageTemplate for the frontend, ObjectGraph for your ORM, and soap4r for services.

    So regardless of your stance on Rails, check out Ruby... there's a lot of cool stuff.

    --

    Don't think of it as a flame---it's more like an argument that does 3d6 fire damage

    1. Re:Eh kindof by brian_olsen · · Score: 3, Informative

      "It requires you to do a lot of things manually that could easily be done automatically, and you still write bits of SQL in your code."

      Which type of things can be done automatically, you see? Also, what is so bad about writing SQL queries *for complex queries*? I know in my case, I will not be hopping from database system to database system to worry about SQL compatibility issues.

      "Also, more importantly, it doesn't provide an application layer that entirely abstracts the functionality from the interface. This is bad for any number of reasons."

      You mean its use of ERb?

      "Finally, it's pretty much tied to MySQL, so if you use PgSQL or Oracle (and you should), then you're in for a big headache."

      I have no problem using it with PostgreSQL.

    2. Re:Eh kindof by znu · · Score: 4, Informative

      I've been using Rails for about 7 months, and have done two major projects in it. I completely disagree with your assessment. For starters, it's not at all tied to MySQL. PgSQL support is also very good. My understanding is that Oracle support is not so great at the moment. But I expect that will change. My real point here is that Rails is not inherently tied to any specific database; it's just a matter of what ActiveRecord adaptors happen to be out there right now.

      As far as requiring the user to write SQL code, yes, you do have to write fragments of SQL code, sometimes. But SQL is a useful way to describe queries -- that's the whole point. Would using some other query language, that got translated to SQL, be any better? I don't see why it would.

      Your comment about Rails not abstracting functionality from interface seems off base as well. Rails adopts a standard MVC architecture, which is pretty much the standard method for abstracting functionality from interface. If you're not getting such abstraction in your Rails apps, you probably just need to think about exactly what should go in the models, what should go in the controllers, and what should go in the views, and rearrange things a bit. Like any other MVC environment, Rails can't prevent you from e.g. putting view-specific code in your model. All it can do is provide a structure that allows you to properly separate these things if you take the time to think about your design properly.

      Finally, on the charge that Rails only provides proof-of-concept features, I think you've misunderstood one of the major design principles of Rails. Rails is intended to provide a framework to build on, not a bunch of components you can plug together to get a web app without writing any code. As such, many of its components focus on the core functionality that's really useful, to the exclusion of other stuff. That other stuff might sometimes be nice to have, but it frequently locks you into doing things the way the framework does them, instead of the way that's most appropriate to your app. The Rails approach is a very refreshing change, for me anyway, and I hope the project will continue to maintain this focus.

      --
      This space unintentionally left unblank.
    3. Re:Eh kindof by Anonymous Coward · · Score: 1, Informative

      Rails isn't tied to any database. For example, I use a sqlite3 for development. For production, I then move to postgresql (read below about keeping data). You can even create an "in-memory" database if you want to prototype something really simple.

      Here is a short prototype:
      require 'rubygems'
      require 'active_record'

      ActiveRecord::Base.establish_co nnection(
        :adapter => "sqlite3",
        :dbfile  => ":memory:"
      )

      ActiveRecord::Schema.define do
        create_table :users do |t|
          t.column :name, :string
        end

        create_table :posts
          t.column :post_id, :integer
          t.column :title, :string
          t.column :body, :text
        end
      end

      class User < ActiveRecord::Base
        has_many :posts
      end

      class Post < ActiveRecord::base
        belongs_to :user
      end

      me = user.create :name => "me"
      me.create_in_posts :title => "Blah", :text => "look at all the text I am writing!"

      Isn't that neat? I defined my schema in Ruby. Rails will translate this code into SQL statements for any SQL server it supports. Rails also has this neat thing called migrations. You can mess around with your schema, and not effect the data that is already in there. You can even pick up your data and move it to a different SQL database (sqlite3 -> postgresql)

    4. Re:Eh kindof by draed · · Score: 1

      Have you even used rails? It's just as easy to use Postgres or sqlite then it is to use MySQL.

    5. Re:Eh kindof by MrByte420 · · Score: 1

      Actually, Rails works fine with Postgres, using it here all the time...

      --
      If religous zealots don't believe in Evolution, then why are they so worried about bird flu?
    6. Re:Eh kindof by zardo · · Score: 1
      I'm sure the Criteria objects came up when ActiveRecord was being developed. The big Java ORM frameworks, hibernate and torque, both use the Criteria objects and I find them to be cumbersome. Sure it may be "pure" but that is one thing I like about rails is that it doesn't sacrifice usability for philosophical concerns.

      Your example of Criteria as good automation is a poor one, and back to the comment I previously made, if you were to start a Criteria class library to solve a supposed problem with your application design, you find the Criteria objects become a maintenance boondogle, while it is already all programmed into the database you have to RE-program it into ruby each time you need to do something new, and for little gain, if any. Your code is essentially the same but without quotes, and it doesn't make sense to use inheritance which would be one of the few advantages of your solution. If you have a certain query class, and you subclass it, how would you modify the criteria it represents? It's all represented in some cryptic internal form. You would be better off working with raw text.

      Another case of automation that should be avoided is the user/rbac automation, the subject has come up, I present it as a good example of why automation can be bad if taken to extremes. The user model may have to be changed significantly, and designing a whole slew of code around one specific implementation of it is bound to cause more problems than it solves.

      If you're using your Criterian objects as an example of automation that should be there, I think you haven't seen the problems that arise from too much automation. Although I admit, your solution is more elegant than others that, for example, use a class constant to represent the greater-than symbol. One objection I have to yours is that it is hard to differentiate between the database and your code, and unless your goal is totally transparent persistance, then it complicates things. There is a library called DyBase which does pretty good object persistance you may be interested in.

      The fact you have HTML in a separate file from the code is not sufficient for full separation. You should be able to entirely drop the web interface and instead write, say, a GTK or commandline app, without changing any of the backend code.

      This is a philosophical argument, in practice MVC works well for GUI apps, where the application architecture is all the same, but for a stateless web application you must code everything differently. I'm not going to go into great detail on this, but MVC was originally used in GUI applications with no intention of dropping in a web browser layer. Try writing a web browser layer to interface with GTK treeview and see how useful it is. It may actually make sense if your application is structure with a lot of AJAX components, which is a breakthrough I've just recently started to utilize (web applications that act like GUI apps).

      Then you have not seriously used it with other databases. I recommend you hop on #ruby-lang on irc.freenode.net (I'm there as oGMo as well), and ask around for people's experience with Rails and other databases.

      I use pg and it works fine. I don't use Oracle but I wouldn't be surprised, most Rails users are probably more interested in an open source database, that may change.

      Uh, you have metrics for this where? All of the above modules are much older and more developed than Rails. Rails is the new kid on the block, and it's still got a lot of growing up to do.

      Time doesn't mean it's more thoroughly tested. It's the size and strength of the community. It's obvious the ruby community is growing by leaps and bounds because of the number of people interested in rails.

      Notice I removed the idiot label. I apologize for thinking you're an idiot.

    7. Re:Eh kindof by Decaff · · Score: 1

      Would using some other query language, that got translated to SQL, be any better? I don't see why it would.

      The reason is portability - you can plug in translations for different databases, and a good translator will translate your query into highly optimised SQL for that database. This both protects your code from any future database migration, and allows the potential users of your code to have a choice of which database they deploy on.

  27. Author has it all wrong by wackysootroom · · Score: 2, Informative

    Judging by how this article was written you haven't used rails at all, or maybe used it for something extremely trivial. The "automatic code generation" (scaffolding) is only there to help you get started on a project. You can completely bypass it if you want.

    I'd be willing to bet that if you used rails for an hour or two, you wouldn't have written this article. In fact, the entire article depends on your assumption that the code *has* to be generated automatically.

    So what are you waiting for? Try it and see!

  28. Java and Tapestry? by flyboy974 · · Score: 1

    Tapestry is also doing a lot of code generation in Java. You simply write your classes as abstract, create abstract bean members (getters/setters), or other annotated values, and it'll generate the underlying code.

    This is great for rapid prototyping and getting your application to a usable point. Then, as you need to, just implement the members as needed. Many times you won't need to set things, because you'll be reading from an underlying object and then doing set's on all the properties, and doing get's to set the underlying object during a save.

    It takes some getting use to. The jury is still out for me too.h

  29. Perhaps by discoMingus · · Score: 1

    It depends what you mean by maintainable. Is it maintainable by the lone cowboy coder (or small group) who writes their own apps? Sure! When you talk about maintainability in a large production environment it's a little different. I've run into issues at work where the Rails apps I've written are hard to maintain because the people who run our server farms aren't familar with the technology and how to support it. (They don't like that I'm running Apache!) So, maintainability in that sense, I'd say RoR is not quite there (but it's getting there real fast).
    As for the "automatic code generation" it's not quite that, it's all done behind the scenes (and scaffolding is only part of it). I see how the "alarm bells" can go off because seeing the actual 'code' generated makes a programmer feel all warm and fuzzy inside but really, it's not that big a deal.

    1. Re:Perhaps by jgerman · · Score: 1
      "I've written are hard to maintain because the people who run our server farms aren't familar with the technology and how to support it. (They don't like that I'm running Apache!) So, maintainability in that sense, I'd say RoR is not quite there (but it's getting there real fast)."


      Wow, it's a fault of the technology that the people who run your server farms aren't well trained for the job they're being asked to do? Nice logic there.

      --
      I'm the big fish in the big pond bitch.
    2. Re:Perhaps by discoMingus · · Score: 1

      I didn't say it was a fault of the technology, chill out. All I'm saying is that not enough people know about it yet and are comfortable with it make it as maintainable as a J2EE or .Net app. I can't just hand my app over to someone who maintains our servers and say "here, now support and maintain it." RoR is still too new.

    3. Re:Perhaps by aminorex · · Score: 1

      It is perfectly suitable logic for operating a system. It would be nice to have only good hackers on staff, so that trivialities such as choice of language are down in the noise, but if it may well become critical to the mission of your organization that person X perform maintenance on system Y, and person X does not and will not be able to deal with code in language Z at time T, then you shouldn't write system Y in language Z, or you will be SOL and run around crying "OMGWTFBBQ!"

      --
      -I like my women like I like my tea: green-
  30. Re:Here's an AJAX example - how good is RoR for th by zardo · · Score: 2, Informative
    I've been using rails for over a year, I think that would be really easy and a testament to how great a language ruby is, in addition to how great a framework rails is. The filesystem classes you will be amazed with, and you don't even have to know javascript to get some pretty amazing AJAX functionality out of your app.

    I honestly couldn't think of a better way to do something like that than with Rails.

  31. You're right .... by GavrocheLeGnou · · Score: 1

    i think you're touching a sensible subject.
    with autogeneration can you really maintain your applications and more important, what happens with future versions of RubyOnRails ?

    Will thoose autogenerated scripts still be usable ?

    Does the ROR developpers have to write migration scripts for your scripts everytime ?

    With plateforms like Zope, as soon as structure is not changed the scripts are much more reliables.

    ----
    Gavroche Le Gnou
    Flash Xml Multi-User Socket Server

  32. TurboGears by ultrabot · · Score: 2, Interesting

    In the meantime, if you want rails-like development but with Python check out TurboGears.

    It's been raising quite a storm lately, and for a good reason!

    --
    Save your wrists today - switch to Dvorak
    1. Re:TurboGears by Anonymous Coward · · Score: 0

      Is it better than Disraeli Gears?

    2. Re:TurboGears by mbyte · · Score: 1

      Anyone did try out Trails yet? They say its like RoR in Java, without the generated code ...

  33. Template System for RoR by DigitalRaptor · · Score: 1

    I'm interested to hear what the Slashdot community thinks is the best templating system for Ruby on Rails.

    I'm a PHP / Smarty developer and have really liked it.

    I know there are some great templating systems out there, like Canny (very closely based on Smarty but not made for Rails).

    Ideally I'm looking for something that works seamlessly with Rails and is close to Smarty in concept and functionality. Canny for Rails would be perfect. (Or has someone found a way to use Canny with Rails?)

    --
    Lose Weight and Feel Great with Isagenix
    1. Re:Template System for RoR by Diomedes01 · · Score: 1

      Have you looked at Liquid?

      --
      "To hope's end I rode and to heart's breaking: Now for wrath, now for ruin and a red nightfall!"
    2. Re:Template System for RoR by DigitalRaptor · · Score: 1

      Yes, and I need to look at it more. The documentation was sparse (at least when compared to Smarty, which I'm used to and has excellent documentation), so I wasn't able to rule Liquid out, or decide I liked it enough to install it and learn it.

      I'm still trying to wrap my head around Ruby and Rails, and was investigating templating engines to try and decide whether it was worth the time to continue learning Ruby and Rails. I've been doing PHP and Smarty so long that I'm very used to them, so changing isn't trivial.

      I've pretty well decided that RoR is worth pursuing, as is Liquid. But before diving in wanted to see if there were some templating systems I'd missed.

      --
      Lose Weight and Feel Great with Isagenix
    3. Re:Template System for RoR by infojunkie · · Score: 1

      I came to RoR with the same questions, having used Smarty for everything I did in the past. It took a couple of online tutorials before I came to the conclusion that Smarty-like templating isn't really necessary, or even helpful, with RoR.

      I realized that the views themselves are the templates, and that I could get the same Smarty functionality, without having to learn new syntax, because you can use Ruby as the templating language as well. If I'm not mistaken there's a templating system for PHP (fasttemplate rings a bell) that does the same thing.

      It's not too difficult to adapt to, unless you're a little slow like me... :)

      Take a look at http://www.onlamp.com/pub/a/onlamp/2005/01/20/rail s.html and http://rails.homelinux.org/

      I've also really enjoyed http://poignantguide.net/ruby/

    4. Re:Template System for RoR by Hutchizon · · Score: 1

      Be sure to check out Amrita2 at http://amrita2.rubyforge.org/>. To quote their page: "Amrita2 is a a xml/xhtml template library for Ruby. It makes html documents from a template and a model data." I like the very clean separation of code from the HTML. You can prototype view the HTML, and you're not sticking bits of logic that will baffle your designers.

  34. Re:Eh kindof -- Idiot by zardo · · Score: 1

    Forgive me but I've been using rails for over a year and it would seem the parent is posting FUD. You'll have to explain yourself in more detail.

    Many of the features it provides are more academic proof-of-concept implementations than well-tested, well-polished ones

    Which features are you talking about?

    It requires you to do a lot of things manually that could easily be done automatically

    Give an example. This should be pretty easy, but I've found I'll often try and automate something and down the road it turns out to be more maintenance than if I were to have just hacked it out.

    ...and you still write bits of SQL in your code

    I have a pretty large ecommerce app and the only raw SQL I have to write are where conditions, which arguably could have been written out in Ruby but that would probably be more work and no gain.

    Also, more importantly, it doesn't provide an application layer that entirely abstracts the functionality from the interface.

    I'm not sure I know what you are talking about, because my interface is for the most part completely separate from my processing. Interface goes in my views and the processing happens in my controller. Explain this please.

    Finally, it's pretty much tied to MySQL, so if you use PgSQL or Oracle (and you should), then you're in for a big headache.

    Pretty much tied to MySQL? It comes with connection adapters for both MySQL and PgSQL, and it works fine with both of them. This aught to be a pretty good reason not to trust anything you have said. You have no idea what you're talking about. It doesn't make use of any MySQL-specific features like enums, everything is abstracted down to basic SQL.

    If you're developing a more serious app, you may look at stuff like PageTemplate for the frontend, ObjectGraph for your ORM, and soap4r for services.

    There hasn't been nearly as much testing and development going on with those projects. I don't know how you could say they are for "more serious apps". You would probably spend at least twice as much time developing an application with one of those.

  35. Before worrying about a maintenance nightmare... by Anonymous Coward · · Score: 0

    you should first look at the functionality nightmare that exists. Ever try selecting a table twice in an sql query (aka joining it to itself)? It can't be done. Try a different language, something that isn't a maintenance nightmare and isn't a functionality nightmare. Try python.

  36. Maintainability of Code Generation by bokmann · · Score: 1

    The author's concern could be expressed about the maintainability of generated code, whether in Ruby or Otherwise.

    To talk about this intelligently, lets split it into 2 kinds of generation: the 'one-off' code generation that occurs once, in order to get something up and running, which is then maintained on its own, and the 'generate every time you build' mentality of things like XDoclet (to mention one of many). Both have their pros and cons.

    With one-off code generation, (which is what Rails is), you generate the code that gets the 'skeleton', but from there, it is something you have to maintain yourself. You have to understand what you are generating and maintaining... you might as well think about it as starting our having to maintain someone else's code (which really, it is). As long as you understand the generated code, this is not a problem. one-off code generation is simply a convenience for getting started, it is not a replacement for knowledge.

    With build-time code generation, you are ideally automating something that you would have to understand in order to keep up with changes elsewhere in the system. While it might be automating away some drugery, often times you also end up automating away 'layers' that you don't want or need to understand. This is where the maintenance nightmares of generated code come in - you have to hook into stuff you don't understand, often by inserting code in between comments that say something like: //** your code to be put here //** end of your code

    When this is done well, it leads to the dream scenario of getting 'something for nothing' where it is not done well, you create a 'culture of ignorance' that simply guarantees you won't know how to solve the problems you inevitably end up creating.

    In my humble conclusion, rails-generated code is VERY maintainable, but you are not off the hook for understanding what has been generated.

  37. Re:Eh kindof -- Idiot by zardo · · Score: 1

    Typo: It comes with connection adapters for both PgSQL and Oracle, in addition to MySQL, and a few other databases.

  38. I use Ruby on Rails and Java by MarkWatson · · Score: 1

    Wow - what a bogus premise: off course Rails based web applications are maintanable. I consider maintenance and modification costs to scale fairly linearly with code size and Rails applications are concise.

    After heavy experimenting with Common Lisp, Python, and Smalltalk based frameworks I have decided to base my consulting business on just Ruby on Rails and a subset of the Java J2EE stack. I am a little prejudiced on language choice since I have written 5 Java books and I am working right now on a Ruby book for Manning; and on Monday I spent a half day creating the RubyPlanet.net news site. Still, I enjoy Lisp, Python, and Smalltalk and gave web frameworks written in those languages a good evaluation.

  39. Ruby sin Rails by Anonymous Coward · · Score: 1

    I just use a Ruby dispatcher that doesn't require rails, it just loads Ruby apps like php-cgi.

  40. Java Interfaces by bunglebungle · · Score: 2, Informative

    Java interfaces allow you to declare that something is a Duck, so it must be a duck. However, with Java, I can ensure that anything I think I want to call a duck does indeed fulfill the contract of being a duck. What in Ruby forces you to properly export the collection of methods in Enumerable when you defined is_enumerable to return true? Nothing?

    In Ruby, you can write code that assumes a parameter has a method called foo. In the future if I make a new object, I can add a foo method to it and pass it into that code. In Java, all it takes is the oh-so-hard task of creating an interface called, say, CanFoo, that declares a foo method, and typing my parameter to that. For anything I want to pass into that code, I just implement method foo, which I have to do anyway, and add CanFoo to my list of implemented interfaces. Classes don't have to inherit from any particular class, and they can implement as many interfaces as they want. So that was no more work. However, now the compiler helps me to ensure that I properly fulfill the contract of CanFoo. Plus if I want to do anything useful like find things that think they CanFoo, or rename foo to something else, the compiler will know where all of these references are and help me.

    I'm not anti-Ruby, but I just plain don't understand arguments like this for the language.

    Also, "say it only once" may be somewhat forced by the framework, which is a good principle of a framework, but that transcends languages, so I don't buy that, either.

    I'm not arguing that Rails isn't maintainable, just that your reasoning for why it is aren't exclusive to Rails or Ruby.

    1. Re:Java Interfaces by Bruce+Perens · · Score: 1
      DBC is useful and would be a good feature to add to Ruby. But even DBC doesn't guarantee that anyone implements a method correctly, only that they return the right type. As I've noted elsewhere, some degree of static checking of Ruby is theoretically possible, and a compiler is in development.

      Bruce

    2. Re:Java Interfaces by Tamerlin · · Score: 2, Interesting

      "Java interfaces allow you to declare that something is a Duck, so it must be a duck. However, with Java, I can ensure that anything I think I want to call a duck does indeed fulfill the contract of being a duck. "

      How? If I have an interface with a method "quack" that is supposed to print a message from a string you pass it, and I write a class implementing it that calculates the factorial of 1,023,342 instead, you can call it, and it will compile and even run, but still violate the contract of being a duck.

    3. Re:Java Interfaces by bunglebungle · · Score: 1

      I don't really view interfaces as design-by-contract. I think your comment about implementing a method correctly or not is besides the point, as implementing something incorrectly can be done in any language. As it relates to maintainability, the topic of this thread, I argue that Java and interfaces are superior. What if you wanted to add a method to your contract of Enumerable? How, in Ruby, do you go and find every object that used to think it was Enumerable, but now isn't? If you say that a static checking compiler is in the works, then it seems that duck typing really isn't as advantageous as previously asserted. Ruby may be more maintainable if you originally wrote the code, but if you are taking over maintenance of someone else's code, then I think static typing really helps. I'm willing to put in a little more work up front so I can let Eclipse do a whole lot of work for me later.

    4. Re:Java Interfaces by Dalroth · · Score: 2, Interesting

      Java interfaces allow you to declare that something is a Duck, so it must be a duck. However, with Java, I can ensure that anything I think I want to call a duck does indeed fulfill the contract of being a duck. What in Ruby forces you to properly export the collection of methods in Enumerable when you defined is_enumerable to return true? Nothing?

      I call BS. Just because a Java class implements an interface, does not mean it implements what is expected of the interface. If your compare method returns a -1 when it should return a +1, you aren't a duck, you're a retarded duck and Java let's you do that just like Ruby.

      Bryan

    5. Re:Java Interfaces by bunglebungle · · Score: 1

      Yeah, so, you can do that in Ruby, too. In both cases you don't have a duck. The comment is in regards to maintainability. Neither language prevents you from coding like a moron. However, down the road, let's say you want to change something related to "quack" or being-a-duck. How do you find references in Ruby? Search all text files for a string? With static typing (Java), the compiler knows if changing something affects other code or what code is referenced where. Say you want ducks to be able to "shitOnGround". With Ruby you have to go find all the classes that think they are ducks to make sure they can shitOnGround now. If you add shitOnGround to the duck interface, the compiler will tell you about all the things that no longer properly implement Duck, insofar as method signatures are concerned. Sure, neither language ensures the method implementation isn't bogus, but if someone could find the solution to that then we wouldn't have jobs. But there's a difference between assuming things passed to a method have both quack and shitOnGround methods, and getting a runtime error if they don't, versus knowing at compile-time whether or not that code will run. Which do you think will be noticed more often and earlier?

    6. Re:Java Interfaces by Bruce+Perens · · Score: 1
      A compiler is in the works. I don't know what checking Matz plans, but it would not impose new type rules upon Ruby. I am only observing that certain forms of type checking are theoretically possible in Ruby by propogating information from a called function to its caller.

      Don't take this as an objection to type-checking, I agree that it can be useful.

      So, say I do want to add a new method to Enumerable. I add it to one object, and I make use of it in one place. And the system doesn't complain, and I can add that feature gradually to the rest of my program. With tighter checking, I would have to add the new method to all of the other objects that use Enumerable at the same time. In general Ruby facilitates an incremental style of programming. But I used to program C++ incrementally too. So, when I changed the interface of a virtual base class, I defined the method in the base class to print a message and bomb out the program. I bet a lot of other programmers did that too. The incremental paradigm was more important to us than the type-checking. Maybe Ruby just fits us better.

      In reality, a new method to Enumerate would probably be defined in terms of the other existing methods and would have a default implementation in the base module.

      Bruce

    7. Re:Java Interfaces by bunglebungle · · Score: 1

      See my reply to Tamerlin. You're both barking up the wrong tree. Clearly there is no magic language that lets you ensure code does exactly what it says it will. The contract is that you will have certain methods with certain parameter and return types - interface contracts, not design-by-contract or something even more encompassing, which you seem to be describing. Reading any more into it by saying the contract also states that you will have correct implementation is silly. Any language can have bugs, idiot programmers that don't know what they are doing, or malicious hackers. Nothing will prevent that, which is so obvious I'm somewhat surprised you both took my statement the way you did.

      Ruby: code takes an object you expect to have a method name quack. Call the code with an object with no quack method, runtime failure.

      Java: code takes a Duck. Compiler won't let you call it without that object having a quack method.

      Which gets noticed first? Which way would you rather have when you are maintaining the code 6 months from now and have forgotten everything? Maintenance is the topic of the thread.

    8. Re:Java Interfaces by Tamerlin · · Score: 1

      "Yeah, so, you can do that in Ruby, too. In both cases you don't have a duck." Agreed. That was the point: interfaces and static typing can't prevent another programmer's stupidity from screwing up YOUR code, which usually means that in your standard-issue chaotic hackshop, your coworkers will screw something up for you sooner or later, and no language can prevent that. "How do you find references in Ruby? Search all text files for a string? With static typing (Java), the compiler knows if changing something affects other code or what code is referenced where." That is something I also agree with, even though I love coding in Ruby. It's caused me no end of trouble tracing Python code, though that can for the most part be attributed to the fact that the people writing said Python code did a miserable job of it, which is another thing that no programming language can't prevent.

    9. Re:Java Interfaces by moonbender · · Score: 1

      Of course, what you describe would not be possible in Java. Interface are pure virtual, they may not contain any code at all, just function definitions. Including default implementations would make it an abstract class - but since Java does not support multiple inheritance, a given class can only extend a single abstract, while it can implement any number of interfaces.

      (Not meant to rag on Java - I love the whole strong typing object orientation and understand the design choices against multiple inheritance.)

      --
      Switch back to Slashdot's D1 system.
    10. Re:Java Interfaces by bunglebungle · · Score: 1

      I see the point of the incremental programming, which I think can be good short term, but there's problems with it. If you never get around to changing all the other places, then you've left timebombs in your code that could fail, depending on the nature of the change. Also, you say that often a base class would have a default implementation or something, but one of the arguments in your original post was that you aren't forced into extending a specific class. I think those ideas are a bit at odds.

      As far as maintenance is concerned, if you are changing Enumerable, then you probably have a good reason, and there may be lots of code using it assuming certain things, and if you want to change it you may need to look at all those things to evaluate those impacts as well as your reasons for making the change to start with. You may decide that change isn't worth it, or maybe you really have a separate interface to create, since maybe it really is separate from Enumerable, or maybe you need a sub-interface of Enumerable, because some but not all things have this new feature. These are the sort of things that, while perhaps Ruby makes it easier, it is not necessarily a good idea, from a maintenance perspective, for these things to be easy.

      I'm not trying to knock Ruby, and I really like some of the other features Ruby has to offer. And everyone's brain works differently. But this duck-typing argument shows up so much it's a personal beef of mine. (It has merit but not as much as I see it getting everywhere, I think.)

    11. Re:Java Interfaces by JamesOfTheDesert · · Score: 1
      Which gets noticed first? Which way would you rather have when you are maintaining the code 6 months from now and have forgotten everything? Maintenance is the topic of the thread.

      I'd suggest that, as no language can offer assurance that other developers haven't written moron code, you should have unit tests in place to mkae sure that not only does you code compile and run, but does what you intended.

      The unit tests will also go a long way in helping explain what code is supposed to be doing, in the odd chance that developers have neglected to write good, clear comments (very unlikely, I know, but has been know to happen.) And that is key to maintainable code.

      --

      Java is the blue pill
      Choose the red pill
    12. Re:Java Interfaces by bunglebungle · · Score: 1

      I think everyone is missing my point. Clearly stupid people can write whatever they want. Obviously unit tests help in this regard, but still don't prevent it. My original point is that, contrary to what Bruce said, duck typing does not help maintainability. You and several others keep harping on this point of moronic implementation, which has nothing to do with my original point. In no way am I saying that just because Java has interfaces can you assume that implementation will be correct or you can change things and it will still work. That's just so idiotic I didn't even think anyone would take my comments that way. Strong, static typing makes it easier to figure out how some (not all) changes will affect other code in a way that Ruby's dynamic typing does not allow. That includes unit test code. This helps a person maintain and change code more easily, especially if the person has not worked on the code before.

    13. Re:Java Interfaces by JamesOfTheDesert · · Score: 1
      Strong, static typing makes it easier to figure out how some (not all) changes will affect other code in a way that Ruby's dynamic typing does not allow. That includes unit test code. This helps a person maintain and change code more easily, especially if the person has not worked on the code before.

      On the contrary. Static typing (both Ruby and Java have strong typing) makes it harder to change code, because you are constantly bumping into interface incompatibilities when you simply try to add or modify signatures and object behavior.

      If I change a method signature to take String instead of an Integer, Java will bark at me, but it will not tell me if that problem is meaningful. I have to alter all the related code to accept the new data type, and then run my tests to ensure that the behavior is correct, not simply that the compiler gods have been pleased. And that's something people should be doing anyway, and that is what will really tell you what changes matter.

      The larger point is that, if you are using unit and functional testing to ensure that code does more than compile without exceptions, then the added benefits of static typing are outweighed by the inconvenience they add in day-to-day coding and refactoring.

      Unit tests and comments do far more to improve maintainability than static typing.

      --

      Java is the blue pill
      Choose the red pill
    14. Re:Java Interfaces by heinousjay · · Score: 1

      Did you ever try to convince a Mac user that their platform wasn't perfect for everyone? Because that's basically what you're doing here. There's no talking to zealots, you know.

      If it helps, I got your point from the first.

      --
      Slashdot - where whining about luck is the new way to make the world you want.
    15. Re:Java Interfaces by Anonymous Coward · · Score: 0

      Obviously, if said moron can write the code that breaks in compile/run time, said moron can write the unit tests that do not do the proper testing or reflect the correct runtime requirements as well as the wrong documentation. Sure, in either case both ruby and java falls flat, but if the parameters and return types are checked at compile time, and throws an error saying you should be returning a duck and not a chicken object, said moron would at least think about his/her code again. Then again maybe not, but at least it is does add another filter to prevent runtime problems, especially if the runtime problems doesn't croak but instead causes data corruption that doesn't get notice until many months into production. Then it'll be a bloody maintenance nightmare.

    16. Re:Java Interfaces by Anonymous Coward · · Score: 0
      Static typing (both Ruby and Java have strong typing) makes it harder to change code, because you are constantly bumping into interface incompatibilities when you simply try to add or modify signatures and object behavior.

      Which makes it harder to do it wrong, but no harder to get it right. You can't seriously see that as a drawback?

      the added benefits of static typing are outweighed by the inconvenience they add in day-to-day coding and refactoring.

      What inconvenience is that? Static typing has only ever added convenience for me, particularly in refactoring, where it provides a nice formal language for reasoning about program transformation.

      Unit tests and comments do far more to improve maintainability than static typing.

      Of course, but static typing is a great way of automating some of your testing and commenting - removing potential sources of error, and giving you more time to concentrate on the trickier parts.

    17. Re:Java Interfaces by Anonymous Coward · · Score: 0

      This is such a ridiculous argument. You're missing the real point of the contractual obligation. It isn't to enforce what you seem to think it is.

    18. Re:Java Interfaces by ibbey · · Score: 1

      You're partly correct. Both sides in the debate are absolutely convinced they're right, so it's an unwinnable debate. But what everyone seems to miss in these debates sometimes is that both sides are correct. Bungle is right that for him, Java is more maintainable. It fits his programming style better. The Ruby proponents are right that Ruby is more maintainable for them for the same reason. Can we all just agree that their can be more then one best language-- that different people in different situations will sometimes choose different tools-- and that that's a good thing?

    19. Re:Java Interfaces by heinousjay · · Score: 1

      Can we all just agree that their can be more then one best language-- that different people in different situations will sometimes choose different tools-- and that that's a good thing?

      Shh... don't give away the secret. Those of us who understand that will always be ahead of the rest. Let them figure it out on theiw own, or suffer follishly.

      --
      Slashdot - where whining about luck is the new way to make the world you want.
    20. Re:Java Interfaces by heinousjay · · Score: 1

      I must be drunk. Sorry for the spelling.

      --
      Slashdot - where whining about luck is the new way to make the world you want.
  41. Re:Before worrying about a maintenance nightmare.. by eluusive · · Score: 1

    That's not true, self joins are very common and usefull.

  42. How about a little research first by blunte · · Score: 1

    Before posting a question like this, how about researching RoR just a little.

    RoR generates complete, readable code for you when you ask it to (the scaffold), but once you've done that, you're typically going to go modify that yourself. It's relatively simple, logical code. And it's a one time deal. You will typically intentionally go modify that scaffold code, unless you're doing something really simple.

    Besides, if you wanted to know how maintainable RoR code was, you could have followed any of the many tutorials to see how they make changes after having "generated" code.

    --
    .sigs are for post^Hers.
  43. Don't Repeat Yourself (DRY) by Baldrson · · Score: 1
    The idea of the Rails specification (and any program generator including compilers) is to express yourself at a higher level so as to avoid redundancy by closing the gap between program specification and code. Avoiding redundancy is otherwise known as succinctness, factoring and even compression.

    While working with the corporate software process group at SAIC (I was managing the automated ordnance inspection software department at the time) it became apparent to me that most of the software process is reducable to a human-mediated build/compilation process where the "source" language is the formalism used for specification. Since the highest level language for specification is predication (largely of pre and post conditions of the system's operations) it became apparent that predicate calculus tools -- not necessarily direct execution thereof -- could be very important for automating large portions of the software process.

    Since Rails isn't high enough level, its specification language is inadequate and the resulting code generated must be edited directly. But it is a step in the right direction.

    1. Re:Don't Repeat Yourself (DRY) by CableModemSniper · · Score: 1

      Apparently you want it to be Prolog on Rails?

      --
      Why not fork?
    2. Re:Don't Repeat Yourself (DRY) by Baldrson · · Score: 1
      Prolog has the wrong semantics for a specification language due to the way unification screws up for recursion, among other things. It was a hack for the PDP-10 over 20 years ago and shouldn't be confused with a serious attempt at predicate-oriented programming.

      XSB is closer but for a more serious treatment of the predicate-oriented approach see my prior /. comments regarding subsuming exception handling and "OO" programming within a predicate formalism.

      Ultimately you want to dispense with the SQL database altogether and leverage the fact that predication is relational so you eliminate an entire layer of semantic noise.

  44. If you think Ruby on Rails is scary... by NardofDoom · · Score: 2, Funny

    You've obviously never worked with ASP.NET.

    --
    You have two hands and one brain, so always code twice as much as you think!
    1. Re:If you think Ruby on Rails is scary... by Anonymous Coward · · Score: 0

      Mod parent up

      -1 flamebait
      +5 insightfull
      --------------
      +1 karma bonus

  45. You obviously haven't used Rails beyond the 'demo' by Anonymous Coward · · Score: 0

    The code generated by Ruby on Rails is intended just to get you started. It also happens to be a completely optional step. You can choose not to use generated code. In my experience so far, the generated code is not adequate for writing real applications, but serves more as a pointer on best practices to use for dividing the work to be done between the model, view and controller.

    I didn't like the scaffolding code that was generated and went off to change it, basically, removing a whole generated view/controller, and merging it into another view/controller. After I did that, it seemed to have too much duplicated functionality, and I had a choice between making methods that take classes as additional arguments, and splitting the functionality into similar but separate files. I chose the latter and after refactoring, guess what? I was back to the beginning, which sort of taught me that the default division of labour is a pretty good one.

    I don't plan on using the generated code to write the rest of the views and controllers in my project. Why? Just looking at the one class for which I generated a scaffold, gives me a good idea on how I can handle the rest of the code. To believe that Ruby on Rails will write your application for you (which is what you seem to think, as you are complaining about maintaining lots of the generated code) is not correct. No computer will write your code for you properly.

    Scaffolding is just to help you get started. You aren't supposed to use it in production. Why don't you also complain that the scripts/console in Rails doesn't print out HTML? After all, because you got a tool to help you look into your domain model, and it shows you what is going on, and let's you type in your own Ruby as well, then why not complain that it doesn't write out the HTML too?

    My point is that the point of scaffolding is not to build your application for you ... so don't complain if you selected the wrong tool for the job. Would you blame dBase for not letting you speak SQL to it?

  46. Repeat after me by Anonymous Coward · · Score: 0

    "Rails is not a code generation tool"

    Have you really use it?

  47. RoR & Maintainability by Whatchamacallit · · Score: 2, Informative

    RoR (Ruby on Rails) is simply a very nice API for doing web apps with Ruby. It will auto-generate some code via what Rails calls Scaffolding. This is meant to get something working extremely quickly and it allows you to enter some data into a table with minimal fuss. The code it generates is quick and dirty and you are supposed to re-write each method as you move forward. That said, it's not a real code generator in the traditional sense. The Wow factor of the videos on rubyonrails.com show off the Scaffolding but that is only a very small part of Rails development.

    Ruby itself is very maintainable because the syntax is so very clean. However, it's up to you to document your code with meaningful comments, check it into CVS or Subversion, and implement your own Unit Tests, and include RDOC tags in your comments, etc. All code regardless of language is maintainable if you eliminate the code monkey bad habits. i.e. if you've been coding in PHP and all your code became unmaintable then it's your own fault and not that of PHP. Ruby in my opinion is better organized then PHP and encourages good code standards but ultimately, it's up to the programmer. If you are a neat freak and are very detail oriented and you tend to go back and cleanup, test your code before you check it into your version control system then your code will always be maintainable.

    I like the way the RoR ActiveRecord mapping system; maps my classes to database tables and objects to my records. You can programatically create records in the table by creating additional objects. The scaffolding will read an existing database table and generate working classes so you can utilize CRUD functionality. You don't have to use scaffolding but it comes in handy for me even when I throw it out one method at a time and re-write it.

  48. Re:Eh kindof -- Idiot by oGMo · · Score: 1

    Criminy, that's a hard post to read. Use blockquote instead of bold! ;-) Anyway:

    Which features are you talking about? Give an example. This should be pretty easy, but I've found I'll often try and automate something and down the road it turns out to be more maintenance than if I were to have just hacked it out.

    Rails requires you do a lot of stuff like do manual updates on objects, write literal SQL strings in your code, and other similar little things that could, with some creative ruby, be done automatically. On the count of SQL, and at the risk of self-promotion, check out Criteria, which lets you write literal Ruby statements that are transformed into SQL, all in a ruby-esque manner.

    For the latter count, it is easy (or at least, not very difficult) to implement a system that does implicit object persistence. I have such a system called mephle, which you can see the latest version of in the SVN repository, but it's not documented well enough for general use, and I wouldn't advertise it as such. However, it shows that such a thing is not only possible, but pretty straightforward.

    Give an example. This should be pretty easy, but I've found I'll often try and automate something and down the road it turns out to be more maintenance than if I were to have just hacked it out.

    This is just poorly-designed automation, then. There is a clear line for where automation should end and where manual usage should begin. Follow these rules:

    If it's something the system can figure out automatically based on specified information, it should be automated. If it's something that's always unique, it should be manual. If the information has been specified once, it should not have to be specified again. If there can be special cases, it should be possible to hook in code to handle them.

    If you have a system that follows the above rules, you will find yourself writing much, much less code and focusing almost entirely on the problem at hand. And it's possible to write such a system, especially in ruby---see above.

    I'm not sure I know what you are talking about, because my interface is for the most part completely separate from my processing. Interface goes in my views and the processing happens in my controller. Explain this please.

    The fact you have HTML in a separate file from the code is not sufficient for full separation. You should be able to entirely drop the web interface and instead write, say, a GTK or commandline app, without changing any of the backend code.

    Pretty much tied to MySQL? It comes with connection adapters for both MySQL and PgSQL, and it works fine with both of them. This aught to be a pretty good reason not to trust anything you have said. You have no idea what you're talking about. It doesn't make use of any MySQL-specific features like enums, everything is abstracted down to basic SQL.

    Then you have not seriously used it with other databases. I recommend you hop on #ruby-lang on irc.freenode.net (I'm there as oGMo as well), and ask around for people's experience with Rails and other databases.

    There hasn't been nearly as much testing and development going on with those projects. I don't know how you could say they are for "more serious apps". You would probably spend at least twice as much time developing an application with one of those.

    Uh, you have metrics for this where? All of the above modules are much older and more developed than Rails. Rails is the new kid on the block, and it's still got a lot of growing up to do.

    --

    Don't think of it as a flame---it's more like an argument that does 3d6 fire damage

  49. RoR HLL maintainance nightmare by recharged95 · · Score: 2, Insightful
    Granted that RoR is a nice alternative from Java or scripting--can RoR generated code be a nightmare to maintain?

    Yes, if poorly written and

    Yes, when applications get very, very complex--which is a given. And they will get very complex, just wait 2 yrs.

    Consider the great development tools of RoR such that you end up with a Microsoft environment/paradigm--great for RAD, not so great for critical systems that need to be up 24/7, 100%.

    I'd still go with XML Schema-based code generation, much more stable as it forces you to thing about state and behavior before you write your first GUI title bar. And since the web is XML-centric, makes sense..

  50. Structure generation vs code generation by Erisynne · · Score: 4, Insightful

    As others have noted, what Rails generates for you are stubs. Even if the stubs are full-featured enough to let you add, edit, view, and delete objects, they're still stubs. It's just that RoR is succinct enough that generating 150 lines of code (including action views and layouts) is all that's necessary to provide all of that functionality in a very basic way.

    But, two links for your consumption.

    My article on the topic of what I call Scaffold Withdrawal
    http://www.slash7.com/articles/2005/12/07/the-fall -from-scaffolding

    Structure generation vs code generation (from the Rails' creator's blog)
    http://www.loudthinking.com/arc/2005_10.html

    It's true that "Ask Slashdot" is vehicle for enlightenment, but I didn't think it was a vehicle for the basest laziness. I don't understand why someone would go Ask Slashdot instead of looking at a couple F/OSS Rails app packages and deciding for himself whether or not they look "maintainable."

    If the submitter did, he'd find that it's clear that maintaining Rails apps is no problem. You don't have to know much about a given app to even do serious "maintenance" on it. As long as the programmer hasn't tried really hard to break all the benefits Rails brings to the table (regular file structure, MVC separation, clean models, helper classes, etc), then you'll already know a lot about how the app is structured before you even unzip it.

    --
    ---- My Design, Code, Ruby on Rails blog: http://www.slash7.com/
    1. Re:Structure generation vs code generation by kale77in · · Score: 1

      +5, Insightful.

      100.times {puts "I will use Google more diligently!"}
  51. Rails is just best practices.. but not perfect.. by Anonymous Coward · · Score: 0

    I consider Rails to be nothing more than a collection of programming "best practices". I try to use many of the same techniques in my own programs. Indeed, I had a home-brew Perl framework that used some of the same techniques that Rails' Action Pack uses and I considered it my "secret weapon" for rapid development (NOT "prototyping".. just fast coding that doesn't waste time). As others point out, Rails is not about the "scaffolding".. the abstractions are deeper and more general than that.

    I've been doing this programming thing a while and I consider it perfectly natural to "write programs that create programs". It's NOT code generation (that's when one program spits out a text file containing another program).. it's just dynamic programming: meta-programming and late binding and lots of run-time decisions. Sure, if you're not experienced, or you're still learning Ruby syntax, you might feel frustrated with an abstract meta-language. You should use the opportunity to learn and dig deeper, in my opinion. So 9-to-5 Java grunts may not enjoy digging deep in Rails, but maybe an old-school Lisp hacker would. Which would you like working at your org, anyway?

    Ruby and Rails are great examples of why all that "metaprogramming stuff" is good to have in a language.. even if you don't personally use them, someone can create something cool with them that you can use.

    So Rails code is very concise and well-factored, which is good.

    BUT.. there is an unfortunate dark side to Rails. The author may be very bright and have great insights in procedural programming, but he simply does not understand data modeling, or it was not taught to him in school, or he chose to ignore it when it was. He thinks the logical model exists only in his code, and advocates a 1960's pre-relational style of application-centric data management. In fact, the Rails theoretical model is nothing more than the old network "model" (navigational queries, universal meaningless object ids, and no high-level declarative abstractions.. the programmer does the work). The Rails community, containing many data management novices eager to avoid having to *think* (this is different than doing less work!), follows right along. Some of the stuff in the Rails mailing lists and blogs is quite silly and flies in the face of data management best practices.

    I would like to see an RDBMS that uses Ruby syntax and Ruby attribute types.. it would be a perfect companion to Rails, and would be easy to use and understand. I really get tired of these object-to-SQL mapping anti-patterns. Until then, anyone starting a Rails (or any other app) would be best served by ignoring any data management advice from the Rails community and learning some basic skills FIRST.. so your apps sit on a firm foundation! Rails, being well-factored, thankfully doesn't get in your way if you choose to do this.

    So to answer the question.. yes, RoR apps are highly maintainable, provided you 1) understand the Ruby language and the Rails codebase, and 2) properly create your logical model *first*. And if RoR turns out to be the wrong choice at your org, a solid foundation will let you build new apps in a different framework without fear of conflicting with your conceptual model. Yes, having to do #1 and #2 means you have to actually spend some time learning before diving in and developing that critical multi-million dollar e-commerce site.... no framework can be a substitute for knowledge!

  52. Coincidental naming by kabloom · · Score: 3, Interesting

    The problem that he's referring to in ruby is coincidental naming.

    I implement a function with a name "join" without knowing what the rest of the world uses it for. (e.g. my "join" joins a chatroom, but the standard use of "join" is to concatenate all of the objects in an array together into a string.) Suddenly my object looks like a duck, and quacks like a duck, but doesn't act like a duck. Ruby thinks it can be used in the same context that everything else uses it in, but semantically it can't be used there.

    Inheritance prevents conicidental naming problems by making the default assumption that two similarly named functions *don't* do the same thing, and can't be used in the same place. You override this assumption by indicating that the class inherits from a certain class (C++) or implements a certain interface (Java).

    1. Re:Coincidental naming by mabinogi · · Score: 1

      > Ruby thinks it can be used in the same context that everything else uses it in, but semantically it can't be used there.
      But it will only actually _be_ used if someone _tries_ to use it. Your documentation of your class would make it pretty clear that it probably shouldn't be used that way even if it looked like it _could_ be.

      Smalltalk had this same concept, so it's not a new idea...

      --
      Advanced users are users too!
    2. Re:Coincidental naming by Anonymous Coward · · Score: 0

      That argument only makes sense if you pass random objects to your methods.

  53. On the naming of things by Anonymous Coward · · Score: 0
    The problem is that languages that suffer from premature typing have come to be thought of as exemplars of OO by a majority of programmers, when they are in fact half-assed hybrids that attempt to combine the static, early typing of non-OO languages with other aspects of a proper OOL. The big problem is that they retain non-OO warts that distort their entire type system and complicate the language.

    OO means that objects are typed, and this is enforced by the internal API for accessing them. Static compile-time typing is a kluge to work around a broken type system that does not, indeed cannot, enforce typing at run time. This is a bad imitation of OOP, although it is capable fo running pretty fast (until a bug sneaks around the type assumptions at run time and crashes it). It is a brittle and inflexible, and the baroque superstructure that is C++'s template kluge (for example) is a testament to how badly its type system is flawed at its core. Of course a lot of folks mistake that for a feature: it is in fact a symptom of a fundamental design problem in the language.

    Executive summary: Eschew premature typing

    Slashdot simplification: C++ suxors!!!

  54. Ruby on Rails creeks of immaturity by Anonymous Coward · · Score: 0

    It is a very immature framework, specially when it comes to Enterprise applications.

    For example any real enterprise application requires end to end transaction support. Does ActiveRecord handle that? What if the transaction is distributed across systems like mainframe 3270 terminals, couple of web services and some database access? I'm sure doing this in RoR would be much harder and probably take more code than doing it in robust enterprise frameworks like J2EE.

    What about LDAP support and single sign on?

    I could go on and on... based from the advertising pitch of RoR it seems RoR is just a glamourous framework for managing database tables. I can use any existing DB management tools to do the same with no code as well.

    RoR is just hype, using a pretty clever marketing strategy (I'll give it that). The videos were a cool marketing ploy and it sure fooled a lot of people.

    So no, in summary RoR is not a replacement for J2EE, it is not an enterprise application development framework. It is a hype bubble waiting to burst.

    1. Re:Ruby on Rails creeks of immaturity by arevos · · Score: 1
      For example any real enterprise application requires end to end transaction support. Does ActiveRecord handle that? What if the transaction is distributed across systems like mainframe 3270 terminals, couple of web services and some database access? I'm sure doing this in RoR would be much harder and probably take more code than doing it in robust enterprise frameworks like J2EE.

      This may come as a shock to you, but most websites don't need a mainframe of 3270 terminals to run. I know, I know, it's as much as a surprise to me as it is to you. I even hear that one can create a commercial website for under a million dollars, these days! What will they think of next? Maybe home users will have websites next!

      The point I'm not-so-subtly trying to make is that enterprise-grade, million dollar web applications that handle a kazillion hits a day aren't actually that common. It's true that Rails isn't going to create the next Google, but there are websites out there which don't have to handle hundreds of gigabytes of traffic per day. Ruby isn't designed for the enterprise. It's designed to run small to middle-sized web-applications, such as 43 Things or Penny Arcade. And sites like these make up the majority of the net, whilst web applications suited for "enterprise use" are in a considerable minority.

  55. Static vs Dynamically Typed maintainability by TheNarrator · · Score: 5, Insightful

    Ruby is not statically typed, which means that if you have a very large program and you change an API in that program you have to go and find all the instances of calls to that API in your program yourself, either through running automated tests or seeing the broken calls in the debug log of your application. Compiled langauges on the other hand such as Java,C,C++,C# have static calling conventions which means that when you break an api the compiler will point out all the broken calls to you and not let you run your program till you fix them all. This tends to make statically typed languages more maintainable. If you need to break out of static calling conventions you can in Java at least using introspection and bytecode enhancement but this is usually only done in well defined scenarios inside of application frameworks instead of for every class like in Ruby.

    1. Re:Static vs Dynamically Typed maintainability by blakeyez · · Score: 1

      This issue has been argued to death, but I feel I need to step in here. If you change an object's api in a dynamic language such as Ruby, you should have a solid unit test suite that will catch all the breaks. Statically typed languages let you typecast things to no end, so really they can quickly identify some problems based on type/method signatures, but completely miss others.

    2. Re:Static vs Dynamically Typed maintainability by Colonel+Panic · · Score: 1

      Personally, I'd much rather maintain the dynamically typed program/API. If you decide that some object in your statically typed system needs to be of a different class, then you've got to go through a lot of code to change that type (either that or you do a lot of casting and thus lose your type safety anyway). If I want to do that in, say Ruby, I don't need to change anything as long as the interface didn't change significantly.

    3. Re:Static vs Dynamically Typed maintainability by cygnus · · Score: 1
      but when you do make this decision, the point is that there are tools that can read the contracts built into your code and inform the process. either you've done it using a refactoring, and the IDE does *all* of the work for you, or you make the change and the IDE gives you a laundry list of changes you need to address.

      while dynamic typing can eliminate a lot of BS in small codebases, in really large ones, it's exactly Java's cranky, repetitive verbosity that makes large changes easy because your tools understand a great portion of your code as much as you do.

      --
      Just raise the taxes on crack.
    4. Re:Static vs Dynamically Typed maintainability by Q2Serpent · · Score: 1

      Static typing makes it impossible to change the types (not the interfaces) of public apis of libraries and utilities. You can't change everyone's code because it is everywhere. In a dynamically typed language, so long as the interface is the same, the third party code works as expected. In Java or C++, one has to change the version (or work *very* hard to maintain both the old and new interfaces using a variety of tricks).

    5. Re:Static vs Dynamically Typed maintainability by Anonymous Coward · · Score: 0

      And thats a good thing. Immutable interfaces are the way to go. They can be a pain for small apps, but for enterprise scale systems they are gold.

    6. Re:Static vs Dynamically Typed maintainability by mrandre · · Score: 1

      Having worked extensively with PHP, Java, and Ruby, I find these sort of arguments puzzling. Perhaps my experience is unique, but I find I run into ruby problems and java problems at about the same rate. The difference is, all the ruby problems show up in the same place. In Java, some of the problems show up at compile time, while some show up at run time. All that extra typing seems a strange fixation if it only saves you from a subset of potential problems. More damning: The feedback loop on a scripting language is much shorter. With Java, I while away my days waiting for ant to run, and Tomcat to redeploy. In ruby, I fix problems in minutes. There's no wait. For a large enough problem, the time spent me end up being the same. But the stress level is so much lower. And it's fun! It's funny that these arguments seem to hinge on the universe of ideals, rather than the universe of actuals.

      --
      "I don't want to achieve immortality through my work. I want to do it by not dying." -Woody Allen
    7. Re:Static vs Dynamically Typed maintainability by Anonymous Coward · · Score: 0
      An interface is a kind of type (or more correctly, one facet of a type), so I might have missed what you mean, but it sounds like your frustrations are with the coarse-grained, inflexible and unexpressive static type systems of Java and C++, rather than static typing in general.


      Would you care to give an example?

    8. Re:Static vs Dynamically Typed maintainability by TummyX · · Score: 0, Flamebait

      Static typing makes it impossible to change the types (not the interfaces) of public apis of libraries and utilities. You can't change everyone's code because it is everywhere. In a dynamically typed language, so long as the interface is the same, the third party code works as expected. In Java or C++, one has to change the version (or work *very* hard to maintain both the old and new interfaces using a variety of tricks).

      You may have a small point for some C++ apps but you're completely wrong WRT C# and Java. Both C# and Java do code binding late when a program is loaded rather than when a program is compiled. You can change a type or extend an interface as long as you don't break the existing interface and your program will continue to function fine. C# and Java preserve metadata, binding is based on "string" names not based on old techniqnues like method offsets.

  56. SQL by guinsu · · Score: 1

    One thing that disappointed me when I had a look at Ruby was its SQL interface (at least on Windows for SQL server). I find myself writing the same repretitive code in ASP to connect to a server and execute stored procedures. Same thing in Java with JDBC. I did a quick survery of other scripting languages to see if any had features to let me cut down on this copy and paste coding. Ideally I'd love to just call a stored procedure like a method and let the computer sort it out (you know, let the machine do the repetitive part like its supposed to). Ruby was about the best with cutting out the overhead code, but still not ideal. ASP, Python, PHP and Java all looked about the same. The worst part is I did the same check about 6 years ago and somehow accessing a database hasn't changed. This is probably the most common task in web development and its a pain in the ass. And VB style visual controls never worked well for me, I always needed to do something slightly different with the data so I have found it easiest to put the recordset into objects first, then, display it.

    So I've decided to stick with Java, I have about half a framework of my own I wrote and if I wrote some code generation it would do the other half. Perhaps there is some great framework out there that I missed that someone will tell me about, but that is part of the problem too, whatever is out there isn't advertised. Easy database access should be in the tutorial for the language if it exists, instead of the usual inefficient ADO-style examples.

    1. Re:SQL by Anonymous Coward · · Score: 0

      Hmm. Microsoft has an enterprise library for ASP.Net

      Which makes getting something from the database as simple as...

      SqlHelper.ExecuteDataSet(ConnString, CommandType.StoredProcedure, "GetSomeStuffByID", myID);

      (where connString is your connection string and myID is a parameter you pass in)

    2. Re:SQL by Anonymous Coward · · Score: 0

      ORM?

      For Java there's Hibernate, JDO and JPA (JSR-220, EJB3.0-persistence). There's also iBATIS, which isn't an ORM but is supposed to be great for database stuff.

      Ruby has ActiveRecord and Og (ObjectGraph).

  57. generation gap pattern can add maintainability by zdburke · · Score: 2, Informative

    Vlissides' generation gap pattern can help solve a lot of the maintainability issues with code auto-generated from a DB's structure. The idea is that you use some tool to auto-generate stubs from your model, and then you extend (in the formal OO sense) those stubs. When your model changes, you can regenerate your stubs without trying to do some ugly merge between your customized templates and those that reflect the new structure.

  58. Automatic Code Generators by ansible · · Score: 1

    I've believed for the last few years that automatic code generators (*) are a bad idea.

    I haven't spent too much time looking at RoR, except for reading some introductory docs. But when I ran across the code generation bit, that set off alarm bells.

    I've used automatic code generation systems a few times. It was always inconvenient. There were always instances where you wanted to do something the code generator couldn't do by itself, so you had to drop into the programming language itself. One system I used had a sort of patch system, so that when you made changes and regenerated the code, it would re-apply your hand modifications. Still was klunky. But the programming language (**) was bad enough to work in directly, so I didn't mind the klunkiness.

    Needing any kind of code generator, be it a GUI layout tool, or what's in RoR is a realization that the programming language itself isn't capable of further abstraction. I guess there is no shame in that, most languages aren't capable of abstraction beyond a fixed level.

    There is a solution to this kind of thing, however. If you have a programming system which is sufficiently expressive enough, you can keep coding to higher and higher levels of abstraction. I'm talking about things like higher-order functions and macros. Not C preprocessor macros of course; I mean Common Lisp and Scheme macros.

    With a good macro system (which Ruby doesn't have, but can kinda / sorta get by without) you can abstract away even the boilerplate code. But if RoR needs a code generator, then maybe you really need higher levels of abstraction that Ruby can provide.

    I suspect, though that the code generator was the first solution. Someone of sufficient cleverness may be able to find a cleaner and more elegant way to do the same thing without the code generator. Ruby is not LISP, but it is pretty good.

    (*) I don't mean code generators in the loosest sense of the term, so this doesn't include compilers and such. I mean programs which generate high-level language code. As opposed to C, which is a low-level language / high-level assembler.

    (**) Informix 4GL, for the old fogie DBAs out there. Used FourGen's CASE tools.

    1. Re:Automatic Code Generators by ajrs · · Score: 1
      fourgen was bought out by fitrix, if I'm not mistaken. I wrote a scipt that used expect, uucp, and patch to install fixes at client sites over modems.


      Now I feel old.


      It wasn't that bad to maintain- the only bug I couldn't work around was in Infomix's 4GL. It had a buffer over run in the report page header at 42 lines.

    2. Re:Automatic Code Generators by Anonymous Coward · · Score: 0

      Lisp macros are automatic code generators. Actually any kind of GUI builder is a code generator, for that matter, even the ones that output XML documents. Indeed, the libraries that read them in are nothing more than interpreters for DSLs encoded in XML.

    3. Re:Automatic Code Generators by ansible · · Score: 1

      Lisp macros are automatic code generators. Actually any kind of GUI builder is a code generator, for that matter, even the ones that output XML documents. Indeed, the libraries that read them in are nothing more than interpreters for DSLs encoded in XML.

      In one sense this is true. However, unlike the klunky external code generators, LISP macros are built into the programming language. And, with a few caveats, can be tightly integrated with the rest of your code. LISP macros are a mostly clean and seamless.

      With the external code generators, there are always two levels you are operating at. And that's what causes problems during regular programming, but especially when you want to integrate a third-party library.

    4. Re:Automatic Code Generators by swimmar132 · · Score: 1
      In case you're not aware, there's multiple levels of 'code generation' in RoR.

      In the first case, which is awesome, there's script/generate model Account. That will automatically create

      • app/models/account.rb that contains a nothing about a class called Account that derives from ActiveRecord::Base
      • test/fixtures/accounts.yml - a file that contains test fixtures that you can use for unit tests. It contains two stubs of data.
      • test/unit/account.rb - a file that unit tests the Account class. All it tests is if it can sucessfully instantiate an Account objecet.

      And similar stuff exists for creating Controllers, Migrations, etc.

      There's another type of 'code generation' that generates functions for you at runtime. If you put into your Account model has_many :users, that will insert a couple methods into your Account class *at runtime*.

      Then, there's scaffolding, which, if you want, will create a CRUD controller and views that operate on some object. You can either have the methods created at runtime by putting scaffold :account into your Accounts controller, or have Rails insert all the CRUD functionality directly into the controller and views by doing script/generate scaffold Accounts.

  59. Doesn't work. by Medievalist · · Score: 3, Funny


    Sadly, the stupid are shameless.

  60. Automatic Code Generation sets off alarm bells? by meowsqueak · · Score: 3, Interesting

    I have no experience with Ruby or RoR but I am a software engineer like many people here and I would like to stick up for automatic code generation. Modern software is extremely complex and even when excellently designed and implemented by a skilled person or team it is still subject to faults. Automatic code generation, when done properly, is an excellent way to reduce the effort and risk associated with creating certain types of complex systems. A classic example is a parser - hand writing parsers can be done, of course, but they can be notoriously difficult to test and small grammar changes can upset the entire structure of the parser. In this situation, automatic code generation is not only useful, it's also safer and more reliable. If you have to change the grammar, you just reconstruct the parser code.

    A compiler is a form of automatic code generation - you don't compile your source by hand, usually, you let the compiler do it. The compiler becomes a cornerstone of your industry and is trusted perhaps far beyond what it really deserves. But the important thing is that it is hopefully consistent and can compile to a lower form much more accurately and faster than you or I or anyone can. You can make large scale higher-level changes without worrying too much about the effects of these at the lower level.

    Unfortunately all generalisations fail when you talk about specifics and the implications of this don't need stating, but I think it's unwise to say 'automatic code generation sets off alarm bells' when it is more accurate to think 'writing it manually should set off alarm bells' for many implementations.

    1. Re:Automatic Code Generation sets off alarm bells? by Anonymous Coward · · Score: 1, Insightful

      Automatic code generation itself isn't the problem. The real problem with maintainability is if the programmer has to edit both the source and the generated code. For example, if you use a wizard to create GUI code that has places to fill in some code, and then you change the GUI and regenerate the code, it can get very messy. The examples you cite (parsers and compilers) do not involve the programmer editing the generated code.

    2. Re:Automatic Code Generation sets off alarm bells? by meowsqueak · · Score: 1

      Yes, that is a fair comment. The good infrastructures tend to split the customisable 'manual' code away from the autogen stuff, but if you have to tweak the autogen result then yes it can get messy.

  61. I call it implicit typing by monkeyGrease · · Score: 1

    And to naysayers for implicit typing, it is used all the time under different looks in real heavyweight production code (C++ templates ala STL style, the multitude of runtime aggregate type systems out there, very late bound dispatching, etc, etc). Note that in some cases (like STL), the 'is_suchandsuch' is not necessary, since C++ templates are a compile-time thing so you get compile time type checking and binding.

  62. Re:Before worrying about a maintenance nightmare.. by rossifer · · Score: 1

    Can't join a table to itself in SQL? You have to name the table each time, but it's not very difficult and certainly not impossible. Try something like this:

    select parent.name from person as parent, person as child
    where child.parent_fk = parent.person_pk;


    Regards,
    Ross

  63. Generated Code? by misleb · · Score: 2, Interesting

    I started my first real Rails project with generated scaffolding, but after a few days there was almost nothing left of it. And I almost wish I had never generated the scaffolding because I had to spend time cleaning up tons of files and method stubs that I was never going to use.

    I do, however, use the basic "scripts/generate " scripts. They save me a minute or two of creating files and directories and class definitons. Handy, I suppose, but I am not sure if this is considered "generated code." The only "code" that Rails really generates for me is HTML and SQL (Tag Helpers and ActiveRecord) which is pretty nice, actually. The less HTML and SQL i have to write and more I can focus on the actual code, the better.

    Re: code generation replacing OO model:

    I have no idea what the OP is talking about. RoR is pure OO.

    Probably the only thing that I find a little frustrating about RoR is the shear volumn of files involved in a project. Navigating through them gets gradually more time consuming.

    -matthew

    --
    "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
    1. Re:Generated Code? by matchboy · · Score: 1

      In my book... you touch script/console before you ever touch script/generate. ;-)

      http://www.programmingrails.com/

      --

      Robby Russell
      PLANET ARGON
      Robby on Rails
  64. Re:Eh kindof -- Idiot by Spaceman40 · · Score: 1
    Rails requires you do a lot of stuff like ... write literal SQL strings in your code ... that could, with some creative ruby, be done automatically. On the count of SQL, and at the risk of self-promotion, check out Criteria, which lets you write literal Ruby statements that are transformed into SQL, all in a ruby-esque manner.
    Sure, you can write SQL in Ruby, but why would you want to? SQL was a language designed for database queries. Taking one of your examples:
    idx1 = SQLTable.new("orders")
    q1 = (idx1.price > idx1.paid) & (idx1.duedate < Time.now.to_i)

    q1.limit = 5
    q1.order = :ASC
    q1.order_by = idx1.name, idx1.age

    puts q1.select
    ... which is equivalent to ...
    SELECT * FROM orders WHERE ((orders.price > orders.paid) AND
    (orders.duedate < NOW)) LIMIT 5 ORDER BY orders.name, orders.age ASC
    So tell me, why would you prefer the first over the second?
    --
    I [may] disapprove of what you say, but I will defend to the death your right to say it.
  65. Re:Before worrying about a maintenance nightmare.. by Anonymous Coward · · Score: 0

    now try that in rails.

  66. Obvious question. by Anonymous Coward · · Score: 0

    Why is it named "Ruby on Rails"? Searching provides no answer.

  67. Ruby is very maintainable by kallistiblue · · Score: 1

    At least it appears to be.

    I'm still trying to learn the ropes.

    --
    Laugh at my ignorance while I learn Rails - a Real ne
  68. Let's talk about sex... or how about Rails sex by matchboy · · Score: 1

    Rails isn't the evil code generation monster that you make it appear to be. It is merely a set of best practices that you either like... or you don't. Our Rails development team really likes them and we're willing to give up a few of our personal preferences for the sanity of working with a framework that allows for easier collaboration.

    The Ruby on Rails framework just sets the tone for you. You can use the scaffolding generator... but we don't in any of our client products. We might use it to just get a quick CRUD view of the existing data we're looking to work with.

    It's nothing more than a well thoughtout set of best practices... and people love it.

    The *other* guys are still hung up on their own ideas of what is best for their code... but in the end... we just want to get stuff done. Rails makes that a bit quicker to do so.

    Ruby+Rails+PostgreSQL+Lighttpd = Enterprie Ruby on Rails! ;-)

    RRPL4LIFE.

    --

    Robby Russell
    PLANET ARGON
    Robby on Rails
  69. Dear Editors... by tyrione · · Score: 1

    Is it too much trouble to ask you to proof-read stories? The article links commentary is painful on the mind. Between the liberal use of commas, 'of' in place of 'off' to other examples of "what the hell are you trying to write?" how is it that this type of article gets submitted?

    A friend of the crew?

  70. Re:Eh kindof -- Idiot by bnenning · · Score: 1

    So tell me, why would you prefer the first over the second?

    The first can be reused when you're searching something other than a SQL database, for example an in-memory array. Also, the first is easier to parameterize since you don't have to manually build SQL query strings.

    --
    How to solve most of our problems: 1.Lots of nuclear plants. 2.Cure aging.
  71. Notice these examples are small projects? by Sagarian · · Score: 1

    all the examples cited here about why strong typing is a bad thing and the examples cited to prove that dynamic binding appear to be small, single person projects. totally true for single-person productivity when the only person on both sides of an interface contract is yourself. dangerous thinking for much larger projects. remember: right tool, right job.

  72. Usage of RoR by achacha · · Score: 4, Interesting

    RoR is pushing this whole codegen thing too much (I personally think codegen is the work of mediocre developers who have ego issues, but that's just me). I used RoR for about a day and wrote a little app then realized that maintenance is a pain and that I would have to manually change all the code anyways to make it behave as I want and that codegen created something I did not want. Then I weighed it against writing sevlets and JSP pages and RoR didn't look so appealing. Ruby is a nice scripting language but I didn't like the architecture of rails. Just not for me. Performance was quite bad too, about 6 times slower than JSP for fetching some data from a database, manipulating it (which is the bulk of the work) and displaying it (given JSP gens compiled into Java and takes advantage of JIT). Ruby is a nice language though, but it's not as useful as python. So I struggle to find a place where I can use it, maybe it can be nice as a simple embedded script language (similar to Lua).

    If asked what I would use to develop a server side app, I would have to look at volume and complexity then go in the order: C/C++ > servlets > JSP/PHP > RoR (from highest volumen/complexity to lowest). For high volume/complexity C/C++ is still the best efficient way to go but not for all, requires more work from the developers and not for average/weak developers. Servlets are a good next step if performance is not extremely important. JSP/PHP is a good way to run a site that doesn't have complex computation or one that is static content based (news, blog, forum, and such). RoR I would use for maybe some prototyping or to build a quick and dirty app to provide a simple view of the database (but even then I would probably lean to PHP). YMMV.

    1. Re:Usage of RoR by ogleslurp · · Score: 2, Informative
      I used RoR for about a day and wrote a little app then realized that maintenance is a pain and that I would have to manually change all the code anyways to make it behave as I want and that codegen created something I did not want. Then I weighed it against writing sevlets and JSP pages and RoR didn't look so appealing.
      I'm certain that this idea will be expressed elsewhere, but please note that the code that rails generates is only a skeleton that you can shape to suit your purposes. But which code generation feature did you use? I am honestly curious, because I can't really line up these comments with any of the code generation features in rails without making some pretty absurd assumptions.
      Performance was quite bad too, about 6 times slower than JSP for fetching some data from a database, manipulating it (which is the bulk of the work) and displaying it (given JSP gens compiled into Java and takes advantage of JIT).
      Probably you were using the webrick server in development mode. It's not really supposed to be fast, it's supposed to be simple and portable. If you spend some time looking around, you'll find many production configurations that will run as fast as you need them to.
      Ruby is a nice language though, but it's not as useful as python.
      This is just noise, honestly. Please explain!
    2. Re:Usage of RoR by Trejkaz · · Score: 1

      Well, apparently enforcing indents as part of the language syntax inherently makes a language more useful.

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
    3. Re:Usage of RoR by Skal+Tura · · Score: 1

      PHP actually is quite good even when it comes to high volume & complex stuff.

      I know, as i've done it, a MMOG, 100% Pure PHP.
      In fact, that's the first big project i did with PHP, and it performed AMAZINGLY well, and i were back then very weak developer indeed.
      The code was full of intended IF clauses, hardcoded stuff, mixed up layout & functionality etc.
      and unoptimized mysql tables...

      Even then, it performed really well, never have i had anything even close to performance problems, i did have some problems which seemed like performance problem but indeed were not but a bug in the code, causing it at a first glance to look like performance problem. (Nope, it was not an infinite loop).

      Even the battle ticker was done with PHP, like i said 100% PHP. It consisted of multiple dimensions of objects inside of each other, loading all stuff first to memory, then running the calculations, then saving all that.
      Even when i used per ship simulation, not as whole simulation(large bunches of ships at a time), it performed with a 1.3Ghz Thunderbird for battles of over 500k ships, faster than when the next tick was to occur.
      Of course, 500k ships was not by far enough, as it was initially built for having MASSIVE fleets (really late on the game, millions of ships per player for players who bought mainly little ships), but still it would have performed upto somewhere midgame in the early days well enough. needless to say i changed it to calculate large bunches to be capable of running hundreds upon hundreds of battles simultaneously.

      We are currently enhancing the code base, changing the structure to have completely separate templating and functionality parts and easier extensibility (getting rid of all hard code, and changing to dynamic), optimizing on the run everything. We are getting way better performance now also, as most of the loops has been gotten rid of by doing better mysql queries (getting data from multiple tables according to some criteria, and then just passing that to templating, Smarty btw, instead of gathering that data with N+1 queries).

      You heavily underestimate PHP's performance, like so many else. But most underestimates it because, they don't know jack about optimizing PHP and getting the most performance out of it.

      Now, im not saying it's the most performing out there, by far, naturally C/C++ is faster, and anything which compiles to native code.
      But compared to Java... I'd say PHP is helluva lot faster than Java/servlets... Java is bloated badly imo.
      Oh yeah, and you can do desktop apps with PHP too, and it's already an old concept.
      (i for one ventured into a little seeing would it be possible with PHP back in 2001, but it has been realized for masses via PHP-GTK
      lately)

      Oh yeah, and the game in question is: Paradox Online, http://www.paradox-online.net/

    4. Re:Usage of RoR by hempalicious · · Score: 1

      Hey .. it worked for COBOL!

    5. Re:Usage of RoR by achacha · · Score: 1

      The libraries available to Ruby and not as extensive as Python, I didn't mean language specifics, sorry if I was unclear.

      I am a hardcore C++ developer with a lot of Java, so for me Ruby and Python are used for the same position: scripting. Python libraries are very extensive and complete for almost everything I want in a scripting language (even more so than java). Ruby is still a relatively new langugae and the libraries are just not powerful enough (yet...). Withpython I can post to newgroups, send email, do XSLT, generate XML files all with a few lines of code; with ruby I have to do a lot of the work still. I have no doubt Ruby will get there but for now it's still not mature enough.

      Like I said, Ruby has excellent constructs for OO development (for a script language); so I have been thinking of a way to embed Ruby into my C++ code to externalize some scripting tasks (Lua is another contender but the documentation to Lua is a bit too obscure and I don't have the time to learn it, Ruby is better documented and easier to get started with).

      I can see how Ruby on Rails is meant for portability (I did you the web brick but in release mode), but I personally need performance to handle the load of 100 hits per seconds (not a lot but when I used RoR for the small DB view part it was noticeably slow so I went back to the JSP page, I'll rewrite it in C++ which should solve the performance issue).

      So don't misunderstand me, I am not saying Ruby sucks, quite teh contrary, I actually like it a lot and use it when I have a simple script task, but my 1 day with RoR was not too pleasant, which doesn't mean I am going to stop using Ruby.

    6. Re:Usage of RoR by ogleslurp · · Score: 1
      The libraries available to Ruby and not as extensive as Python
      What are you looking for that you haven't found? I'd be glad to help you find what you need.

      I think that you'd be surprised if you were to look around rubyforge or the RAA. There are a lot of useful libraries available right now. Rubygems can make installing any of them that are packaged as gems a snap!

      Also consider checking in with the ruby-talk mailing list. There are lots of smart folks waiting there to help you.
      I am a hardcore C++ developer with a lot of Java, so for me Ruby and Python are used for the same position: scripting. Python libraries are very extensive and complete for almost everything I want in a scripting language (even more so than java). Ruby is still a relatively new langugae and the libraries are just not powerful enough (yet...). Withpython I can post to newgroups, send email, do XSLT, generate XML files all with a few lines of code; with ruby I have to do a lot of the work still. I have no doubt Ruby will get there but for now it's still not mature enough.
      I think you must not have looked around very hard. All of the tasks that you have laid out are easily accomplished wth existing ruby libraries (which are as often as not ports of python or perl libraries).

      It's an honest mistake. When I have to dig through the Python documentation I usually end up curled up in a ball in the corner of the room. It just doesn't work for me. It doesn't take me more than a minute or two to find what I need for my work in Ruby (with a few exceptions).
      Like I said, Ruby has excellent constructs for OO development (for a script language); so I have been thinking of a way to embed Ruby into my C++ code to externalize some scripting tasks (Lua is another contender but the documentation to Lua is a bit too obscure and I don't have the time to learn it, Ruby is better documented and easier to get started with).

      Lua may be worth looking into. I've a coworker that's looked into it for a personal project . He told me that it was easier for him to pick up than Ruby (for embedding anyway).
      I can see how Ruby on Rails is meant for portability (I did you the web brick but in release mode), but I personally need performance to handle the load of 100 hits per seconds (not a lot but when I used RoR for the small DB view part it was noticeably slow so I went back to the JSP page, I'll rewrite it in C++ which should solve the performance issue).

      I think that I wasn't clear in my last post. Don't use Webrick and expect to get any kind of performance out of it. Use Apache. Use Lighttpd. It doesn't matter what you do to Webrick. It won't be quick until the ruby interpreter gets real quick.

      So develop on Webrick and deploy on a performance server. I think that's a popular approach.

      Good luck in your future endeavors and good luck finding the right tool for the job. I think that's something you should focus on.
    7. Re:Usage of RoR by achacha · · Score: 1

      I'll give RoR another shot without using the WebBrick, I usually use Apache, so it should fit just fine.

      The problem I had with rubyforge was that I got code that did xslt, but it was buggy and failed to transform some basic templates that I worked fine with xalan and ms-xslt engines. So I spent a few hours tracking it does to realize that it was a bug in the library I downloaded which soured me to it as I was able to do the same task with python in 5 lines of code. I do not remember what the libarry was called but this was a year ago, and while I am sure there is a lot of bug free code there, when doing script development I need things to work fast and not have to worry about bugs in the library. When I get library bugs with python is when I stop relying on it so much.

    8. Re:Usage of RoR by ogleslurp · · Score: 1

      With regard to the rails stuff: Mebbe try lighttpd. I've heard _such_ great things about using this in combination with fastcgi. I'll be curious to hear how it turns out. When you've spent some time with it, let us all know.

      With regard to xslt: Yeah, this was actually the thing that you listed off that made me wince. I had a bit of a tough time with the xslt library when I tried to use it last. My solution to the problem was to use the templating that ships in the Ruby standard library. I suspect this isn't the answer that you're looking for.

      Another solution you may want to consider is shelling out. It's dirty (I guess), but I'm pretty sure that you can get your transform done for cheap by a third party.

      I think that there's been a lot of work done on the ruby libraries in the past year. It might be worth your time to revisit them. Good luck, and don't hesitate to try the ruby-talk mailing list next time you work yourself into a corner!

  73. Re:This is your typical dev-versus-admin mentality by Anonymous Coward · · Score: 0

    You don't even say if you USE Ruby, or Ruby on Rails. If not you are just being opinionated without being informed. Either way, your post is useless.

  74. Agreed. And, Python equivalent of RoR by CarpetShark · · Score: 1

    Well said. In the end, Ruby is just a MVC and ORM web framework, along with a little bit of code generation to get you started. That's basically all good, though :) On that note, it's worth mentioning the Python equivalent of RoR, since the poster mentioned a python background. Django is probably the best place to look for an MVC/ORM (web) framework in Python, if you're interested in trying it.

  75. Re:Before worrying about a maintenance nightmare.. by Anonymous Coward · · Score: 0

    SELECT replies.parentid parent, replies.postid
    FROM posts thread
    INNER JOIN posts replies ON replies.parentid=thread.id
    WHERE thread.isparent=1

    That's a join on itself, right? Who said it's impossible?

  76. Code generation methodology by gfim · · Score: 4, Insightful

    Unfortunately, that's exactly what most Visual C++ programmers mean by code generation. The "wizard" generates a huge chunk of boilerplate code that the developer never understands. He would prefer not to even look at it, but occasionally has to make some minor tweak.

    When I use code generation, I generally write the generator too. As you say, there are two choices: you either generate the code once and then maintain it completely manually (i.e. it's just the scaffolding), or you maintain the generator and the input to the generator but never touch the output of the generator.

    Tools like Borland C++ Builder and Rational Rose try to give you the best of both worlds with the "round trip" code generation/reverse engineering. While they do have some advantages, in my opinion they aren't overly successful at it.

    --
    Graham
    1. Re:Code generation methodology by anomalous+cohort · · Score: 1

      The bi-directional code gen approach does seem to be popular with the Borland and IBM camps. My guess is that approach is perceived to be desireable from that class of developers who have trouble grasping the highly abstract concept of Model Driven Software Development. You have a bug with a page so you fix the template but you have to be careful that your fix doesn't break the other pages generated by that template. It can be very tricky with certain types of bugs.

      MSFT goes the "wizard" route which saves the keystrokes for a one-time template driven code gen. It's much easier to implement than the bi-directional route and adresses the same keystroke saving need at least initially. I find that I'm able to get by with the wizardly MSFT approach as long as I keep strict on the "full separation of concerns" and "loose coupling" stuff. If you minimize the need to make changes to the wizard output, then you don't lose much when you need to run the wizard again.

      The maintain the generator and the input to the generator but never touch the output of the generator approach is the most flexible and adaptable but requires the smartest developers.

    2. Re:Code generation methodology by gfim · · Score: 1

      I don't believe the point of the wizard is to save keystrokes. It's because the average developer wouldn't have a clue how to do those bits of the code. They just generate it and try not to touch it. I've asked very experienced Windows developers what a particular chunk does and they just look at me blankly.

      To me, any part of my code base that I don't understand is a huge risk. Sooner or later I will have to change it for some reason. I really don't want to have to do it by trial and error.

      As you suggest, the biggest problem is finding good developers.

      --
      Graham
  77. Or, if you're using RoR... by MAdMaxOr · · Score: 1
  78. Alternate Frameworks by hohonuuli · · Score: 2, Informative
    Rails has been getting a lot of Buzz lately but it's not the only RAD framework out there. Personally, I'm not a fan of Ruby so I'm not so keen to jump on to the 'Ruby Rocks' bandwagon. If you're using python you may want to check out the Python equivalents of 'Ruby on Rails'. Here's a few:
  79. The hard part is writing, not maintaining by Chief+Typist · · Score: 3, Informative

    I've been using Rails and Ruby for the past few months -- I had no prior experience with either.

    The thing that has become clear to me is that the hard part of Rails is learning *how to do it right*

    The "automatic code generation" (scaffolding) is helpful for learning *how to do it right* but as you get deeper into the framework, you find yourself coming up against difficult and/or domain specific problems. In all cases I've encountered so far, there are simple solutions to these problems -- the hard part was finding the right way to solve the problem.

    You have to take the time to read the documentation, dig through the source code, think about design patterns, and write elegant Ruby code.

    Often, this code is only a few lines long. For example, I had an issue with SQL statements including NULL values when I wanted to pick up a default from the table schema. The solution was a single line of code to remove the named attribute from an array in a Model subclass. It took a few hours of research & prototyping to figure out that one line of code.

    So as far as maintainability is concerned, I'd say it's pretty good. That one line of code mentioned above is easy to understand for someone doing maintenance. Less is more.

    One final observation that I've made regarding Rails and Ruby -- it's a lot like Cocoa and Objective-C (another excellent framework backed by a dynamic language.) When you find yourself writing a lot of code, it's a good sign that you are doing things wrong.

    -ch

    1. Re:The hard part is writing, not maintaining by disserto · · Score: 1

      One effort to help with documentation is an annotated API, like the PHP docs:

      http://rails.outertrack.com/

  80. You aren't supposed to use scaffolding. by Some+Random+Username · · Score: 1

    When people complained that scaffolding opens up trivial exploits, the answer was "you aren't supposed to use it". Its just there to look impressive in the demo videos, and for people who can't add/delete/edit their database through other means (I have no idea who these people are).

    1. Re:You aren't supposed to use scaffolding. by Jack9 · · Score: 1
      Please re-read the section of my post, which covers why I reject default scaffolding outright.

      Can you alter the templates generated? If I have coding standards implemented, I have serious doubts the default RoR scaffold templates specifically adhere to mine.
      Useful coding standards aren't about indentation, alone.
      --

      Often wrong but never in doubt.
      I am Jack9.
      Everyone knows me.
    2. Re:You aren't supposed to use scaffolding. by Some+Random+Username · · Score: 1

      Please re-read my entire post. I don't care why you reject scaffolding, you don't have to reject it because you aren't supposed to use it. Its not an option for you to reject, it is known to be broken and should not be used. Its just there for people who can't edit their db for some reason, so they can stick data in to build their app on.

    3. Re:You aren't supposed to use scaffolding. by Jack9 · · Score: 1
      Its not an option for you to reject, it is known to be broken and should not be used
      Scaffolding is not a broken concept, it's a fundamental (code re-use) with a new name. You already use it when you use Dreamweaver or pull a function from another project or something you copy from a textbook. I believe that you interpret "scaffolding" as a static database interface. That's one example of it, not the definition.
      --

      Often wrong but never in doubt.
      I am Jack9.
      Everyone knows me.
    4. Re:You aren't supposed to use scaffolding. by mrlpz · · Score: 1

      In agreement with Jack9. Perhaps a case of another WikiPedia definition user ? But in all seriousness. If you think that scaffolding code is "just for demos", you're very much mistaken, and probably tied to the misguided notion that no one ever needs to reuse code ever.

    5. Re:You aren't supposed to use scaffolding. by Some+Random+Username · · Score: 1

      See my reply to jack. Scaffolding is a specific (useless and broken) piece of functionality in rails. I did not mean the concept of generating code in general.

  81. Re:Eh kindof -- Idiot by oGMo · · Score: 1
    Sure, you can write SQL in Ruby, but why would you want to?

    For a number of reasons:

    • Building SQL from a (slightly) abstracted language construct makes it much, much easier to piece together a statement. Consider:
      q = (tbl.price > n)
      q &= (tbl.date < t) if t
      In this (somewhat) trivial example, you have added a criterion to the query based on a condition in the code without having to worry about SQL syntax, escaping, or converting formats. The logic of your code is obvious and concise, not littered with irrelevant details.

      Now imagine how easy it would be to build an interactive report builder with the ability to throw the pieces together in this manner. Yes, it's easy. :-)

    • Portability is transparent. With the new DBI module updates, Criteria will pick the "flavor" of the database you're using transparently. MySQL likes the REGEXP, PgSQL likes RLIKE. Older Oracle doesn't support JOIN, new Oracle does. MySQL and PgSQL JOIN syntax is subtely different. With Criteria... it doesn't matter. You don't have to worry about it.
    • It looks more natural in your code. You don't have to worry about where to put long SELECT statements, or have a special editor or mode for that portion of your code.
    • It can be applied to non-SQL entities. This may be especially helpful if you're debugging code or writing unit tests and don't want to have to configure a database connection.
    • You can build reusable query templates for later with .x? syntax.
    • Escaping, database quoting, and bind variables are handled appropriately. You don't have to worry about injection vulnerabilities, even if you're using parameterized SQL in places where bind variables are not supported (such as column lists).

    I could go on, but this should be sufficient.

    --

    Don't think of it as a flame---it's more like an argument that does 3d6 fire damage

  82. RoR is maintainable enough -- but... by oldCoder · · Score: 5, Informative
    But the programmers API isn't nicely documented in RoR, although there is a web page that claims to do that. For example, to search the RoR API web page you have to use google. Half the time I come up with a blank document. That is, the entry for the function I want is a blank page, and there is no context (no "up" button) so I can't use it as a starting place for more navigation.

    The result of the somewhat sloppy documentation is that if I find a function that does something (like by looking at the source) I don't know if it is guaranteed to be there next release. The existing book ("Agile web programming...") is too chatty and not complete and accurate like a reference manual would be.

    So I'm somewhat blindly following the examples and when something doesn't work I have to backtrack. Still, all in all, I like it. I need the speed.

    And, like a lot of people, I found I had to go back and study Ruby a few times. The existing Ruby docs are great.

    But I desperately want a good Rails reference manual.

    --

    I18N == Intergalacticization
    1. Re:RoR is maintainable enough -- but... by foobaric · · Score: 1
  83. Re:Here's an AJAX example - how good is RoR for th by matfud · · Score: 1

    Trees are a bitch no matter which language you use. If you can find a tree that satisfies your requirements then you are golden. But most of the time the "tree" modules/javascript/whatever does not satisfy your requirements.

    As an example: most javascript based trees require the entire tree structure to be available before the tree is rendered for the client. This may work for you, it has not for me. Most Ajax tree systems (ie they request the children of a node you are expanding rather then having the information up front) only work if the tree is not able to change. If the tree can change then they do not update correctly.

    By the way, that is not specifically ruby related, it is related to the "trees" that are available. Ruby will not help you here. nothing will help you here unless you want to do exactly what someone else has already done.

  84. Re:OUTGOING by Anonymous Coward · · Score: 0

    Okay, seriously. A site full of geeks and nobody's cracked this yet? I'm losing faith in you, Slashdot.

  85. Common Misconception by l00k · · Score: 4, Insightful
    The idea that developing in Rails is 'code generation' is a common misconception amongst /.ers - in fact the last time a Rails article was posted sometime last week I had to do battle with a number of people that thought this.

    I hope that the number of highly-modded responses which have had the chance to clarify what code generation is in Rails, and what its purposes are within the development cycle, will allay some of the FUD. When I began learning Rails I was under no impression that code would be generated beyond the scaffold, and that the scaffold was only there to get some meaningful database interaction happening right away. This tutorial which I began learning Rails from explained it clearly:

    Of course, these actions and views are very plain--not the sort of thing you'd want users to see (unless they are total geeks). The good news is that we can leave the scaffolding in place and slowly, one at a time, provide our own versions of the actions and views. Each time you create one of the actions or views it will override the scaffold's version. When you're done, simply remove the scaffold statement from the controller.

    The way I imagine the misinformation formed is from certain people hearing the sentiment of "faster development in Rails" and jumping to the conclusion that there must be some sort of cheat involved. Watching the video demos probably fueled this, as the demos are showing Rails off, and the scaffolding is a selling point.

  86. What purpose? by misuba · · Score: 1

    Which, of course, kinda defeats the purpose of automatically generating code in the first place.

    So, you've asked the Rails developers what their purpose was in using generated code?

    The sole reason Rails has generators is to do the tedious bit that gets you started. That's all it's there for, that's all it was ever there for.

    The confusion over this is in large part due to the early Rails marketing strategy of making screencast videos instead of readable documents, IMO; everyone latched onto the scaffold thing because it was visual. But scaffolding is really, really ridiculously unimportant.

    --

    If you don't pretend to be anyone, are you?

  87. Re:Agreed. And, Python equivalent of RoR by Beek · · Score: 2, Informative

    > In the end, Ruby is just a MVC and ORM web framework, along with a little bit of code generation to get you started.

    Don't forget about testing... The testing framework is probably the best part of the framework, and not enough people are talking about it.

    But int the end, Rails is more than just MVC + ORM + Code Generation + Testing. Rails is greater than the sum of its parts. Having all of those thing in one cohesive framework is much better than cobbling together a stack of tools to do the same thing.

  88. ^sets^peal by dwater · · Score: 1

    > sets of alarm bells

    "Sets"? That's like a collective noun or something, right? Is that the correct one for 'alarm bells'? I think not - Google tells me it should be a 'peal of alarm bells'.

    or did you mean 'off'?

    yeah, sure, anally retentive; so what?

    --
    Max.
  89. RoR Code Generators? by Anonymous Coward · · Score: 0

    I've been working on a few RoR projects and we only use the code generators to create unit test stubs for our controllers and models.

    We haven't used scaffolds AT ALL in ANY of our RoR projects. So maintenence as far as that is no problem whatsoever.

    Maintaining the code doesn't seem to be any more an issue than any other languages. It depends entirely on how you DESIGN your app. Of course, RoR can't design it for you... But if it doesn't scale it would be easier to blame the framework and not your design huh? :D

  90. Re:It's obvious... it's more readable than Forth! by Anonymous Coward · · Score: 0

    >>>"Now, mind you I might just be upset because I looked at RoR and didn't instantly understand everything. But I was generally put off by the amount of things that were being invoked as if by magic, and I'm even less of a magician than I am a developer."

    You're right, Ruby is dense, but things could be much worse: it could have been written in Forth, Perl, APL, Smalltalk, LISP, or Postscript. Did you notice that the developers of Ruby brag how Perl coders can just roll right on over to Ruby -- and it shows in the depth and conciseness of each statement and the decorators you put on the variable names based on their context.

    For my first Ruby app I was able to write a complicated (for me) cross-indexing application in Ruby rather quickly and found the language much easier to work with than something like Perl, and it felt I was faster coding than if I were using Python. Also, the equivalent Python program would have been much longer. In terms of using it with the internet, can you imagine controlling spaces inside embedded Python in HTML pages!

    To a large extent, the code is the documentation. I think you need more practice writing new apps with Ruby. To be fair, it is a more dense language. But the results are so quick. I'm a VB programmer. I hope to work on VB/Linux if Parrot is ever released. :) I think Ruby is great -- particularly for code generation.

  91. Re:Eh kindof -- Idiot by cdcarter · · Score: 1
    I'm not sure I know what you are talking about, because my interface is for the most part completely separate from my processing. Interface goes in my views and the processing happens in my controller. Explain this please.
    The fact you have HTML in a separate file from the code is not sufficient for full separation. You should be able to entirely drop the web interface and instead write, say, a GTK or commandline app, without changing any of the backend code.

    I am going to let you in on a huge secret. Rails is a WEB APPLICATION DEVELOPMENT SUITE. A GTK application is not designed to be run in a web browser, and is not designed to be served up, and used on many machines at once. I am sure that if you wanted to though, you could write an add-on to actionsupport and allow it to be a GTK app using the proper Ruby Librarys
    --
    "Love is like a trampoline, first it's like "SWEET!!" then it's like *BLAMM!*"
  92. I miss the VB approach by Anonymous Coward · · Score: 0

    For biz forms, it is hard to beat the VB approach as far as productivity and simplicity. Some complain about code duplication, but that is only if you don't factor commonalities to shared routines.

    Some also complain that VB forms don't scale to user's screens. I never found that a big problem, but some vendors have discovered "stretch zones" that allow widgets to stretch across the zones. Thus, one can have both visual design and stretchiness.

    I miss that approach for web stuff. The current generation of web junk is clunky and wordy and anti-visual.

    Sure, the language was sometimes awkward, but that can be remedied.

  93. final void superClassMethod() {} //WO > RoR? by MacDork · · Score: 2, Insightful
    And if in, say, Java, how do you know the subclass didn't override superclass methods to do totally different things!

    Well, if you make a method final in Java, the compiler generates an error when you try to compile an overridden subclass method. That's one way to take care of the problem :-) Perhaps Ruby has something similar...?

    RoR, codegen.. from what I gather, there's nothing there that wasn't done years ago. It's called WebObjects. So far, no one has mentioned to me or pointed out anything RoR does in Ruby that WebObjects doesn't do already in Java. Meanwhile you loose the advantage of TONS of mature libraries written in Java. Am I missing something? Is there something particularly compelling about Ruby perhaps? I'm not trying to be condescending toward RoR or anything, but all the 'hype' I've read here about RoR was done a decade ago with WO. Plus, WO does a number of things that I haven't heard the RoR camp boasting, like deploying database connected apps over the internet directly to the desktop with WebStart/D2JC.

    Anyone care to enlighten me?

  94. you reveal your ignorance with your poor example by hardcorejon · · Score: 1

    There is _ONE_ string class in java, it's java.lang.String. It can be arbitrarily long, it can dynamically grow and shrink. It could have bells on its toes if you really wanted.

    A better example might be the existence of java.sql.Date when we already have java.util.Date, or the confusion-causing collection classes like Hashtable vs HashMap, and Vector vs ArrayList (the formers were part of java 1.0, the latters added later and generally preferable).

        - jonathan.

  95. and your point is? by hardcorejon · · Score: 1

    Instead of changing the parameter type String from Integer, why not override the method and declare an identically named one that takes the alternate parameter type? Then new code can use the new method, and old code doesn't break.

    What's the problem? Maybe you could provide a better example of whatever point you were actually trying to make.

        - jonathan.

  96. Re:you reveal your ignorance with your poor exampl by Sircus · · Score: 2, Interesting

    I'm not saying the other guy's right, but, er, you're revealing your ignorance a bit. ...it's java.lang.String...it can dynamically grow and shrink.

    No it can't, it's immutable. Strings can only create new objects which have grown or shrunk. Admittedly, the optimised implementation uses the same backing array for the new String, but it's still a new String. A StringBuffer (which in my books is another string class) can dynamically grow and shrink. In 5.0/1.5 there's now also StringBuilder.

    --
    PenguiNet: the (shareware) Windows SSH client
  97. Always the same story... by blais · · Score: 0

    It's always the same story: there is no silver bullet. Once your application will get "serious", you will have to occasionally dig down to the bare metal and debug at a lower level, optimize for performance, etc. And at that point you will need "real" knowledge. My advice: make sure you learn SQL, make sure you understand how the components work. If you're building the next amazon, forget about all that rapid app stuff (unless you're building a site for a friend which will get 2 visitors per day).

    1. Re:Always the same story... by Theatetus · · Score: 1
      Once your application will get "serious", you will have to occasionally dig down to the bare metal and debug at a lower level, optimize for performance, etc. And at that point you will need "real" knowledge. My advice: make sure you learn SQL

      So in your world, "SQL" means "bare metal"?

      --
      All's true that is mistrusted
  98. XSB superceded by Mercury w/tabling by Baldrson · · Score: 1

    I hadn't done this search for a while but just now I re-did it and discovered that the Mercury compiler now has XSB-style tabling. This is an important advance for practical logic programming.

  99. i agree, but i disagree by hardcorejon · · Score: 1

    Different tools for different people; different tools for different jobs.

    I could not agree more. But the important distinction here is that the decision of which tool to use is not solely a matter of personal preference. The particulars of the task at hand also come into play.

    It remains to be seen what range of applications RoR works best for - at first glance a wide range of webapps looks promising. The range of apps that Java is good for is fairly well known. Many folks are quick to point out java's shortcomings, but few would argue that Java is the best tool for _every_ job, and oftentimes the perceived shortcomings are actually just a misapplication of the tool. If you try to pound a nail in with a screwdriver, do you blame the screwdriver?

    The main problem I have with RoR is that the Ruby language is weakly typed. Automated refactoring tools that can rename methods, shuffle variables and methods around different scopes are very handy and very difficult to do in a highly dynamic language like Ruby. This is not to say that those dynamic attributes don't come in handy in some applications, but for maintaining a very large codebase, refactoring tools are a must-have.

    Developers who complain about 'I change this name and the compiler complains' must still be using vi or emacs to write code. IDEs like Eclipse or Intellij make this a moot point.

        - jonathan.

    1. Re:i agree, but i disagree by cynicalman · · Score: 1

      "The main problem I have with RoR is that the Ruby language is weakly typed."
      Wrong. Ruby is strongly typed. What makes things different than Java is that typing is dynamic, not static. So in Ruby, you can do this

      i = 1
      puts i.class # This prints "FixNum"
      i = "one"
      puts i.class # This prints "String"

      In Java you can't (variables are typed when declared.) So, the type can change, but it is strong.

      --
      the cynicalman - http://blog.geeksmithology.com
    2. Re:i agree, but i disagree by hardcorejon · · Score: 1
      Uh, I think this definition might help things out a bit (emphasis added):
      A strongly-typed programming language is one in which each type of data (such as integer, character, hexadecimal, packed decimal, and so forth) is predefined as part of the programming language and all constants or variables defined for a given program must be described with one of the data types. Certain operations may be allowable only with certain data types. The language compiler enforces the data typing and use compliance. An advantage of strong data typing is that it imposes a rigorous set of rules on a programmer and thus guarantees a certain consistency of results. A disadvantage is that it prevents the programmer from inventing a data type not anticipated by the developers of the programming language and it limits how "creative" one can be in using a given data type.
      Even leaving aside the obvious compile-time checking issue, how is Ruby strongly-typed if I can change the type of any variable reference willy-nilly? That's like programming in Java and declaring every variable as an instance of "Object". Sure you can shuffle Strings and Integers around all you want, but it does very little to help type-safety issues. - jonathan.
    3. Re:i agree, but i disagree by cynicalman · · Score: 1
      You might want to read this presentation from OSCON 2005 called "10 Things Every Java Developer Should Know About Ruby", especially this section, "Item #6 Objects are Strongly Typed not Statically Typed" (http://onestepback.org/articles/10things/item6.ht ml)

      The Java comparison is inappropriate, because while the subclass of the type pointed to by the reference might change, the reference remains the same -- the actual type doesn't change. So declaring everying as an Object is useless for doing any real work, because a String or Integer (or anything else) referenced as an Object must be cast in order to call subclass methods. This doesn't work in Java:

      Object o = "Hello, World";
      System.out.println(o.length());
      // This works:
      System.out.println((String) o).length());

      In Ruby, the actual type is changed, yet any behaviour not specific to the current type of the object is invalid. Hence the type is strong, but dynamic. You can't call "downto" on a String (or "downcase" on a Fixnum), because it doesn't make sense.

      --
      the cynicalman - http://blog.geeksmithology.com
    4. Re:i agree, but i disagree by hardcorejon · · Score: 1

      OK, I understand and agree that the Java "Object" analogy does not fit well for the Ruby situation.

      I'm just curious: With strongly-but-dynamically typed Ruby, is it possible to do static ("compile" time) type checking? If not, how can a function/method make any assumptions about what parameters are passed in and what methods/operations they support? Is it purely by convention, and enforced solely by unit tests? Is there an easy and reliable way to rename or rescope methods without resorting to a recursive grep (which might pickup identically named methods on other types)?

          - jonathan.

    5. Re:i agree, but i disagree by ibbey · · Score: 1

      As I said, "different people in different situations will sometimes choose different tools". For some jobs, Programmer A will choose Ruby, for others, he'll choose Java, for still others he may choose C++, Perl, or PHP. Another programmer in the same position might choose a different language for the same job. That doesn't mean that either of them were wrong, just that they have different preferences and priorities.

      You're right that Java has certain advantages that show up in certain domains of programming, just as Ruby does in others. That doesn't mean that it's a better language. Better, at least in this context, is absolutely subjective.

  100. Re:you reveal your ignorance with your poor exampl by hardcorejon · · Score: 1

    Yes, indeed you're correct.

    But, from a programmer's point of view, if I do:

    String x = "foo";
    x += "bar";

    Semantically, we can say that 'x' dynamically grew to hold a reference to the new string "foobar". Of course behind the scenes different object instances are created and/or shuffled around behind the String reference named 'x'.

    The _contents_ of the string is immutable, but semantically those contents can grow/shrink behind the object reference to them.

        - jonathan.

  101. Boxing by Stu+Charlton · · Score: 1

    The primitive / wrapper hassle is a minor annoyance, at best. And like .NET, there's the "autoboxing" feature in Java 5 that makes this more or less go away, though you may have to understand its own quirks (i.e. you get consistency at the expense of easy predictability).

    --
    -Stu
  102. Best post in thread by Stu+Charlton · · Score: 1

    The author may be very bright and have great insights in procedural programming, but he simply does not understand data modeling, or it was not taught to him in school, or he chose to ignore it when it was.

    I've been waiting all thread for someone to finally point this out. RoR is one of the most productive things to come out of the web programming community in a while, but its creator and community are doing a lot of damage to a very important discipline.

    The Rails community, containing many data management novices eager to avoid having to *think* (this is different than doing less work!), follows right along. Some of the stuff in the Rails mailing lists and blogs is quite silly and flies in the face of data management best practices.

    In fact, many people on the blogs are starting to say that there ARE no data management best practices, as data integrity is bunk, and the database shouldn't manage the meaning of the data. They point to the the whole integration database vs. application database distinction, but that ignores the risks you're taking when you create poor data structures for the sake of programmatic simplicity. And then there's the bigger observation that databases have been the most proven way to integrate systems over the past few decades; messaging works too but is much newer and arguably harder to get working properly.

    Then again, I'm an SOA advocate in my day job, so arguably this is where things are heading anyway. I'm around a lot of large organizations in recent years, and there are not very many "web + database" projects anymore; they've built them all. Now it's about integrating these silos as services, to improve the quality of data in the enterprise, consistency in experience, flexibility in business process, etc.. Whereas RoR just seems content with creating yet another layer....

    --
    -Stu
  103. Ok, we have a serious misunderstanding. by Some+Random+Username · · Score: 1

    Scaffolding is not a concept in rails, it is a single, very specific piece of functionality. Its when you use the actual "scaffold" function on your class. I never said the concept of generating code was flawed, I said rails scaffolding is not supposed to be used.

    1. Re:Ok, we have a serious misunderstanding. by Jack9 · · Score: 1

      My mistake. Shows what I know about Rails (0 practical experience using it). I stand corrected.

      --

      Often wrong but never in doubt.
      I am Jack9.
      Everyone knows me.
  104. Hype by oldCoder · · Score: 1

    Oh, but it's hype that has made Java into what it is today...

    --

    I18N == Intergalacticization
    1. Re:Hype by mrlpz · · Score: 1

      You mean the language all the "programati" or "architectati" are leaving in droves for things like Ruby and Python ? You don't say, really ? Let's put it this way, I've been around enough that I've forgotten more languages than care to remember.....and every single one of them......followed in like 10-12 year cycles of something like this:

      whispers....
      murmurs....
      then "talk"....
      then "hype"....
      then "furor".... ( No, not THAT kind of "Fu__her", you putz )
      then rumble....
      then talk.....
      then whisper...

      Most languages from the 80's/90's today are hovering around the rumble/talk stage, with things like C#, PHP, Ruby, Python scattered across the "hype" or "furor" stages. Sure, disagree with me on those points...but Lisp....now THERE was a language ( and STILL is ! ).

      Ask yourself....when was the last time you programmed a website in Snobol, eh ? Or Modula ? C'mon ....and for you C# bigots, forget C++ or Java, you owe more to OBERON-2, than you realize. Oy, but that would be expecting too much of some folks.

  105. Multiple humans editing a record by Anonymous Coward · · Score: 0

    I'm sure this pattern has a name, but I don't know what it is, so we'll try the verbose explanation.

    I have one record in a DB. I want people to be able to edit it and I want the results to be helpful if two people edit the same record at the same time - so that the second saver doesn't save over the first one. Does RoR have something to deal with this?

  106. "absolutely subjective" ?? is that possible? by hardcorejon · · Score: 1

    Even constraining our domain to the world of webapps, I disagree that language choice is an "absolutely subjective" decision. If I were building a simple 2-form webapp then Java would be absolute overkill, when PHP or RoR could get the job done 10x as fast.

    So in this case, there is some objectivity to it -- Java entails a certain amount of overhead that is just not worth if the situation doesn't demand it. No one would deploy an Oracle parallel server to run a 3-table database that had no transactional requirements.

        - jonathan.

  107. Which is why we use Catalyst instead by Anonymous Coward · · Score: 0

    We do rapid application development for the web using Catalyst (http://catalyst.perl.org/) - it's fast, it's MVC, and because it's perl we can leverage the whole of CPAN to avoid re-inventing wheels. It's also (with a little CPAN-fu) trivial to deploy on any host that supports FastCGI, and most of our clients already have enough in-house perl knowledge to be confident they wouldn't be sunk if we disappeared tomorrow.

    RoR has a great team behind it and an even better hype machine, but Catalyst simply does the job and does it well - and with mod_perl scales comfortably to huge application workloads.

  108. Re:you reveal your ignorance with your poor exampl by Sircus · · Score: 1

    Sure, but it only takes something as simple as...

    x="foo";
    y=x;
    y+="bar";


    ...to get down to the fact that it's a new object. This difference can crop up pretty easily when working with Strings...

    --
    PenguiNet: the (shareware) Windows SSH client