Slashdot Mirror


Ruby 1.9.1 Released

Janwedekind writes "Yuki Sonoda yesterday announced the release of Ruby 1.9.1 (Ruby Inside coverage with lots of links). The VM of Ruby 1.9, formerly known as YARV, was initiated by Koichi Sasada and has been in the making for quite some time. Ruby's creator Yukihiro Matsumoto has already presented many of the upcoming features in his keynote at RubyConf 2007. Most notably, Ruby 1.9 now supports native threads and an implementation of fibers. A lot of work also went into encoding awareness of strings. The 1.9.1 version is said to be twice as fast as the stable 1.8.7. It will take some time though until the majority of existing Ruby extensions get ported to 1.9."

226 comments

  1. Twice as fast... by XDirtypunkX · · Score: 0, Troll

    So now it's only "really slow" as opposed to "really really slow"? Ruby needs to look at some of the lessons learned by the various Smalltalk and JavaScript speed-up projects from over the years if they want to actually get competitive on performance.

    1. Re:Twice as fast... by Anonymous Coward · · Score: 5, Funny

      They don't need to be compettive on performance. They just need to improve performance to "barely tolerable slow" as opposed to "intolerably slow".

    2. Re:Twice as fast... by bstadil · · Score: 5, Informative

      Too busy to just google for 2 sec before spouting off?
      Here is jRuby using java VM , Maglev using Smalltalk VM , IronRuby using MS .Net , or pure Ruby Rubinius>Rubinius all aimed at among other execution speed.

      --
      Help fight continental drift.
    3. Re:Twice as fast... by Anonymous Coward · · Score: 0

      Uh, exactly what Javascript engine are you using that's faster than Ruby 1.9?

    4. Re:Twice as fast... by Anonymous Coward · · Score: 2, Funny

      all of them?

    5. Re:Twice as fast... by Anonymous Coward · · Score: 0

      Too busy to just google for 2 sec before spouting off?

      Clearly. Just look at the number of years that passed between your Slashdot registration dates. Can you imagine how busy he must have been to take that long to register?

    6. Re:Twice as fast... by Anonymous Coward · · Score: 0

      The guy was trolling, but he didn't say Javacript was faster than ruby, just that Ruby should learn from the improvements to javascript.

    7. Re:Twice as fast... by SanityInAnarchy · · Score: 3, Informative

      You know, you have a point. I think all dynamic languages could probably learn something from the recent Javascript speed-up projects...

      Except Ruby isn't slow.

      And yes, I am happy about it being twice as fast, because it was already fast enough.

      --
      Don't thank God, thank a doctor!
    8. Re:Twice as fast... by Foofoobar · · Score: 1

      So in other words... if you want something decent and fast, use Java???

      --
      This is my sig. There are many like it but this one is mine.
    9. Re:Twice as fast... by bstadil · · Score: 4, Informative

      Sorry it wasn't clear. No it is Ruby implemented to run on a Virtual Machine. You write your Ruby code as normal and it gets compiled to byte code that run very fast. This is how Java is fast. Ruby can in principle be as fast as Java. Ruby is not inherently slow just the current implementation is somewhat slow.

      --
      Help fight continental drift.
    10. Re:Twice as fast... by XDirtypunkX · · Score: 0

      Too busy knee jerking to actually respond to the criticism? None of those are the main release of Ruby. What I was commenting on was the fact that 1.9.1 itself is still slow as 2x improvement still isn't bringing it into line with a lot of other systems.

      The research that has been put into various Smalltalk/JavaScript implementations hasn't quite made it into the main release of Ruby yet. Unfortunately, this is still the one a lot of people are running their websites on. A speed up on the order of some of those JavaScript has been seeing lately in the main release of Ruby is going to deliver benefits that the more immature VM based releases of Ruby can't yet.

    11. Re:Twice as fast... by LarsWestergren · · Score: 4, Informative

      JRuby is an interpreter, written in Java. It does not compile Ruby to Java bytecode.

      Incorrect. I certainly DOES compile Ruby to Java bytecode. Read the blogs of Charles Nutter, John Rose and Ola Bini for more information.

      --

      Being bitter is drinking poison and hoping someone else will die

    12. Re:Twice as fast... by LarsWestergren · · Score: 2, Insightful

      So in other words... if you want something decent and fast, use Java???

      Pretty much, yes. Welcome to the 21st century.

      --

      Being bitter is drinking poison and hoping someone else will die

    13. Re:Twice as fast... by jcupitt65 · · Score: 3, Insightful
      Ruby 1.9 is roughly competitive with PHP in the Alioth Shootout (not a great benchmark I know, but interesting):

      http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=yarv&lang2=php

    14. Re:Twice as fast... by subreality · · Score: 4, Insightful

      Except that slideshow is comparing the performance of popular frameworks for different languages. So they're showing that Rails is an efficient framework. That's a perfectly valid point to make (the language makes it easy to write a better algorithm, or maybe the framework is just more efficient), but it doesn't say anything about how fast the code is executed.

      I switched from Perl to Ruby as my everyday sysadmin and glue language, and I use it pretty extensively. I love Ruby, but I won't try to handwave away its faults. In my usage, it's undeniably, dramatically, slower than Perl. We're talking order of magnitude here, not marginal stuff that only shows up in benchmarking.

      A script to parse a huge, complex data file sucks ten times as many CPU cycles to do the same work. For what I do, that's OK, because the ten minutes to run the job is completely dwarfed by the development time saved by using a sane language.

    15. Re:Twice as fast... by __aabvlw4075 · · Score: 1

      Certainly better performance is a Good Thing, everything else being equal, and in some projects execution speed is vitally important. For a great deal of purposes, however, Ruby's speed is more than adequate. Its benefits easily outweigh the cost of irrelevantly being slower than some other languages in such cases.

    16. Re:Twice as fast... by John+Allsup · · Score: 4, Insightful

      It has always been 'fast enough' for appropriate programming problems. If Ruby is too slow, you're in the wrong problem domain to use Ruby.

      Note that there is, and can never be, OneTrueLanguage(TM).

      Efficient development is all about playing to the advantages of the development tools available to you. Complaining about weaknesses is usually indicative of a lack of understanding.

      --
      John_Chalisque
    17. Re:Twice as fast... by Anonymous Coward · · Score: 0

      Why is it that every time some-ones' favourite interpreter is compared to a compiled language, speed is not an issue, and many arguments are given as to why not. Yet when it comes to comparing interpreted languages, suddenly speed becomes all important ?

    18. Re:Twice as fast... by jonaskoelker · · Score: 1

      So now it's only "really slow" as opposed to "really really slow"?

      It's really really simple: a speed improvement of a factor x means you multiply the number of "really"s by 1/x.

      Had it been three times as fast, it would have been merely "real slow".

      If you're ever reduced (hah!) to fractions of a single letter, just scale the ASCII value of that letter. So if it was 24 (=2*12) times as fast, it would be half an r, or "8 slow".

    19. Re:Twice as fast... by Bearhouse · · Score: 1

      It has always been 'fast enough' for appropriate programming problems. If Ruby is too slow, you're in the wrong problem domain to use Ruby.

      Note that there is, and can never be, OneTrueLanguage(TM).

      Efficient development is all about playing to the advantages of the development tools available to you. Complaining about weaknesses is usually indicative of a lack of understanding.

      Very true. Should not stop you working on them, (weaknesses) tho'. A lot of progress is driven by criticism - constructive or otherwise.

    20. Re:Twice as fast... by scientus · · Score: 0

      no ruby can be much faster than java:ruby is a language that promotes good coding, by making blocks a central part of the language. ruby is also not bloated and has a much smaller pane to optimize the performance of.

      Most apps are not factorials, etc--fast execution is more related to implementation and good coding. With 1.9 code execution is similar to java or python. Also, if you need fast implementations of specific repetitive algorithms then you can use a C library, something which ruby has a mature way of interfacing with.

    21. Re:Twice as fast... by Anonymous Coward · · Score: 4, Funny

      Being "roughly competitive" with PHP isn't saying much...

      Like saying "I'm basically as knowledgable as Joe the Plumber"

    22. Re:Twice as fast... by Mozk · · Score: 1

      I have a vast variety of [engines] where we [run] our [code].

      --
      No existe.
    23. Re:Twice as fast... by refrud · · Score: 0, Troll

      Total waste of time

    24. Re:Twice as fast... by XDirtypunkX · · Score: 1

      Of course, it's not going to match C, OCaml or even Java in terms of speed. Speed isn't a strengh of dynamic languages, but that doesn't mean it isn't important and it is a weakness relative to Ruby's direct competitors (other dynamic languages and other implementations of Ruby).

      Take the comparison of Ruby with Python on the language shootout:
      http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=python&lang2=ruby

      With a 2x increase there, Ruby is still behind Python (which isn't standing still) and not doing that well on memory usage either. That can be the difference between handling everything on one server, or buying two.

    25. Re:Twice as fast... by BerntB · · Score: 4, Informative

      I still do Perl.

      Half the reason is that Perl is a bit insane and breaks all language design rules -- but still works. That makes it fun. The other half is that the community is so good; CPAN is a result of that and, also, you don't have so much of that disgusting hype (like you just commented on); like you, I'd rather not be identified with a community doing that.

      Ruby do look sweet and Python seems usable (if a bit boring). But with the "Perl Best Practices" book becoming so popular and Moose (et al), I can't motivate a switch. The largest problem with Perl today IMHO is that it takes a bit more time and energy to learn.

      --
      Karma: Excellent (My Karma? I wish...:-( )
    26. Re:Twice as fast... by silverdr · · Score: 1

      It seems that you are one of those who never really used it for any serious work. If you had - you wouldn't put this kind of comment. Ruby has already been pretty fast _for what it is meant and used for_. Of course - extra speed gain never hurts but the speed (while highly welcome) has not been the most important problem in the 1.8 versions.

      I understand that you tried to be funny, insightful, informative, whatever with your First Post and there is not much time to seek insight knowledge before putting up the First Post...

      --
      Now, mod me down freely. My karma can't get any worse...
    27. Re:Twice as fast... by Anonymous Coward · · Score: 0

      The Ruby code used in the shootout isn't particularly good. I rewrote some of it as an exercise in Ruby 1.8, mostly just avoiding things like use of Bignum instead of Fixnum, really unnecessary String object allocation and really, really, really unnecessary use of closures, and it cut down the execution times to something like 1/3-1/10. Some people, if they have a new screwdriver(*) they will use it, even on a nail. Even better, I could use metaprograming for some stuff and then cut down the times in two problems to about 1/50. I should really post that code, but it's been a over year and I'm not sure where or if I have it.

      (*) I've used closures in Simula, Bignums in Python and functional programing like use of string objects in JavaScript. So although I'm still excited to have them all put together so nicely in one language, I've played around with them enough to know where they shouldn't be used. There are a lot of things that make Ruby a nice thinking language at the cost of execution time. But when you are done with your thinking, you can easily transform it to faster code, it usually improve readability too.

    28. Re:Twice as fast... by Anonymous Coward · · Score: 0

      The largest problem with Perl today IMHO is that it takes a bit more time and energy to learn.

      That, and that it

      breaks all language design rules

      Now, I use perl a lot for sysadmin things at work, and I love it. CPAN saves me a bundle of time when I need something more fancy than "look through text for pattern X, and do Y if you find it". But it's becoming increasingly difficult to find someone who also knows perl.

      It's become an unpopular language because (and this is my opinion, not a de facto list):

      • the amount of trolling the language recently has been seeing: start a perl thread on a forum and wait for the ruby fanclub
      • write once-read never scripts: yes, it's perfectly possible to write clean code in perl, but few people do, and to someone new to the language half of the shortcuts experienced programmers take look like the cat took a nap on the keyboard
      • OO programming in perl looks and feels like a hack: I used to use it a lot, and you can do all sorts of things in perl that breaks the OO-model. Having to use closures for making something "private" really doesn't contribute anything except confusion. Again, I'm not saying it's bad, it just feels kludgy compared to way some other languages handle OO.
      • the whole perl 6 thing: I've given up on perl 6. I'm much more inclined these days to learn a language like Python or ruby since they seem to have a broader audience these days instead of focusing on perl 6 (or the wait for perl 6).

      Lately I don't get to use that much perl anymore, so things may have changed a bit. When I use perl, I still use it the way I've been using it for the past couple of years. It's a neat language, and it gets the job done FAST once you're proficient with it, but it has a lot of things that I personally feel are flaws to the language.

      If only other languages had such an extensive repository like CPAN.

    29. Re:Twice as fast... by Fweeky · · Score: 1

      Um, it's pretty competitive against Python and PHP. I guess they're pretty much doomed against Smalltalk and JS too? Oh, wait..

    30. Re:Twice as fast... by John+Courtland · · Score: 2, Insightful

      What the hell are you talking about? None of what you said makes sense.

      --
      Slashdot is proof that Sturgeon's Law applies to mankind.
    31. Re:Twice as fast... by Paradise+Pete · · Score: 1

      Being bitter is drinking poison and hoping someone else will die

      I like that. Is it original?

    32. Re:Twice as fast... by Paradise+Pete · · Score: 1

      The research that has been put into various Smalltalk/JavaScript implementations hasn't quite made it into the main release of Ruby yet. Unfortunately, this is still the one a lot of people are running their websites on.

      So what if it is? I run my whole business on ruby. Speed of execution is not an issue even in the slightest. But what is an issue is that I can make improvements and additions very quickly. *That* speed is very important to me.

    33. Re:Twice as fast... by Paradise+Pete · · Score: 1

      Why is it that every time some-ones' favourite interpreter is compared to a compiled language, speed is not an issue, and many arguments are given as to why not. Yet when it comes to comparing interpreted languages, suddenly speed becomes all important ?

      Humans are lazy. We look for easy ways to compare things, even if the comparison is not actually valid. Comparing languages by their speed of execution makes little sense, but it can be boiled down to a number, and that makes it attractive.

    34. Re:Twice as fast... by Foofoobar · · Score: 1

      Ruby is not inherently slow just the current implementation is somewhat slow.

      No.. just it's last SEVERAL incarnations that have been slow. That and a bunch of empty promises of how it will be faster and more scalable. One of these days they may deliver but by that time the other languages will most likely hav doubled THEIR speeds.

      --
      This is my sig. There are many like it but this one is mine.
    35. Re:Twice as fast... by Lord+Bitman · · Score: 1

      ... This is how Java is fast.

      Java people always say Java is fast, but if Java is fast, why does EVERYTHING written in Java seem so slow? Do Java people just look at benchmarks and not ever look at real-world uses? This is a serious question. I'm constantly hearing that java is fast, and consistently seeing only (OpenOffice, Eclipse, ANY Java "applet" online) java being hideously slow?

      "If it walks like a very very slow duck..", etc.

      --
      -- 'The' Lord and Master Bitman On High, Master Of All
    36. Re:Twice as fast... by thegux · · Score: 0

      This is completely untrue.

    37. Re:Twice as fast... by BerntB · · Score: 1

      We don't really disagree, but I'd quibble with a few points (In OO, the Moose/Mouse stuff seems to beat OO for all mainstream languages as of today; what a twist! Closures are cool and useful. Also, Perl 6 -- at last -- seems to grow into something really, really exciting.)

      As I wrote, a good part of the reason I like Perl are the smart and interesting people in the community; I'd be plain embarrassed to stand with a crowd that do that kind of hype. (I'm not really sure it's the Rubyists that are those boring trolls, btw?)

      --
      Karma: Excellent (My Karma? I wish...:-( )
    38. Re:Twice as fast... by An+Onerous+Coward · · Score: 1

      I think the reason for the comparison is:

      1) both are scripting languages.

      2) People just assume that PHP is scalable. It runs Wikipedia, and lots of other huge sites. If Ruby can be compared favorably to PHP, then it's hard to argue that it's "too slow" to base a usable framework off of.

      3) Rails people tend to have a bit of a grudge against PHP people. Play nice, children!

      --

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

    39. Re:Twice as fast... by El+Icaro · · Score: 1

      Apps like Eclipse or OpenOffice are pretty massive though. You can argue other apps with similar functionality (Office, Visual Studio) are just as big and are much faster, but they have custom memory management and aren't compiled from bytecode. It's the price of running platform-independent software.
       
      Oh yeah and I think OpenOffice doesn't run on java, just *with* it for extended functionality. The whole system is p bad though.

    40. Re:Twice as fast... by Frizzle+Fry · · Score: 1

      It means that people who rely on PHP can no longer use speed as a reason for continuing to use it.

      --
      I'd rather be lucky than good.
    41. Re:Twice as fast... by chthonicdaemon · · Score: 1

      The ruby 1.9 is to python roughly as Java -server is to c using gcc (ratio of about 1.5). This is not "totally unusable" when comparing Java to C. The interpreted languages are all within one order of magnitude slower than the compiled languages. This does not change much, and people are still happy to use interpreted/dynamic languages because of the increase in development agility and lower time to solution.

      --
      Languages aren't inherently fast -- implementations are efficient
    42. Re:Twice as fast... by RegularFry · · Score: 1

      ...and currently modded "Informative." Yay Slashdot.

      --
      Reality is the ultimate Rorschach.
    43. Re:Twice as fast... by RAMMS+EIN · · Score: 1

      ``speed (while highly welcome) has not been the most important problem in the 1.8 versions.''

      Actually, for me it is. Speed, unpredictable performance, and the huge memory overhead of (what should be) small objects. Note that these are all implementation issues; all can be improved without having to change the language proper.

      --
      Please correct me if I got my facts wrong.
    44. Re:Twice as fast... by try_anything · · Score: 1

      OpenOffice was big and slow long before it accumulated a nontrivial amount of Java code. The OpenOffice wiki lists exactly which functionality depends on the JRE. I don't see anything performance-critical in there. (Oh, and how did I know that? Because I've seen your argument debunked so many times on Slashdot it isn't even funny.)

      As for Eclipse, I really don't understand. I have used Eclipse to write Eclipse RCP apps, and it's pretty miraculous the way it handles its own source code -- thousands of source files in many dozens of packages. If you compare IDEs by how quickly they pop up the "Print..." or "Save As..." dialogs, then Eclipse might rank near the bottom, but on large projects, I worry more about the performance hit of navigating, compiling, searching, and refactoring thousands of files. Eclipse does very well by those standards.

      Eclipse support for C++ sucks ass compared to its Java support, though. If you tried developing C++ code in Eclipse then I'm sure it disappointed, but the problem there is not Java but the fact that C++ is not a big development priority for Eclipse.

    45. Re:Twice as fast... by layeronline · · Score: 1

      Ruby still beats ASP.NET and Flex for speed and style, and it runs on Linux!

    46. Re:Twice as fast... by SanityInAnarchy · · Score: 2, Interesting

      Except that slideshow is comparing the performance of popular frameworks for different languages.

      I believe it also does a comparison of a raw Rack request versus a non-cake PHP page.

      I won't try to handwave away its faults.

      Neither than I -- only pointing out that most people aren't even doing benchmarks. It's just accepted that "Ruby is Slow". I'm not saying it's fast, but I am saying that when you say things like this:

      We're talking order of magnitude here, not marginal stuff that only shows up in benchmarking.

      It might be nice to have some simple examples and numbers to back that up -- besides just factorial. They'd also be great to establish this point:

      For what I do, that's OK, because the ten minutes to run the job is completely dwarfed by the development time saved by using a sane language.

      If you're comparing a ten-line Ruby script with a hundred-line Perl script, and the Perl script is ten times faster, that would pretty clearly show the advantages of each language.

      --
      Don't thank God, thank a doctor!
    47. Re:Twice as fast... by LarsWestergren · · Score: 1

      >>Being bitter is drinking poison and hoping someone else will die

      >I like that. Is it original?

      Unfortunately not. Friend had it in his mail signature, he saw it (or something like it) somewhere on the net, couldn't remember where.

      --

      Being bitter is drinking poison and hoping someone else will die

    48. Re:Twice as fast... by spinkham · · Score: 1

      JRuby has an intrepreter, written in Java. It also has a Just In Time compiler to JVM bytecode. It also has a Ahead of Time compiler to JVM bytecode, just like Java.

      --
      Blessed are the pessimists, for they have made backups.
    49. Re:Twice as fast... by SanityInAnarchy · · Score: 1

      It's worth mentioning, that slideshow actually shows that Rails is much more efficient than CakePHP, but also that Merb is much more efficient than Rails.

      That distinction is going away -- Merb is being merged into Rails (Merb 2 is Rails 3). I'm just pointing out -- you said Rails is an efficient framework, and it's about to become much more efficient, at the same time as Ruby just got twice as fast.

      --
      Don't thank God, thank a doctor!
    50. Re:Twice as fast... by HAWAT.THUFIR · · Score: 1

      JRuby has an intrepreter, written in Java. It also has a Just In Time compiler to JVM bytecode. It also has a Ahead of Time compiler to JVM bytecode, just like Java.

      If it's compiled, does that mean that it would suddenly be appropriate to use generics? I suppose it's more complex than that?

    51. Re:Twice as fast... by beegeegee · · Score: 1

      Just wanted to see if I could jump onto a Joe The Plumber thread. I've never thought about Joe the Plumber and PHP at the same time but okay, yeah, that works.

    52. Re:Twice as fast... by subreality · · Score: 1

      It might be nice to have some simple examples and numbers to back that up -- besides just factorial.

      I did... I'm not kidding when I say my parser is ten times slower.

      If you're comparing a ten-line Ruby script with a hundred-line Perl script, and the Perl script is ten times faster, that would pretty clearly show the advantages of each language.

      That'd be a 100x speedup, per line. :)

      It's not that extreme. In my use, Ruby's only 1.5x as dense as good clean Perl (use strict; not using default variables; not hacking and overloading data; etc). My Perl is strictly procedural with lots of very tight, fast loops, and shallow, unabstracted data structures.

      My Ruby is very OO with a great many very short methods (and resultant deep call stacks), rich objects, and highly abstracted data. The ease of maintenance - not the LOC count - is what makes it faster to code... And I'm clearly handing a lot of extra work to the interpreter.

      Clearly I could transliterate the algorithms between the two languages, and the speed difference would narrow. You can write BASIC in any language... I've written Perl in Ruby. But that doesn't make the basis of a good benchmark. I think it's more meaningful to compare code written like the language was meant to be used. Both of the coding styles above are what I find comes naturally to me when writing in each language.

  2. hmmm... by bsDaemon · · Score: 3, Funny

    No wifi, garbage collection not as good as Lisp; Lame.

    1. Re:hmmm... by Narmi · · Score: 2, Informative

      No wifi, garbage collection not as good as Lisp; Lame.

      Why was this modded as flamebait? And what's that WOOSHing sound?

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

      Mods aren't in the mood for old jokes today, I take it?

  3. I am afraid, there is lack of direction for Ruby by bogaboga · · Score: 2, Insightful

    According to this video , there is lack of direction. This is by Dave Thomas , and important figure in the Ruby world.

    On a side note, I will use PHP on my servers before touching Ruby since I see no advantages for using it over PHP.

  4. Ruby vs Python by Anonymous Coward · · Score: 0

    I have only used Python and don't know anything about Ruby (I only heard that it has a very nice syntax), anyone would like to give me a good comparison between them?

    1. Re:Ruby vs Python by nicknicknick · · Score: 4, Insightful

      Python is skiing and ruby is snow boarding. One's more fun than the other but they are more similar than different.

    2. Re:Ruby vs Python by mehemiah · · Score: 3, Informative

      that is asking for a bloody long post that will boil down to. The ruby syntax is cooler yet more obscure, the vm is slower but just because there is less money behind it. It must be nice to have a big company like Google behind you. *scoffing at the php fans and their Zend touting* (PS, im a python fan) when I say that the syntax is cooler, i give the example that the for loop is implemented as a call to an iterator so you get this http://refactormycode.com/codes/2-ruby-simple-loop.

    3. Re:Ruby vs Python by grumbel · · Score: 1

      Ruby uses explicit 'end' to mark blocks, Python doesn't. Ruby uses OOP for pretty much everything while Python doesn't (i.e. [].length vs len([], [1,2,3].each{|i| ...} vs for i in [1,2,3]:). Python follows a philosophy of doing something exactly one way, while Ruby doesn't have a problem allowing multiple ways to accomplish the same thing. Ruby uses $ to mark global variables, @ to mark member variables, Python uses explicit 'self.' to do it.

      Overall however they look and feel pretty similar.

    4. Re:Ruby vs Python by try_anything · · Score: 4, Interesting

      Ruby is meant to be more comfortable and expressive in the hands of a programmer than Python. That means more power and more elegance, but also less regularity, more features, and more emphasis on conciseness instead of readability and learnability. (Python is surprisingly readable for non-Python programmers, which I have found handy more than once.)

      Personally, I use Python at work because I'm terrible at remembering linguistic features and syntax. At work almost every neuron in my brain is devoted to C++, so for everything else I need a nice, simple, even stupidly simple language that complements C++. Plus if someone inherits my Python code and says *gasp* "But I don't know Python!" I can honestly say, "Don't worry, you have nothing to worry about. You can learn it in a couple of days."

      People tell me Ruby is more natural and expressive, and I believe them, but if Python ever lets me down I'm skipping straight to the Red Pill, aka Lisp, which I have enjoyed recreationally on occasion. (I keep some spare neurons for myself for fun. Don't tell my boss.)

    5. Re:Ruby vs Python by niteice · · Score: 1

      Ruby doesn't have a problem allowing multiple ways to accomplish the same thing.

      Big disclaimer: Perl does as well. Ruby differentiates itself here by disallowing infinite ways.

      --
      ROMANES EUNT DOMUS
    6. Re:Ruby vs Python by Anonymous Coward · · Score: 0

      Uh, python has iterators:
      print range(1,11)

      Granted, maybe it isn't as readable (see: "cool") as Ruby's:
      (1..10).each { |i| puts i }

      That was sarcasm.

    7. Re:Ruby vs Python by John+Whitley · · Score: 5, Interesting

      Here's my take, having used both languages in anger. First off, let me call out a number of similarities between these languages. They're both OO, dynamic, and provide reflection capabilities (useful for meta-programming). They've both been influenced by functional languages. They both have active, vibrant user communities. Both have many open-source and shipping commercial applications that leverage or are fully built on these languages. While there are notable syntactic differences, I find that there's a certain shared "feel" between Python and Ruby.

      Now I'll call out the differences I find interesting. Python's import model (akin to #include for you C folk) is stronger than Ruby's require when it comes to larger applications. By "stronger", I mean that it's more explicit and therefore provides greater assurance against unintended effects from referencing a different module/class/object than you intended. This is a two-edged sword, since Ruby's code loading approach is less verbose and affords the construction of tools like Rails' Dependencies module which automatically finds code via a convention-over-configuration model. (e.g. calling require is never needed for the main application code of a Rails application if you just follow the file vs. class naming conventions -- this is *very* handy, IMO.)

      I'm big on powerful abstractions in programming languages. On this count, I find that Ruby wins hands down. The Python community has had a muddled approach to some key areas that Ruby had early clarity on via lessons learned from Smalltalk. Specifically, Ruby blocks are a single great primitive that covers the ground of a number of separate, less powerful entities in Python. Blocks are nothing more or less than anonymous functions, aka "lambdas", but their beauty lies in their syntatic integration. Consider the Ruby iterator pattern:
      a = [3,4,5]
      a.each do |x|
      puts x
      end

      The do ... end construct is a block. a is a Ruby Array object. The conventional iterator method each calls the block once for every element in order, as you'd expect. The neat thing here is that it's easy and natural to implement your own custom version of each for your classes. By defining this one method, and including the mixin module Enumerable on your class, you get definitions for a bunch of other useful standard collection methods such as map, find, select/reject and so on.

      Now, Python provides for the special __iter__ method to allow user-defined classes to support iteration. But Ruby's block-based mechanism is fully general and available to the Ruby programmer. Blocks' utility goes beyond iteration, into a wide variety of other cases where anonymous functions are useful. Some motivating examples may be helpful. Another one from Ruby's standard library:
      File.open('foo.txt','w') do |f|
      f.write(some_content)
      end

      This illustrates the Ruby idiom for resource cleanup. Here we're guaranteed that the file will be closed after the block runs. The implementation of open isn't magic, it can be expressed (**simplified slightly) as:

      class File
      def File.open(name,mode)
      file = File.new(name,mode)
      if block_given?
      begin
      yield
      ensure
      file.close
      end
      else
      return file
      end
      end
      end

      And the list of uses goes on and on. Blocks are a foundation component that makes Ruby well-suited for writi

    8. Re:Ruby vs Python by _merlin · · Score: 1

      That doesn't do the same thing at all, and won't do the same thing in the incompatible Python 3 as in Python 2. The Python equivalent to that Ruby would be:
      for i in range(1,11): print i

      The Python is more readable, but the operation of Python's range(1,11) is a bit less obvious than Ruby's (1..10).each IMO.

    9. Re:Ruby vs Python by Anonymous Coward · · Score: 0

      How about..

      Ruby looks more like line noise than line noise.

      Python is fun to program and powerful

    10. Re:Ruby vs Python by jonaskoelker · · Score: 2, Insightful

      [ruby is more OOP than python:] [].length vs len([]), [1, 2, 3].each vs for i in [1, 2, 3]

      Given my understanding of OOP, those are not particularly good examples.

      len([]) is equivalent to [].__len__, a method invocation on the object in question. Different classes can define different __len__ methods.

      for i in some_object calls some_object.__iter__ behind the scenes; same thing again: a method with different definitions across different classes.

      What defines OOP is not where you put the dot, but what the dot means, which roughly speaking is the method lookup in a vtable. Ruby and Python both do that, so they're both OO. Python just puts a little syntactic (and semantic) sugar on it.

      Something I'm more likely to agree with: Python and Ruby are both more OO than C++ with respect to the collection classes.

      Why is that? Because (for example) vector.size and set.size aren't overridden versions of (a hypothetical) collection.size.

      In Haskell parlance (note: "class" means two different things in C++ and Haskell), the code

      template <T> int foo(const T& t) { return t.size(); }

      uses class-bound polymorphism with inferred classes. Meaning that the set of types T for which the code is valid is the class of types that have a size method. The inferred-ness (roughly speaking) means that you don't write template <T extends has_a_size_method> ...

      If you still believe Ruby is more OOP than Python, could you point out either (1) another example, or (2) why you disagree with my thinking?

      I hope one or more of us can learn something from this discussion :)

    11. Re:Ruby vs Python by Jane+Q.+Public · · Score: 1

      It's much harder to hurt yourself badly on a snowboard... but of course you still can if you really try.

    12. Re:Ruby vs Python by grumbel · · Score: 1

      If you still believe Ruby is more OOP than Python, could you point out either (1) another example, or (2) why you disagree with my thinking?

      The difference is that Ruby is OOP from the start and through and through, while Python get stuff patched in a little bit at a time with every new version. See Pythons print-statement vs Ruby puts for example.

      OOP aside, another difference worth mentioning between Ruby and Python is that in Ruby the () for function calls are optional. So [].length works just as well as [].length().

    13. Re:Ruby vs Python by ubernostrum · · Score: 1

      The difference is that Ruby is OOP from the start and through and through, while Python get stuff patched in a little bit at a time with every new version. See Pythons print-statement vs Ruby puts for example.

      You really need to work on your form; this is at best a 2 out of 10 on the Ruby/Python trolling scale. Generally, you want to pick something that's subtly false, or which requires deep knowledge of the topic to expose the problem with the assertion, not something which is known to be false by folks who have even cursory familiarity with the subject.

    14. Re:Ruby vs Python by Anonymous Coward · · Score: 0

      Now, I'm not familiar with Python but I'd say you're trolling. Then again, your complete post is content-free except for some handwaving about "deep knowledge" and "cursory familiarity".

      Take a look at Python's simple print statement and tell me with a straight face that it's an OO method instead of a parser feature. Contrast this with Ruby's Kernel#print statement, which is treated as a simple member function call instead of a language construct.

      The fact that method calls (assert, print and del) are included in the language syntax, means that Python is not (yet) fully OO.

    15. Re:Ruby vs Python by Anonymous Coward · · Score: 0

      If you had read the GP's link, you would have found that the shortest Ruby implementation would be p *1..10.

      By the way, what's that range(1, 11)? Python doesn't do inclusive ranges?

    16. Re:Ruby vs Python by AlXtreme · · Score: 1

      The fact that method calls (assert, print and del) are included in the language syntax, means that Python is not (yet) fully OO.

      This line of reasoning is moot. Kernel is automatically required in Ruby, so the Kernel method calls are similarly included in the language syntax. Not to mention that a lot of methods Kernel has are put in separate modules in Python (exec, system, sleep, rand) or are methods of objects (split, chomp), so you could argue that Ruby is less OO than Python.

      But either way, as I said, this argument is moot. Even if Python has automatically included methods instead of a single Ruby class of which all methods are included, so what? In Python you can override the few included methods (import my_pretty_print as print), in Ruby you can override your Kernel object and the methods you want to replace. In both languages it is (rightfully) bad form to do so and discussing the OO-ness of a language on such a level is as pointless as comparing dick-lengths.

      Remember, it's how you use it that counts.

      --
      This sig is intentionally left blank
    17. Re:Ruby vs Python by gatkinso · · Score: 4, Insightful

      One has to wonder if you actually ski or snowboard. Other than the fact that they are both done on snowy downhill slopes, there is no similarity.

      --
      I am very small, utmostly microscopic.
    18. Re:Ruby vs Python by Anonymous Coward · · Score: 0

      This illustrates the Ruby idiom for resource cleanup. Here we're guaranteed that the file will be closed after the block runs.

      Python has the with syntax for this. The equivalent to your file-writing example would be

      with open('foo.txt', 'w') as f: f.write(some_content)

    19. Re:Ruby vs Python by Anonymous Coward · · Score: 0

      So lack of parser features is a sign of an OO language?

      As was said OO isn't about where you put the dot, but what it means. print just makes calls to the write method of the output. Just syntactic sugar, like the for statement.

    20. Re:Ruby vs Python by makapuf · · Score: 4, Funny

      you know, bad analogies are like a wooden banana.

    21. Re:Ruby vs Python by makapuf · · Score: 1

      I agree with you, except that :

      len() is a shortcut for the __len__ method, which you can redefine.


      >> [].__len__()
      0

      there is not do() method on iterables, however. (I think in this case it's more readable, but it can be debated)

    22. Re:Ruby vs Python by Fweeky · · Score: 1

      Wow, what does line noise look like in your reality?

      class Foo
        def moo(bla)
          bla.map {|x| x.frob }
        end
      end
       
      class Foo:
        def moo(bla):
          return [x.frob() for x in bla]

      Nope, I'm pretty sure neither of those look like line noise.

    23. Re:Ruby vs Python by ubernostrum · · Score: 4, Informative

      Then again, your complete post is content-free except for some handwaving about "deep knowledge" and "cursory familiarity".

      ...snip...

      The fact that method calls (assert, print and del) are included in the language syntax, means that Python is not (yet) fully OO.

      Well, actually understanding what's going on does require a bit of knowledge of the way the languages work, but my point was that it's irresponsible to go from an assertion like "up until Python 3.0 print was a statement" to "Python isn't really object-oriented" or "Python's OO is just bolted on", because even a basic understanding of how Python works shows that to be false. Let's consider an easy example, a simple function which adds two numbers (Slashdot's comment system will eat the indentation of the function body, but that's neither here nor there):

      def add(x, y):
      return x + y

      You might call this function by writing add(2, 3), which would return 5. That turns into a method invocation, delegating to the __call__ method of the function, which is an object: add.__call__(2, 3). And that, in turn, expands into an invocation of the __call__ method of the class of the function object, with the function object passed as the first argument to get the self reference, and the rest of the arguments following: types.FunctionType.__call__(add, 2, 3) (all functions in Python are instances of FunctionType, which is accessible through the types module if you ever have a need to do things manually without resorting to Python's function-definition syntax).

      From just this simple example it's clear that the object-orientation really does go all the way down, and that the existence of the print statement in older Pythons was a "bolted-on" wart of an OO language rather than being the other way around. The same is true for the other "special" statements in Python; these are not vestigial remnants of some non-OO language which got an object system tacked on, they are bits which were added on to an OO language for pragmatic reasons (print was turned into a function in Python 3.0, but assert and del, remain as special cases).

      This also reveals a few interesting points of Python/Ruby comparison:

      • Just as many things which appear to be "standalone" functions in Ruby are actually methods on Kernel, which is implicitly available everywhere, many things which appear to be "standalone" functions in Python are actually members of various modules (and are exposed at the toplevel through Python's implicit __builtins__ module, which also provides a handy way to access the original objects if they're being shadowed by something user-defined; if a name is not found in local scope, any enclosing scope or global scope, __builtins__ is the last place Python will check before raising a NameError).
      • But, Python's style of OO is different than Ruby's; Ruby has a message-passing OO system, where there really are no "method calls", just objects which respond to messages of particular names (the syntax hides this somewhat, but if you poke at it you'll see this is how Ruby does it), while Python has a method-invoking OO system. This is why Python requires parentheses for function and method calls: the parentheses are the syntax which invokes the __call__ method of a callable object, just as, for example, "/" is the syntax which invokes the __div__ method of a (numeric, or number-emulating) object. In this sense the parentheses can be thought of as an operator of slightly higher-than-normal complexity (they are not actually an operator in the sense of being recognized as such by Python's lexical analyzer, however, because parentheses are used for other purposes depending on context).
      • Although both languages are object-oriented a
    24. Re:Ruby vs Python by Moleculo · · Score: 1

      Python's range() makes more sense if you look at it without an explicit starting value. range(5) returns [0, 1, 2, 3, 4] -- the legal indices for a list of five items.

    25. Re:Ruby vs Python by Sandor+at+the+Zoo · · Score: 1

      Yeah, other than the fact that they're both winter-time leisure activities involving strapping one or more long pieces of fiberglass to your feet, in order to make your way down a snowy slope, they're nothing alike!

      And the parent got modded "insightful"? Sheesh.

    26. Re:Ruby vs Python by Just+Some+Guy · · Score: 1

      Consider the Ruby iterator pattern:

      a = [3,4,5]
      a.each do |x|
      puts x
      end

      Having not used Ruby, I've never quite gotten why this is so special. The Python equivalent would be:

      for x in a: print x

      It's not creating an anonymous function, but it's doing the same work otherwise. Can you give an example of why the Ruby way is better? I'm asking genuinely; I'd really like to see what makes this cool.

      The neat thing here is that it's easy and natural to implement your own custom version of each for your classes. By defining this one method, and including the mixin module Enumerable on your class, you get definitions for a bunch of other useful standard collection methods such as map, find, select/reject and so on.

      What does that buy you over Python's list comprehensions or generator expressions?

      --
      Dewey, what part of this looks like authorities should be involved?
    27. Re:Ruby vs Python by johanatan · · Score: 0

      I do both and disagree--they are similar.

    28. Re:Ruby vs Python by ultrabot · · Score: 1

      Specifically, Ruby blocks are a single great primitive that covers the ground of a number of separate, less powerful entities in Python.

      Blocks are covered by generators and with-statement. They are separate, but certainly not less powerful (and most Python fans would argue they are more intuitive).


      a = [3,4,5]
      a.each do |x|

      Yeah,


      for x in a:
          print x

      is so much less readble ;-).

      The neat thing here is that it's easy and natural to implement your own custom version of each for your classes.

      Yeah, and it's every bit as natural to implement python generators.

      Now, Python provides for the special __iter__ method to allow user-defined classes to support iteration. But Ruby's block-based mechanism is fully general and available to the Ruby programmer.

      ... generators again ...

      Blocks' utility goes beyond iteration, into a wide variety of other cases where anonymous functions are useful. Some motivating examples may be helpful. Another one from Ruby's standard library:
      File.open('foo.txt','w') do |f|

          f.write(some_content)
      end

      This illustrates the Ruby idiom for resource cleanup. Here we're guaranteed that the file will be closed after the block runs. The implementation of open isn't magic, it can be expressed (**simplified slightly) as:

      This is why Python has "with" statement now. Can you bring up something that is *not* covered by with statement or generators? No?

      I know this is a bad idea on ruby fanboy thread, but all of this post is just a strawman that is reminiscent of typical rubyhink (i.e. comparing ruby against an obsolete version of Python).

      Ruby guys should stick to comparing ruby against Java, it will be a much easier crowd to attract. People familiar with Python are typically much less impressed by these antics.

      --
      Save your wrists today - switch to Dvorak
    29. Re:Ruby vs Python by Anonymous Coward · · Score: 0

      What you're describing violates the "explicit is better than implicit" idiom in python. I'd tend to agree with python's take.

      In that ruby code, depending on the context, File.open() behaves radically different, returning the file in one case and ensuring closure of it, or simply returning the file handle. Thats rather presumptuous. I can easily imagine the need to open it without wanting to close it when the block is done - that behavior should be -explicit-.

      And, fwiw, python has the `with` statement, which essentially is the block_given=True case, allowing the with'd object to run custom entering and exiting code.

    30. Re:Ruby vs Python by DragonWriter · · Score: 1

      It's not creating an anonymous function, but it's doing the same work otherwise. Can you give an example of why the Ruby way is better?

      IMO, Ruby's use of blocks is simpler, cleaner, and more elegant than the variety of Python techniques that cover different parts of what Ruby does with blocks. But, largely, its subjective.

    31. Re:Ruby vs Python by Anonymous Coward · · Score: 2, Funny

      they're hard to eat?

    32. Re:Ruby vs Python by Anonymous Coward · · Score: 0

      Well, you don't have to be going down a slope to ski. Which also means it doesn't have to be a leisure activity (though it's fun), it's a viable means of transportation.
      My god, this analogy is starting to make more and more sense!

    33. Re:Ruby vs Python by HiThere · · Score: 1

      Actually, Python's OO was pretty much "just bolted on", but that happened several iterations of the language ago. Somewhere before 1.4. Possibly before 1.0. (I wasn't there.) As of 1.4, however, the bolting on process was still pretty evident. It's become less and less so with each iteration, until now the interface is pretty smooth. You can still see a few cracks here and there, though possibly with Python3 those will have disappeared.

      Python isn't, and never tried to be, Smalltalk. literal numbers haven't been objects. (Possibly they are as of Python3.) This has been for the sake of efficiency, but it's lead to several cracks in the syntax, and many special cases. (Not as many as C++, though. Not nearly as many!)

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    34. Re:Ruby vs Python by f0rk · · Score: 1

      I do both and disagree--they are similar.

      Programming in python and ruby, or snowboarding and skiing ?

    35. Re:Ruby vs Python by try_anything · · Score: 1

      Python doesn't do inclusive ranges?

      It's quite handy for zero-based indexing. It's also convenient for splitting a big list into a bunch of little ones:

      [a, b) = [a, a1) union [a1, a2) union [a2, a3) union [a3, b)

    36. Re:Ruby vs Python by spiralx · · Score: 1

      Literal numbers have been objects since Python 2.2, which was released on the 21st December, 2001.

      >>> dir(4)

      ['__abs__',
        '__add__',
        '__and__',
        '__class__',
        '__cmp__',
        '__coerce__',
        '__delattr__',
        '__div__',
        '__divmod__',
        '__doc__',
        '__float__',
        '__floordiv__',
        '__format__',
        '__getattribute__',
        '__getnewargs__',
        '__hash__',
        '__hex__',
        '__index__',
        '__init__',
        '__int__',
        '__invert__',
      etc.

      You can create subclasses using class foo(int). Everything is an object in Python.

    37. Re:Ruby vs Python by johanatan · · Score: 0

      All of the above actually. :-) But, I was responding to the remark about skiing and snowboarding being dissimilar in specific. I actually thought the analogy to skiing/snowboarding was pretty accurate too.

    38. Re:Ruby vs Python by Anonymous Coward · · Score: 0

      So having 3 weaker language constructs to do the work of one more powerful one is a good thing now? I have no stake in the Ruby/Python "war" but that strikes me as odd.

    39. Re:Ruby vs Python by ubernostrum · · Score: 1

      Actually, Python's OO was pretty much "just bolted on", but that happened several iterations of the language ago. Somewhere before 1.4. Possibly before 1.0.

      No, the OO has been there from day one; Python 0.9.0, the first public release, was an object-oriented language.

      What you may be getting at is the fact that originally Python had two type hierarchies, similar to the way .NET and Java still distinguish between "primitive" types ("value types" on .NET IIRC), which include things like numbers, and everything else; hence on those platforms some types have to be explicitly or implicitly wrapped ("boxed") in objects for certain use cases. This doesn't change the OO tenor of the language, really (the biggest stumbling block was simply that the primitives couldn't be subclassed directly, so workarounds were provided to allow user-defined classes with the correct behavior), and the unification of those two hierarchies started a long time ago; everything you'll interact with in Python today is derived from the base object, which is one definition of OO (but, importantly, not the only such definition). A few years ago I heard Guido describe it by saying that in Python, everything is an object but not everything is necessarily an instance of a class (something that's actually been changed now, since everything derives from object these days), which is fine by me.

      So maybe it comes down to someone's personal definition of "object oriented", which is of course possible given how many definitions of the term there are, but for general statements about types of languages I don't see any reason to say Python isn't or wasn't "object oriented" (unless your personal definition is one of the extreme ones which basically only admits Smalltalk, in which case that's your problem and not Python's).

      Meanwhile I think I've shown pretty clearly that Python is thoroughly object-oriented and that the OO is so deeply embedded in the language that claims of being "bolted on" just don't hold up.

    40. Re:Ruby vs Python by HiThere · · Score: 1

      That would explain the "cracks" I noticed. I haven't bothered to understand Python very deeply. (Well, to remember the pieces I didn't use.)

      I sort of remember that I knew what you said when I was first learning Python, but that was a long time ago, and I haven't used it consistently enough to remember that kind of detail (i.e., the details that don't affect the code I was writing).

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    41. Re:Ruby vs Python by mehemiah · · Score: 1

      quite right. Cool being a double edge sword. obscure means less readable here. It also doesn't help my programing that there are so many dam ways to do it.

  5. Re:I am afraid, there is lack of direction for Rub by Foofoobar · · Score: 1

    Rubys speed and scalability hasn't compared in the past but each iteration I always try to re-evaluate and give it another shot. The only argument for it in the past for web dev is RAILs and there are plenty of MVC frameworks for PHP now including PHPulse, Cake and Codeigniter.

    My company tried to make the switch and could find enough developers, could find enough module support and just couldn't get the same functionality for RUBY as with languages that have larger communities. Plus under large loads, it buckled and we ended up having to rely upon the same PHP codebase to get the job done anyway.

    But again, a new iteration may mean improvements and who knows, they may have made some positive changes this time. Naturally it won't have all the support of more mature languages but all I expect is for it to be able to scale as well and handle page loads as well before I'm switching languages.

    --
    This is my sig. There are many like it but this one is mine.
  6. Re:I am afraid, there is lack of direction for Rub by Chandon+Seldon · · Score: 5, Insightful

    On a side note, I will use PHP on my servers before touching Ruby since I see no advantages for using it over PHP.

    Choice of programming language actually matters, and dismissing languages you haven't used much is foolhardy. If this isn't obvious to you, this article may prove enlightening.

    --
    -- The act of censorship is always worse than whatever is being censored. Always.
  7. Re:I am afraid, there is lack of direction for Rub by Anonymous Coward · · Score: 0

    Dave Thomas is not at all important in the Ruby world. He just wrote some terrible books about the language.

  8. Re:I am afraid, there is lack of direction for Rub by AuMatar · · Score: 4, Insightful

    No, it really doesn't. What matter is availability of libraries, and your personal profficiency with the language. Given C and a regex library, I'll write better, cleaner, and faster doing string parsing than I would in perl. Why? Because I've used C and C++ every day for the past 8 years. Even though I use and know perl and regex is built into the language, I make more mistakes in it due to using it only a few times a year. And yes, I've actually tried this- I was 5x faster in C with the regex library. Do the test again with a perl maven, and I'm sure the opposite result would occur, even if you gave a problem that's more traditionally a C thing.

    Now there are some languages that better suit individual people than other languages, due to the way they approach problems. Lisp is good for people who think very mathematically. C is good for those who think in a very step by step manner. OOP is good for people who think in terms of models and interactions. But you'll always be more efficient in a language you know well than one thats new to you.

    Which isn't to say there's no reason to learn a new language- you may find one that fits you a bit better, especially if you learn a new paradigm like functional. But you'll never solve a problem quicker by using a language you aren't as familiar with, unless a library for a major piece of functionality exists in that language but not yours.

    --
    I still have more fans than freaks. WTF is wrong with you people?
  9. Re:I am afraid, there is lack of direction for Rub by Foofoobar · · Score: 2, Interesting

    That's an oversimplification of the issue. You don't simply use a new tool because it CAN do something, it is also a matter of whether it can do it BETTER that the current tool, whether you can find people who can use that tool, whether you can find information on how to use that tool with other systems and tools and whether that tools has a robust set of expansions/libraries/modules.

    To date for alot of people and companies, RUBY was hype (and this has alot to do with the community that hyped it). Now that the hype is over, people are beginning to evaluate it for what it is. RUBY can provide an easy entry level, is a powerful language but has not to date shown it's ability to scale, continues to rely HEAVILY on languages that it's community says it is much better than in order to scale (ie PHP, Perl, Python), and the benchmarks I have seen are always slanted (ie trying to test pageload times for PHP vs RUBY without installing PHP as an Apache Module).

    So the correct phrase should be... The right tool for the job (given current employment pool capable of supporting said tool and community support for said tool).

    --
    This is my sig. There are many like it but this one is mine.
  10. Re:I am afraid, there is lack of direction for Rub by SanityInAnarchy · · Score: 1

    On a side note, I will use PHP on my servers before touching Ruby since I see no advantages for using it over PHP.

    If you see no advantages to using it over PHP, you obviously haven't looked very hard.

    Off the top of my head: Ruby has better syntax, a better object model, runs faster (really), better standard libraries -- Rails aside, Ruby tends not to pollute the global namespace with bullshit like mysql_escape_magic_quotes_no_really_I_mean_it_this_time...

    PHP's advantage? Lots of unimaginative programmers like you know it, and it's slightly better at mixing code and data, since it's really just a Turing-complete template language. But I like haml anyway, and regardless, the template is one tiny part of your app -- the actual application logic should be buried in the model somewhere.

    So for the majority of the program, PHP has no advantage. For the tiny minority where it would, in a well-designed app, haml makes it look so ugly it's not even funny.

    --
    Don't thank God, thank a doctor!
  11. Re:I am afraid, there is lack of direction for Rub by SanityInAnarchy · · Score: 2, Interesting

    You do realize neither Ruby nor Rails is an acronym, right? Ok.

    The only argument for it in the past for web dev is RAILs and there are plenty of MVC frameworks for PHP now including PHPulse, Cake and Codeigniter.

    And those don't compare well, even to Rails, certainly not to Merb.

    And Merb is going to be merged into Rails.

    under large loads, it buckled

    Hardware is cheap. Couldn't you throw more at the problem?

    --
    Don't thank God, thank a doctor!
  12. Re:I am afraid, there is lack of direction for Rub by kandresen · · Score: 1

    I have now seen the video you linked to, and I can't noticed where he said Ruby lack direction. He said in fact that Ruby is great as it is, what he want to see however, is that new ideas for Ruby experimented on as forks rather than tried within the mainline Ruby. I think the video was quite good and worth seeing even though it last 47 minutes!

    The parent I believe is incorrect in using that video to claim there is a lack of direction.

  13. Re:I am afraid, there is lack of direction for Rub by JakeD409 · · Score: 1

    On a side note, I will use PHP on my servers before touching Ruby since I see no advantages for using it over PHP.

    Except for where speed is of the utmost importance (in which case you're limited to C/C++, and possibly just assembly language), anything you can do in one language, you can pretty much do in any language. The question is, how EASY is it to do it in a certain language.

    There may be no web app you can create in Ruby that you can't also create in PHP, but that doesn't mean PHP is always equally suitable to the job at hand. You may find that Ruby allows you to complete certain projects much faster, saving you a LOT of money. And in those cases, that would be a big advantage for using it over PHP.

  14. Re:I am afraid, there is lack of direction for Rub by Anonymous Coward · · Score: 0

    Dave Thomas is not at all important in the Ruby world. He just wrote some terrible books about the language.

    Maybe not, but I hear he's pretty popular in the hamburger world.

    (Somewhat related to that, my verification code was Subway.)

  15. Re:I am afraid, there is lack of direction for Rub by AuMatar · · Score: 2, Insightful

    Hardware is only cheap if someone else is paying for it. Why spend money you don't have to? AMazon and other big companies have already come to that realization. When I worked there a year or so ago it was impossible to get new hardware- not because they were cheap, but to encourage you to use the hardware more efficiently. The end result- a lot more use of virtualization for small stuff, a lot more thought into efficiency of services, and millions saved. Smaller organizations won't save millions, but they'll save a significant chunk of cash. The "just throw money at it" attitude is gross negligence.

    --
    I still have more fans than freaks. WTF is wrong with you people?
  16. Re:I am afraid, there is lack of direction for Rub by try_anything · · Score: 2, Insightful

    That approach makes sense for small jobs, but for projects that take more than (say) two months, it makes more sense to choose a roughly suitable language, even if your proficiency is lower.

    Also, for any code that isn't throwaway code, you have to assume that some unknown person will eventually inherit and maintain your code. Under that assumption, it's more important for the language to be appropriate for the task than for the language to be convenient for the initial programmer. You wouldn't want to inherit a bunch of string parsing code written in Fortran, would you? At least choose a roughly suitable language! Even the best imaginable regex library for C has to be relatively crappy (measured by the readability and correctness of code that uses it) just because of the limitations of the language.

    Now, I personally detest Perl and am pretty good with C++, but if somebody proposed writing a string parsing program in C++, I would tell them to use whatever non-dead scripting language they know, even if it's Perl, and if they don't know one yet, for God's sake pick one and learn it -- even if it's Perl!

  17. Unicode? by shutdown+-p+now · · Score: 4, Interesting

    A lot of work also went into encoding awareness of strings

    That's quite a fancy way to say "a lot of work went into making dealing with strings and encodings as messy as possible".

    So far, Ruby 1.9/2.0 is the only high-level language I know of which allows strings within the same program to be in different encodings (attaching a reference to encoding to every string). For double fun, the encodings need not be compatible with each other (not even with Unicode). This might also make Ruby the first language in which string comparison and concatenation are not well-defined for two arbitrary strings (as you get an exception if encodings are incompatible). Just wonderful - imagine writing a well-behaved library which does any sort of string processing with input parameters with these constraints...

    1. Re:Unicode? by John+Allsup · · Score: 1

      Cocoa and CoreFoundation, though not as high level, do something similar.

      --
      John_Chalisque
    2. Re:Unicode? by _merlin · · Score: 1

      Yeah, but all Cocoa and CoreFondation string encodings can be mapped to Unicode, it's possible to access any string object as Unicode characters, and all comparisons are effectively done in the Unicode character set. You never end up with two strings for which the comparison results are undefined, which I think was the GP's point. (The GP may or may not actually be correct - Ruby could be just as good as Cocoa/CF for all I know - I'm a C/C++/Objective-C guy and don't really know much about Ruby.)

    3. Re:Unicode? by ubernostrum · · Score: 2, Interesting

      So far, Ruby 1.9/2.0 is the only high-level language I know of which allows strings within the same program to be in different encodings

      Perhaps you need to spend time trying more languages; you'd learn not only that other languages have done this, but that many of them later rejected the idea and moved to, typically, a pure Unicode string type with a separate non-string type for working with sequences of bytes in particular encodings.

    4. Re:Unicode? by TheSunborn · · Score: 4, Funny

      Php also allows strings to use different encodings within the same program. With the extra twist that php don't keep track of the encoding, so if you want to find the number of characters in a string, you the developer must know the current encoding of the string, and then call the right method, based on which encoding the string has.

      Sometimes I think that the developers of php just take all the bad things in other languages, and say "I can make a worse implementation of this."

       

    5. Re:Unicode? by Anonymous Coward · · Score: 0

      I think 90% of users will end up with Unicode, and different encodings are importand only in some countries and in some usages (like Japan).

      As I used 1.9 a little, and also strings, I can't see this is being a mess or introduces incompatibility.

    6. Re:Unicode? by Anonymous Coward · · Score: 1, Informative

      How many times must this be said: Unicode is NOT AN ENCODING. UTF-8, UTF-16 are encodings.

    7. Re:Unicode? by shutdown+-p+now · · Score: 1

      Perhaps you need to spend time trying more languages; you'd learn not only that other languages have done this, but that many of them later rejected the idea and moved to, typically, a pure Unicode string type with a separate non-string type for working with sequences of bytes in particular encodings.

      One of my hobby is research of the history of PLs, but I guess I never ventured that far back to stumble into it. If you could give any examples of languages that did the same thing, I would be grateful.

      Otherwise, I agree that the only thing that makes sense today from a pragmatic perspective is an all-Unicode string type.

    8. Re:Unicode? by shutdown+-p+now · · Score: 1

      Php also allows strings to use different encodings within the same program. With the extra twist that php don't keep track of the encoding, so if you want to find the number of characters in a string, you the developer must know the current encoding of the string, and then call the right method, based on which encoding the string has.

      That's rather different, and it's also how C/C++ work. On low-level, that's how anything works, really - a java.lang.String, for example, is really just an array of 16-bit ints at heart. Where the difference appears is when you start performing encoding-aware operations on strings - case-insensitive comparisons, lowercase & uppercase, and so on. At that point, the language operator (or the library functions) that do that have to decide how to figure out the encoding of the string. The most common one today is to just consider it to be Unicode. In C/C++, and some other languages with Unix roots, it uses the current locale instead. The way that Ruby approaches it is certainly unique, at least between mainstream PLs today.

    9. Re:Unicode? by shutdown+-p+now · · Score: 2, Insightful

      I think 90% of users will end up with Unicode, and different encodings are importand only in some countries and in some usages (like Japan).

      As I used 1.9 a little, and also strings, I can't see this is being a mess or introduces incompatibility.

      The whole multi-encoding system was introduced into Ruby, supposedly, to handle those "some countries and some usages". The problem is that it is very hard to write reusable libraries which actually live up to it when there's no guarantee about any input encodings. Say my function gets a string; what operations can it safely do with it? What if it gets two strings from different sources? What if it also gets a text stream? If you've read the Ruby 1.9 mailing list, you'd probably seen Tim Bray's complaints about how tricky it is to e.g. do XML processing that way (XML mandates Unicode).

      I agree that in practice, most likely, everyone will just ignore this whole mess and use Unicode throughout, and libraries will be written to assume that all input strings are Unicode. But then, why introduce all those complications in the first place? If non-Unicode strings are going to end up being second-class citizens anyway, wouldn't it make more sense to make them a distinct type, and their use explicit, just like every other language had done it?

    10. Re:Unicode? by ubernostrum · · Score: 1

      Since this ended up turning into yet another Python versus Ruby thread on Slashdot, I'll pick on Python as an example.

      From Python 2.0 up until (but not including) Python 3.0, Python had an abstract basestring class, from which were descended two classes of things which were used as "strings": str represented sequences of bytes in some particular encoding (the particular encoding was up to you, and you could have str instances of different encodings coexisting within the same file), and unicode represented, well, Unicode strings. This turns out to be a bit troublesome in practice, since it means you have to be very careful about mixing different types of strings, or even differently-encoded str instances, in order to avoid encoding errors.

      As of Python 3.0, there's only one string type, the equivalent of what used to be the unicode type. This means that if something's a string, it's always the same type of string, always Unicode, always comparable to other strings, can always be combined with other strings, etc. To meet the need for sequences of bytes in various encodings, a new type -- bytes -- was introduced, and has slightly different syntax and different semantics from the old str type in Python 2.x. Most importantly, any attempt to mix these two types in Python 3.0 automatically raises a TypeError (where previously, such attempts would sometimes work and sometimes fail with various encoding-related errors); you must either explicitly call the encode method of a string to get a byte sequence, or explicitly call the decode method of a byte sequence to get a string (bytes objects know what encoding they're in, and so can do this cleanly) before doing any sort of comparison or other operations between a string and a byte sequence.

      The biggest objection that's been raised is how to work with filesystems where file names may not be valid Unicode, and to compensate Python's I/O APIs will accept bytes objects as arguments when you need them to, but some functions will not be able to represent some file names. Personally I've never run into a situation where this is problematic, though, since usually if there's no way to convert a file name to a valid sequence of Unicode you'll have larger problems with the file than just whether you can see it from Python's os.listdir() function.

    11. Re:Unicode? by magus_melchior · · Score: 1

      I don't know if they programmed in a manual override switch-- i.e., something like:

      compositestr = "#{asciistr}#{unicodestr.to_ascii}"

      ... but given Ruby's general organization (at least compared to PHP) and developer-friendliness, I wouldn't be surprised if they added such methods to the String class.

      (That's one way to concatenate 2 strings in Ruby. The Perl-like way is either a dot or a plus sign. The variable substitution is usually "good enough for government work".)

      --
      "We are Microsoft. You shall be assimilated. Competition is futile."
    12. Re:Unicode? by shutdown+-p+now · · Score: 1

      You don't need that sort of thing - when you concat two strings, it automatically tries to find a common compatible encoding, and convert both operands to it.

      The problem is that there need not be such a common compatible encoding - apparently, some Japanese legacy character sets are much more extensive (and generally not Unicode-compatible). That's precisely why Ruby doesn't use Unicode throughout.

      If it gets to this, then the concatenation will throw an exception, and there really isn't much that you can do to fix that. The only option is to convert one or both strings to some other (compatible) encodings with loss of information. For some reason, I expect that it will be a popular workaround, and that the "other encoding" will universally be Unicode ;)

  18. Ruby/Python in JVM/CLR not a Silver Bullet by kripkenstein · · Score: 3, Informative

    I am not familiar with Rubinius. But regarding all the others - Ruby on Java, on the CLR, etc., none of those are anywhere close to approaching the speed of recent JavaScript engines.

    The typical situation is that something like JRuby or Jython are implementations of a dynamic language in Java/C#/etc. instead of in C/C++, but they have the same architecture as the C/C++ engines. This leads to about the same performance - the Java VM does excellent JITing, but as we know, it brings Java into about the same area as C/C++, not faster.

    So, these implementations end up being about as fast as the original C/C++ ones (but they have various other advantages, which are their real value).

    The latest-generation JavaScript engines - and we are talking about the last 6 months here! - are very different in their architecture. They use techniques like trace trees and hidden classes, along with native code generation using JITs specializing in JavaScript, to generate performance that can, in some cases, be closer to C/C++ than to Python/Ruby.

    The PyPy project has been saying this all along, in fact - that to make dynamic languages fast, you can't just implement them in the JVM or such and expect 'magic' to happen with that VM's JIT. It doesn't work that way. Even if you JIT an architecture that does hash table lookups or type checking for each assignment, performance will be poor; the JIT can't fix your algorithm. Fixing the algorithm is exactly what latest-generation Javascript engines like V8 and TraceMonkey do.

    1. Re:Ruby/Python in JVM/CLR not a Silver Bullet by Anonymous Coward · · Score: 0

      I've been using groovy on the JVM(running grails projects) and I can say the productivity compensates for the slowness.

      When we're in the performance optimization phase, we just write the bottlenecking code in java and get blazing fast speeds.

      As far as I know, you can do the same with JRuby.

    2. Re:Ruby/Python in JVM/CLR not a Silver Bullet by Jay+L · · Score: 1

      I'm no compiler/interpreter expert, but AIUI the JRuby folks (some of whom are now with Sun) are actively working with the JVM folks inside Sun to add dynamic-language optimizations to the JVM.

      I don't know if this extends to "fixing the algorithm", but it seems like it could. It's early days.

    3. Re:Ruby/Python in JVM/CLR not a Silver Bullet by Fweeky · · Score: 1

      You can use C with JRuby too, using the exact same interface as MRI and Rubinius.

    4. Re:Ruby/Python in JVM/CLR not a Silver Bullet by kripkenstein · · Score: 1

      In theory they might do that. However, AFAIK the 'dynamic optimizations' they are applying are similar to Microsoft's DLR. These are useful, but not in the same area as what we have seen in JavaScript engines in the last 6 months.

      It isn't even clear how to create a generic JIT for all dynamic languages. For example, the latest JavaScript engines are great for JavaScript, but as Python and Ruby are even more dynamic, a different approach might be needed for them.

    5. Re:Ruby/Python in JVM/CLR not a Silver Bullet by Headius · · Score: 1

      There's a fundamental difference here: those of us targeting existing VMs have a lot less work to do to go as fast as the C/C++ impls...and then faster. In JRuby, the basic, dumb implementation of Ruby performs around as well as the C impl. In some cases it's faster, and in some cases it's slower. But when we actually start implementing it *well* we get substantially improved performance. And even better, we can make improvements in days that take the C/C++ impls months or years to do, simply by continuing to structure JRuby in such a way that the amazing JVMs out there can optimize it well.

      V8 and Tracemonkey do a lot to optimize JavaScript, but there's an important detail missing in almost all benchmarks of them: they make JavaScript less slow, but do not in any way bring it to the performance level of Java.

      JVMs like Hotspot are the best hope for fast dynamic languages in the near future.

    6. Re:Ruby/Python in JVM/CLR not a Silver Bullet by kripkenstein · · Score: 1
      I am more familiar with the Python side - Jython, etc. - then Ruby. Perhaps JRuby is extremely different than Jython, I don't know, but on the Python side, performance of Jython is on par with CPython, and has no hope in the foreseeable future of surpassing it.

      V8 and Tracemonkey do a lot to optimize JavaScript, but there's an important detail missing in almost all benchmarks of them: they make JavaScript less slow, but do not in any way bring it to the performance level of Java.

      Well, all benchmarks are problematic, but overall I don't think what you said is accurate. In my experience, and also based on other people's testing, V8, TraceMonkey and SquirrelFish Extreme actually do bring JavaScript closer to Java in performance than to Python/Ruby/old JavaScript engines. It is typical for us to see something like V8/TM/SFE being around 4 times slower than C, and 10 times faster than CPython.

      JVMs like Hotspot are the best hope for fast dynamic languages in the near future.

      Well, we'll have to disagree about that one :) I have far more hope placed in the V8/TM/SFE approach than the JVM/CLR. Another approach I think is more likely to succeed is that of PyPy.

      Again, perhaps in Ruby things are different than for Python. If you have benchmarks showing JRuby ourperforms V8/TM/SFE, I'd be curious to see that.

    7. Re:Ruby/Python in JVM/CLR not a Silver Bullet by Headius · · Score: 1

      The Jython team has done only preliminary work on performance, and stands to gain a lot more over the coming months. They've recently undergone a rewrite of much of their code and are now stabilizing back toward a 2.5-compatible release. Performance work will probably come after that. And if they apply the same techniques we're using in JRuby, they'll probably do well.

      If you have benchmarks showing V8/TM/SFE perform within an order of magnitude of C on something general-purpose (not a bloody fib benchmark) I'd love to see them as well. I have not seen such numbers in my searching.

      I agree that V8/TM/SFE are great JavaScript implementations, but they're largely *just* that, JavaScript implementations. JS is a vastly simpler language than either Python or Ruby, and the performance characteristics will reflect that. In short, JS simply does less "magic" for you behind the scenes. That magic is frequently what makes Ruby and Python harder to optimize, but it's also what makes them more attractive as general purpose languages. So it's a matter of what you can get done with what code; if JS is 10x faster than Python but you have to write 10x as much code to get the same things done, where does that put you?

    8. Re:Ruby/Python in JVM/CLR not a Silver Bullet by kripkenstein · · Score: 1

      If you have benchmarks showing V8/TM/SFE perform within an order of magnitude of C on something general-purpose (not a bloody fib benchmark) I'd love to see them as well. I have not seen such numbers in my searching.

      The benchmarks tend to be either bloody fibonacci tests ;) or 'general-purpose' JavaScript tests, which end up testing DOM etc. quite heavily (well, that is what most JavaScript does). So both are debatable. The fibonacci ones are more relevant to a cross-language comparison IMO, and those tend to show basically what I said. You can also run the code yourself and see.

      So it's a matter of what you can get done with what code; if JS is 10x faster than Python but you have to write 10x as much code to get the same things done, where does that put you?

      I agree Python requires less code, but 10x is a gross exaggeration. But yeah, there's a tradeoff obviously.

  19. Re:I am afraid, there is lack of direction for Rub by AuMatar · · Score: 2, Insightful

    Your maintenance point is good. For that reason alone I wouldn't use C for a web front end (back end service sure, not a front end), because the vast majority of people they'd hire to maintain it wouldn't be experts in it. And for any team project its not your best language that matters, but the best language of the team as a whole.

    I disagree with your time argument though. If anything, the time just makes it more important to use what you're familiar with. If you're talking about something taking 1 hr vs half a day based on language choice, its a minor difference. If you're talking about a 3 month project, you're probably talking 2-3 months extra to use a less familiar language.

    --
    I still have more fans than freaks. WTF is wrong with you people?
  20. Re:I am afraid, there is lack of direction for Rub by SanityInAnarchy · · Score: 3, Insightful

    Hardware is only cheap if someone else is paying for it.

    No, hardware is cheap, relative to programmer time. Moore's Law only reinforces this. In fact, you're making my argument for me:

    Why spend money you don't have to?

    Let's suppose it takes me half the time to code it in Rails than it does to code it in PHP, but requires twice the power to run. And let's suppose I make minimum wage.

    Before it even comes close to costing more to run the hardware than it does to run my salary, you're already running six or seven extra-large instances. Go look up the specs for an extra-large instance. And keep in mind, that's additional -- that assumes the optimized version requires six or seven of those, and my inefficient version requires six or seven more.

    You can run the numbers yourself, but it ultimately tends to work out the same. And all of that assumes the Ruby version is slower -- and, following my link above, it really isn't.

    Smaller organizations won't save millions, but they'll save a significant chunk of cash.

    Smaller organizations, I would think the "just throw hardware at it" argument makes even more sense. The speed of a nonworking app is irrelevant. The speed of an app serving a dozen programmers and testers, before public release, is similarly irrelevant. By the time you're getting hundreds or thousands of requests per second, you're probably making enough money from ads alone to cover the costs -- but while you're still "only" getting dozens of requests per second, a single Rails server might work just fine.

    Now, I agree, throwing hardware at it is not a good long-term solution. The good long-term solution is to optimize the better systems. However, investing in a demonstrably worse architecture to gain a little performance -- maybe -- in the short term, does not seem like a good move.

    --
    Don't thank God, thank a doctor!
  21. Not if you're hosted! by Jane+Q.+Public · · Score: 1

    Hardware costs in a hosted environment can be pretty outrageous.

    But I really wanted to take issue with the insinuation by Foofoobar, which I have heard so many times, that Ruby is "not scalable". Even if he meant Rails, not just Ruby, he is just plain wrong. This scalability "issue" has never been a real issue at all... as long as you didn't mind getting your hands a little dirty in server configurations.

    Look at some of the "top" 100 Ruby on Rails sites, and try to tell me again that Ruby "doesn't scale": http://rails100.pbwiki.com/

    1. Re:Not if you're hosted! by Anonymous Coward · · Score: 0

      Eh?
      The top 100 lists say nothing.
      On ratemypoo, the top rated poo is still poo.

      It would be a lot better to check a list of the top 100 sites on the net and see which ones are running Ruby or RoR

    2. Re:Not if you're hosted! by SanityInAnarchy · · Score: 1

      On ratemypoo, the top rated poo is still poo.

      So it might be useful to look at the top Rails site, and see if it is, in fact, poo.

      --
      Don't thank God, thank a doctor!
  22. Re:I am afraid, there is lack of direction for Rub by jonaskoelker · · Score: 1

    Lisp is good for people who think very mathematically.

    Which aspects of mathematical thinking is it that is well aligned with Lisp?

    What I think characterizes mathematical thinking (as opposed to programming thinking) is the declarative and/or pure nature of math: variables don't change, and there's no notion of time.

    I think a pure functional language, such as Haskell (or at least pure code) would fit better with mathematical thinking, because it has the same unchanging nature that math has.

    I'm guessing that a pure logic programming language would also make a good fit, but I haven't (really) done much logic programming.

    But then again, map and filter are axioms in ZFC and they appear in roughly speaking all functional languages as well, so maybe there's something to it :)

  23. Re:I am afraid, there is lack of direction for Rub by FooBarWidget · · Score: 2, Insightful

    How do you know the tons of manhours put into optimization work won't cost you more than the added hardware?

  24. Re:I am afraid, there is lack of direction for Rub by Jane+Q.+Public · · Score: 1

    It's not just that, either. Ruby is more consistent. Object-orientation was a latecomer to PHP, and the language still shows it's non-object roots. Ruby is consistently, 100% object oriented, and it shows.

    The old tales about being able to do things faster and with many fewer lines of code in Ruby are not just fluff. For example being able, in RoR, to take the submission from a 40-element form on a page, and put it in your database with just "my_object.create(params)" is pretty sligging frick, if you ask me. Of course that is only a very simple example, but still.

    Being able to use reflection to get data about the objects you are handling is great. And the implementation is just plain smooth. Don't remember what you can do with the object at hand? puts my_object.methods.sort

    Other languages have nice features, too, of course. But Ruby has some things that you don't want to do without, once you use them.

  25. What about C? by jonaskoelker · · Score: 5, Funny

    Python is skiing and ruby is snow boarding.

    I guess that makes C drunk driving. Much faster and more crash-prone.

    --*car_analogy_quota("jonaskoelker");

    1. Re:What about C? by windsurfer619 · · Score: 2, Funny
      • C++ is also drunk driving, but with a backseat driver yelling in your ear?
      • Perl is unicycling down the highway? A lot more maneuverable, but you wouldn't want to go very far.
      • Java is taking the biggest train you can find, but not knowing where it's going.
      • Bash is running down the mountainside trying to steal someone else's skis or snowboard and figuring out how to use them before you hit the bottom.
      • PHP is sledding. Very easy to pick up and reasonably fast, but you really hope that a tree doesn't get in your way.
  26. Why does it need a "direction" anyway? by Jane+Q.+Public · · Score: 1

    What kind of "direction" does a general-purpose, Turing-complete language need? What kind of "direction" did BASIC have? Or Pascal? Or C?

    The evolution of Ruby has been extraordinarily fast, considering that the whole language is only around 12 years or so old, and only became somewhat popular 3 or 4 years ago!

    Sure, certain additions to the language might be welcome. Compiler and speed improvements would be welcome. But I don't get this whole talk of "direction". WTF?!

    Now, if that discussion is about Rails, then it makes more sense. But Rails has had plenty of direction. It has improved vastly, and is arguably the most flexible framework out there... soon to be even more so when it incorporates Merb.

    Don't like Erb? Use Haml. Or some other markup... the most you need is a plugin. Gems and plugins are available for almost any conceivable want or business need.

    Direction? Sheesh.

    1. Re:Why does it need a "direction" anyway? by nidarus · · Score: 1

      What kind of "direction" does a general-purpose, Turing-complete language need? What kind of "direction" did BASIC have? Or Pascal? Or C?

      C is a pretty good example (as it hasn't really changed in years), but BASIC and Pascal? VB.NET and Delphi's Object Pascal show obvious signs of direction - be it "turn BASIC into C# with weird syntax" or "turn an imperative teaching language into an object-oriented language for writing GUIs". Both languages are dramatically different from their predecessors, and they didn't just randomly mutate.

      Btw, I didn't get why a framework needs direction, but a "general-purpose Turing-complete" language doesn't. Are you implying that all of those languages are basically the same?

    2. Re:Why does it need a "direction" anyway? by Jane+Q.+Public · · Score: 1

      No, I think we're pretty much agreeing.

      If you look at the languages with "direction" that you mentioned... what are the directions? You said it yourself. BASIC -> wastebasket. Object Pascal -> wastebasket (Which, IMHO, is really sad because Delphi was worlds ahead of Visual Basic until they dropped the ball. But where has it gone since?)

      I think my point is: C did not have "direction", and it is doing fine. Ruby may not have "direction", but it's doing fine. The ones with direction are all proprietary and in general they haven't been doing so well.

      Frameworks, on the other hand, are in a hugely competitive space these days. There are evangelists on all sides and they want to know where their favorite framework "is going", because they are going to put a big investment in it on their next project. A framework that sits still today probably will not be going very far.

      As it happens, as a framework Rails seems to be going in the right direction. It has been getting more flexible, not less. It has been getting faster. It is incorporating Merb. All good things.

    3. Re:Why does it need a "direction" anyway? by nidarus · · Score: 1
      So, what you're saying is that Ruby, like C, shouldn't really change?

      It's certainly one approach. And it's certainly not without merit - just ask the VB people who were forced to move to VB.NET, or even the Python people who'll have to do without the % operator.

      But personally, I like it when languages evolve. As much as people hate VB, it's still better than GW-BASIC (it has functions! woohoo!), and Delphi, well, it's dead now (not because it sucked, but because MS hired their main guy and copied everything that made it special), but it was much better than the original Pascal.

      Btw, I still don't get why frameworks are so different from languages (direction/evolution-wise). You said frameworks are "competitive", but don't you think Ruby has to fight for mindshare, just like Rails?

  27. So? by Jane+Q.+Public · · Score: 1

    Why should they be comparable? They are fundamentally different things. A "Unicode String" is not the same as an "ASCII String" at all.

    How should your string compare work? All similar characters in all popular encodings should map to each other? Hmmmm... that would be a pretty damned big code base to handle all those permutations. Maybe as big as the rest of Ruby.

    1. Re:So? by _merlin · · Score: 1

      Well that's what Unicode is for - you can map all* characters from all text encodings to it, do your processing in one universal character set, and convert to the required encoding for output. That's how Java, .NET, Cocoa, CoreFoundation and even Windows CE and NewtonOS do things.

      *yes, I know there are a few characters from Big5-HKSCS that aren't in Unicode, and the Apple logo from legacy Macintosh text encodings isn't there, either. But for 99.999% of cases, Unicode contains the character.

    2. Re:So? by spitzak · · Score: 3, Interesting

      An ASCII string can be mapped to a Unicode string. For each byte in an ASCII string there is a matching Unicode symbol.

      How should string compare work? Well for simple ==, I think it should fail if the encodings are different, as they really are different. It can also fail if the two strings encode the same Unicode but in different ways (this is possible in some encodings).

      There can however be a more complex call that converts both strings to Unicode and compares them. One huge problem with most current imlementations, including Python, is absolutely brain-dead (and "politically correct") handling of invalid UTF-8, where invalid encodings throw errors, which makes use of UTF-8 actually impossible for non-trivial programs. Instead it should never throw errors. Error bytes should represent something unique in Unicode, one popular proposal is U+D8xx (which is also an "error" in UTF-16).

      A problem Python (and a lot of other programs have) is that they think "Unicode" means "some sort of encoding where each Unicode symbol takes the same space". This requires 21 bits per symbol, the only practical way to support this to use 32 bits. Almost immediatly they run into difficulty in that Windows uses UTF-16, so they punt and use UTF-16, basically abandoning their entire idea. They should instead use UTF-8 which has enormous advantages: UTF-8 errors are not lost and can be translated differently when finally used (ie for display turning them into CP1252 is better, but for a filename turning them into the above error codes is better), all other encodings (which are byte based) can be stored in the same object, and no translation is needed when you load UTF-8 data. Also UTF-16 (including invalid UTF-16) can be losslessly translated to UTF-8 and back, so there is no problem supporting Windows backends either.

    3. Re:So? by tuffy · · Score: 1

      There can however be a more complex call that converts both strings to Unicode and compares them. One huge problem with most current imlementations, including Python, is absolutely brain-dead (and "politically correct") handling of invalid UTF-8, where invalid encodings throw errors, which makes use of UTF-8 actually impossible for non-trivial programs. Instead it should never throw errors. Error bytes should represent something unique in Unicode, one popular proposal is U+D8xx (which is also an "error" in UTF-16).

      That's precisely what Python's .decode('utf-8','replace') does, replacing invalid UTF-8 sequences with U+D8XX characters.

      In addition, Python typically stores Unicode characters as UCS-2 internally (or UCS-4, at compile-time) rather than UTF-16, guaranteeing that each character is a fixed size. Naturally, having fixed-size Unicode characters has a lot of benefits at runtime which would be lost by trying to represent everything internally as variable-length UTF-8 byte sequences. And since UCS-2 covers everything but a few esoteric characters (which are covered by UCS-4), there's very little downside.

      --

      Ita erat quando hic adveni.

    4. Re:So? by Jane+Q.+Public · · Score: 1

      I understand what you are saying, but that is not exactly what I was talking about. Unicode encompasses a huge data space. A "string compare" function would be absolutely huge and efficient unless it were specific to the kind of compare you were doing. E.g., ASCII Unicode, Kanji Unicode, Cyrillic Unicode, etc. One "universal" string compare would be much too large and slow for general-purpose use.

      Of course, what kind of strings you "normally" use could be handled in your internationalization configuration and need not be obvious to the programmer, but that is simply hiding the implementation from the user, it does not address the fundamental issue. A "universal" mapper is out of the question, and that was the only point I was trying to make.

    5. Re:So? by Jane+Q.+Public · · Score: 1
      Some of my characters did not get through the Slashdot editor.

      ASCII <-> Unicode

      , etc. is how it should have read.

    6. Re:So? by Jane+Q.+Public · · Score: 1

      I understand, but that wasn't my point. The question was why strings in Unicode are not treated exactly the same as strings in the native encoding, so that a "universal" string compare would work.

      Ruby is not limited to UTF-8, though that is the default. But that is my point. If you wanted to implement a "universal" string compare that would map all valid characters in Unicode to every encoding available to your system, you would have a monster on your hands. Not all Kanji character encodings are Unicode. Nor ASCII. Nor Cyrillic. UTF-8 and UTF-16 are not the same, etc. So... are you going to write a "universal" character mapper that will handle them all? Of course not. That would be way too slow and inefficient for everyday use.

    7. Re:So? by spitzak · · Score: 1

      Python uses UTF-16 internally on Windows and UTF-32 on Unix (I think "UCS-4" implies that values greater than 0x10ffff are allowed, but Pythons converters to UTF-16 and UTF-8 do not handle this, so it is better to say it supports UTF-32).

      Because Python accepts UTF-16 returned by Windows unchanged (ie when you list the files in a directory, or read data from a UTF-16 file), it is using UTF-16. No amount of calling it UCS-2 will change that. In addition the converter converts non-BMP characters from UTF-8 to the correct len=2 sequence of UTF-16, although the reverse converter is broken and will return 6 bytes.

      I did not know Python3 implemented the suggestion to do U+D8xx. I only saw people requesting this because otherwise handling UTF-8 data is nearly impossible. If Python really did do this it will help enormously. However (after looking at this a great deal) I think they should *not* do the reverse translation (ie turn U+D8xx back into bytes). The reason is that it will destroy the current nice fact that UTF-16->UTF-8->UTF-16 is lossless (imagine the UTF-16 had U+D8xx characters arranged such that the result is a legal encoding). And it does not make the inverse UTF8->16->8 lossless (the UTF-8 could have the 2-byte encoding of 0xD8xx in it).

      The fact that Unix uses 4 bytes and Windows 2 has been a total source of pain for us. Many end users replace their Linux Python with one recompiled for 2 bytes, because (despite naive beliefs to the contrary) the difference causes code to be non-portable even if it appears to not be doing anything remotely complex with strings. This then causes us grief because we are not necessarily binary-compatible with the installed Python on Linux, forcing us to statically link our own copy. This then leads to complaints when people can't load their Python plugins into our code. I believe that if they had used UTF-8 from the start none of this crap would be happening.

    8. Re:So? by spitzak · · Score: 1

      The proposed solution is to translate all the encodings *TO* Unicode, then compare them. Not the other way around.

      Unicode was purposely designed to have a symbol for every symbol in any other encoding used at the time, so that this is possible.

    9. Re:So? by Jane+Q.+Public · · Score: 1

      You are still missing the big picture here. First, I didn't say it wasn't possible. I said it would be huge and inefficient.

      There are too many encodings out there. The part that converts the current character encoding to Unicode would have to be huge, if it had to handle all the character encodings that are available equally.

      As I mentioned elsewhere, this could be handled in your configuration, by linking a mapper that was made specifically for [your default character encoding] to [Unicode]. But that is not the same thing as one "universal" character mapper, which is what most people have been talking about.

    10. Re:So? by _merlin · · Score: 1

      So how do you explain .NET, Java, Windows CE, OSX, etc? They all do all their string manipulation and comparison in Unicode. String manipulation algorithms have become quite good lately.

    11. Re:So? by tuffy · · Score: 1

      Python uses UTF-16 internally on Windows and UTF-32 on Unix (I think "UCS-4" implies that values greater than 0x10ffff are allowed, but Pythons converters to UTF-16 and UTF-8 do not handle this, so it is better to say it supports UTF-32).

      Python uses UCS-2 or UCS-4 internally but sys.maxunicode maxes out at 0x1114111 on UCS-4 builds because there aren't any defined characters that high. Read Include/unicodeobject.h in Python's source code to see for yourself.

      I believe that if they had used UTF-8 from the start none of this crap would be happening.

      Storing unicode strings internally as UTF-8 is madness. Imagine the trivial case of s[3], which bytes would we return? We'd have to walk the string to find the start of that fourth character, then walk it some more to get the whole thing. It'd transform a whole pile of O(1) operations into O(n) ones, and performance would suffer greatly for it.

      --

      Ita erat quando hic adveni.

    12. Re:So? by spitzak · · Score: 1

      s[3] would return the 3rd byte. Anybody who thinks otherwise has obviously not done any serious work with Unicode storage.

      If you really want, you could make a method s.getUnicodeCodePoint(n) which would return the n'th code point. You could also make a function thats return the n'th character as users see them (ie it does combining and invisible characters), return the n'th word, the n'th piece where the ink does not touch, the n'th syllable, etc. In fact there are a million interesting ways of breaking up a Unicode string, and most of them are complicated. And also none of them are used except in the final presentation step, including your "character" example.

      The belief that "characters" are important is due to the fact that in ASCII an offset into a string was equal to the "number of characters". This led to lots of UI being documented as taking "characters" when in fact the purpose of the function is to produce or consume an offset

      Amateur programmers who think that s[3] should return something other than what is at 3*constant_size into the array are probably the biggest impediment to I18N, as they raise this silly argument every time UTF-8 or UTF-16 is suggested and it is really really hard to make them see the light. Very sad really. And scary, as most of them are just bright enough to be dangerous as they could probably write the insanely slow and useless functions they think are needed.

    13. Re:So? by spitzak · · Score: 1

      I went to read the page, unfortunatly the Python guys are making a few mistakes.

      BOM is *not* wanted on UTF-8, it destroys the important aspect that UTF-8 is compatible with ASCII. The fact that Windows relies on this leads to the "bush hid the facts" bug where it thinks plain ASCII is UTF16LE. They should not be supporting this idiot idea. UTF-8 can be very reliably identified by looking to see if there are invalid UTF-8 sequences, in real text it is virtually impossible for this to happen because the necessary character sequences in ISO-8859-1 (or any other byte encoding) are not meaningful text, and even random text has a very tiny (appx 1/20^N where N is the number of bytes) chance of matching.

      Also if they do not throw an exception when a UTF-16 filename is read on Windows and it contains non-BOM characters, they are using UTF-16. No amount of calling it UCS-2 will make that true. This would be the same as saying "I'm reading this UTF-8 data, but I will call it "ASCII" and therefore I never have to worry about multibyte characters, they will magically disappear because I said it is ASCII".

      I can't test this, but I am pretty certain they are taking Windows UTF-16 and putting each word unchanged into their "UCS-2" strings. Therefore they are using UTF-16 but they have broken translators to UTF-8.

      The cutoff is 0x10ffff, which is 1114111 decimal. They seem to have this right, though I never saw it shown in decimal before. You added a 0x to the start, which is wrong.

    14. Re:So? by tuffy · · Score: 1

      And also none of them are used except in the final presentation step, including your "character" example.

      Not by you, perhaps. But if you're going to punt everything to the "final presentation step", it doesn't sound like you're doing any serious work with Unicode storage anyway.

      --

      Ita erat quando hic adveni.

    15. Re:So? by spitzak · · Score: 1

      I don't understand, what exactly would I do before the final presentation step?

      Everything I can think of does not require thinking about "characters". Occasionally the Unicode code points become important (mostly they are needed to translate between encodings), but I am unable to come up with an example that does not also iterate over the string. Iteration makes it trivial to handle variable-length encodings.

  28. So does Perl by Jane+Q.+Public · · Score: 1

    via overflow.

    --
    Now, write that 100 times by sunrise or I'll cut your balls off.

  29. Re:I am afraid, there is lack of direction for Rub by Anonymous Coward · · Score: 0

    And how do you know that adopting and developing more efficient solutions from the start won't save you money on new hardware along the life span of the current hardware?

  30. Re:I am afraid, there is lack of direction for Rub by BerntB · · Score: 1

    I agree with your points. That said, the PCRE library seems quite sweet and I could probably live quite happily with it. Sure, Perl has advantages because regexps are built into the language and don't need quoting etc.

    (-: And that from someone totally opposite of you; I wss never really happy with C++ but do Perl for fun. :-).

    --
    Karma: Excellent (My Karma? I wish...:-( )
  31. Re:I am afraid, there is lack of direction for Rub by Pulzar · · Score: 1

    The old tales about being able to do things faster and with many fewer lines of code in Ruby are not just fluff. For example being able, in RoR, to take the submission from a 40-element form on a page, and put it in your database with just "my_object.create(params)" is pretty sligging frick, if you ask me. Of course that is only a very simple example, but still.

    Well, in Cake it's '$this->Model->create(); $this->Model->save($this->data);'. As examples go, that's not very convincing.

    --
    Never underestimate the bandwidth of a 747 filled with CD-ROMs.
  32. Re:I am afraid, there is lack of direction for Rub by Anonymous Coward · · Score: 0

    "variables don't change"

    Doesn't the name variable suggest, well, variability?

    Are you thinking of constants, in a mathematical sense?

  33. slashcode buglet by Anonymous Coward · · Score: 0

    why aren't the pre parts in parent indented unless you click on the expand link?

  34. Vala is the new high-level language benchmark by CarpetShark · · Score: 1

    Javascript, Smalltalk, or things like microsoft's CLR are not a good comparison for high-level languages' performance these days. That's because Vala manages to do everything that the CLR/JVM does, only with performance somewhere between C and C++.

    1. Re:Vala is the new high-level language benchmark by ibbie · · Score: 1

      Javascript, Smalltalk, or things like microsoft's CLR are not a good comparison for high-level languages' performance these days.

      I respectfully disagree.

      That's because Vala manages to do everything that the CLR/JVM does, only with performance somewhere between C and C++.

      Yes, Vala is quite nice. I've been following its development for quite some time, and it does really have a lot of potential. However, it's still pretty young, as they go; that in and of itself is both a reason for caution, as well as a reason for patting the Vala-devs on their collective backs. It does, after all, execute pretty fast thus far. (:

      When Vala hits 1.0 *and* gets a sizable developer community backing it - i.e., those who really use it and find its flaws and gems - then it might have the chance to supersede its predecessors.

      This is not to say it's not a great language, or a great effort. Heck, I've been hoping for a while that it might have the chance to invalidate the need for Mono (no offense to the Mono guys, you do good work, too) in developing applications.

      But Vala is still 0.5.6. For all we know, a poor design decision could make it terribly slower; I doubt that will happen, but still.

      --
      The wise follow a damned path, for to know is to be forsaken.
    2. Re:Vala is the new high-level language benchmark by CarpetShark · · Score: 1

      Agreed in principle :) However, on version numbers... while 0.5.6 sounds young, Vala's roadmap doesn't have too many releases between that and 1.0, and I've tried it enough to know it works pretty well, so I'm fairly (although, granted, not 100%) happy with using it as a comparison at this stage. You're quite right about number of developers though. I'm not sure what it's user base is right now; I know there are a few reasonably large apps being written in it already. But yes, it could be a whole different ballgame I suppose, once thousands of people try to use it for myriad projects.

  35. Re:I am afraid, there is lack of direction for Rub by MadCat · · Score: 1

    I'll take Perl and Catalyst over Ruby and Rails any day of the week. Ruby borrowed heavily from Perl, and managed to snaffle the rest of it's features out of Python, all combined into a very un-directed little language.

    --
    There is no sig...
  36. Re:I am afraid, there is lack of direction for Rub by MadCat · · Score: 1

    The idiom of "let's throw more hardware at the problem" is a way of saying "we don't know jack shit about how to build a scalable web application, so we'll hide the symptoms by throwing a bunch of additional hardware at it so it at least seems we can scale things".

    Really, building a scalable web app is not hard, but if you're using Ruby on Rails, you're looking for a miracle since it's a known fact RoR doesn't scale very well. Other languages suffer from the same problem, except it seems those languages have more people using them that actually know what they're doing, instead of just following the RoR hype of it being the best thing since sliced bread, which it's not.

    --
    There is no sig...
  37. Re:I am afraid, there is lack of direction for Rub by suggsjc · · Score: 1

    How do you know its going to take tons of manhours to get efficiency gains? I'd imagine that if you hired jr. programmers to do the initial round of programming it would only take a few hours of an experienced sr. programmer to identify potential bottlenecks, and either come up with a solution or just fix the problem.

    Besides, inefficient code will add up almost exponentially as your load increases. So you could throw hardware as a stopgap, but eventually (if you get large enough) you would have saved a lot more on physical resources if you had taken the time to analyze and solve the problem from the beginning.

    --
    When I have a kid, I want to put him in one of those strollers for twins and then run around the mall looking frantic.
  38. Re:I am afraid, there is lack of direction for Rub by Foofoobar · · Score: 1

    Hardware is cheap. Couldn't you throw more at the problem?

    I hear that answer alot from the RUBY community. Why would I as a business be expected to switch to a language that requires twice as much hardware? What you MAY save with software dev speed, you now lose with day to day server maintenance.

    The key to good engineering is to simplify because the more parts, the more chance of failure. So throwing more hardware at the issue when similar languages such as PHP, PERL and PYTHON can do it with far less hardware is not a very good solution.

    --
    This is my sig. There are many like it but this one is mine.
  39. Re:I am afraid, there is lack of direction for Rub by Anonymous Coward · · Score: 0

    PHP's advantage? Lots of unimaginative programmers like you know it, and it's slightly better at mixing code and data, since it's really just a Turing-complete template language. But I like haml [hamptoncatlin.com] anyway, and regardless, the template is one tiny part of your app -- the actual application logic should be buried in the model somewhere.

    So for the majority of the program, PHP has no advantage. For the tiny minority where it would, in a well-designed app, haml makes it look so ugly it's not even funny.

    So basically you're pissed that your hobby language (and make no mistake, that's all Ruby will ever be) will not be adopted because there are more "unimaginative programmers" who know it thus allowing business to move forward with doing actual in an attempt to make a profit.

    The number of intelligent CS morons on here is astounding. You'll always a cog in the machine. You don't understand business, that much is obvious.

  40. Re:I am afraid, there is lack of direction for Rub by An+Onerous+Coward · · Score: 3, Insightful

    > Besides, inefficient code will add up almost exponentially as your load increases.

    Eh?

    We're not talking about poor algorithm selection. We're talking about using a slower language rather than a faster language. Unless you deliberately adopt a "slower languages deserve slower algorithms" mentality, you're talking about a linear increase in hardware.

    In that case, doubling the hardware requirements in exchange for even a 25% cut in coding time is going to be a huge boon for your company. If writing in a cleaner, more elegant language makes the code base smaller and easier to read, those senior developers are going to have a much easier time finding the bugs and the bottlenecks. Plus, if you can write the thing that much faster, your developers are going to have a lot more fun.

    Since we're talking specifically about Rails here, the first optimization pass is usually A) finding pages and partials that can be cached, and B) tweaking your ActiveRecord queries so that the database grabs all the records it needs on the first pass. Both are simple to do, and once you've accomplished them it's going to be quite a while before a normal site is going to run into scaling issues.

    --

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

  41. Re:I am afraid, there is lack of direction for Rub by thegux · · Score: 1

    Ruby on Rails is not a language.

  42. Re:I am afraid, there is lack of direction for Rub by MadCat · · Score: 1

    No, it's a framework based on Ruby, the language. Just as Catalyst is a framework based on Perl, the language.

    Your point?

    --
    There is no sig...
  43. Ruby = Dead language from the 80s by Anonymous Coward · · Score: 0

    Don't mean to be a hater, but IAlwaysLikeIt( when a dead language from the 1980s written by a long retired Japanese dude) isResurrected && pitched to a new Generation;

    Reality Check: DHH knew that WebObjects (Apple's ObjectiveC turned Java for the web) was The Way, but Apple had let that framework languish since buying it along with NeXT. DHH did The Right Thing by building something new, but bet that it would be more successful if he brought Ruby back from the dead rather than try to pitch PERL to a generation of PHP jockies who had come to accept the echo of parrots mimicking guys not smart enough to grasp PERL so they simply mocked it as line noise. You're talking about academic purists and other real morons who typically embrace Python (the Visual Basic of Open Source) because let's face it, anything is better than PHP.

    So PERL is back with its mean Catalyst Framework (almost up to v1.0 and it is awesome), Google seems to be latching onto Python with Django bindings for its Apps service and the cattle herders down in Israel are cooking something up for the PHP drones. Meanwhile, Ruby is fragmenting into a million incompatible releases and Rails is still just 37 Signals.

  44. Re:I am afraid, there is lack of direction for Rub by RAMMS+EIN · · Score: 1

    Question for you:

    Which is greater:

    $total_time_using_language_you_know = $time_per_project_using_language_you_know * $nprojects
     
    $total_time_using_new_language = $time_to_learn_new_language + $time_per_project_using_new_language * $nprojects

    I think you will find that the answer is "it depends". Specifically, it depends on how long it takes to learn the new language, how much more productive that makes you, and how many projects you do. Assuming that a new language makes you more productive, if you do enough projects with it, you save time compared to sticking to a language you already know.

    The notion that the choice of programming language doesn't matter is simply ridiculous.

    --
    Please correct me if I got my facts wrong.
  45. Re:I am afraid, there is lack of direction for Rub by AuMatar · · Score: 1

    Not at all. You're assuming that it really will be faster to do a project in $newLanguage. I disagree- unless there's some library that doesn't exist in $oldLanguage, the productivity of languages at equal levels of experience are equal. I have never in my life seen a problem made simpler by changing languages rather than downloading a library. If you want to dispure my point you need to prove the assertion that it isn't so, not just throw some pseudomath in a post.

    --
    I still have more fans than freaks. WTF is wrong with you people?
  46. Re:I am afraid, there is lack of direction for Rub by jadavis · · Score: 1

    We're not talking about poor algorithm selection. We're talking about using a slower language rather than a faster language.

    You assume that the same algorithm used in two languages will have the same big-O characteristics for CPU and memory consumption. That is not true.

    For instance, some languages can optimize tail recursion into a loop, and some cannot. For those that can, the memory consumption for a given algorithm may be constant. For those that cannot, the memory consumption may be O(n).

    --
    Social scientists are inspired by theories; scientists are humbled by facts.
  47. How about this, then? by douthat · · Score: 1
    --
    She loves me: 09F911029D74E35BD84156C5635688C0 She loves me not: 09F911029D74E35BD84156C5635688BF ...
    1. Re:How about this, then? by drewness · · Score: 1

      It's roughly competitive with Python 3

      Python 3 is much slower than 2.x. Hopefully they'll get it back on track in a point release.

      http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=python&lang2=python3

      Python 2.x still mostly beats Ruby 1.9
      http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=yarv&lang2=python

  48. Re:I am afraid, there is lack of direction for Rub by Anonymous Coward · · Score: 0

    No, hardware is cheap, relative to programmer time. Moore's Law only reinforces this.

    No, hardware is cheap, relative to programmer time when the scale of the application (usage, complexity) is small, but the two scale very differently the operation gets larger. Programmer time scales linearly (if done right) as the application gets larger/better and hardware scales linearly (if done right) as the application usage gets larger. When both are increasing, as is the case in many real-world situations, you can blur the line between the two, but if usage grows much faster than the complexity of the application, you eventually have to address the problem with programmers rather than hardware, especially if your business model doesn't involve profits growing linearly with usage.

    FWIW, at my company, we did an analysis last year as to how much we could save by moving from Java to Ruby for new features, since there have been people we respect that we've met at conferences who are/were Java proponents and have endorsed Ruby as something we should look into. The result was that based on the amount of traffic our app gets (lots...the Java version uses 15 beefy load-balanced app servers connecting to 4 replicated databases) and the size of our engineering team (5 full time), moving to Ruby would have increased our hardware cost 5 times what we pay programmers each year. Most apps that get as much traffic as we do employ 20 or more engineers, but our app is fairly simple and a lot of our work goes into tuning the application to perform better.

    Now I'm not saying that our case is the norm...far from it. However if usage increases much faster than the amount of engineers that it takes to maintain/improve the application, the statement that "hardware is cheap" can definitely be false. Hardware is only cheap relative to programmer time in the right circumstances...the more hardware an engineers code runs on, the more value you get from their time. And anyone making these kinds of decisions should remember that.

  49. Re:I am afraid, there is lack of direction for Rub by arevos · · Score: 1

    I have never in my life seen a problem made simpler by changing languages rather than downloading a library.

    Presumably you're not familiar with a great range of languages, then.

    Say you want to make a bag in Java:

    Map<T,int> bag(Collection<T> coll)
    {
        Map<T,int> m = new HashMap<T,int>();
        for (T key : m)
        {
            if (m.containsKey(key))
                m.put(key, m.get(key) + 1);
            else
                m.put(key, 1);
        }
        return m;
    }

    Whilst in Ruby:

    def bag(coll)
      Hash.new(0).tap{|m| coll.each{|k| m[k] += 1}}
    end

    And in Clojure:

    (defn bag [coll]
      (reduce #(merge-with + %1 {%2 1})) {} coll))

    But short examples like this can't really capture how much languages differ when used in large projects. Different languages open up entirely different ways to abstract a problem. In Ruby you can write methods that generate methods for other classes. In Clojure and other Lisps, there are macros which rewrite the syntax tree at runtime.

    These sorts of features create abstractions that simply don't exist in other languages. There are whole classes of solutions that are simply impractical to use in some types of languages. I've written a few thousand lines of Clojure code, which is quite a lot for the language, and very little of what I've written could be easily translated back to Java.

  50. Re:I am afraid, there is lack of direction for Rub by wzzzzrd · · Score: 1

    in java i would just use the bag class from apache commons. bad example ;) I mean i got your point, ruby is good in implementing containing data structures because of the blocks, but do you really think a project gets developed faster because a language has blocks and closures? I've experienced quite the opposite...if you start using a language that is particularly good in one thing, every problem gets resolved by using this one thing. Especially in ruby, where you have to use blocks which are quite unreadable for everything or you're a noob (just google for a software problem and add "ruby way" to the query).

    --
    On second thought, let's not go to Camelot. It is a silly place.
  51. Yuki Sonoda by Michael+Woodhams · · Score: 1

    OK, this is getting a bit off topic, but Yuki Sonoda is also a character in the Megatokyo web comic. In the comic, she's a 15 year old whose only geek credential is that she collects ancient video game platforms.

    --
    Quattuor res in hoc mundo sanctae sunt: libri, liberi, libertas et liberalitas.
    1. Re:Yuki Sonoda by Corrado · · Score: 1

      OK, this is getting a bit off topic, but Yuki Sonoda is also a character in the Megatokyo web comic.

      That's where I've heard this name before!! Thank you for clearing out a portion of my brain. :)

      --
      KangarooBox - We make IT simple!
  52. Re:I am afraid, there is lack of direction for Rub by arevos · · Score: 1

    I mean i got your point, ruby is good in implementing containing data structures because of the blocks, but do you really think a project gets developed faster because a language has blocks and closures?

    Certainly. When I program in Ruby, I use blocks regularly. Assuming that I am not a closure fanatic, then presumably I have a reason for using them. If they didn't reduce development time, I'd do without.

    Especially in ruby, where you have to use blocks which are quite unreadable for everything

    Personally, I find blocks make code more readable:

    children = people.select { |p| p.age < 18 }

    Compared to:

    List<Person> children = new List<Person>()
    for (Person p : people)
    {
        if (p.age < 18)
            children.add(p);
    }

    Blocks are also more concise. It's my opinion that the more readable code you can fit in your editor window at any one time, the better idea you can get of the whole program. A function that is more than four lines of code is a big function in my book.

  53. Ruby 1.9.1 Compatibility by Anonymous Coward · · Score: 0

    There's a guide around (http://frozenplague.net/2009/01/ruby-191-rubygems-rails/) about how to get some gems to work with Ruby 1.9.1. This involves a little bit of editing around, but generally they do work.

  54. Re:I am afraid, there is lack of direction for Rub by Chandon+Seldon · · Score: 1

    Did you read the article I linked to?

    --
    -- The act of censorship is always worse than whatever is being censored. Always.
  55. Re:I am afraid, there is lack of direction for Rub by Chandon+Seldon · · Score: 1

    You're emphasizing the wrong things.

    For example: scaling isn't a language issue. A system can scale if it can keep working once it grows beyond what some constant set of hardware can support. Whether a system can do that is entirely a question of architecture; choice of framework will have some impact, but language won't at all. Micro-benchmarks of page generation times have nothing to do with scaling at all, except maybe at the absolute upper end. Even reasonably slow page generation times shouldn't be your bottleneck in a non-trivial system.

    The important thing that you're missing is the force multiplier of using a more powerful language. The single largest expense in most software development projects is developers. Anything that lets less developers get more done sooner is hugely valuable - and skilled developers with a powerful language will, in practice, get more done faster than skilled developers with a less powerful language.

    --
    -- The act of censorship is always worse than whatever is being censored. Always.
  56. Re:I am afraid, there is lack of direction for Rub by Foofoobar · · Score: 1

    Scaling isn't a language issue normally but in the case of Ruby, it seems to have an inherent flaw with it's threads which causes it to 'top out' in comparison to other languages; while PHP, Perl and Python continue to fulfill requests, Ruby 'tops out'. For example, as PHP determines a need for more processes, it scales up to handle more concurrent requests. Ruby can't and will top out and just queue them up. Getting more done with less is great no matter what the language and this can be done in all languages... it's called a framework, libraries, patterns and experience. But that has nothing to do with what we are talking about. We were talking about scaling not a languages usability.

    --
    This is my sig. There are many like it but this one is mine.
  57. Re:I am afraid, there is lack of direction for Rub by MyIS · · Score: 1
    Because I've used C and C++ every day for the past 8 years
    But you'll never solve a problem quicker by using a language you aren't as familiar with

    I think the GP is trying to tell you that you need to get familiar with that other language. It takes more time, and for a good reason. You won't just be learning a new API, you'll be getting used to a new way of thinking. And programming is all about knowing the different ways of thinking.

    --
    http://zero-to-enterprise.blogspot.com/
  58. Re:I am afraid, there is lack of direction for Rub by Chandon+Seldon · · Score: 1

    For example, as PHP determines a need for more processes, it scales up to handle more concurrent requests. Ruby can't and will top out and just queue them up.

    That's just a deployment issue. It's definitely easier to get a single-server PHP deployment right - give or take secure permissions - but that doesn't mean that a properly set up RoR install can't take full advantage of a server's resources; mod_rails even does dynamic process allocation if that's what you really want (for Rails applications where "scaling" matters, you may not actually want that).

    Honestly, I don't like the deployment story for either Rails or PHP, but again - that shouldn't be a major criteria for selecting a language. Developer productivity is much more important.

    --
    -- The act of censorship is always worse than whatever is being censored. Always.
  59. Re:I am afraid, there is lack of direction for Rub by seebs · · Score: 1

    I don't buy it.

    I consider myself a moderately experienced C programmer, and by the time I'd been using perl for twenty minutes, I was doing better string manipulation in perl than I do in C. Even now.

    Language matters.

    And PHP is a sucky language. It's everything you'd expect from a language thrown together with bits and pieces tacked on as people found uses for them, and may never be able to get rid of that cruft without breaking so much code that, well, there'd be no point using it -- as you note, the real point is the availability of support code.

    --
    My blog: http://www.seebs.net/log/ --- My iPhone/iPad app: http://www.seebs.net/seebsfrac/
  60. Re:I am afraid, there is lack of direction for Rub by SanityInAnarchy · · Score: 1

    So basically you're pissed that your hobby language (and make no mistake, that's all Ruby will ever be)

    Some hobbies are quite profitable.

    there are more "unimaginative programmers" who know it thus allowing business to move forward with doing actual in an attempt to make a profit.

    That is why I tend to move towards small businesses and startups. You don't need those "more programmers" -- you need the five or ten programmers it will take to get the job done. More than that is just people warming seats.

    But then, PHP makes it so easy to botch the job the first time, you can pretty much guarantee there will be more programmers back to warm seats.

    And no, I'm not really pissed about it. Actually, I'm happy about it. See, I know PHP, so I can use it if I have to. I also know Ruby, and there are fewer people who know Ruby. That makes me valuable -- and it makes the one startup out of twenty that's using Ruby instead of PHP that much more likely to succeed.

    You'll always a cog in the machine.

    I've never been a cog in the machine, not in my working adult life.

    You don't understand business, that much is obvious.

    I'm not paid to. I'm paid to write good code, which I can do more effectively and more productively in Ruby than in PHP.

    --
    Don't thank God, thank a doctor!
  61. Re:I am afraid, there is lack of direction for Rub by SanityInAnarchy · · Score: 1

    Why would I as a business be expected to switch to a language that requires twice as much hardware?

    Because it requires half as many programmers, and hardware is far cheaper than programmers.

    What you MAY save with software dev speed, you now lose with day to day server maintenance.

    Server maintenance? Ah, I see, you're well behind the times.

    See, I can fire up another Amazon EC2 instance with a single command, or automatically from a script. And since I assemble and manage them with scripts, once I get it past a single instance, it takes exactly as much effort to manage twenty as it does to manage two.

    And your comment about "moving parts" is equally dated, if you're thinking in terms of likelihood for a CPU to fail. Once I've got two, if either fails, the other can notice and fire up a new instance, killing that one. Failing hardware then becomes Amazon's problem, not mine.

    And seriously, day to day maintenance? Haven't touched the 3mix server in over a week. If you have to perform manual maintenance on a production server every day, you're Doing It Wrong.

    The key to good engineering is to simplify because the more parts, the more chance of failure.

    This is true of code, also. Fewer lines of code means fewer moving parts. Ruby commonly means fewer lines of code.

    when similar languages such as PHP, PERL and PYTHON can do it with far less hardware is not a very good solution.

    Can they, though? Follow the link in the post you're replying to. Ruby is not significantly slower than PHP in real-world benchmarks -- in a few of them, it's significantly faster.

    --
    Don't thank God, thank a doctor!
  62. Re:I am afraid, there is lack of direction for Rub by SanityInAnarchy · · Score: 1

    The idiom of "let's throw more hardware at the problem" is a way of saying "we don't know jack shit about how to build a scalable web application,

    You're misusing the word "scalable". You probably mean vertical scalability, or performance.

    And it's not saying we don't know how to build a performant application. It's saying we don't care, because programmer time is more expensive than CPU time. It's simply not worth it to optimize past a certain point.

    you're looking for a miracle since it's a known fact RoR doesn't scale very well.

    Citation needed.

    Also, you are again talking about vertical scalability. Rails is actually excellent at horizontal scalability, which means, specifically, "Can we throw more servers at it and have it just work?"

    Not every PHP app can do that. Nor every Python, or Java app. However, unless you do something stupid, every Rails app can be scaled by throwing hardware at it.

    Keep in mind, you will have to do this at some point. No Amazon, or Myspace, or Google, is going to run off a single server, no matter how massive. They all have to scale horizontally. You have to address that problem sooner or later.

    So, I'm arguing that horizontal scalability is more important than vertical scalability. Horizontal scalability means you can ultimately handle as much traffic as you can find hardware for. Vertical scalability means you save some money on hardware -- that's all.

    just following the RoR hype of it being the best thing since sliced bread, which it's not.

    No, it's not, but it's still pretty damned good.

    Hype does not automatically make something a bad idea. Does anyone remember the hype about AJAX? I think most Rails hype is tame compared to that, but as it turned out, AJAX is pretty useful. It's not the Best Thing Ever, but it's still useful.

    If you can find where I've said Rails is the best thing ever, please, point it out. Otherwise, please try to reply to just my post, not every Rails developer ever.

    --
    Don't thank God, thank a doctor!
  63. Re:I am afraid, there is lack of direction for Rub by SanityInAnarchy · · Score: 1

    if usage grows much faster than the complexity of the application, you eventually have to address the problem with programmers rather than hardware, especially if your business model doesn't involve profits growing linearly with usage.

    However, there should be some amount of profit which improves linearly -- why wouldn't you throw some Google ads on the site?

    As for usage growing faster than complexity, we generally call this "A nice problem to have."

    Now I'm not saying that our case is the norm...far from it.

    And I'll concede that there are many situations outside the norm, which is why I would love to see Ruby get faster. I see nothing in the syntax and behavior of either language to suspect that Java should automatically be faster than Ruby.

    But for now, there's still embedded systems, mainframes, operating system kernels, console video games, and many, many other places where a language like Ruby isn't even remotely appropriate.

    I will make one more argument: Every greenfield app should probably at least be prototyped in something like Ruby. If you find yourself in a situation like you've described, you can always rewrite in another language. But since it's a greenfield app, what you want to avoid is letting a competitor get their version out the door before yours, even if your version is more efficient than theirs.

    I'm curious whether you considered JRuby?

    --
    Don't thank God, thank a doctor!
  64. Perl 6 release this year by Anonymous Coward · · Score: 0

    With Perl 6 being released later this year I'd say that it is a waste of time even reading this article. Better to get ready for the tidal wave which will be the return of Perl.

  65. Re:I am afraid, there is lack of direction for Rub by Nevyn · · Score: 1

    Blocks are also more concise.

    C/Java/Whatever doesn't require the newlines ... if you prefer non-newlines then:

    List<Person> children = new List<Person>();
    for (Person p : people) if (p.age < 18) children.add(p);

    ...now the only real difference is the fact you are declaring what types are in the list, something ruby/python/perl can't do and is one of my biggest annoyances with python (don't do ruby).

    --
    ustr: Managed string API with ave. 44% overhead over strdup(), for 0-20B
  66. Re:I am afraid, there is lack of direction for Rub by Foofoobar · · Score: 1

    But now you are comparing RoR (language + framework) to PHP (language). Bad comparison. Thats like comparing a submarine to a volkswagon. I was strictly comparing languages based upon benchmarks of the languages and NOT the frameworks.

    I'm willing to take a second look at Ruby but to date it has always come second as a web language for speed, scalability. And the only argument people provide for using it is 'you can develop faster'; well you can in ANY language given a good framework, proper training, knowledge of patterns, etc etc. The thing Ruby DOES provide that enable you to develop faster (like obfuscating looping and stuff like that) unfortunately is also it's achilles heel and causes extra processing to occur causing it to be slower than other languages doing the same tasks.

    Now speed and scaling may not be top on your list but when you get your product built and you start to get popular and are getting a couple million hits a day and can't afford all that new hardware yet, and the platform you chose can't keep up, then it becomes an issue. This is why people make a big deal about it. Having working for Amazon as a startup, we doubled our business every month for the first two years from 95-97!!! Ruby would never have been able to accomplish that and we would have had to constantly be replacing and buying hardware. There has to be a stabilization point.

    For now, Ruby is GREAT as a small mom-n-pop solution and for smaller shops that don't expect big growth (as long as they can find the developers and tools). But it is not yet ready for large to enterprise deployment and even for that reason, I would stay away from it for medium size businesses due to expected growth. However, with every iteration, it is becoming more and more mature and I expect they will work through these issues in the next 3-5 major releases.

    --
    This is my sig. There are many like it but this one is mine.
  67. Re:I am afraid, there is lack of direction for Rub by MadCat · · Score: 1

    You're misusing the word "scalable". You probably mean vertical scalability, or performance. And it's not saying we don't know how to build a performant application. It's saying we don't care, because programmer time is more expensive than CPU time. It's simply not worth it to optimize past a certain point.

    Which is exactly the attitude that's keeping things from scaling (regardless of whether I'm using this word in it's proper context, sorry, English isn't my native language) -- because you don't care, so why care at all about optimising when well, you can just throw more hardware at it? Sooner or later you'll be spending more on hardware than you are on programmers. Besides, programmers that do not know how to optimise properly should either quit the job or go back to school and study some more.

    Citation needed.

    Twitter.

    Also, you are again talking about vertical scalability. Rails is actually excellent at horizontal scalability, which means, specifically, "Can we throw more servers at it and have it just work?" Not every PHP app can do that. Nor every Python, or Java app. However, unless you do something stupid, every Rails app can be scaled by throwing hardware at it. Keep in mind, you will have to do this at some point. No Amazon, or Myspace, or Google, is going to run off a single server, no matter how massive. They all have to scale horizontally. You have to address that problem sooner or later.

    Scaling is scaling, whether it be horizontal or vertical. Horizontal scaling only gets you so far in the long run as well. Then again don't take my word for it but I've seen that same "oh well we'll just throw more hardware at it" solution blow up in some seriously interesting ways.

    So, I'm arguing that horizontal scalability is more important than vertical scalability. Horizontal scalability means you can ultimately handle as much traffic as you can find hardware for. Vertical scalability means you save some money on hardware -- that's all.

    Vertical scalability also forces you to know what you're doing when it comes to algorithms and such things. I know, I know, I'm probably a horribly oldfashioned cunt by saying it, but really, if you're going to build a car, you might as well build yourself a fast one instead of a 10 ton truck being powered by a 2 stroke 40hp diesel engine and say "well we can always throw more engines in here".

    No, it's not, but it's still pretty damned good. Hype does not automatically make something a bad idea. Does anyone remember the hype about AJAX? I think most Rails hype is tame compared to that, but as it turned out, AJAX is pretty useful. It's not the Best Thing Ever, but it's still useful.

    I'll admit it's good, but the problem comes from people who blindly follow the hype and will claim that RoR IS the best, and can do it better, and what the hell do us old Perl writing coots know anyway. I don't want to go and compare experience e-peens, but my comments on scalability are based on some interesting observations in the past.

    If you can find where I've said Rails is the best thing ever, please, point it out. Otherwise, please try to reply to just my post, not every Rails developer ever.

    Did I say you said rails is the best thing ever? I didn't. Why bring it up in the first place?

    --
    There is no sig...
  68. Re:I am afraid, there is lack of direction for Rub by Chandon+Seldon · · Score: 1

    I was strictly comparing languages based upon benchmarks of the languages and NOT the frameworks.

    That's even less useful, because then you're just comparing a well integrated Apache module to basically nothing. There are well defined deployment solutions for Rails, not so much for Ruby without a framework.

    Having working for Amazon as a startup, we doubled our business every month for the first two years from 95-97!!! Ruby would never have been able to accomplish that and we would have had to constantly be replacing and buying hardware.

    For any business that isn't planning on going from nothing to the Dow Jones in less than a decade, the business numbers for performance come out quite a bit different. Even if you're only going to get as much traffic as Slashdot, servers are still cheaper than developers. Assuming that you're going to be the next Amazon or Google and wasting money preparing for that early is simply a bad business decision.

    And the only argument people provide for using it is 'you can develop faster'; well you can in ANY language given a good framework, proper training, knowledge of patterns, etc etc.

    Do you have any argument or reference to support your claim that language choice doesn't matter to development time, or are you just going to keep asserting it?

    --
    -- The act of censorship is always worse than whatever is being censored. Always.
  69. Re:I am afraid, there is lack of direction for Rub by arevos · · Score: 1

    C/Java/Whatever doesn't require the newlines

    It's still more verbose, and you can't chain for-loops. You're also limited to built-in looping structures; there's no support for folds or the like.

    ...now the only real difference is the fact you are declaring what types are in the list

    Types are useful, so long as you have a decent type system. Unfortunately, Java has a very poor type system. I wouldn't necessarily say it was the worst type system ever devised, but it's certainly in the top 10.

  70. Java like cross-country skiing by Latent+Heat · · Score: 1

    It is a practical means of transportation in some but not other environments, it is supposed to be good for you and it is Politically Correct, people seem to think they can pick it up with a minimum of skill and many do, but you would have a whole heck of a lot more fun if you were on downhill skiis or on a snowboard and knew what you were doing.

  71. Re:I am afraid, there is lack of direction for Rub by RAMMS+EIN · · Score: 1

    ``You're assuming that it really will be faster to do a project in $newLanguage.''

    I am assuming that the development time isn't equal for all languages. I find the contrary assumption (there is no difference in development time among all languages) absurd.

    ``I have never in my life seen a problem made simpler by changing languages rather than downloading a library.''

    That may be so, but this requires that said library exist. That won't always be the case. And what if you actually wanted to write such a library?

    ``If you want to dispure my point you need to prove the assertion that it isn't so, not just throw some pseudomath in a post.''

    I agree that pseudomath doesn't prove anything. On the other hand, the burden of proof isn't on me; you were the one making the original assertion, so the burden of proof is on you. Having said that, there are studies that compare development time across programming languages. One example is "Lisp as an Alternative to Java" (PDF), which finds that development time differs among Lisp, Java, and C++.

    --
    Please correct me if I got my facts wrong.
  72. Re:I am afraid, there is lack of direction for Rub by RAMMS+EIN · · Score: 1

    ``do you really think a project gets developed faster because a language has blocks and closures?''

    Yes.

    ``I've experienced quite the opposite...if you start using a language that is particularly good in one thing, every problem gets resolved by using this one thing.''

    Yes. This is why languages like Ruby are good, and languages like Java are bad. In Ruby, you have simple and powerful constructs that you can pick and choose from; use the ones you like and ignore the rest. In Java, you have no choice but to use classes, and many useful things are lacking from it.

    --
    Please correct me if I got my facts wrong.
  73. Re:I am afraid, there is lack of direction for Rub by DragonWriter · · Score: 1

    Twitter.

    Rails wasn't Twitter's problem, though there was some initial finger pointing in that direction. The problem was that Twitter initially had a simple synchronous architecture (which, sure, is the easiest thing to do with Rails, as with most frameworks) when it needed an asynchronous messaging architecture, and that they didn't do database optimizations that are out of scope for the web application framework. See, among other things, this article.

  74. Re:I am afraid, there is lack of direction for Rub by DragonWriter · · Score: 1

    but do you really think a project gets developed faster because a language has blocks and closures?

    Yes.

    I've experienced quite the opposite...if you start using a language that is particularly good in one thing, every problem gets resolved by using this one thing. Especially in ruby, where you have to use blocks which are quite unreadable for everything or you're a noob

    Since Ruby blocks are structurally pretty much identical to Ruby method definitions, which are themselves pretty similar to function/method definitions in most vaguely C-like (or Algol-derived, if you prefer) languages, I find describing them as "quite unreadable" to be rather odd. If you have a lot of programming experience but none of it in other languages where passing around anonymous functions as arguments is commonplace, it probably seems unusual at first and takes a little bit of time to get over that feeling, but I wouldn't think it would be too big of a barrier for most people.

  75. Re:I am afraid, there is lack of direction for Rub by SanityInAnarchy · · Score: 1

    Sooner or later you'll be spending more on hardware than you are on programmers.

    That generally happens later. Premature optimization is the root of all evil.

    programmers that do not know how to optimise properly should either quit the job or go back to school and study some more.

    The fact that I choose to focus on other things does not mean I don't know how to optimize. Knowing when to optimize is what's important.

    I'll quote it again: Premature optimization is the root of all evil. Above all, build a clean, maintainable architecture. If you find out that certain parts of it are too slow, then you start to optimize -- ultimately, you may end up writing some parts of it in C. But when you've got enough traffic that you have to do that, you've got a nice problem, maybe enough money to hire a full-time person who's job is to optimize.

    At the point where you've got a thousand servers, a 10% performance gain is a hundred servers you no longer need. At the point where you've got ten servers, a 10% performance gain is only worth it if it takes less than, oh, three hours, given the going rate for dedicated/virtual servers.

    And chances are, again, that at this point in your lifecycle, you would probably be better served spending those three hours working on the app itself, to get it out the door.

    Obviously, there are exceptions. If you're slurping an entire table into RAM, you're Doing It Wrong, and you're probably only saving yourself a few lines of code, or a few minutes reading SQL documentation.

    Twitter.

    Aside from the demonstrated fact that Rails wasn't their scaling problem, there's also the part where they still seem to be running Rails, and they still seem to be doing alright. (Correct me if I'm wrong on either of those.)

    For that matter, Twitter also demonstrates exactly why you should put off the scaling issue. Twitter now has enough traffic and enough money that they should be able to rewrite from scratch if they have to. Others have tried to make better, more efficient Twitters, but so far, Twitter has first mover's advantage -- everyone is using Twitter, so why would they switch to something else?

    It's the classic "worse is better" argument. If it takes you twice as long to get to market with a solution that's twice as efficient, all the money you've saved won't buy back the customers you lost to that first mover.

    Horizontal scaling only gets you so far in the long run as well.

    It depends what kind of app you're building, but if horizontal scaling works at all, you should be able to continue to scale horizontally as long as you have money to throw at it.

    Contrast with scaling vertically, where you have to wait for Moore's Law, which may never kick in for you if you haven't designed for multicore. (Conversely, a horizontal scaling architecture, you can just spawn an instance per core.)

    I'll admit it's good, but the problem comes from people who blindly follow the hype and will claim that RoR IS the best, and can do it better, and what the hell do us old Perl writing coots know anyway.

    Perl, I get along with just fine. Python, I have no problem with. Erlang or Smalltalk, I have some respect for.

    It's people who do PHP just because it'll supposedly be easier to hire crappy programmers, or Java because it's what Big Business uses, that get on my nerves. Especially people who use C because they need performance -- a web app written in C very likely belongs on thedailywtf, unless there's a very good reason for it.

    Did I say you said rails is the best thing ever?

    What you said was, specifically, other languages seem to have more people who know what they're doing, instead of just following the RoR hype.

    See, I don't think I was "hyping" Rails. That's why I said, please reply to my comment, and not to "the Rails comm

    --
    Don't thank God, thank a doctor!
  76. Re:I am afraid, there is lack of direction for Rub by ToasterMonkey · · Score: 1

    Server maintenance? Ah, I see, you're well behind the times.

    Where the fuck do YOU work?

    And your comment about "moving parts" is equally dated, if you're thinking in terms of likelihood for a CPU to fail. Once I've got two, if either fails, the other can notice and fire up a new instance, killing that one. Failing hardware then becomes Amazon's problem, not mine.

    And seriously, day to day maintenance? Haven't touched the 3mix server in over a week. If you have to perform manual maintenance on a production server every day, you're Doing It Wrong.

    "server"? "Server"? As in ONE server?? You know half the geeks reading this site work with hundreds of them right? Do you know what happens in a given day in environments with 100+ servers? All Hell breaks loose. There is ALWAYS something that needs to be fixed or monitored better.

    if you're thinking in terms of likelihood for a CPU to fail. Once I've got two, if either fails, the other can notice and fire up a new instance, killing that one.

    Damn dude, you know there are just a _few_ organizations out there that are running more than a couple web servers right?

    Really, the only thing dated here is you. We've pretty much narrowed you down to an arrogant young student somewhere. Get a real IT job before running your mouth off like servers don't need maintenance, complex environments can be controlled from a little script, or things that claim to failover actually do.

  77. Re:I am afraid, there is lack of direction for Rub by SanityInAnarchy · · Score: 1

    "server"? "Server"? As in ONE server??

    Company is out of money, so yes, only one.

    One which needed maintenance (other than updates) exactly once in its lifetime. And updates can be scripted.

    Damn dude, you know there are just a _few_ organizations out there that are running more than a couple web servers right?

    Point is that once you've got two, the model works. A few hundred could be done with the same principle -- when one goes down, spawn another.

    Get a real IT job before running your mouth off like servers don't need maintenance, complex environments can be controlled from a little script,

    In the very real IT job I had (until the economy imploded), I actually didn't do a lot of IT, mostly because, as much as you'd like to mock it, complex environments can be controlled from scripts. Those scripts aren't necessarily "little", but they get the job done.

    When I can type one command to provision, boot, and configure a server, and with a little tweak, that command could do the same to n servers, no, there's not really a lot of maintenance. If they were 100 servers, each doing something completely different, you might have a point. But if they're 100 servers running the same app that, more efficiently coded, might run on 20 or 50, it really doesn't take any more effort to run 100 servers than it does 20.

    --
    Don't thank God, thank a doctor!
  78. Re:I am afraid, there is lack of direction for Rub by DragonWriter · · Score: 1

    Scaling isn't a language issue normally but in the case of Ruby, it seems to have an inherent flaw with it's threads which causes it to 'top out' in comparison to other languages

    Ruby 1.8.x uses green threads in a single process per interpreter instance, JRuby uses Java threads (which are native threads on most or all platforms, IIRC), Ruby 1.9.0/1.9.1 use native threads with a GIL, exactly, AFAIK, like Python up through and including 3.0. Each of these Ruby implementations will have different threading performance.
    Of course, none of that matters for Rails, which is probably where the issue you are talking about arouse rather than Ruby itself, since Rails is still, AFAIK, single-threaded throughout, with experimental threading support.

    For example, as PHP determines a need for more processes, it scales up to handle more concurrent requests.

    Every Ruby implementation contains support for spawning additional processes, though deciding whether and when to do this isn't a language function, its an application (or framework, or even application server) function.

  79. Re:I am afraid, there is lack of direction for Rub by DragonWriter · · Score: 1

    But now you are comparing RoR (language + framework) to PHP (language). Bad comparison. Thats like comparing a submarine to a volkswagon. I was strictly comparing languages based upon benchmarks of the languages and NOT the frameworks.

    PHP is a language a templating system designed very much for building web applications.

    Ruby is a general purpose programming language, that is largely popular due to a particular web app framework.

    Comparing bare Ruby with no non-standard libraries to PHP for web apps hosted behind another server is at least as bad of a comparison, and arguably far worse, than comparing RoR to PHP.

    I'm willing to take a second look at Ruby but to date it has always come second as a web language for speed, scalability.

    I've yet to hear a coherent argument for how Ruby fails at scalability compared to any other language, whether PHP or anything else.

    The thing Ruby DOES provide that enable you to develop faster (like obfuscating looping and stuff like that) unfortunately is also it's achilles heel and causes extra processing to occur causing it to be slower than other languages doing the same tasks.

    Ruby doesn't obfuscate looping. I have no idea what you mean by "stuff like that" other than "other stuff that isn't true, either".

  80. Ruby isn't slow, Ruby programs are slow by Anonymous Coward · · Score: 0

    Ruby can be a rather fast language. As fast as Python at least. For more complicated problems I sometimes find it faster than C, att least without making the C code very hairy.

    With very little effort you can make a slow program that solves a very complicated problem. If it's too slow, it's not hard to make it faster (but you have to have a clue what goes on inside the interpreter), writing that first slow version and then optimise it to the speed of Python is easier and less time consuming then to write one Python version. And you can start coding before you have a clear idea of what to do.

    It's like making an oil painting, you start with that greasy coal sketch, then a greasy oil sketch, repaint, repaint... and then before you know it, it's finished. You could do a better painting in watercolour, if you know more or less exactly what you want to do (or make time consuming preparations), and it would be done slightly faster, if you know more or less exactly what you want to do, but if you don't know more or less exactly what you want to do, you get a horrible painting. I usually prefer faster techniques when I paint (like watercolour, pastel and tempera), but thats because I usually know exactly what I want to achieve. If I don't have a clear picture in my head, nothing beats oil (actually that would be digital painting, but that canvas has to many limitations). When I make a program, I like to think and code at the same time, then Ruby is an excellent tool. If I know exactly what to do then I use C, not Python.

  81. Re:I am afraid, there is lack of direction for Rub by Foofoobar · · Score: 1

    That's even less useful, because then you're just comparing a well integrated Apache module to basically nothing. There are well defined deployment solutions for Rails, not so much for Ruby without a framework.

    An apache module??? What are you talking about? Perl, Python and PHP vs Ruby??? You selected ONE while I am broadly comparing and naming examples. But to go with your example, I believe you are talking about PHP which was designed to be used as an Apache Module and not as a standalone and as such will always suffer a startup loss of time vs any language since it does not stay running as a daemon in the background. Hence people benchmark it as an Apache module.

    Now back to less whining and more comparing of languages...

    servers are still cheaper than developers...

    And sys admins are to maintain all those those servers you are buying are equally cheap. How about the DBA's? etc etc. Everytime you overly complicate your architecture, you extend your cost. The Ruby answer has always been 'so we're slow... throw hardware at the answer' and that has not been a solution for companies that get to a medium size and can no longer afford maintenance or the staff to maintain.

    Additionally, Ruby devs seem to think they have a 'MAGIC LANGUAGE' that allows them to develop so fast that all other languages are absolete. Got news for you... all languages have MVC frameworks, all languages can use patterns. These are not new concepts. Ruby is not fast for development. It is merely fast for newbies picking up a language who have never programmed before. And that's even more dangerous because they don't understand the fundamentals of what they are doing.

    --
    This is my sig. There are many like it but this one is mine.
  82. Re:I am afraid, there is lack of direction for Rub by Chandon+Seldon · · Score: 1

    And sys admins are to maintain all those those servers you are buying are equally cheap. How about the DBA's? etc etc. Everytime you overly complicate your architecture, you extend your cost.

    The same one sysadmin can handle four web servers instead of two, or eight instead of four. A slow interpreter doesn't make the database any slower, so the DBA bit is irrelevant. The application will probably be limited by something other than interpreter speed anyway; needing more servers at all is just absolute worst case.

    Additionally, Ruby devs seem to think they have a 'MAGIC LANGUAGE' that allows them to develop so fast that all other languages are absolete. Got news for you... all languages have MVC frameworks, all languages can use patterns. These are not new concepts. Ruby is not fast for development.

    You're making this assertion - that language doesn't matter to development speed - for the third time. It's blatantly wrong. Consider assembly language vs Python. The reason that Python is more productive is that it allows for more abstraction and less code. Ruby allows for more abstraction and less code than PHP does, and therefore will be faster to work in. Libraries and patterns don't change this - again, clearly demonstrated by considering Assembly (or C).

    --
    -- The act of censorship is always worse than whatever is being censored. Always.