Slashdot Mirror


Ruby Off the Rails

An anonymous reader writes "IBM DeveloperWorks has an interesting writeup on Ruby that takes a look at the programming language as a stand-alone solution rather than defining it in terms of Rails. From the article: 'Ruby on Rails is just one facet of what makes Ruby great, just like EJB is only part of the Java enterprise platform. Andrew Glover digs beneath the hype for a look at what Java developers can do with Ruby, all by itself. Ruby's syntax is quite different from that of the Java language, but it's amazingly easy to pick up. Moreover, some things are just plain easier to do in Ruby than they are in the Java language.'"

325 comments

  1. What I need to know by Anonymous Coward · · Score: 0, Troll

    Before I even consider Ruby: is it faster and less memory hungry than Java.

    If the answer is no, then I'm not going to waste any effort on it.

    1. Re:What I need to know by arevos · · Score: 5, Interesting
      Before I even consider Ruby: is it faster and less memory hungry than Java.
      If the answer is no, then I'm not going to waste any effort on it.

      If speed and memory usage is your only criteria when choosing a language, why not use C or assembly?

    2. Re:What I need to know by the+eric+conspiracy · · Score: 4, Informative

      Ruby is useless to me because it has no unicode support.

      In this shootout it was found that Ruby had lower memory consumption, but also ran much more slowly than Java:

      http://shootout.alioth.debian.org/benchmark.php?te st=all&lang=java&lang2=ruby&sort=fullcpu

    3. Re:What I need to know by Geoffreyerffoeg · · Score: 3, Interesting

      Before I even consider Ruby: is it faster and less memory hungry than Java.

      Yes on both counts. It's faster for you to write programs, and requires less of a learning curve.

    4. Re:What I need to know by Anonymous Coward · · Score: 0

      That is not the only critera, Java just makes for a very liberal hard upper limit.

    5. Re:What I need to know by Decaff · · Score: 1

      Yes on both counts

      No on both counts. There is as yet no high-performance VM for Ruby, and it's memory use is not optimised.

      Having said that, Ruby is a wonderful language.

    6. Re:What I need to know by Bastard+of+Subhumani · · Score: 0
      Ruby is useless to me because it has no unicode support.
      If plain ascii ISO-8859-1 was good enough for Aristotle, Jesus Christ & Shakespeare, it's good enough for you.

      Too good, in fact.

      --
      Only three things are certain; death, taxes, and apocryphal quotations - Ben Franklin.
    7. Re:What I need to know by Anonymous Coward · · Score: 0

      Ruby, IMHO, have the simplest model to do extensions on C/C++.
      So, is very easy to make a prototype on Ruby, profile, and speedup the bottlenecks with C

    8. Re:What I need to know by arevos · · Score: 1

      If you're programming for older hardware, or for mobile devices, then I could understand your use of Java. Likewise, if you're developing a large application, I could understand your use of Java. But if you don't need such efficiency from your code, why spend more time developing a program in Java, when you could develop it faster in Ruby?

    9. Re:What I need to know by Decaff · · Score: 2, Insightful

      why spend more time developing a program in Java, when you could develop it faster in Ruby?

      Because not getting the best performance out of hardware, no matter how old or new it is, puts your application at a disadvantage compared to your competitors. No matter how much you may try and justify things, your users don't care about the language you use to develop - they care about performance.

      There are alternatives - you can use both Ruby and Java together (JRuby works on the JVM). I think this 'mix and match' approach will be more widely used in the future.

    10. Re:What I need to know by badfish99 · · Score: 3, Funny
      Aristotle would have wanted Greek, and Jesus would have wanted Aramaic. So no, ISO-8859-1 was not good enough for them. Nor is it much use for the majority of people in the world today.

      As for Shakespeare, he couldn't even spell his own name, so he didn't care.

    11. Re:What I need to know by Anonymous Coward · · Score: 0

      There's no high performance JVM either -- of course, that depends on your definition of "high performance". For me it's "doesn't slow my machine to a crawl and use all the RAM" -- so in my case, no, there's definitely no high performance JVM.

    12. Re:What I need to know by arevos · · Score: 1
      Because not getting the best performance out of hardware, no matter how old or new it is, puts your application at a disadvantage compared to your competitors. No matter how much you may try and justify things, your users don't care about the language you use to develop - they care about performance.

      But if your product comes out 6 months before your competitors, and is developed at three times the rate, who's going to have the advantage then? People don't care about performance as much as they do features and capabilities. Further, performance loss is only noticable by the human eye up to a point. If your product responds within 100ms, then it isn't going to matter whether it returns in 5ms or 50ms.

    13. Re:What I need to know by Decaff · · Score: 2, Interesting

      But if your product comes out 6 months before your competitors, and is developed at three times the rate, who's going to have the advantage then?

      I really don't believe it will. Ruby is a wonderful language I agree, but actual language coding is not a major part of any project. Design, testing and debugging are. In these areas, in my opinion, there is little difference between the language (in fact, Java has a wider range of high-quality IDEs and debugging tools).

    14. Re:What I need to know by Decaff · · Score: 1

      There's no high performance JVM either -- of course, that depends on your definition of "high performance". For me it's "doesn't slow my machine to a crawl and use all the RAM" -- so in my case, no, there's definitely no high performance JVM.

      Considering there has been a new release of Quake written in Java that is very much the same speed as the C version I feel it is reasonable to disagree.

      With insufficient memory, almost any application (especially GUI apps) will slow to a crawl.

      It is like arguing that C++ is slow because KDE is unusable on a 64MB linux box.

    15. Re:What I need to know by Anonymous Coward · · Score: 0

      How about the fact that Java apps are slow on a machine with 512Mb of RAM? How's that grab you, Java boy? How much RAM would recommend burning up on shitty apps that are still slow even when you do have gigs of RAM?

    16. Re:What I need to know by arevos · · Score: 2, Interesting
      I really don't believe it will. Ruby is a wonderful language I agree, but actual language coding is not a major part of any project. Design, testing and debugging are. In these areas, in my opinion, there is little difference between the language (in fact, Java has a wider range of high-quality IDEs and debugging tools).

      I must disagree here. I can think of several commercial Java web-based projects that I know could have been done in at least the third the time in Ruby on Rails. And the programmer and author Paul Graham holds his startup's use of Lisp as the major factor in their resulting success. In my experience, the choice of language is far more significant than you make it out to be.

    17. Re:What I need to know by Anonymous Coward · · Score: 0

      Oh, and BTW: you are lying about Quake. I've seen the Java version... with hardware gfx acceleration, it runs about as fast as it used to on a pentium. Sure, you can run Quake in Java, now that we have several gigahertz of CPU power and a gig of RAM and a gfx hardware acceleration. Woo fucking hoo.

      In case you were wondering, that doesn't translate into being as fast as C... nor does it make Java suitable for 3d games... unless you happen to be a disingenuous Java fanatic.

    18. Re:What I need to know by Decaff · · Score: 1

      How about the fact that Java apps are slow on a machine with 512Mb of RAM? How's that grab you, Java boy?

      This is simply not a fact at all. I am using the Java NetBeans development evironment in 64MB. Works fine and fast. I am using Java games on my mobile phone.

      How much RAM would recommend burning up on shitty apps that are still slow even when you do have gigs of RAM?

      I guess that is why the newly-released PC game Tribal Trouble (written entirely in Java) runs on a 700MHz pc with 128MB memory.

      Sorry, but the evidence suggests that whatever your personal experience, in general you are mistaken.

    19. Re:What I need to know by marcosdumay · · Score: 2, Informative

      The chosen language is one of the things that the Consumer (maybe they not think the same, but, whatever) is most aware of. Let's see... The Consumer wants programs that are:
      1 - Efficient (memory, processor, net, and disk usage,...)
      2 - Bug-free
      3 - Cheap

      A low level language leads to 1, but not to 2 and 3. A good hight level language leads to 2 and 3, but not to 1. How well received your programs is depends only on how well it fits the Consumer's expectations (and how fat is your marketing bill), so the language matters.

      Also, Ruby + Java doesn't lead to a nice combo. The ideal combinations are with languages of different abstraction levels, like Ruby + C, or Ruby + some excelent hight level framework for web pages, aka Rails. So bad Java doesn't combine well with low level languages.

    20. Re:What I need to know by Decaff · · Score: 1

      Oh, and BTW: you are lying about Quake.

      Not just me; take a look at the recent 'Quake 2 ported to Java' thread posted on Slashdot.

      I've seen the Java version... with hardware gfx acceleration, it runs about as fast as it used to on a pentium. Sure, you can run Quake in Java, now that we have several gigahertz of CPU power and a gig of RAM and a gfx hardware acceleration.

      Sorry, but I saw a demo version years ago on much less that that.

      Woo fucking hoo.

      Well, you could post this, or perhaps discuss bencharks.

      nor does it make Java suitable for 3d games... unless you happen to be a disingenuous Java fanatic.

      Which is odd, considering new 3D games written in Java are being released all the time. here is a new one:

      http://tribaltrouble.com/

    21. Re:What I need to know by Decaff · · Score: 1

      I must disagree here. I can think of several commercial Java web-based projects that I know could have been done in at least the third the time in Ruby on Rails. And the programmer and author Paul Graham holds his startup's use of Lisp as the major factor in their resulting success. In my experience, the choice of language is far more significant than you make it out to be.

      Again, I disagree. Even coding of the web application is a minor part of the project except for the very smallest projects. Most reasonable web projects involve careful storyboarding of the web pages, design and testing of database schemas and lots and lots of CSS work.

    22. Re:What I need to know by Decaff · · Score: 1

      Also, Ruby + Java doesn't lead to a nice combo.

      I don't understand why you said this, as they are already being used together, with JRuby on the JVM. Ruby has access to the features of the JVM (efficient threading) and Java class libraries and Java has access to the Ruby classes you produce.

    23. Re:What I need to know by arevos · · Score: 1
      Again, I disagree. Even coding of the web application is a minor part of the project except for the very smallest projects. Most reasonable web projects involve careful storyboarding of the web pages, design and testing of database schemas and lots and lots of CSS work.

      I suggest we agree to disagree. It's clear that this is coming down to personal experience, something that is a little difficult to base an argument upon, without degenerating to each of us blindly insisting the other is wrong.

    24. Re:What I need to know by Decaff · · Score: 1

      It's clear that this is coming down to personal experience, something that is a little difficult to base an argument upon, without degenerating to each of us blindly insisting the other is wrong.

      I have no intention of insulting :)

      I am not basing on personal experience - part of my job is to understand and review web (and other) development processes, and I have seen projects at a range of scales.

    25. Re:What I need to know by arevos · · Score: 1
      I have no intention of insulting :)

      I said insisting, not insulting :)

      I am not basing on personal experience - part of my job is to understand and review web (and other) development processes, and I have seen projects at a range of scales.

      Then whose experience are you basing this upon?

    26. Re:What I need to know by Decaff · · Score: 1

      I said insisting, not insulting :)

      Heh - sorry - a combination of not wearing my glasses and assuming usual slashdot comment standards :)

      Then whose experience are you basing this upon?

      Both my experience and the experience of many others whose projects I have had to review - how using different languages and technologies have worked for them. They have used a range of technologies, including .NET, JSF, PHP, PERL etc.

    27. Re:What I need to know by Anonymous Coward · · Score: 0

      That's amusing... so if I take all but 64mb of RAM out of my PC and try to run netbeans... it'll be nice and fast? Funny that, because I've tried it on several machines ranging from 256mb to a gig of RAM and they've all been slow enough to make me sit there grinding my teeth while the PC thrashes (and that's "thrashes" in the CS definition). I guess we just have radically different definitions of "slow" -- which where I came in.

    28. Re:What I need to know by Anonymous Coward · · Score: 0

      Because not getting the best performance out of hardware, no matter how old or new it is, puts your application at a disadvantage compared to your competitors. No matter how much you may try and justify things, your users don't care about the language you use to develop - they care about performance.

      So why do you like Java then?

    29. Re:What I need to know by Bastard+of+Subhumani · · Score: 0
      How about the fact that Java apps are slow on a machine with 512Mb of RAM?
      Anything's slow on a machine running 23 different sets of spyware, Bill.
      --
      Only three things are certain; death, taxes, and apocryphal quotations - Ben Franklin.
    30. Re:What I need to know by Scarblac · · Score: 4, Insightful

      Because not getting the best performance out of hardware, no matter how old or new it is, puts your application at a disadvantage compared to your competitors. No matter how much you may try and justify things, your users don't care about the language you use to develop - they care about performance.

      Simply not true. 95% of software is developed in-house, by small development teams that don't exactly have time to spare. Managers care about productivity, about getting more features implemented in the same time. An extra server costs what, the same as hiring a programmer for a single month?

      --
      I believe posters are recognized by their sig. So I made one.
    31. Re:What I need to know by Decaff · · Score: 1

      That's amusing... so if I take all but 64mb of RAM out of my PC and try to run netbeans... it'll be nice and fast?

      Of course not! Where do you expect the operating system and GUI to reside?

      What it means is if that you restrict the memory allowed to Java to 64MB, Netbeans will run fine.

      Funny that, because I've tried it on several machines ranging from 256mb to a gig of RAM and they've all been slow enough to make me sit there grinding my teeth while the PC thrashes (and that's "thrashes" in the CS definition). I guess we just have radically different definitions of "slow" -- which where I came in.

      Well of course it will thrash! Even a modern Linux running GNOME or KDE alone will have some trouble with less than 256MB.

      As for thrashing on a Gig, I am sorry, but I simply don't believe it at all.

      I have Oracle + NetBeans + Open Office running on a machine with only 512MB, and I have no performance problems. The same setup works fine on other machines - it is not just restricted to one specific set of hardware.

      For me - slow means unusable - having to wait for compilations or GUI. I don't have problems.

    32. Re:What I need to know by arevos · · Score: 1
      Both my experience and the experience of many others whose projects I have had to review - how using different languages and technologies have worked for them. They have used a range of technologies, including .NET, JSF, PHP, PERL etc.

      But again it comes down to personal experience, not just of yourself, but of the people you have met and worked with. With all due respect, my own personal experience contradicts your assertions.

    33. Re:What I need to know by Decaff · · Score: 1

      But again it comes down to personal experience, not just of yourself, but of the people you have met and worked with.

      No. It is based on actual evidence of how long projects take, not experience, not opinions.

      With all due respect, my own personal experience contradicts your assertions.

      You can say that your experience is different, but it doesn't invalidate my evidence. My evidence is based on the study of a large number of projects from many people.

    34. Re:What I need to know by Decaff · · Score: 1

      Simply not true. 95% of software is developed in-house, by small development teams that don't exactly have time to spare.Managers care about productivity, about getting more features implemented in the same time. An extra server costs what, the same as hiring a programmer for a single month?

      Performance is unrelated to development time and features.

      Also, not all projects are server-side and can have performance boosted by additional central hardware.

    35. Re:What I need to know by jadavis · · Score: 1

      Java's JVM is on the RISC side of the spectrum, whereas languages like Ruby are not.

      Typically a Ruby program will have fewer lines of actual Ruby code, and the rest of the work will be done in a C library. So, Ruby has less work to actually do.

      Typically a Java program will be written in Java to much lower levels, and so have more actual Java code, so the JVM has to do more work.

      In your example, the JVM isn't doing the 3D processing, so it's kind of irrelevent how fast the JVM is.

      One of the strengths of languages like perl/python/ruby is that they have simple interfaces to C, and many libraries are already written in C. So, a few simple lines of ruby code can do a lot of calculation very fast, even if Ruby itself is slow.

      Implementing libraries in C is seemingly much less common in Java.

      --
      Social scientists are inspired by theories; scientists are humbled by facts.
    36. Re:What I need to know by arevos · · Score: 2, Insightful
      You can say that your experience is different, but it doesn't invalidate my evidence. My evidence is based on the study of a large number of projects from many people.

      But if I find that a project done in Rails is N times faster than a Java project of a similar nature I've done in the past, I'm hardly going to discount it based on the unseen evidence of someone on Slashdot. If, in my experience, Ruby proves to be a far faster development language than Java, I'm not going to hum and say, well, what about those project managers who decided language wasn't a deciding factor.

      Add to this the fact that there are many experienced developers who take the opposite of your position; Paul Graham, as I've already mentioned, and quite a few of the chaps at Google. I'd dig up more examples, but it's Christmas Eve and decidedly late.

      In my opinion, people should try out both languages and decide for themselves based on the results, rather than rely upon the experience of others. Wouldn't you agree?

    37. Re:What I need to know by Anonymous Coward · · Score: 0

      Your comment about Unicode is valid. Before anyone takes your comment about Unicode to mean Ruby isn't used in Asian countries, I believe Ruby is more popular in Japan than Python.

      But the benchmark you site uses Ruby 1.9 which is unreleased, unfinished, unoptimized and not even beta yet. It was compared to a fully optimized Java release: Java HotSpot(TM) Server VM (build 1.4.2_05-b04, mixed mode).

      But benchmarks aren't as important as common sense or real-world performance of production applications:

      * if you want smaller memory use and faster performance, use c or assembly
      * if you want programmer productivity, use a language like Ruby, Python, Tcl
      * if you need to balance the above two, then use any of dozens of others

      I love using different languages but I find myself not having enough time to master them all. So I'm limiting myself to x86 assembly, c, c++, ruby, and sql--and of these, I use c++ and ruby most frequently.

      When I say that Ruby drastically improves programmer productivity compared to Java, it is because I actually used Java professionally for about 4 years and even got Sun's Java Architect certification just so I can bill higher rates.

      After using the combination of C++ and Ruby, I don't have any compelling reason to go back to using Java when I can dictate/choose whatever language I feel is best for each project.

      And don't forget to optimize for programmer-productivity as well as program performance. I rewrote scripts in pure c to gain much-needed performance, but I also converted SQL into ruby using ActiveRecord to gain much-needed programmer productivity--and no, I don't use Ruby on Rails.

      Also, anyone claiming that c++ programming is dangerous because of pointer errors is just being lazy. I have not yet detected a single memory leak in my c++ apps using runtime tracers after I started using smartpointers (boost) and a c++ lint checking. Not a single one. The real disadvantage of c++ is lower programmer productivity due to language complexity and compile times.

    38. Re:What I need to know by BorgCopyeditor · · Score: 1
      Ruby is useless to me because it has no unicode support.

      False.

      --
      Shop as usual. And avoid panic buying.
    39. Re:What I need to know by Decaff · · Score: 1

      But if I find that a project done in Rails is N times faster than a Java project of a similar nature I've done in the past, I'm hardly going to discount it based on the unseen evidence of someone on Slashdot.

      Absolutely not! I wouldn't.

      However, my point is that this may not be a general advantage.

      Add to this the fact that there are many experienced developers who take the opposite of your position; Paul Graham, as I've already mentioned, and quite a few of the chaps at Google. I'd dig up more examples, but it's Christmas Eve and decidedly late.

      Yes - I had heard of the Graham article. Where I am it is time to say Merry Christmas!

      In my opinion, people should try out both languages and decide for themselves based on the results, rather than rely upon the experience of others. Wouldn't you agree?

      Absolutely. All I get concerned about is the idea that because some projects are far faster with Ruby alone or with Rails, then this is a general advantage that this sort of development technique will have over Java in all circumstances for all scales of project. Time-to-market can involve a lot more than just coding speed. In some projects I have seen, CSS development was a key aspect - in that case the base language used would have been totally irrelevant!

    40. Re:What I need to know by mikefe · · Score: 1

      It's faster for you to write programs, and requires less of a learning curve.

      Uhh, we're talking about computer memory, not developer memory.

      Next!

      --
      There: Something at a specific location.
      Their: Owned by someone.
      Please make sure your english compiles.
    41. Re:What I need to know by Decaff · · Score: 1

      In your example, the JVM isn't doing the 3D processing, so it's kind of irrelevent how fast the JVM is

      You should take a look at the Java3D technology White Paper which describes how this works. It contradicts you.

      From the Java 3D FAQ:

      "The initial Java 3D implementations are written mostly in the Java programming language but also take advantage of native methods to provide maximum performance."

      One of the strengths of languages like perl/python/ruby is that they have simple interfaces to C, and many libraries are already written in C. So, a few simple lines of ruby code can do a lot of calculation very fast, even if Ruby itself is slow.

      But again, this raises problems. One of my development areas is numerical work. The last thing I want to do is to have to mix languages. In Java I can do the whole thing (GUI, I/O, calculations) in one language.

    42. Re:What I need to know by the+eric+conspiracy · · Score: 1, Informative

      But the benchmark you site uses Ruby 1.9 which is unreleased, unfinished, unoptimized and not even beta yet. It was compared to a fully optimized Java release: Java HotSpot(TM) Server VM (build 1.4.2_05-b04, mixed mode).

      Attacking a set of benchmarks based on softare versions is not helpful unless you supply measurements that support your point. And please note that Java 1.4.2 is not current. Scientific evaluation rather than hand waving, please.

      When I say that Ruby drastically improves programmer productivity compared to Java

      I'd accept this based on my experiences with Python. However I think you give that up in testing - especially as the size of the programmer team grows. Dynamically typed languages are subject to more runtime errors than statically typed languages, and run time errors are more expensive to test for and to catch.

      I have not yet detected a single memory leak in my c++ apps using runtime tracers after I started using smartpointers (boost) and a c++ lint checking.

      That contravales most opinions regarding smart pointers - while they reduce memory management problems in C++, reference miscounts and circular references in smart pointer based code still leave C++ programs more vulnerable to memory leaks than programs with built-in GC implementations that are more robust in handling these conditions.

    43. Re:What I need to know by HeroreV · · Score: 1

      At least he provided an interesting fact about Shaecspir.

    44. Re:What I need to know by jadavis · · Score: 1

      So you're telling me that Java3D doesn't use the GPU? How could it possibly get any performance at all if it doesn't use the routines in the graphics card?

      --
      Social scientists are inspired by theories; scientists are humbled by facts.
    45. Re:What I need to know by peteMG · · Score: 1

      Can someone mod this thread +5 Friendly?

      Most civil discussion I've ever seen on /. - perhaps it's the holiday spirit.

    46. Re:What I need to know by mcrbids · · Score: 2, Interesting

      Because not getting the best performance out of hardware, no matter how old or new it is, puts your application at a disadvantage compared to your competitors. No matter how much you may try and justify things, your users don't care about the language you use to develop - they care about performance.

      Come again? This might be true for a rather small percentage of software, but I don't think it applies even for a majority.

      What I find funny is that I remember these same arguments being made about C because it was so inefficient and "high level", and how assembler was the way to go for performance reasons.

      Most software development is for fixed-function, limited, internal use by a company, organization, or small niche marketplaces. In these environments, getting feature N to work quickly is very important, getting it to work rapidly is marginally important, and the language or platform is irrelevant.

      High-level languages like Ruby, Perl, and PHP (and possibly Java) allow developers to focus on getting the job done quickly, without spending as much time worrying about things like memory management. They allow you to switch types dynamically, so that adding 5 to a character '3' results in an 8.

      If a total of 200 people are using the software, it's very reasonable to expect that the software would perform nicely on commodity software, even if it's not particularly efficient. In this space, all that matters is that it works, and is developed as quickly and cheaply as possible. The cost of development is typically much, much higher than the cost of the total hardware involved - so who cares if it takes a $10,000 server to make it work, if it saves $120,000 in labor expenses for development, and gets to implementation 4 months earlier?

      Where's your smart money going to go?

      --
      I have no problem with your religion until you decide it's reason to deprive others of the truth.
    47. Re:What I need to know by lahi · · Score: 1


      What it means is if that you restrict the memory allowed to Java to 64MB, Netbeans will run fine.


      Thank you for reminding me of one thing I just don't understand about Java.

      Back in the nineties, I converted from CP/M to become a Mac-fanboi. There, I admit it. (I have since recovered. Now I'm a NetBSD-weenie.) At that time, we Mac-folk where often teased with a particular working mode which seemed ridiculous to Windows and Unix people alike. (And in retrospect, they were right. Of course, at the time I would never have admitted that.)

      Every Mac-application had two "static" configuration parameters: The minimum memory size it could work with, and the maximum it was allowed to use. If for some reason the max was too low, say, if you suddenly wanted to create a large image in PhotoShop, then you would be told, "sorry not enough memory", and then you could quit, fix the Max-size, and start again. If you had a suite of programs running at all times, you might also have to adjust the sizes of those to fit in your available memory.

      Today, Java VMs come with the same usage pattern. Recently we had to set -Xmx=1536M for our J2EE web portal at work. Naturally that causes downtime. Before that it would thrash under heavy load, and die with heapdumps due to the garbage collector giving up. (Now, I know that this is typically an indication of a problem in the application, but that is not the point here: the machine had enough memory, but the JVM just wouldn't use it beyond the 1024M it was previously allotted, and it works fine today with 1.5G.)

      I wonder why we have to live with that in this century. It was already a bad idea in the last.

      Oh, to be on-topic: I suppose Ruby, like Perl, will happily consume all the memory you have, no questions asked.
      +1 for Ruby on this assumption.

      -Lasse

    48. Re:What I need to know by arevos · · Score: 1
      Absolutely. All I get concerned about is the idea that because some projects are far faster with Ruby alone or with Rails, then this is a general advantage that this sort of development technique will have over Java in all circumstances for all scales of project.

      Ah, well, we're in agreement there! I'm a firm believer in using the right tool for the right job, and as you say, sometimes Ruby isn't the right tool for the job. Java does have some neat libraries and APIs, and alternative languages for the JVM like Nice, Groovy or Scala, can make one's life quite a bit simpler. You also get the performance advantage, which is always nice.

      Where I am it is time to say Merry Christmas!

      Here too. Merry Christmas! :)

    49. Re:What I need to know by JeremyALogan · · Score: 1
      An extra server costs what, the same as hiring a programmer for a single month?
      Exactly... I was hashing out this very thing this morning for a project I'm working on. At some point I realized I'd be stupid to not use the quickest development method (in this case RoR) since the cost of a new server is roughly equivalent to half a week worth of my time (I'll be using cheaper homebuilt Linux boxes). If I can get the project done a month sooner (maybe a bit conservative for this project) then that's ~ 8 more servers I could afford to throw at it. I can guarantee that RoR isn't enough slower to demand that much more hardware.

      However, don't take my word for it. Paul Graham (et al) suceeded in his startup because of this very thing. He thinks (and I tend to agree) that programmer time is worth more than computer time.
    50. Re:What I need to know by Decaff · · Score: 1

      I agree mostly with what you are saying, because I agree that languages need things like range checking and garbage collection.

      Come again? This might be true for a rather small percentage of software, but I don't think it applies even for a majority.

      I disagree. An example - I have written some software that prepares reports for printing through XML processing. Java can do this fast; Ruby can have speed problems in this area. The difference means an acceptable wait of a minute or two, or an unacceptable delay. I find this sort of thing turns up all the time.

      They allow you to switch types dynamically, so that adding 5 to a character '3' results in an 8.

      I would argue that this is the kind of thing that can lead to real problems later on with confusing code. Even Ruby won't allow such a horror!

      What I disagree with somewhat is that getting things up and running as fast as possible is that important especially for internal use. I have seen far, far to many examples of where this approach was taken and the results were unsupportable. What matters for internal use where applications can be required to be up and supported for years is software engineering and design, not just a quick development cycle.

      Also, I believe that what is involved in software development is so much more complex than just the development language that the differences between (say) Java and Ruby are not going to let you get to market 4 months early - both are good languages for reasonably fast development, but Java has the advantage of speed of execution which gives you a margin of safety for the future when it turns out your website actually has to do something substantial at some point.

      If a total of 200 people are using the software, it's very reasonable to expect that the software would perform nicely on commodity software, even if it's not particularly efficient.

      Depends what you mean by efficient. In the XML example I showed above, Java outperforms Ruby by more than an order of magnitude. With another example of software I have set up (Image processing) the difference is probably even greater.

    51. Re:What I need to know by Decaff · · Score: 1

      So you're telling me that Java3D doesn't use the GPU? How could it possibly get any performance at all if it doesn't use the routines in the graphics card?

      This is an interesting point. Java 3D implementations can use the GPU, but can also do most of the work themselves. It depends on the implementation. The point is that Java is perfectly fast enough to do most of the work itself if necessary.

    52. Re:What I need to know by mattcasters · · Score: 1

      OK, so you forgot to tell the JVM how much memory it could use on the machine... Should I start to cry now?
      It's still so much better then having the JVM kill the whole machine because someone forgot to let objects get out of scope.
      Look at it this way: at least your machine was still running fine.
      Suppose you only had the 1G to spare and it went to 1.5Gb: your application wouldn't be running anymore either. Do you know what trashing is? It's not very nice!

      -1 for the script kiddy languages as far as I'm concerned: bad behaving processes should go way, not hang around.

      Just my 2 cents,

      Matt

      --
      News about the Kettle Open Source project: on my blog
    53. Re:What I need to know by Decaff · · Score: 1

      Thank you for reminding me of one thing I just don't understand about Java.

      It is nothing to do with Java. Java as a language does not deal with this. The memory options start with -X which means that they are specific to individual implementations of the VM.

      Note that this does not mean that Java does grab all this memory - all it means is that it is not allowed to grab more. Modern VMs can release portions of this limit back to the OS while it is not being used by Java.

      What you are doing is telling the VM that it is not allowed to interfere with the rest of the OS by grabbing more than a certain amount of maximum memory - this is a good thing.

      but the JVM just wouldn't use it beyond the 1024M

      well, it wouldn't by default. So you change it.

    54. Re:What I need to know by I+Like+Pudding · · Score: 1
      When I say that Ruby drastically improves programmer productivity compared to Java
      I'd accept this based on my experiences with Python. However I think you give that up in testing - especially as the size of the programmer team grows. Dynamically typed languages are subject to more runtime errors than statically typed languages, and run time errors are more expensive to test for and to catch.
      Ah, but you don't have to compile Ruby either. Even without taking that into account, I don't think the debugging cost would exceed the programming gain. My error rate still sort of sucks in rails because I am only moderately familiar with it - I think it will improve in time. My error rate in ruby is quite a bit lower than anything else, though, even though I have written more PHP and Java, and much much more Perl.
    55. Re:What I need to know by Anonymous Coward · · Score: 0

      Most civil discussion I've ever seen on /. - perhaps it's the holiday spirit.

      NAH, it's actually Commander Taco pretending to be two different, nice people.

    56. Re:What I need to know by MemoryDragon · · Score: 1

      Depends if you run into a C fallback or not, most of the times you do not. Here is an example, PHP is the perfect example of what you mentioned, now the Caucho guys have moved PHP onto resin into a JVM it got a speed boost of 6x over a plain lamp configuration on the code level. (Most of the performance of the typical webapp goes down the drain during db access)

    57. Re:What I need to know by MemoryDragon · · Score: 1

      Sheesh... xMx 1563 for your portal, you guys should seriously check your code, I have been running a portal server on plain 128m for years with no downtime at all.

    58. Re:What I need to know by MemoryDragon · · Score: 1

      To comment on this even more, most of the java needs so much ram situations I have seen the last few years came from the typical we allocate as much as we need without a second though patterns, and then everything was blamed on Java. Reading a 500 meg data file into ram before dumping it into the DB and then blaming it on java was such a typical situation! Those patterns often are very similar, and often are caused by some whiz guy who thinks he knows everything better than the rest of the world!

    59. Re:What I need to know by Decaff · · Score: 1

      I can guarantee that RoR isn't enough slower to demand that much more hardware.

      Why does everyone assume that a lightweight web framework is a useful illustration of general purpose coding? I have many apps that run client-side. They do things like present geographical information and do image processing. RoR helps with this how?

      Paul Graham (et al)

      It is easy to pick one well-known and highly specific case, but that does not mean it applies generally.

      Also, picking the views of someone who is encouraging the use of LISP (a very fast and mature language) to support the use of RoR (a very immature framework) does not help.

      If you pick a slow language (no matter how nice) for general development your applications you will eventually lose out in the end. You are helping processor manufacturers and PC salesmen, and not your users and customers. Such applications have a tendency to grow and gain complexity and functionality. Sooner or later they hit a performance issue, and some at least partial re-write in something faster is required.

    60. Re:What I need to know by JeremyALogan · · Score: 1

      I wasn't advocating it for all-around use. If I were doing any of the things you mentioned (image processing and the like) it simply would not make sense to do it this way. However my argument wouldn't apply. It'd (more than likely) actually take longer to develop this type of software in what is, essentially, a scripting language designed for rapid web development.

      I wasn't claiming that that Ruby (or RoR) is an end-all language/framework... just that in certain instances rapid development is worth a lot more than a few clock cycles. In this case I CAN use Paul Graham as an example because though he may be a "highly specific case" that's exactly the user-base that RoR is for... people who want to develop web apps really quickly.

      As far as the comparrison to LISP (LISP being a "mature" language)... they all had to start somewhere. Ruby was released in 1995 (aka. the same year as Java's first public release) and has grown a lot since then. In fact it borrows a lot from LISP and Smalltalk (which also borrows a lot from LISP).

      Anyhow... considering that you posted about 20 posts on this one topic and all of them (well, all that I read) were talking about how Java was good and Ruby (and Rails) was bad I don't think we'll ever agree. One theme I noticed was an apparent misunderstanding of what Rails is. It isn't just ActiveRecord... it's a whole MVC architecture. If you think that MVC is a bad idea you might want to let a whole list of popular / sucessful projects know that they can stop waisting their time.

    61. Re:What I need to know by Decaff · · Score: 1

      Anyhow... considering that you posted about 20 posts on this one topic and all of them (well, all that I read) were talking about how Java was good and Ruby (and Rails) was bad I don't think we'll ever agree.

      I really, really like Ruby. It is a beautiful language and I use it a lot, often along with Java. But this does mean that I don't recognise it's disadvantage. Lack of speed is one of them.

      One theme I noticed was an apparent misunderstanding of what Rails is. It isn't just ActiveRecord... it's a whole MVC architecture.

      I know that - I have used it, and I have been using MVC architectures since the 80s (in Smalltalk).

      If you think that MVC is a bad idea you might want to let a whole list of popular / sucessful projects know that they can stop waisting their time.

      Of course it is not a bad idea! When did I ever say that? I use MVC all the time these days - both in Swing and in JSF.

      What I dislike is Rails' implementation of it.

    62. Re:What I need to know by lahi · · Score: 1

      What can I say - you're absolutely right of course. But as I said, I already knew that the memory problem was indicating a problem in the code. That wasn't my point. My point was that in the past, I have used a platform where having to state memory demands explicitly was the norm, and that platform (Macintosh pre-OS X) was ridiculed by some for that reason. Yet noone seems to think that it is a problem now with the Java platform. I wonder why.

      When I *want* to limit resources available to my programs on Unix, I would use ulimit.

      -Lasse

    63. Re:What I need to know by Decaff · · Score: 1

      Ruby, IMHO, have the simplest model to do extensions on C/C++.
      So, is very easy to make a prototype on Ruby, profile, and speedup the bottlenecks with C


      I have been down this route with other languages. There can come a point where a significant part of your code ends up in C or C++ (at least the key parts that do most of the work). You therefore lose many of the benefits of the language you start of with.

      With a language like Java (or some of the faster Smalltalks or LISPs) this sort of messy compromise is unecessary.

  2. Get the basic premise right, first by ikkibr · · Score: 0, Offtopic

    Rails is _not_ a code generation framework. Note the period on that sentence. Rails may provide the some simple scaffold generation, but that's only there if you _want_ to use it, and it happens to fit the way you'd like a particular part of your app to work. The code produced is concise, easy-to-follow, and thus easy-to-maintain. For my own applications, I barely ever use scaffolding. It works well for simple admin screens where I just want 'something' that works for now, then will spend some effort on designing it a little better, later. Rails is as maintainable as you make it. If you're a poor programmer, you're likely to write unmaintainable code, no matter what language or framework you have to help you. Rails helps point you in the right direction, but in the end, it's up to the _developer_ how maintainable his/her code is.

    1. Re:Get the basic premise right, first by Anonymous Coward · · Score: 4, Funny

      I love it how the Rails fanatics always take great personal insult at even the mere suggestion that code generation isn't its strong point. Even though, surprise surprise, the infamous tutorial video advertises just this very feature throughout pretty much the entire clip. It's like watching a little kid cry and stamp their feet at a grocery store trying to get their parents to buy them cereal.

    2. Re:Get the basic premise right, first by Anonymous Coward · · Score: 0

      This troll posts this shit in response to every Rails article.

    3. Re:Get the basic premise right, first by Joey+Vegetables · · Score: 1

      Aside from the common and seemingly unavoidable tasks of generating HTML and SQL, why would one need to generate code in a high-level, multiparadigm language? I've seen very few instances of this need that didn't result from either a weakness in the language or toolset (*cough* old-style VB) or a design issue. It's the job of the toolset to allow you to express business logic in a clear, readable, and maintainable way. It's the job of the developer to do so. And frankly I have to agree that usually the tools do a better job of allowing expressive code than average developers do to actually write it.

  3. Re:It's obvious by starwed · · Score: 2, Informative

    Why was this modded up? The article doesn't even mention code generation. It compares Ruby and Java as generic development languages.

  4. Mod parent down... by starwed · · Score: 0, Offtopic

    This is a generic resonse, which has nothing to do with the article. The guy who posted it posted at least one other generic "Rails" response, having absolutely zilch to do with the article.

    1. Re:Mod parent down... by Anonymous Coward · · Score: 0

      The poster is just grabbing comments verbatim from the usenet comp.lang.ruby discussion group.

    2. Re:Mod parent down... by Anonymous Coward · · Score: 0

      This is not a generic response, it is a copy/paste response.

      You are modded offtopic because the moderators give generics moderations

  5. Re:It's obvious by ikkibr · · Score: 0, Redundant

    they can't be arsed to rtfa, nor can I...

  6. Re:It's obvious by Anonymous Coward · · Score: 5, Informative

    ikkibr is a robot that looks for similar past articles and reposts highly-modded comments from those articles. See http://ask.slashdot.org/comments.pl?sid=171820&cid =14310500

  7. Re:It's obvious by Geoffreyerffoeg · · Score: 1

    they can't be arsed to rtfa, nor can I...

    Why bother RTFA? The post title is Ruby Off the Rails. Which means Ruby without Ruby on Rails. So why did you even take the effort to copy-and-paste a post completely about Ruby on Rails?

  8. Re:Flamewar.....NOW! by arevos · · Score: 2, Interesting

    I too like Python, but let's put this into perspective. This is an article about Ruby and Java, not about Python. Just because someone starts talking about Ruby doesn't mean they're mandated to mention the alternatives.

  9. Loving complexity for complexity's sake by Man_Holmes · · Score: 4, Interesting

    You just have to love java programmers making the easy more difficult. What I have learned in managing developers is that you have to constantly fight their desire to make things more complicated without a valid reason for doing so.

    He's correct that certain tasks are easier in Ruby than in java, not to mention that the code is more readable. But he is missing in my opinion the most important part of Rails and that the ORM. Use scaffolding or don't use it. But if you bypass Active Record you're just making more work for yourself.

    Man Holmes

    1. Re:Loving complexity for complexity's sake by Decaff · · Score: 2, Informative

      You just have to love java programmers making the easy more difficult. What I have learned in managing developers is that you have to constantly fight their desire to make things more complicated without a valid reason for doing so.

      What a great generalisation! Not everything that looks easy is really easy. Not all code can be 'quick fixes'. Ruby on Rails may have its place, but Java and it's frameworks really shine when you need very high performance and a range of scalability options.

    2. Re:Loving complexity for complexity's sake by BigGerman · · Score: 1
      Why "flamebait"? The Man definitely has a point, like or not.

      Just recently I saw the project that was basically just a few web pages and it was realized as a tasty soup of custom MVC framework, JSPs, JSP tag libs, Velocity (by itself and (horror) inside taglibs), Spring and XML/XSLT thrown in for a good measure.

    3. Re:Loving complexity for complexity's sake by byolinux · · Score: 1

      Performance? Isn't Java pretty slow?

    4. Re:Loving complexity for complexity's sake by Decaff · · Score: 2, Insightful

      Just recently I saw the project that was basically just a few web pages and it was realized as a tasty soup of custom MVC framework, JSPs, JSP tag libs, Velocity (by itself and (horror) inside taglibs), Spring and XML/XSLT thrown in for a good measure.

      Just because some developers make bad choices does not mean that this is any fault of the language, or is a general fault of all developers in this language. Such messes can occur in any language - I have seen some real VB horrors.

    5. Re:Loving complexity for complexity's sake by Anonymous Coward · · Score: 0

      What I have learned in managing developers is that you have to constantly fight their desire to make things more complicated without a valid reason for doing so.

      Absolutely true. Sir, you are wiser than you may realize. And I say that with the utmost sincerity.

      BTW, do you happen to manage a team in the Los Angeles area? I am desparately looking for an enlightened team to work with.

    6. Re:Loving complexity for complexity's sake by Gulthek · · Score: 1

      Only for client apps. On a server things are a little different.

    7. Re:Loving complexity for complexity's sake by jdhutchins · · Score: 1

      Performance? Isn't Java pretty slow?

      No

    8. Re:Loving complexity for complexity's sake by byolinux · · Score: 1

      Ah, so it's like.. the JVM, the applet bit that is slow?

    9. Re:Loving complexity for complexity's sake by jZnat · · Score: 1

      J2EE is a very powerful server program, and Tomcat is also a very good substitute as well. Java is amazingly good when it comes to this sort of thing.

      --
      'Yes, firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.'
    10. Re:Loving complexity for complexity's sake by NumbThumb · · Score: 2, Interesting

      Modern JVMs get very close to the performance of traditional, pre-compiled code. What makes java feel slow in in the client world are two, no, make that three, factors:

      1) the JVM needs to start. That needs time. On a server, it basically starts once, and then it just runs. Also, JIT only really kicks in for long running applications.
      2) Java needs a lot of RAM. If you try to run a java app on a smallish box, chances are it will start swapping.
      3) Swing is Slow, it makes Java GUIs feel cluncky. SWT is much better for the user, it "feels" more responsive.

      --
      I have discovered a truly remarkable sig which this 120 chars is too small to contain.
    11. Re:Loving complexity for complexity's sake by Ohreally_factor · · Score: 1

      4) A fanatical devotion to the Pope.

      Uh, make that four factors.

      Nobody expects the Spanish Inquisition!

      --
      It's not offtopic, dumbass. It's orthogonal.
    12. Re:Loving complexity for complexity's sake by daecabhir · · Score: 1

      To whit: There is not now, nor will there ever be, a programming language in which it is impossible to write bad code. I have this on a button somewhere, and I consider it a fundamental truism.

      I have had to work with many languages, and have had to maintain code in most of them. During that time, I have seen some incredibly clean and elegant code, and I have also seen some totally bind-moggling cruft. The problem is that many college CS curriculums do not provide any coursework dealing with how to develop software for the real world - and I mean writing code, gathering requirements, designing systems and testing. So many folks come out of college still taking the brute force approach to designing and codeing software - and I would have been in this boat myself if I hadn't been lucky enough to be working in high school and college with professionals who were willing to share their "lessons learned" about developing maintainable systems. So don't blame the language, blame the idiot who chose technologies for the sake of learning the technologies, and the manager who let him get away with it.

      As for Java, I've been working with the language for about two years now in a web application environment. I came from a predominantly C/C++ background, and I can tell you that I now would rather write code in Java than either of those two languages (or most of the other languages I know). Why? Because it is truly OO, because it has the strengths of perl in terms of available libraries to do just about anything, because it has some of the best frameworks for developing web applications that I have seen, and because it is one of the cleanest languages I have ever worked with.

      I think the OO part is what causes the most heartburn in modern applications written in OO languages - it has been my experience that many people don't truly grok OO, so they end up developing systems the old "C" method using an OO platform in name only. This means that you will run into the same problems with Ruby that you would in Java... sure, there might be some aspects of Ruby that reduce the amount of code you need to write over Java for certain tasks (but there's also probably a Java class library to do what you want), but it is quite likely that if someone couldn't handle the OO aspects of Java they're not going to grok how to use Ruby's OO features to best effect.

      Bottom line: use the technologies that are appropriate for the job, and apply good software engineering practices for maintainable systems. If Ruby is the right thing for your environment, then do it. If it's Java, C, C++ or perl, then use those (just please, for the sake of the guy coming along behind you, try to stick to one language in the application). The only language on my "avoid" list (and I am sure that I will get flamed for this) is python - any language that cares about indentation (since COBOL) and uses blank lines as end-of-block delimiters (thus disallowing white spacing in code) is an abomination.

      --

      -- daecabhir (this mind intentionally left blank)
    13. Re:Loving complexity for complexity's sake by Decaff · · Score: 3, Informative

      2) Java needs a lot of RAM. If you try to run a java app on a smallish box, chances are it will start swapping.
      3) Swing is Slow, it makes Java GUIs feel cluncky. SWT is much better for the user, it "feels" more responsive.


      Both these are now way out of date. Java memory handling has been tidied up. As even a 'smallish box' these days is more than 128MB, memory really is not going to be a problem at all.

      Swing is hugely faster these days, to the extend where it is often reported to be more responsive than SWT on some platforms (such as Linux). Swing is now by default OpenGL or DirectX accelerated.

    14. Re:Loving complexity for complexity's sake by Joey+Vegetables · · Score: 3, Insightful

      Only crappy developers. The better ones understand that software development (not just coding, but analysis, architecture, and design) is actually a process of documenting, managing, and reducing complexity, to the greatest extent possible.

    15. Re:Loving complexity for complexity's sake by dasil003 · · Score: 2, Informative

      He's correct that certain tasks are easier in Ruby than in java, not to mention that the code is more readable. But he is missing in my opinion the most important part of Rails and that the ORM. Use scaffolding or don't use it. But if you bypass Active Record you're just making more work for yourself.

      The article isn't about Rails... in fact it's not even about database-driven websites... or even web programming in general. It's just a comparison of the Ruby and Java languages in general. ORM is neither here nor there.

    16. Re:Loving complexity for complexity's sake by Decaff · · Score: 1

      Only crappy developers. The better ones understand that software development (not just coding, but analysis, architecture, and design) is actually a process of documenting, managing, and reducing complexity, to the greatest extent possible.

      That is not good software development. Good software development is about putting the appropriate amount of complexity.

      The debate seems to be between those who support the 'get something simple up and running as soon as possible' (reduce all complexity to a minimum) approach and those who support the 'make sure that all applications have the potential to be extended and scaled up and high-performance if required' approach.

      In my experience, the first approach can often lead to huge problems later.

    17. Re:Loving complexity for complexity's sake by badmonkey · · Score: 1

      Swing applications still usually look they were created by children with crayons. If not that bad, then they still don't look as good on average as an SWT application.

    18. Re:Loving complexity for complexity's sake by Decaff · · Score: 1

      Swing applications still usually look they were created by children with crayons. If not that bad, then they still don't look as good on average as an SWT application.

      I could not disagree more. SWT looks terrible on Windows - I have rarely seen one that picks up the XP look and feel right. on MacOS/X and Windows Vista Swing will be guaranteed to be indistiguishable from the native GUI.

      Also, if you don't like the Swing look - download one you do like - there are hundreds of alternatives.

    19. Re:Loving complexity for complexity's sake by stonecypher · · Score: 2, Interesting

      As even a 'smallish box' these days is more than 128MB, memory really is not going to be a problem at all.

      Amusingly, Java's three strongest positions are the portable market (J2ME,) followed by the server market (EJB,) followed by the embedded market (microcontrollers, especially with the upcoming blu-ray deployment.) Neither J2ME nor embedded average more than 23 meg per device, and for servers where parallelism is a serious issue, the smallest possible memory footprint is desirable.

      For thirty years people have attempted to hand-wave away bloat with "modern" computing power. With age you will discover that it's not the ceiling so much as the margin that's important. Yes, you can use a language which requires 300% overhead, and for lots of things that's okay. But, in industry, where RAND suggests almost m80% of software is actually developed, the cruel reality is that your 300% overhead means that your competition can do four times as much on the same machine. Whereas that may not be important for a word processor, that's hella important to simulators, aggregators, data mining, and the sort of large-scale tasks that dominate real-world developer time.

      There are dozens of higher level languages than Java and dozens of faster languages than Java, all of which predate Java. Java's strength comes not in its speed, but in its low cost of binary portable redevelopment (hence its near-complete redomination of the cell phone world as previously taken wholesale by Symbian and BREW.) Java's "high performance" is a myth; you guys seem to think that C++ is the only speed candidate, when code written in Forth, K, Structure and portable assembly (for some tasks) tend to blow the doors off of both.

      There's a reason Java never took C++ out of the industrial performance market. It has nothing to do with actual performance; that's why C++ took over from FORTRAN even though FORTRAN is essentially faster, and why other languages never took over from C++ despite having relatively complete support libraries. Java is a spectacular example of what a language needs to do to not fail to defeat C++, because Java did everything but one thing.

      The fundamental problem is reliability. Unfortunately, it's really difficult to hammer this into a Java programmer's head, because the first thing you want to say is "Java doesn't have exceptions," at which point the Java programmer absolutely shits themselves, because a third of their language revolves around handling these things called exceptions. The problem is, Java exceptions are an error propogation and handling mechanism, and they're so visually similar to C++ exceptions that it's just dental work and a half to get a Java programmer to believe they're not the same thing (especially since the number of people who came into the occupation was so huge during the dot com boom, when Java was big money central, and so since they've migrated into C++ they're using C++ exceptions the way Java programmers use the word, and since there are as a result so many glaringly badbear uses on the intarweb, where it seems all Java programmers learn their trade.)

      Exceptions in C++ are a very different thing than they are in Java. Properly used, exceptions in C++ are used to handle situations like "hey, where did my disk drive disappear to," or CPU panic conditions. Exceptions in C++ are a last ditch holy shit maneuver to save the information when the moon crashes into the data center. Exceptions in C++ are for ghastly aberrant situations, such as failing hardware, not to handle sloppy programmer problems.

      Of course, I shall receive ten counters from people dredging up code on sites full of badbearery such as geoshitties, codeproject and msdn (to all the peanut-gallery screamers, there's void main() all over MSDN, and if you don't know why that should make you shut up, you're not qualified to comment on quality c++ source and you need to stop reading Herb Schildt books) pointing out egregiously bad uses of exceptions in defense of

      --
      StoneCypher is Full of BS
    20. Re:Loving complexity for complexity's sake by stonecypher · · Score: 1

      Neither J2ME nor embedded average more than 23 meg per device,

      Typo. That's supposed to say 2 meg.

      --
      StoneCypher is Full of BS
    21. Re:Loving complexity for complexity's sake by try_anything · · Score: 1
      Exceptions in C++ are a last ditch holy shit maneuver to save the information when the moon crashes into the data center. Exceptions in C++ are for ghastly aberrant situations

      Bjarne Stroustrup (whom you seem to accept as an authority, since you cite the ARM) says, "In C++, exceptions are used to signal errors that cannot be handled locally, such as the failure to acquire a resource in a constructor." (That's a bit different from Things that aren't supposed to happen, ever.) He also acknowledges that there are cases "where it is not entirely clear what should be considered an error and what should not."

      Furthermore, he is willing to consider using exceptions for non-error conditions: "Using exceptions as alternate returns can be an elegant technique for terminating search functions." However, he almost immediately follows that with, "Whenever reasonable, one should stick to the 'exception handling is error handling' view," tempered with, "Unfortunately, the real world isn't so clear cut. Program organization will (and to some extent should) reflect that."

      The lesson? If you want to spout puritanical dogma, don't cite an avowed pragmatist as your only authority. Come to think of it, if you want to spout puritanical dogma, you're better off not be talking about C++ at all, since it's about as impure and accomodating as anything you can buy on the streets late at night, partly by design.

      (All quotes are from TC++PL, except the first, which is from the technical FAQ on Stroustrup's web site.)

      Setting authority aside, I don't think any distinction related to domain semantics or "expectedness" (much less Does not ever happen, ever-ness) is a reliable guide to what should and should not be an exception. Such distinctions lead to gunk like this (please pardon the formatting; I haven't really figured out how to post code on Slashdot yet):

      File open_file(string filename, bool user_provided_filename=false):
      ____if(file doesn't exist):
      ________if(user_provided_filename):
      ____ ________// it's "expected" for user-provided filenames to be bad
      ____________return File::invalid()
      ________else:
      ____________// it's "exceptional" for non-user-provided filenames to be bad
      ____________throw FileNotFoundException(filename)
      ____....
      This example is based on real code that was written by an inexperienced programmer who knew the "rules" too well for his own good. I have also heard a programmer seriously propose that we fork a mature source code module to replace exceptions with return codes for a certain class of errors, so that it could be used in a setting where the errors were "expected" rather than "exceptional." That's clearly absurd, but it's a logical consequence of allowing domain semantics to determine what should and should not be an exception.

      Consistency, understandability, elegance, and performance are important; an abstract idea of what constitutes an "error" can be a helpful heuristic, but it disintegrates if pressed too hard. One of the nice things about C++ programmers is that they have fewer preconceptions than programmers in other languages, so using exceptions consistently within a module is not a stylistic mistake no matter how they're used, as long as understandability and performance aren't compromised.

    22. Re:Loving complexity for complexity's sake by jma05 · · Score: 1

      Reducing complexity is not ignoring complexity. What worries me is adding more complexity in the guise of managing complexity.

      Your's and my experiences differ. I favor the first approach because ...

      1.) Only a small portion of applications outlive their lifecycles.
      2.) When extended use becomes evident, it's time to redesign the application because the requirements have changed.
      3.) Application redesign is not a bad thing. The previous version provides insights that simply cannot be gained by attempts to pre-plan everything.

      I always consider avoiding injecting this requirement into application development process too early. Extensibility does not come for free and to succeed requires a through understanding of the problem domain, a luxury that most projects do not have. It is important to not solve problems that have not appeared yet because too often they get in the way of problem that do need to get solved immediately.

  10. Go Java! by HillaryWBush · · Score: 4, Interesting
    Moreover, some things are just plain easier to do in Ruby than they are in the Java language."

    Congratulations Java, you've finally proven yourself as the new Benchmark(TM). Enjoy a lifetime of groundless belittlement.

    By the way, if moreover isn't on this list, it sure ought to be. Over.

  11. Re:So, what's it like? by arevos · · Score: 3, Informative
    As a side note, why is it the people so quickly forget what these languages are really for. They are Rapid Application Development(RAD) and prototyping languages. You're not supposed to ship products developed with these languages! You're supposed to prototype the application and if it looks viable, develop it in a real language like C or C++!

    Why? The speed of C and C++ are hardly needed for most applications, and languages like Ruby and Python can leverage GUI toolkits like Qt and GTK. If your Qt Ruby application is indistinguishable from your Qt C++ application, why waste time developing in C++ if you don't have to?

  12. Wow by Anonymous Coward · · Score: 0

    Wow, they have Ruby off the Rails now?

    With apologies to Homer Simpson...

  13. MOD PARENT UP!!! by Anonymous Coward · · Score: 0

    ikkibr is a robot that looks for similar past articles and reposts highly-modded comments from those articles. See http://ask.slashdot.org/comments.pl?sid=171820&cid =14310517

  14. The author of the article, Andy Glover... by tcopeland · · Score: 4, Informative

    ...is a good guy to write this sort of thing since he's been programming Java for a long time and has also branched out into "dynamic Java" things like Groovy. He's done a bunch of stuff on dbUnit (including a dbUnit chapter in Java Testing Patterns), too. So he's had enough experience with Java to know what's what.

    I'm probably biased, though, since Andy also wrote the CPD Ant task.

  15. Re:So, what's it like? by Decaff · · Score: 4, Insightful

    Why? The speed of C and C++ are hardly needed for most applications

    This is the same excuse I have heard for decades when fans of a language try and 'justify' it's lack of performance. Sooner or later a lack of performance really does become a problem - if it wasn't then many Ruby developers would not be working on high-performance VMs for the language.

    There are situations where performance doesn't matter, but this is not true for 'most' applications.

    I really like Ruby, but I will find much wider use for it when it is truly fast.

  16. Re:So, what's it like? by alexmipego · · Score: 1

    I guess that if everything was coded in C/C++ we would have better performance because of those "platforms" and languages that are slow as hell.

    There are a lot to choose from, but all those options are barely optimized unlike C/C++ compilers.

  17. Erm, hello by m50d · · Score: 4, Insightful
    Moreover, some things are just plain easier to do in Ruby than they are in the Java language.

    That goes for any sane modern language.

    --
    I am trolling
    1. Re:Erm, hello by stelmach · · Score: 1

      Are you implying that the Java language is not modern, and the Ruby language is?? Let's remember that Ruby was introduced in 1995 while Java was introduced in 1994.

    2. Re:Erm, hello by Slashdiddly · · Score: 1

      No, he's saying that *some* things are easier in one language than another. What those things are differs from language to language.

    3. Re:Erm, hello by cnerd2025 · · Score: 2, Insightful

      Java is easy to use, but the creators had a bit of diarrhea of the fingers: it takes like 10 lines to write something that would take about 3 in C/C++. Also, some of the "built-ins" are just freakin' arbitrary. Java, though, isn't as arbitrary as C++. So Java is like the little brother of C++ who still doesn't implement OOP quite well enough, while talking far too much. It had support of its mother to make it known (Sun Microsystems), and it utilizes centralized documentation/codification (a blessing and hinderance). Ruby is truly object-oriented and is in the spirit of Smalltalk, with features not simply academic in nature. After learning Java, I really had a bitter taste for OOP. When I learned Ruby, it was like walking from Kansas to Oz.

    4. Re:Erm, hello by m50d · · Score: 1
      Are you implying that the Java language is not modern, and the Ruby language is??

      No, I'm implying the Java language is not sane and the Ruby language is.

      --
      I am trolling
    5. Re:Erm, hello by m50d · · Score: 1

      I had precisely the same experience with Python in place of Ruby. But having looked at a number of languages I'm pretty sure it would be the same with most of them.

      --
      I am trolling
    6. Re:Erm, hello by 1110110001 · · Score: 1

      Work on Java started in 1990, work on Ruby in 1993. That should be more important than a release date.

      b4n

    7. Re:Erm, hello by jma05 · · Score: 1

      >> it takes like 10 lines to write something that would take about 3 in C/C++

      That fits a description of "not easy". Especially when C/C++ aren't exactly known to be easy either.

      Just curious, which high level language do you consider difficult than Java?

    8. Re:Erm, hello by cnerd2025 · · Score: 1

      Perl. 'nuff said.

  18. What is .Net's competition? by bigtallmofo · · Score: 4, Interesting

    I've often heard comparisons of .Net to Java and for a while there it seemed to me like they were two separate but somewhat equal development environments. Now it seems that several languages/environments have been coming up (PHP/Ruby) and many articles I see compare it to Java or explain how it's competing with Java.

    What does the future hold in terms of what environment will "come out on top" when Java seems to be compared to or even competing against so many languages while .Net doesn't seem to have such competition?

    --
    I'm a big tall mofo.
    1. Re:What is .Net's competition? by Anonymous Coward · · Score: 0

      "while .Net doesn't seem to have such competition?"

      Because no one outside of Microsoft developers know about, care about, or use .Net?

    2. Re:What is .Net's competition? by OldAndSlow · · Score: 2, Interesting
      .Net doesn't have competition in this arena because it is propriatry. MS has so throughly closed their environment that every would-be Matz will develop on Linux, where there are no taxes to pay to the corporate overlords and no "defend the monopoly" landmines.

      It seems to me that MS is in a position where they will forever be chasing the leaders in language development.

    3. Re:What is .Net's competition? by Anonymous Coward · · Score: 1, Insightful

      It's because .NET is a platform, not a specific language. Microsoft also has a vested interest in making the platform more suitable for dynamic languages; see IronPython for an example.

      The JVM was designed around the notion of Java as a language, whereas .NET was designed as a platform for multiple languages. That difference in approach changes how .NET competition and comparisons are formed.

    4. Re:What is .Net's competition? by jZnat · · Score: 1

      Microsoft went and had C# (Mono?) and other .net languaged standardised. .Net is just another good competitor to Java.

      --
      'Yes, firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.'
    5. Re:What is .Net's competition? by cyber-dragon.net · · Score: 1

      .NET is not compared to cross platform development environments because it is not. It is windows centric and only works there. That gives it it's own catagory I lovingly call "not worth discussing as it is functionaly useless to me."

      Therefore java will enter into a comparison and be worth comparing because it does something the common web designer may use or impliment. PHP/MySql is popular because it works, and it will run on any platform and almost all hosts support it. Java is a close second in terms of support server side. I cannot run .NET stuff at any hosting company that will promise me 99.999% up time. Why? You simply cannot promise that on a windows server.

      The .NET framework I would not learn nor impliment if you payed me Well... maybe if you payed me a LOT, but Microsoft already turned me down when they gave me a job offer and I told them it would cost half a mill a year plus benefits and stock options on a 5 year contract for me to sell my soul and give up every moral principle I hold dear. Hey, everyone has thier price, I just admit mine.

    6. Re:What is .Net's competition? by donjigweed · · Score: 0, Troll

      moral principles? uh, how much have you donated to charity there, putz? given in the billions have you? i didn't think so. bill has. he's the modern day robin hood. everyone on here should be programming in .net.

    7. Re:What is .Net's competition? by ealar+dlanvuli · · Score: 1

      If people are going to use .net, then these other langauges are not important. If they are not, that is where the competition comes form.

      --
      I live in a giant bucket.
    8. Re:What is .Net's competition? by Anonymous Coward · · Score: 0

      i hope u aren't serious :-(

    9. Re:What is .Net's competition? by Decaff · · Score: 1

      The JVM was designed around the notion of Java as a language, whereas .NET was designed as a platform for multiple languages. That difference in approach changes how .NET competition and comparisons are formed.

      This is, I feel, misleading, as can be seen by the fact that there are far more languages for the JVM (>200, including Ruby, Python, TCL, Smalltalk, Prolog, LISP...) than for .NET (20-30?). .NET looks like it was designed for multiple languages, but that is a bit of a marketing spin. In practice, it is tailored for procedural java-type languages - J#, C#, VB.NET. This is why Visual Basic 6 had to change so much before it could be a .NET languages. Languages that don't work in this way don't run that efficiently on .NET - just like with the JVM.

    10. Re:What is .Net's competition? by MemoryDragon · · Score: 1

      Marketing mumbo jumbo, .net has forced some changes in C++ and other lanuages which sit on top of it, the JavaVM even has more languages running on top of it than .Net has, after all a VM is just a VM a virtual processor emulation layer, the rest is marketing.

    11. Re:What is .Net's competition? by Merdalors · · Score: 1
      I realize this is about Ruby, but can anyone explain to me why Microsoft didn't include the .NET framework in Windows XP? As a developer of consumer software, I'm loath to burden my 6 MB download with the 20MB millstone of the .NET framework. What gives?

      Does Microsoft not believe in .NET? Is .NET still so unstable that it's not worthy of being included in the Windows XP Professional installation CD?

      If you're developing Corporate, B2B apps, it's not a big problem to shlep the .NET CD over to a couple of hundred machines, and install it.

      100,000 desktops, in another part of the world, for a $29 sale? Can't afford to get on the plane for that one. Imagine walking your grandmother through a .NET framework install over the phone. Now picture the machine not rebooting.

      --
      Slashdot entertains. Windows pays the mortgage.
    12. Re:What is .Net's competition? by aled · · Score: 1

      Microsoft submited C# to a standards organization but didn't open .Net. Then .Net is neither a standard, open source. And is only available in Windows.

      --

      "I think this line is mostly filler"
    13. Re:What is .Net's competition? by Jobe_br · · Score: 1

      I don't know. I've never been one to tie myself to a particular language. Lately, I think my opinion is that Java or any other "OO" language doesn't make your code OO. Proper use of design patterns and keeping the code, objects, responsibilities, etc. as simple as possible, make an OO system. Whether that's Java or Ruby doesn't really matter IMO. I've seen a heck of a lot of non-OO Java, and I imagine the same can go for Ruby, Python, Groovy, and certainly Perl (been there, done that). Create as many classes, inheritance, etc. as you like - it doesn't give you OO just by that virtue alone, that's certain. At least not "good" OO, as I would define it (and the GoF, et al).

      Part of what I'm not fond of in Ruby (and maybe that's just because I'm a Ruby novice), but when I look at Ruby code (as a novice), it isn't particularly clear what's going on - there seems to be a heck of a lot of "behind-the-scenes" things going on, which IMO isn't always that great. Java has its fair share of "behind-the-scenes", too - but, maybe its a bit more granular than Ruby, not at as high a level, so the bigger picture is composed of more pixels, so to say.

      In the end, every language has its place. Hopefully Ruby will get some traction with MDA/MDD and good expression of UML, as Java and many other "OO" languages have.

  19. Ruby & Java == Moriarity & Holmes by Maxmin · · Score: 2, Informative

    The ruby crowd positions themselves as none other than mortal enemies of Java and anyone stupid enough to still be using that pathetic excuse for a language!

    Ruby could be just an also-ran if it didn't have Java to kick around. After ten years of spotlight, it's not hard to find detractors. The real question is, can ruby be defined on its own terms, and not Java's? Doesn't seem like it so far, which isn't good news for longevity.

    Also, what you're forgetting is that some programmers like the clarity of a well-defined class hierarchy, and Java's got that. Ruby has got some pretty muddy classes that try to do too much.

    --
    O lord, bless this thy holy hand grenade, that with it thou mayest blow thine enemies to tiny bits, in thy mercy.
    1. Re:Ruby & Java == Moriarity & Holmes by BACbKA · · Score: 4, Insightful

      Wasn't Java itself once defined mostly in terms of C++, and isn't C# now defined in terms of Java?

      --

      VKh

    2. Re:Ruby & Java == Moriarity & Holmes by SmallOak · · Score: 3, Informative

      "The real question is, can ruby be defined on its own terms, and not Java's?"

      I'm not sure this is even a issue. the Disussion on Ruby Vs Java seems to happen totaly outside the Ruby 'community'. I read a lot of Ruby programmer blogs and don't see Java mentioned that much.

      Interesting reading

      http://www.artima.com/intv/ruby.html
      The Philosophy of Ruby: A Conversation with Yukihiro Matsumoto

    3. Re:Ruby & Java == Moriarity & Holmes by Decaff · · Score: 1

      The ruby crowd positions themselves as none other than mortal enemies of Java and anyone stupid enough to still be using that pathetic excuse for a language!

      Apart from the fact that 'that pathetic excuse for a language' is now the most popular, I agree.

      Ruby is a stunning language, elegantly designed and full of fascinating features, and deserves to be promoted like this, not by comparison with other languages.

    4. Re:Ruby & Java == Moriarity & Holmes by Nataku564 · · Score: 1

      Define 'most popular'. I currently know no ruby developers, only those who play with it on the side.

    5. Re:Ruby & Java == Moriarity & Holmes by Nataku564 · · Score: 1

      Ack ... he meant java. Eh well.

    6. Re:Ruby & Java == Moriarity & Holmes by JamesOfTheDesert · · Score: 1
      I currently know no ruby developers, only those who play with it on the side.

      I'm one. I make my living with it.

      --

      Java is the blue pill
      Choose the red pill
    7. Re:Ruby & Java == Moriarity & Holmes by JanneM · · Score: 2, Insightful

      The ruby crowd positions themselves as none other than mortal enemies of Java and anyone stupid enough to still be using that pathetic excuse for a language!

      When looking at who is "positioning" Ruby that way, it seems to be mostly Java users, actually - at times to belittle Ruby (there seems to be a few developers that feel threatened by the Rails framework) but mostly, it seems, as a basis from which to highlight shortcomings in Java. Ruby developers don't seem all that interested in these comparisons.

      --
      Trust the Computer. The Computer is your friend.
    8. Re:Ruby & Java == Moriarity & Holmes by Decaff · · Score: 1

      When looking at who is "positioning" Ruby that way, it seems to be mostly Java users, actually - at times to belittle Ruby (there seems to be a few developers that feel threatened by the Rails framework) but mostly, it seems, as a basis from which to highlight shortcomings in Java. Ruby developers don't seem all that interested in these comparisons.

      Sounds like you have not been following Slashdot much. Java developers aren't belittling Ruby. Many of us love it - in fact ruby runs on the JVM as JRuby. The noise seems to be coming from the Rails people who have 'rediscovered' ORM and use it in ways which some of us think has limitations and can give rise to problems. However, if you criticise Rails you are told you simply don't 'get it'. The fact that many of the ways Rails works have been been already tried before in Java and other languages and have been discovered to be less than perfect seems to be of no consequence.

    9. Re:Ruby & Java == Moriarity & Holmes by PeeCee · · Score: 1
      isn't C# now defined in terms of Java?

      With the recent developments, especially C# 2.0 vs Java 5, and now the proposals for C# 3.0, I'd say it's going the other way around. I think generics and auto-boxing are perfect examples of features that, while not groundbreaking (they may have been JSRs before Microsoft even mentioned them, I don't know), Sun would've never gotten around to implementing unless they felt the pressure. Even if some things were IMHO half-assedly implemented like Java Generics.

      Java has certainly reached something akin to maturity, but there is still plenty left to be done. I'm afraid if the enhancement process isn't somehow made more dynamic, especially now considering the new alternatives like Ruby and Python (which are proving useful in many more domains than one might've thought), it will stagnate and become an old, heavy dinosaur. Kinda like COBOL.

  20. Re:So, what's it like? by arevos · · Score: 2, Interesting
    There are situations where performance doesn't matter, but this is not true for 'most' applications.

    I find this rather hard to believe. The resources needed to run Halflife 2, and the resources required to run a Instant Messenger application, are on a quite different scale from one another. Clearly, therefore, you can afford more inefficiencies in an IM application, than you could in the latest 3D game. Are you claiming that this isn't the case? That we need the latest graphics cards and processors to run text-editors, personal organisors or IM programs?

    Performance matters up to a point, but it's important to realise that there is a point where it ceases to matter. Where this point is depends on your application. A user isn't going to care whether a function takes 1 millisecond or 40 time as long. So long as it is below the barrier at which the inefficiencies become noticable, these inefficiencies don't matter.

    Programming languages like Ruby, are less efficient from the computer's point of view, but more efficient from a programmer's perspective. If you can develop your product and push it out into production 3 times faster than your competitors, with little noticable performance loss, then you're going to make more money. If you can add more features and adapt to the market 3 times faster, then you're going to make more money. Sometimes the advantages of using a language like Ruby or Python outweigh the disadvantages.

  21. Smalltalk's inheritance by soundofthemoon · · Score: 4, Insightful

    Most of the things I love about Ruby are qualities that it inherits from the Smalltalk programming language. Typing objects instead of variables, everything is an object, object-based encapsulation, blocks as objects, polymorphic collections with enumerators, and the overall style of programming. Ruby is the first language since Smalltalk that I could really grow to love. It adds a lot that Smalltalk doesn't have, like regular expression syntax and better case statements, modues and mixins, and easier access to metaprogramming.

    In some ways Ruby is a bit too dynamic - one of the strengths of Smalltalk is its simplicity and the predictability of your code. With Ruby it's easy to adopt a programming style that makes it difficult to predict what will happen when you do something in your code. Experienced programmers should be able to avoid those pitfalls, but I worry that some of the features will ecourage neophytes to create code that is difficult to maintain or understand.

    1. Re:Smalltalk's inheritance by recharged95 · · Score: 1
      "but I worry that some of the features will ecourage neophytes to create code that is difficult to maintain or understand."

      Sounds like what Java went though from jdk 1.0-1.3.

    2. Re:Smalltalk's inheritance by AaronLawrence · · Score: 2, Funny

      but I worry that some of the features will ecourage neophytes to create code that is difficult to maintain or understand.

      Sounds like C++...

      --
      For every expert, there is an equal and opposite expert. - Arthur C. Clarke
  22. Not being a robot is no excuse. by Anonymous Coward · · Score: 0

    Robot or no robot, you're still copying highly-modded posts from previous threads and passing them off as your own, which is reprehensible.

  23. Use my new language called Booby by Anonymous Coward · · Score: 3, Funny

    It does everything every other language
    does but some things are easier and some things are harder.
    Because its relatively new you get to rewrite a bazillion
    lines of library code and API's that already exists in other languages.
    Furthermore you will become even more multilingual than you used
    to be so you can raise language critique to an even higher (f)art
    form. One profound difference, for example, is that Booby uses braces
    but they are reversed from C++ and Java i.e. the open brace is } instead of {.
    I expect to see a whole book on the ramifications
    of that alone.

    1. Re:Use my new language called Booby by Anonymous Coward · · Score: 0

      ;)
      i like that!

  24. Re:So, what's it like? by Decaff · · Score: 1

    Are you claiming that this isn't the case? That we need the latest graphics cards and processors to run text-editors, personal organisors or IM programs?

    Actually, I am.... These applications contain things like image handling, grammar checking, spell checking, file parsing and transfer, and many sophisticated GUI features.

    If you can develop your product and push it out into production 3 times faster than your competitors, with little noticable performance loss, then you're going to make more money.

    Having developed with a range of programming languages for 30 years, I just don't believe that this sort of speed different exists between languages. Unless you are using something really awful or verbose, then any competent developer truly familiar with any modern language and it's libraries will be productive. Ruby may well be at least 3x as consise as Java, but raw coding time does not make up that much of the development time of any significant project.

  25. Re:So, what's it like? by Anonymous+Brave+Guy · · Score: 1
    The resources needed to run Halflife 2, and the resources required to run a Instant Messenger application, are on a quite different scale from one another. Clearly, therefore, you can afford more inefficiencies in an IM application, than you could in the latest 3D game. Are you claiming that this isn't the case?

    Sure, as long as the IM is the only software running on your client's PC. However, most computers today are running multi-tasking OSes, and resources your inefficient software steals aren't available for other applications that might need them.

    We just rejected a software upgrade at work, worth thousands to the vendor for our office alone, on the basis that while it ran fine in isolation, it wouldn't play nicely with other software on the machines under some indeterminate circumstances. That would stop us doing our jobs as well as we were before, so bye bye upgrade.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  26. Re:So, what's it like? by Dare+nMc · · Score: 4, Insightful

    > Sooner or later a lack of performance really does become a problem
    my limited history of languages says, a lack of performance is taken care of by compiler/VM writers when a market for such comes about.

    C was unacceptable, and is now the standard for speed. C++ was way too slow now their are 100's of optimizers to turn off all the features that cause it to be slower than C.
    Java started out with horrible performance, but this story talks many times about how fast it is, it has compilers now, and a hundred different optimized VM venders to speed it up.
    I see no reason why Ruby would be slower as a language, except the lack of optimizers, perhaps due to the lack of time in the spotlight, and thus the lack of a market requesting it.

  27. Isn't anything off the rails... by Jeff+DeMaagd · · Score: 2, Insightful

    ...the basic definition of being derailed?

  28. Rails hobbles Ruby by MarkusQ · · Score: 2, Insightful

    I like Rails, but I love Ruby. The hardest part of learning Rails was (for me, an experienced Ruby coder) learning all of the things that you lose when you go to Rails. (One example out of many: in Ruby when you create a Hash you can provide a default function (rather than just a default value) to be used when an element is missing; with Rails, this generally doesn't work since the functions don't serialize).

    Conversely, if you like Rails you really should explore standalone-Ruby to see what you are missing.

    --MarkusQ

    1. Re:Rails hobbles Ruby by JamesOfTheDesert · · Score: 1

      I think Rails offers more of a "Wow" expereince for people coming from PHP or Java; experienced Rubyists appreciate what Rails offers, but also understand how relatively simple Ruby makes it to do these things on your own, and often it is better to just roll your own rather than wade through the Rails API maze.

      --

      Java is the blue pill
      Choose the red pill
  29. Re:So, what's it like? by Decaff · · Score: 1

    I see no reason why Ruby would be slower as a language

    True. Languages often do tend to speed up with time. But is if often hard to predict which languages do this. I used to use Smalltalk, and was constantly waiting for really fast cross-platform implementations. These never appeared.

  30. Re:So, what's it like? by Nataku564 · · Score: 1

    Dyanamic type checking.

    C/C++ is all static type checking.
    Java is also static type checking (mostly).
    Ruby/Perl/etc are dyanamically typed. This == slow(er).

    In addition, Java/Ruby/Perl like to sandbox your program in (with good reason) so you cant go and fly off the end of the stack (or any other low level data structure) and explode into a million pieces. This also makes it slower.

    Optimization can only do so much when you dont know what it is you are going to be getting.

  31. Re:So, what's it like? by arevos · · Score: 2, Interesting
    Actually, I am.... These applications contain things like image handling, grammar checking, spell checking, file parsing and transfer, and many sophisticated GUI features.

    If your text editor truly takes up as much processing power and memory as the latest 3D chart-topper, then perhaps you should look for a piece of software with a little less weight?

    Having developed with a range of programming languages for 30 years, I just don't believe that this sort of speed different exists between languages. Unless you are using something really awful or verbose, then any competent developer truly familiar with any modern language and it's libraries will be productive. Ruby may well be at least 3x as consise as Java, but raw coding time does not make up that much of the development time of any significant project.

    Ruby's conciseness is a by-product of its power. Working around Java's limitations often isn't a trivial task, and Ruby's powerful syntax makes it possible to design some very flexible frameworks. For instance, one commerical java project I was involved in required a web-based file storage system. When I look back on it, Ruby on Rails would have made the job infinitely easier; once the user and file database tables were set up, Rails would have automagically generated class and html interfaces for them. A login helper would have created the login, and then it would have only required a few lines of code to connect in Rail's file upload handling. The entire project could have done in days what had been done in weeks using Java tools.

    From my own experience, Ruby has been considerably faster than Java.

  32. Re:Flamewar.....NOW! by Bastard+of+Subhumani · · Score: 0
    Just because someone starts talking about Ruby doesn't mean they're mandated to mention the alternatives.
    Doesn't mean it's forbidden either, you big fat nonce.
    --
    Only three things are certain; death, taxes, and apocryphal quotations - Ben Franklin.
  33. Re:So, what's it like? by Decaff · · Score: 1

    Ruby's conciseness is a by-product of its power.

    In some respects, I agree.

    The entire project could have done in days what had been done in weeks using Java tools.

    I disagree. With some areas of a simple web project this is probably the case, although using visual design of JSF pages with JavaStudio Creator allows the production of data-linked web pages in seconds. There are also many new Java approaches to web development and data access that are far faster and more elegant than the traditional struts/JDBC approach.

    With the right tools and a good IDE, Java web development can be fast. Not as fast as getting the initial pages up with Rails scaffolding, sure (although projects like Trails come close), but still fast.

  34. Re:Flamewar.....NOW! by arevos · · Score: 1
    Doesn't mean it's forbidden either, you big fat nonce.

    Then I respectfully submit that you, sir, should have worked an opinion on Lisp and Haskell into your answer.

  35. Ruby 12 years Old by Anonymous Coward · · Score: 0

    The language was created by Yukihiro "Matz" Matsumoto, who started working on Ruby on February 24, 1993 and released it to the public in 1995.
    That is about the same time Java took off.

    http://en.wikipedia.org/wiki/Ruby_programming_lang uage

  36. Ruby has some Unicode support, what's missing? by Anonymous Coward · · Score: 2, Informative
    1. Re:Ruby has some Unicode support, what's missing? by Anonymous Coward · · Score: 0

      So the article you quote basically says:
      Ok, we handle binary data in strings ok, our regexp engine does some utf-8 stuff, for encodings please use iconv.

      I wouldn't really call that unicode 'support', its more like a minimal requirement to use unicode at all...

      AFAIK You cannot write Ruby scripts in unicode, you cannot simply configure your stdout/stdin or other file channels to use different encodings, convert between encodings on the fly or things like that. Basically if you have Unicode your handling binary data.

      Take a look at how Java (or Tcl, which is more a comparision for Ruby) handle Unicode.
      In Tcl you can write your scripts in any encoding if you like, all internal data is either binary data or unicode, so you do not fall into the trap of losing encoding information while manipulating string data, the regexp engine does not manipulate single bytes if you hand it a unicode string, it operates on characters. The channel subsystem allows simple configuration to automatically do conversions, there are functions to encoded/decode various encodings manually and so on.
      Maybe Ruby can do it by using iconv, but its not integrated into the language, you have to actively think about the problem instead of having a language that moves the problem out of your way.

  37. Re:Flamewar.....NOW! by Scarblac · · Score: 1

    I too like Python, but let's put this into perspective. This is an article about Ruby and Java, not about Python.


    But that is a bit odd. To my mind, Python, Perl and Ruby are a pretty close family of similar languages. Java is rather different (mostly because of all the strict type checking, and the idea that putting everything in classes makes a language OO). Stuff like duck typing is central in both Ruby and Python.


    Either compare different types of apple, or apples and oranges. But why would you compare one specific apple with one specific orange :-)

    --
    I believe posters are recognized by their sig. So I made one.
  38. While we are at it: finding a Ruby group near you by SmallOak · · Score: 1

    www.rubyholic.com

  39. Re:So, what's it like? by arevos · · Score: 4, Informative
    With the right tools and a good IDE, Java web development can be fast. Not as fast as getting the initial pages up with Rails scaffolding, sure (although projects like Trails come close), but still fast.

    I'm doubtful. I bump up against the limitations of Java every other day, and it seems like the only way you could get around such things is with an awful lot of code generation.

    For instance, I was recently writing a Java class to convert an XML DOM into a custom object tree. This largely involved writing getters and setters, and for loops to iterate over NodeLists to pull out descendant elements. I couldn't help thinking that with Ruby, I could have written "has_attributes" and "has_descendants" methods, and generated the getters and setters and DOM handling automatically. Instead of my classes being 50 lines apiece, they could have just been 4. It would have taken me far less time in Ruby than I did in Java, because Java hasn't got metaclass-like abilities like Ruby or Python.

  40. How Ruby fits in for my work. by mpn14tech · · Score: 3, Informative

    I work as a java developer, but I still still have plenty of other languages in my toolbox. I have just started with experimenting with Ruby. The biggest thing I see is that Ruby fills gap for me between perl and Beanshell.
    The programming hierarchy I tend to think of for my work,
    1. Shell- Basic scripting. Glueing commands together.
    2. Perl- More powerful sripting features, but not really OO.
    3. Ruby- Still a scripting language, but designed around OO.
    4. BeanShell- Good for quick glueing of java classes together
    5. Java- When I need a full compiled application environment.

    For me each language has its purpose and I use them where it best gets
    the job done.

    1. Re:How Ruby fits in for my work. by Anonymous Coward · · Score: 0

      ??BeanShell??

      and yet you do no mention of Python???

    2. Re:How Ruby fits in for my work. by swimmar132 · · Score: 1

      What makes Ruby 'still a scripting language"?

    3. Re:How Ruby fits in for my work. by ealar+dlanvuli · · Score: 1

      It would be hard to develop a large project in Ruby without a pseudo-language self-imposed contract on top of the language since it is so loose.

      This is my definition of scripting language.

      --
      I live in a giant bucket.
    4. Re:How Ruby fits in for my work. by Anonymous Coward · · Score: 0

      Would it be hard? Is that your experience because you've tried it or is it speculation?

      What would you need to add to "elevate" it from a "scripting language" to whatever you consider Java?

      If your answer basically boils down to "Java has static typing of variables," how do you explain Smalltalk?

      I think the real problem is cultural.

    5. Re:How Ruby fits in for my work. by I+Like+Pudding · · Score: 1

      I have the same problem. I can't get off unless I'm tied up, gagged, whipped, and electrocuted.

      That's my definition of sexy.

      Seriously, though, you should not be relying on the language to organize everything for you - don't go fobbing your architectural duties off on the language. Really, LISP is the scriptiest scripting language under your definition.

      I maintain a large, old perl codebase. I have no problems reading and understanding what any given line of code is doing. I do have tons of problems finding code and following the path of execution. Why? The architecture and frameworks were hand-rolled and barely refactored. When there isn't an obvious or straightforward way to do a thing, you might see 4 different implementations in 4 different modules. Suck.

    6. Re:How Ruby fits in for my work. by Decaff · · Score: 1

      The biggest thing I see is that Ruby fills gap for me between perl and Beanshell.

      Then why not try Groovy? It runs on the JVM, has great integration with Java, is a lot like Ruby and has far more features than BeanShell (like closures).

    7. Re:How Ruby fits in for my work. by swimmar132 · · Score: 1

      Hm, a lot of other people (including me) don't seem to have that problem. Wonder why you do.

    8. Re:How Ruby fits in for my work. by Decaff · · Score: 1

      What would you need to add to "elevate" it from a "scripting language" to whatever you consider Java?

      For me, the first thing I would want is a decent open source IDE that would allow multi-threaded debugging of Ruby apps.

    9. Re:How Ruby fits in for my work. by stevens · · Score: 1
      For me, the first thing I would want is a decent open source IDE that would allow multi-threaded debugging of Ruby apps.

      Ask, and ye shall receive.

      Seriously, though, half the problem with some of these new environments is over-complexity for a task (I'm looking at you, Java). The fact that you think you need an IDE and eg., multithreaded debugging to make the environment work show that you're in that over-complex world.

      When you see an old-timer validate his code because it itself allows for inspection and dumping state, *and* has such a simple internal structure that you can understand the working parts, you realize that the IDE crowd missed something.

    10. Re:How Ruby fits in for my work. by Decaff · · Score: 1

      Seriously, though, half the problem with some of these new environments is over-complexity for a task (I'm looking at you, Java). The fact that you think you need an IDE and eg., multithreaded debugging to make the environment work show that you're in that over-complex world.

      Sorry, but this is nonsense. There is absolutely no substitute for being able to stop code and inspect variables and debug things. The most powerful development environments of the past decades (Smalltalk, LISP etc) have had this, and anything else is inadequate.

      When you see an old-timer validate his code because it itself allows for inspection and dumping state, *and* has such a simple internal structure that you can understand the working parts, you realize that the IDE crowd missed something.

      More nonsense. I am an old-timer - I have been developing for 30 years. The idea that you can develop multi-threaded applications of hundreds of thousands of lines of code simply using 'print statement' debugging and looking a code by eye is sheer wishful thinking.

      The so-called 'IDE Crowd' have been leading the way in the way in software development techniques for over 30 years. The idea that we should put up with less is ridiculous.

    11. Re:How Ruby fits in for my work. by stevens · · Score: 1
      The idea that you can develop multi-threaded applications of hundreds of thousands of lines of code simply using 'print statement' debugging and looking a code by eye is sheer wishful thinking.

      Straw. You can just not develop something that's hundreds of thousands of lines of coupled nonsense. You modularize it and keep the code in smaller sections with clear interfaces which are graspable. Debugging should be a total last resort.

      I'm not arguing against debugging environments, I'm arguing against relying on them to check your work. I wish I had a nickel for every bug some developer stuck into code I maintain on the idea that 'it can be debugged later' rather than validating it. Note that the first thing you said you needed in the language was a debugger: not a good standard library, not a flexible runtime engine, not a runtime shell like irb or clisp, not closures or good OO or fast reflection, but a debugger. I guess it just set me off.

      I've worked on big programs that were easy to program (with low bug counts) because they were properly modularized. You could implement whole features just by checking out the sub-module (with only 5-10k lines) with the change, and running the tests in it. You could understand the code; the tests actually provided coverage enough to be confident.

      I've also worked on big programs where a small change in some buried class would ripple through the codebase, providing a multi-hour "step-into" party to solve. And these coupled designs are almost impossible to add unit tests to, so you're stuck with the debugger for 70% of your work time.

      I'm just advocating for the former over the latter. I find many "intermediate" programmers I work with don't realize there's an alternative to spending 6+ hours a day in a debugger.

      The so-called 'IDE Crowd' have been leading the way in the way in software development techniques for over 30 years.

      Trust me, I know. I've been maintaining this shit.

    12. Re:How Ruby fits in for my work. by Decaff · · Score: 1

      Straw. You can just not develop something that's hundreds of thousands of lines of coupled nonsense. You modularize it and keep the code in smaller sections with clear interfaces which are graspable. Debugging should be a total last resort.

      I disagree. Part of development should be the construction of tests. Quite regularly those tests will reveal wrong assumptions or bad code. One of the most useful ways to find out why the assumptions are wrong is to single step through the code and see what happens.

      And I simply can't imagine trying to debug a multi-threaded web application passing information between many levels of user interface, business logic and database interface simply using print statements and logs. Being able to trace this with an IDE can save a phenomenal amount of time, in my experience.

      Note that the first thing you said you needed in the language was a debugger: not a good standard library, not a flexible runtime engine, not a runtime shell like irb or clisp, not closures or good OO or fast reflection, but a debugger. I guess it just set me off.

      No, what I meant was the first extra thing I needed! After all, Ruby (and lots of scripting languages) already has a shell, and a good library, closures etc. I can see how you reacted like that if you did not understand this, or if I was unclear.

      Trust me, I know. I've been maintaining this shit.

      Me too - since the 70s.

    13. Re:How Ruby fits in for my work. by stevens · · Score: 1

      Sorry to come off brusque, as we seem to differ in quantity more than quality.

      I simply can't imagine trying to debug a multi-threaded web application passing information between many levels of user interface, business logic and database interface simply using print statements and logs.

      This is actually the work I do. I simply won't debug in such an environment. I will not step through the full code. Each interface between those levels should be well-defined, tested, and should log what it gets and what it returns upon request. The modules themselves should be small enough that stepping through is rarely needed. In my business (financial industry), we have to be able to tell what happened days/months/years after the fact; I cannot say "Hold on I'll attach a debugger to my prod webserver."

      This is exactly where I have to train the kids away from debuggers, and get them to plan the interfaces and logging so that we can reconstruct the issue. Sure, attach a debugger in dev--who cares. But if you don't have a plan for well-tested modules connected by logged interfaces, then you lose money.

      So I guess I see why you would want a debugger, but for me if you need one, then you're already in trouble.

    14. Re:How Ruby fits in for my work. by Decaff · · Score: 1

      So I guess I see why you would want a debugger, but for me if you need one, then you're already in trouble.

      I guess I am :)

      Actually, I do see your point - that debugging can be a bad habit to fall into if you use it as a substitute for good design.

      The reason is that I am almost always working in a different way from you - I very rarely work on new code. Most of what I do is Java ports of existing projects. In that case, much of the logic was designed by someone else, and is often not that clear or well documented. Running debuggers in parallel - in the original language and in Java - is an invaluable way to follow through the logic and to check for inconsistencies and problems.

      Another occasion when debuggers can be invaluable is when you are having problems with open source libraries and products. Being able to trace from your code into the library to investigate things - without having to insert your own statements into that code (which may in itself cause further problems, especially in multi-threaded situations) is incredibly useful.

      There is another circumstance I have found where debuggers can be hugely useful. Occasionally I have some phenomenally complex algorithms to set up - some horror of business logic, or large mathematical model. The business logic or model itself may be speculative - it may be being retro-fitted to existing working practises and data. In this case, you have to develop in an iterative way, exploring the model and seeing how it reacts to changes and how it does or does not fit the required data. In this situation having 'print statement' and 'logger' debugging is great at telling you what is going wrong, but sometimes there is no substitute for a debugger to find out why.

      But anyway - I have been using interactive debugging for over 30 years, and it has been part of the best development systems ever written - Smalltalk IDEs. I believe that for some development processes a good debugger is invaluable.

    15. Re:How Ruby fits in for my work. by stevens · · Score: 1
      Running debuggers in parallel - in the original language and in Java - is an invaluable way to follow through the logic and to check for inconsistencies and problems [in porting apps].

      I don't envy you that work. :-)

      I have been using interactive debugging for over 30 years, and it has been part of the best development systems ever written - Smalltalk IDEs.

      I never did use smalltalk, but I have used its stepchild-with-pointers ObjC on NeXTStep. And ObjC is cute, so I imagine that Smalltalk was prettier.

      I originally mistook your love for good tools for the modern Java-only code-monkey attitude. I swear, in two years, I'll be able to hire just the tools and leave the Java "programmers" unemployed.

      BTW, (I'm thinking of your ports) isn't it amazing what programmers will go through because people can't come up with a new set of specs for they want the thing to do? I suppose it pays the bills. :-)

    16. Re:How Ruby fits in for my work. by Decaff · · Score: 1

      I don't envy you that work. :-)

      Actually it is fun - it involved a lot of detective work!

      BTW, (I'm thinking of your ports) isn't it amazing what programmers will go through because people can't come up with a new set of specs for they want the thing to do? I suppose it pays the bills. :-)

      Actually, it is not that. It is because they develop in one language with no concerns for future portability, then don't bother to upgrade for 10 years and their code and language becomes unsupported.....

  41. Re:So, what's it like? by Decaff · · Score: 1

    I'm doubtful. I bump up against the limitations of Java every other day, and it seems like the only way you could get around such things is with an awful lot of code generation.

    What you get with modern Java tools is not code generation as such, but generation of non-Java stuff. For example JSF generates JavaScript and high-quality HTML. JDO generates high-quality SQL, and JDO tools allow automated generation of schemas from Java classes (and the other way around). IDEs like Eclipse and Netbeans allow these things to be plugged together and handled in an automated way.

    For instance, I was recently writing a Java class to convert an XML DOM into a custom object tree. This largely involved writing getters and setters, and for loops to iterate over NodeLists to pull out descendant elements. I couldn't help thinking that with Ruby, I could have written "has_attributes" and "has_descendants" methods, and generated the getters and setters and DOM handling automatically. Instead of my classes being 50 lines apiece, they could have just been 4. It would have taken me far less time in Ruby than I did in Java, because Java hasn't got metaclass-like abilities like Ruby or Python.

    Good example; and in this case I would use code generation. I almost never write getters or setters in Java - my IDE does it (and then manages them) for me. If I look at the class properties in NetBeans, I only see the variables ('bean properties') - the code is all hidden and managed for me.

    Don't get me wrong - I think Ruby is beautiful and I use it a lot. I just don't think that with the right tools Java is that much less productive for substantial projects.

    You are right - it may be 'getting around' limitations in Java, but if it gets the job done in a maintainable way - why does this matter?

  42. Like you are justifying bad syntax? by FatSean · · Score: 1

    I mean, it isn't ALL about performance. Maintainability is probably the #1 coding related issue I hear about. Performance always matters. It just isn't always the primary concern. As a developer in internal and B2B IT systems to 8 years, performance is usually far down on the list. The hired help can wait an extra second for a system response to save development and maintenance costs.

    --
    Blar.
  43. Re:While we are at it: finding a Ruby group near y by JamesOfTheDesert · · Score: 1

    This may be more active and more complete: http://rubygarden.org/ruby?RubyUserGroups.

    --

    Java is the blue pill
    Choose the red pill
  44. Re:Flamewar.....NOW! by Tablizer · · Score: 2, Insightful

    Python better add the features that Ruby hypers won't shut up about or risk getting left in the popularity dust. It is not that Ruby is better, but if people keep talking about certain features then people will *expect* them because they hear about them, not necessarily because they really are a Silver Bullet. Hype works, I am sorry to say.

  45. Monopoly by Anonymous Coward · · Score: 0

    How come whenever someone mentions Ruby on Rails a get a picture of the Monopoly Guy hanging out of a train on that "Goto Pacific Railroad" (or whatever) chance card?

    1. Re:Monopoly by greg1104 · · Score: 1

      You're thinking of the "Take a ride on the Reading" Chance card. I instead find myself humming "Going off the rails..." line from Ozzy Osbourne's "Crazy Train" when reading about this subject.

  46. Re:It's obvious by Anonymous Coward · · Score: 0
    I spent a weekend learning some ruby and enjoyed it, the following weekend I decided to play with rails... ughhh! Rails is a half baked solution, I never put utility scripts above document root and rails braindead dispatch is a step backwards from mod_perl, python or PHP. I've not played with ruby since, partly because it's difficult to seperate the language from the hype surrounding Rails. I already know how to code web applications and Rails felt like a straight-jacket but the deciding factor was the attitude of the Rails zealots. Narrow minded Rails proponents are a credit to every scripting language other than ruby. Rails does not have all the answers and rails freaks always remind me of Microsoft employees promoting .NET

    Ruby is an interesting language and I'll look at it again some time, however I'd go back to writing CGI's in C before adopting rails, it really does suck that much!

  47. Re:So, what's it like? by arevos · · Score: 1
    Good example; and in this case I would use code generation. I almost never write getters or setters in Java - my IDE does it (and then manages them) for me. If I look at the class properties in NetBeans, I only see the variables ('bean properties') - the code is all hidden and managed for me.

    But that still doesn't solve the problem of repetition when parsing DOM elements. Java's introspection is too unwieldly to be used often, and I'm unfortunately constrained by Java 1.4 - no generics for me! Perhaps I should look for, or design, a program that will generate Java code from templates.

    Don't get me wrong - I think Ruby is beautiful and I use it a lot. I just don't think that with the right tools Java is that much less productive for substantial projects.
    You are right - it may be 'getting around' limitations in Java, but if it gets the job done in a maintainable way - why does this matter?

    True; for simple problems code generation can be a solution, but it's a solution that does have limitations, and one that strikes me as horribly inelgant. Perhaps, though, it warrents some further investigation on my part.

  48. Re:So, what's it like? by petermgreen · · Score: 1

    if you don't need to maintain a public interface is there any reason not to just use the fields directly and only change them into getters/setters if you need to add a sideeffect given that modern ides (at least eclipse) make doing that change painless?

    --
    note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
  49. Purpose of being verbose by Anonymous Coward · · Score: 0
    For all those whining about java being verbose, the reason verbose code + well define coding practices is it reduces maintenance cost. Ruby allows terse coding, but honestly, how long is it going to take someone new to understand all the subtleties of a program? Being verbose has 1 major purpose. Making code explicit, instead of implicit. By that I mean, forcing the original author to be verbose means the details are spelled out. Sure it takes more time, but later on, it's easier for someone to decifer it. Terse syntax is great when everyone working on the project knows how something works.

    I've worked on enough jobs where the previous author wrote in shorthand and didn't follow good coding practices. The end result is the next person writing the code has to spend a lot of timer figuring out exactly what the heck the code does. Dynamic languages are great and they provide a lot of ways of saving typing, but what a programmers goals are is different than a company. A company wants the code well documented and easy for someone new to understand. This makes sure the company isn't at the mercy of a single programmer. Should a programmer leave, a company wants to make sure someone else can pick up the code and be productive quickly.

    For all those eletist who think, "I want to write a few lines as possible", the reason why managers and executives like Java is the verboseness + strong emphasis on good coding practices. That is the primary contribution of Sun to the programming world.

    1. Re:Purpose of being verbose by Moses+Lawn · · Score: 2, Interesting

      No, verbosity like this serves no purpose whatsoever. It's just like writing: if you want those that come after you to understand it, write clean, spare code with useful symbol names and use comments on the non-obvious parts, for chrissake - that's what they're for. In fact, verbosity does just the opposite - it encourages vast amounts of cut-and-paste monkeywork, and all the attendant bugs and inefficiencies that come with it.

      I've seen enough cryptic, overterse code that was incomprehensible, but I've seen just as many 2000 line monster modules that took a week of tracing through to understand what was going on. What's worse, the more verbose the code, the harder it is to modify and extend it, or - god forbid - try to use it for something else.

      It's not elitist to want to write as little code as possible - it should be your goal. I have a lot of work to do and not a lot of time, and I do not want to write 20 lines where 3 will do. If you have to resort to tools to autogenerate gobs of code to use your language, you're doing something very wrong.

      Excessive verbosity is great if you're a) overly anal retentive, b) not really a very imaginative programmer, or c) getting paid by the hour.

      Oh, and Sun's primary contribution seems to be shovelloads of methodolgies and APIs starting with the letter 'J', thrown aperiodically at the community in the hopes that some of them will stick, most of which are deprecated or outright disappeared when some new strained coffee metaphor comes out saying "No, *this* is the Right Way To Do It!"

      --

      What if life is just a side effect of some other process and God has no idea we exist?

    2. Re:Purpose of being verbose by Hiro+Antagonist · · Score: 1, Insightful

      Managers like Java because Java was a language designed to be impressive to managers. Writing Java code is painful, because you have to do so much repetition, and because Java goes absolutely apeshit if you don't play ball.

      You know what I want out of a language and application framework? I want to be able to repeat myself as little as possible, have a simple codebase with built-in hooks for unit testing, be able to run my code anywhere, and be able to produce a working program in a rapid fashion. Java doesn't give me this, and I'm not sure if Ruby does just yet, but it seems a lot nicer.

      I've just started looking at Ruby, and insofar, I'm impressed -- it feels like a mix of Perl and Python, with a dash of Lisp thrown in. It could certainly be faster (and the next VM looks very nice), but overall, the language has a very good design, and it is a joy to work with. I feel the same way I did when I discovered Perl (4), only now I get all the OO goodness that feels so hacked-on and kludgy in Perl, but without the indentation madness of Python.

      --

      --
      I Hit the Karma Cap, and All I Got Was This Lousy .sig.
    3. Re:Purpose of being verbose by ealar+dlanvuli · · Score: 1

      I grade homework, people who 'write comments on the non-obvious parts' are always lacking enough comments for me to quickly understand what they did (even though I wrote the assignment!).

      You should be documenting at least once per method/function, and I tend to find it a good idea to put a comment above every block larger than 3 lines long.

      Sean

      --
      I live in a giant bucket.
    4. Re:Purpose of being verbose by ealar+dlanvuli · · Score: 3, Funny

      I'm sorry. I've probably written 200kloc of Java in my life. I have never noticed this painful repitition? Where is it?

      Thanks,
      Sean

      --
      I live in a giant bucket.
    5. Re:Purpose of being verbose by tunah · · Score: 4, Insightful

      StringTokenizer st = new StringTokenizer(s);

      --
      Free Java games for your phone: Tontie, Sokoban
    6. Re:Purpose of being verbose by mikaelhg · · Score: 1
      StringTokenizer st = new StringTokenizer(s);
      public void strawman(String amateur) {
          for(String part : amateur.split(" ")) {
              System.out.println(part);
          }
      }
      See: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ String.html#split(java.lang.String)
    7. Re:Purpose of being verbose by Decaff · · Score: 1

      Managers like Java because Java was a language designed to be impressive to managers.

      No. Java was designed to be safe for developers.

      Writing Java code is painful, because you have to do so much repetition, and because Java goes absolutely apeshit if you don't play ball.

      With a modern IDE, you don't have to repeat yourself. The point of Java is that, unlike C or C++, it does not go apeshit if you don't play ball. It safely shows you where you have gone wrong.

    8. Re:Purpose of being verbose by mikaelhg · · Score: 1

      Managers like Java because Java was a language designed to be impressive to managers.

      Bullshit. Managers like Java because it helps their team achieve their business objectives better than the other languages you describe.

      On your own dime, go jump in leaf piles, run through a field of flowers, play with Python, Ruby or whatever is good for your spiritual wellbeing, but when you're working to pull a paycheck, you don't get to put your own flights of fancy before things which make your team (not you as an individual performer, but your team as a whole) more effective in achieving business objectives.

    9. Re:Purpose of being verbose by mav[LAG] · · Score: 3, Insightful

      Bullshit. Managers like Java because it helps their team achieve their business objectives better than the other languages you describe.

      Hmmm, this attitude sounds somewhat familiar. Oh yeah, Paul Graham has written about it at length in this essay:

      The pointy-haired boss miraculously combines two qualities that are common by themselves, but rarely seen together: (a) he knows nothing whatsoever about technology, and (b) he has very strong opinions about it.

      Suppose, for example, you need to write a piece of software. The pointy-haired boss has no idea how this software has to work, and can't tell one programming language from another, and yet he knows what language you should write it in. Exactly. He thinks you should write it in Java.

      Why does he think this? Let's take a look inside the brain of the pointy-haired boss. What he's thinking is something like this. Java is a standard. I know it must be, because I read about it in the press all the time. Since it is a standard, I won't get in trouble for using it. And that also means there will always be lots of Java programmers, so if the programmers working for me now quit, as programmers working for me mysteriously always do, I can easily replace them.

      On your own dime, go jump in leaf piles, run through a field of flowers, play with Python, Ruby or whatever is good for your spiritual wellbeing, but when you're working to pull a paycheck, you don't get to put your own flights of fancy before things which make your team (not you as an individual performer, but your team as a whole) more effective in achieving business objectives.

      Horseshit. Python and Ruby and Lisp are real-world workhorses that don't need tens of millions of dollars in hype to be successful. For instance I have tens of thousands of lines of Python code out on the field doing real work, 24 hours a day, seven days a week for really demanding clients, including governments and advertising agencies. In one case, I finished a project in a third of the time it took three Java programmers - and mine was smaller, faster and more maintainable for the guys who took it over. Time is money and succinctness is power in software development and Java doesn't make the cut on either. Oh sure, it's a great tool to allow development by the lowest common denominator (money quote from James Gosling) but the really smart teams I know despise it for the ugly hack it really is. When I expressed this opinion in a column for a local computing mag, I was assailed with all kinds of outraged squeals from the local Java gurus. But none of them could answer my points honestly.

      If readers disagree, answer honestly with words rather than modpoints. I've tried Java. I really have. I found it ugly, slow, anal and seriously limiting to work with. And I don't seem to be allowed to fix flaws in it either. That's not good.

      --
      --- Hot Shot City is particularly good.
    10. Re:Purpose of being verbose by mikaelhg · · Score: 0, Troll

      The pointy-haired boss miraculously combines two qualities that are common by themselves, but rarely seen together: (a) he knows nothing whatsoever about technology, and (b) he has very strong opinions about it.

      Well, fuck you too, buddy. Merry Christmas to your ignorant ass.

      I'm sure it's easy to copypaste some strawman argument containing hilarious phrases such as "pointy-haired boss" which the children will find irresistible, since they know nothing about the actual merits of the arguments, having never managed anyone, let alone a group of people who work together to achieve objectives such as saving people's lives, or even less noble objectives such as creating a software platform to aid the collective research efforts of thousands of researchers.

      For instance I have tens of thousands of lines of Python code out on the field doing real work, 24 hours a day, seven days a week for really demanding clients, including governments and advertising agencies. In one case, I finished a project in a third of the time it took three Java programmers - and mine was smaller, faster and more maintainable for the guys who took it over.

      I have used hundreds of thousands of dollars on Python code which the author believed to be really maintainable and work really well, but in the reality-based world turned to be such crap that the whole team, including me, had to work a breakneck pace to rewrite it in Java, which has such incredible features as working threading support, no Global Interpreter Lock, actual Oracle and LDAP support that doesn't leak memory like anything, and isn't 20 times slower than the Oracle and LDAP support in other languages, no monkey patches (oh yeah, Python coders seem to think that it's SUCH a good idea to monkeypatch others' code, since after all, SMART people should know without any documentation what's going on, and documentating code is useless anyway, people should just go in and read all of those millions of lines of code if they want to know what's going on) and, you know, clear and accurate documentation and HORDES of pre-existing components which make your life so much easier, if only you're not infected with the dreaded Python community NIH disease.

      Java does have an additional useful feature: because of its mandatory coding practises and standards it's pretty easy to spot when an amateur has written something really broken, and contain the problem to those components which the amateur has touched. Perhaps this is what has happened to you?

      I've used, in production, Python, Perl, C, C++, Pascal, Java, x86 assembly, a little AutoLisp, and so on. Hundreds of thousands of lines. (The C code I have out there is pretty crappy, for which I apologise, but I was an amateur and thought of my work much as you seem to think now.) Since I'm now a professional, I don't fucking connect programming language tools to my personal or professional identity. It's a real bad idea to do so, if you want to remain, or become, a professional.

      Working in teams means that you can't just think what's right for you right now, you have to think of what's good for the team on the long run. Sometimes managers are wrong in their decisions about which path to take, but after you've tried the Python path, it quickly shows itself to be one of the paths that's pretty easy to just rule out because of its obvious defects. Like Pascal is, for different reasons.

      Perhaps it's time for you to grow up too, buddy, and understand that the world doesn't revolve around you and what you want. Wishing things don't make them true. Different things are true to different people with different backgrounds.

      KISS doesn't just mean "least code" or "least rows" or "least symbols."

      If it doens't support distributed transactions, it's not simple, because it just can't be an integral part of so many applications. Which means that the investment you make in this piece of software is mostly wasted, while a larger investment in a piece of software which DOES support XA is muc

    11. Re:Purpose of being verbose by mav[LAG] · · Score: 3, Funny
      Well, fuck you too, buddy. Merry Christmas to your ignorant ass.

      Tsk tsk. You're taking this way too personally.

      I'm sure it's easy to copypaste some strawman argument containing hilarious phrases such as "pointy-haired boss" which the children will find irresistible, since they know nothing about the actual merits of the arguments, having never managed anyone, let alone a group of people who work together to achieve objectives such as saving people's lives, or even less noble objectives such as creating a software platform to aid the collective research efforts of thousands of researchers.

      I rest my case. The above paragraph is one sentence! Obviously working with Java's crufty verbosity has affected your writing. I'd suggest taking a course in a more pithy language. By the way, Graham's argument is not a strawman: he's made it clear over a few different essays that because programming languages vary in power, smart coders who use more powerful languages can code circles around those using Java. Also if you're going to drag in logical fallacies then I need to point out yours too: "saving people's lives" and "aiding ... thousands of researchers" has nothing whatever to do with the merits of Java versus other programming languages. It's an emotional red herring.

      I have used hundreds of thousands of dollars on Python code which the author believed to be really maintainable and work really well, but in the reality-based world turned to be such crap that the whole team, including me, had to work a breakneck pace to rewrite it in Java, which has such incredible features as working threading support, no Global Interpreter Lock, actual Oracle and LDAP support that doesn't leak memory like anything, and isn't 20 times slower than the Oracle and LDAP support in other languages, no monkey patches (oh yeah, Python coders seem to think that it's SUCH a good idea to monkeypatch others' code, since after all, SMART people should know without any documentation what's going on, and documentating code is useless anyway, people should just go in and read all of those millions of lines of code if they want to know what's going on) and, you know, clear and accurate documentation and HORDES of pre-existing components which make your life so much easier, if only you're not infected with the dreaded Python community NIH disease.

      Sheesh, I thought the previous sentence was bad but this one takes the cake. Full stops are your friend. So is coherence. Some answers:
      • If you paid hundreds of thousands of dollars for a component written by an idiot in a language your team doesn't use, then you're the bigger idiot.
      • Python does have working threads and the GIL has never bitten me when working with multi-threaded libraries in C.
      • Bummer about Oracle. Try Postgres instead. It's cheaper and better.
      • Monkeypatching is considered harmful by any Python programmer worth his salt.
      • Python comes with batteries included. Of all communities it's the one with the *least* amount of NIH syndome.

      Java does have an additional useful feature: because of its mandatory coding practises and standards it's pretty easy to spot when an amateur has written something really broken, and contain the problem to those components which the amateur has touched. Perhaps this is what has happened to you?

      Entirely possible. But I've seen good Java - really top of the line guru-doing-an-exercise-proposed-by-Martin_Fowler-s tandard type Java - and it was just plain ugly because the language is just plain ugly.

      I've used, in production, Python, Perl, C, C++, Pascal, Java, x86 assembly, a little AutoLisp, and so on. Hundreds of thousands of lines. (The C code I have out there is pretty crappy, for which I apologise, but I was an amateur and thought of my work much as you seem to think now.)

      Can't recall making any comments about your work or even you personally. *Checks* - nope. You

      --
      --- Hot Shot City is particularly good.
  50. Ways of Using Ruby by TheUncleD · · Score: 4, Informative
    Also, there's many different ways of using Ruby besides Rails. Rails is ONE freamework. Iowa is another here you can find out . Another is just plain eruby mod_ruby. Another is cgikit, a friend of mine uses it exclusively although it has little english documentation at this time.

    Rails as has been said, is a framework. Ruby is the language, and all rails is just ruby with a design in place to make it easier. Some great tools for using rails are becoming available though, due to its increasing user-base. A lot of people are still "trying it, and going back to php" but its got a core user group now and that's what counts.

    1. Re:Ways of Using Ruby by TheUncleD · · Score: 1

      That link was meant to be here

  51. Re:So, what's it like? by Decaff · · Score: 1

    if you don't need to maintain a public interface is there any reason not to just use the fields directly and only change them into getters/setters if you need to add a sideeffect given that modern ides (at least eclipse) make doing that change painless?

    The thing is that so many useful Java APIs and tools want to have the ability to look at a field and even modify them on the fly (as in the fields of components in GUI tools). They do this using the getters and setters. As adding getters and setters is as simple as adding a field using a modern IDE, where is the harm?

  52. Re:So, what's it like? by Decaff · · Score: 1

    Java's introspection is too unwieldly to be used often, and I'm unfortunately constrained by Java 1.4 - no generics for me!

    I find Java 1.5 features to be enormously useful.

    True; for simple problems code generation can be a solution, but it's a solution that does have limitations, and one that strikes me as horribly inelgant. Perhaps, though, it warrents some further investigation on my part.

    To be honest, I find that code generation is actually best for more complex problems - the more that is automatically handled by the IDE the better, as the IDE can keep track of so much. Java code generation is usually not subject to the limitation of systems like Rails - it is not one-shot - it can be two way and adaptable. I agree it is not that elegant, as it is not a feature of the language itself.

  53. Ruby is what Perl and Python want to be by ari_j · · Score: 0

    I used Ruby for a while a few years ago, enough to fall in love with it and wish I had more uses for it. I was unable to think of anything that I could do in Perl and not do more readably in Ruby, or anything I could do in Python and not do more easily in Ruby.

    Then again, I like Common Lisp and my Christmas list this year included an open-source Miranda compiler.

    1. Re:Ruby is what Perl and Python want to be by Anonymous Coward · · Score: 0

      Then again, I like Common Lisp and my Christmas list this year included an open-source Miranda compiler.

      Why don't you just use Haskell like a normal person? Serious question.

      And there's enough compilers to last through Hannukah, let alone Xmas.

    2. Re:Ruby is what Perl and Python want to be by ari_j · · Score: 1

      Miranda has a more readable syntax than Haskell. Haskell also has the largest mandatory toolchain of any language other than the .NET family.

    3. Re:Ruby is what Perl and Python want to be by Anonymous Coward · · Score: 0, Insightful

      Python does not want to be Ruby. And I pray that will always remain so.

      Ruby is more readable than Perl no doubt, ANYTHING is more readable than Perl, but Python has as big a readability advantage over ruby as Ruby has over Perl. And that advantage far outweights the few little things in which ruby is "easier".

    4. Re:Ruby is what Perl and Python want to be by ari_j · · Score: 1

      Care to name any examples of the advantages of Python over Ruby, or just rely on sweeping statements with nothing to back them up? I said that Ruby has a readability advantage over Perl and a writability one over Python. Being able to format your code how you want is a good thing.

    5. Re:Ruby is what Perl and Python want to be by Anonymous Coward · · Score: 0

      Miranda has pretty much exactly the same syntax as Haskell (or rather Haskell has the same syntax as Miranda). I don't even understand your comment about the mandatory tool chain, you only need a compiler, ghc for example, and an editor to write Haskell code.

    6. Re:Ruby is what Perl and Python want to be by Anonymous Coward · · Score: 0

      I said python has readability advantage. Nothing more. Nothing less.

      It doesn't contradict your statement either, it can be less readable while being more writable, althouh I personally happen to disagree with writability as well.

      As for the sweeping statements, you're not exactly on the high ground here, "I was unable to think something" isn't exactly the most convincing "backing up" I've ever seen.

    7. Re:Ruby is what Perl and Python want to be by ari_j · · Score: 1

      "largest mandatory toolchain" ... the Debian package for ghc6 is 62.2 MB. GCC is 4.2 MB plus 8.8 MB for libc6-dev, or about 1/5 the size to get up and running. Also, Miranda's syntax is easier to read than Haskell's, IMHO (to which I am entitled).

    8. Re:Ruby is what Perl and Python want to be by ari_j · · Score: 1

      It's not that you contradicted my statement - it's that you apparently ignored it entirely. That said, you are free to name something that is easier to do in Python than in Ruby. I couldn't think of anything - maybe you, the Python advocate, can. If not, then I'm the only one here who has backed up his statement with anything at all. It is impossible to prove a negative - but if you can provide a counterexample I will gladly concede the point.

  54. Agreed by MarkusQ · · Score: 1

    Agreed. The main reason that Rails's limitations don't sink it for me is how easy Ruby makes it to extend / modify the base to suit your needs. I didn't like the way ActiveRecord serialized some objects--so I wrote my own serialization in a few dozen lines of code.

    --MarkusQ

  55. Then why does he... by Anonymous Coward · · Score: 0
    Then why does he intentionally make the java code look long and tedious by making the member vars private? He could have simply made those public and the code would have appeared as concise as the Ruby stuff. Is there some kind of access control going on in that Ruby code that I'm unaware of (being that, admittedly, I don't know Ruby) or are there access controls in the language at all?

    Furthermore, he gives Ruby an attaboy for allowing him to define both classes in one file. I'm not sure why that would be terribly important to him, but it can be done rather simply in java too. The rule is one public class per file. There's nothing wrong with multiple package classes in the same file, so if you aren't producing a library for others to use, write your whole darned program in one file if that floats your boat. He could even do multiple public classes by making them inner classes of the named class. But honestly, I don't understand why packing two classes into one file qualifies as a major achievement. Finally, when he gets into the filtering code, I notice a glaring omission; Import statements of some kind. Am I to understand it's back to C style name collisions with Ruby?

    Aside from showing how 'terse' Ruby can be, about the only praise he has for the language is that it is dynamically typed. In other words, you don't need a Java interface to call a method. I can still do that in Java with reflection: java.lang.reflect.Method Strong typing isn't the huge PITA a lot of people try to make it out to be. Casting and RTTI gets old sure. If you're doing a lot of casting and RTTI though, then it's a pretty good sign that you need to refactor your code.

    I'm not trying to pooh pooh Ruby here guys, but this doesn't seem like a very persuasive sermon to convert all the Java programmers of the world. In short, I still fail to see what all the fuss is about.

    1. Re:Then why does he... by tcopeland · · Score: 1

      > I can still do that in Java with reflection:

      Right, you can do everything in Java that you can do it in Ruby; they're both Turing complete. But you're fighting the static typing when you do it in Java - which is why calling a method in Ruby is just foo.send("bar"), and in Java it's 40 lines of method lookup and exception catching.

  56. Another example by Jesus_666 · · Score: 1

    At my university we currently have a software project running. Or rather, it's part of the curriculum that during basic studies every CS student has to do a one-year project, which changes every year. Our assignment is to redesign the IEEE Reengineering Bibliography (how fitting) using Java. The best solution is to be used by the IEEE - no wonder, since the old site was put together by the lecturer responsible for the project (he also maintains it and is responsible for 90% of the entries. It's not a very popular site). Put together rather badly, I might add - the site went live in 1995, wasn't updated design-wise a single time (do you remember what passed as good site design back in 1995? The site barely lives up to that) and on the server side is a horrible hodgepodge of awk, sed, CGI/C++ and Bourne shell scripts. Using CVS to backup the database, which happens to reside in two text files, one being a BibTeX document and the other one apparently in a custom format.

    I'm not saying that awk, sed, the Bourne shell, C++, CVS and BibTeX are bad, but mixing them in a live application creates something vaguely resembling a Rube Goldberg device. Ugh.

    --
    USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
  57. Re:So, what's it like? by ciggieposeur · · Score: 1

    This is the same excuse I have heard for decades when fans of a language try and 'justify' it's lack of performance.

    Java:Ruby :: Pot:Kettle

  58. Talk about coincidendces... by Jesus_666 · · Score: 1

    I just googled for a Haskell implementation in Java. I'm in the development team of an (admittedly comatose) project to create a Java-based game RAD environment (we are (were) aiming for something like the RPG Maker XP, if you happen to know it) and one of the key features is "script in any language you please (as long as it's on the list)". Java interpreters for script languages like Rhino or JRuby would plug into a defined interface and the scripts would be saved with metadata indicating dependencies like the interpreter version. This vening I thought how cool (although mostly impractical) it would be to script a game in Haskell.

    Although, of course, for math-heavy games (economy simulations?) Haskell would suddenly turn into the epitome of elegance. I think that Haskell only really shines when it's used to do stuff that would be expressed as formulae anyway. But it really does shine, then.


    I'm sorry that I can't offer deeper insight into Lisp, but I could make a generic comment about parentheses.

    --
    USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
    1. Re:Talk about coincidendces... by Knights+who+say+'INT · · Score: 1
      Where Haskell does shine is in its generalized algebraic abstract type support. Maths (well, numbers) are one type that's predefined and intuitive to use, and it generates lots of examples of the pretty kind, but import a parser library like Parsec and you have non-"math" examples that take the "formulaic" declarative style to great levels of elegance. Or you can import a Tree library and have it search domains with great beauty and smartness.

      Say we want to verify the Collatz conjecture for a given space of seed numbers. Bruteforcing won't work: if we can't prove that the Collatz sequence converges for a given n, how do we know when to interrupt Collatz(n) and move over to Collatz(n+1)? Behold search over a memoized rose tree in a two-minute hack:
      module traverseCollatz where
       
      import Data.List
      import System
      import Data.Tree
       
      invFunc :: (Integral a) => a -> (a, [a])
      invTreee :: Integer->Tree Integer
      upto_ :: Int->Integer->[Integer]
      upto :: Int->[Integer]
      findCollatz :: Integer->Int->Bool
      minLevelCollatz :: Integer->Int
      minLevelCollatzes :: [Int]
       
      invFunc x = (x, [if (x-1) `mod` 3 == 0 then (x-1) `div` 3 else x, 2*x])
      invTree = unfoldTree invFunc
      upto_ a = concat . take a . levels . invTree
      upto a = upto_ a 1
      findCollatz x a = elem x (upto a)
      minLevelCollatz x = until (findCollatz x) (+1)
      minLevelCollatzes = map minLevelCollatz [1..]
      OTOH, it's generally a bad idea to do numerics in Haskell. At least for the next few years. Even fanatic Haskellers will point you to O'Caml for numerics stuff.

    2. Re:Talk about coincidendces... by arevos · · Score: 1
      I just googled for a Haskell implementation in Java.

      The nearest thing to Haskell in Java that I've heard of is Scala.

  59. Re:So, what's it like? by irc.goatse.cx+troll · · Score: 1

    " A user isn't going to care whether a function takes 1 millisecond or 40 time as long. So long as it is below the barrier at which the inefficiencies become noticable, these inefficiencies don't matter."
    But when ran on a machine already bogged down (say, a K6-2 350mhz like my parents run, with some spyware thrashing resources enough as is, then that becomes the difference between a tollerable 1second and an intollerable 40 seconds.

    Just because it doesn't matter to you doesn't mean it doesnt matter.

    For the record, I do most things in perl, but most of what I do is not desktop apps, its stuff ran on a server where I know if its taking too long or not. Desktop apps are a whole different ballgame. Some would say eclipse is slow but because of how fast modern machines are it doesnt matter. They say the same about azureus. Now try running them both and see what happens to usability. Just because you have the resources doesn't mean you should throw them away.

    --
    Pain lasts, kid. Its how you know you're alive. Sometimes I think this growing up thing is just pain management-TheMaxx
  60. Oh noes! by Jesus_666 · · Score: 1

    As a side note, why is it the people so quickly forget what these languages are really for. They are Rapid Application Development(RAD) and prototyping languages. You're not supposed to ship products developed with these languages! You're supposed to prototype the application and if it looks viable, develop it in a real language like C or C++!

    Someone better tell the Gentoo guys to redo Portage in C++. Obviously the current implementation does not have the performance neccessary for the critical job of zero-latency package management.


    Of course I'm kidding. No one would develop in a language like C++, which was developed for schools in order to make learning real languages like PHP, Visual Prolog or Objective-Befunge easier. ;)

    --
    USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
    1. Re:Oh noes! by octopus72 · · Score: 1

      Funny. C++ is native language with very good performance, while Java and friends are here only because of simplicity of deployment and standard platform.

    2. Re:Oh noes! by Decaff · · Score: 1

      Funny. C++ is native language with very good performance, while Java and friends are here only because of simplicity of deployment and standard platform.

      Java is certainly native language, and has been for years. The only difference is that the compilation is done at run time.

      In some ways Java is MORE native language than C++, as the VM can produce tailored and optimised machine code for the specific processor you are running on, whereas C++ has to be compiled in advance for the processor the developer assumes you are running on. As development moves to 64-bit processors on popular platforms, this can be an enormous advantage.

    3. Re:Oh noes! by Jesus_666 · · Score: 1

      Especially because C++ allows the programmer to write code that breaks when compiled with a different bittage (or using libraries which are) than intended, which is why people running Gentoo on AMD64 usually have to install a second Gentoo compiled for 32-bit in a chroot.


      BTW, GP seems to not have gotten the point of my post. I pointed out that the notion that C++ can do everything better than any other language is silly - things like package management don't need extreme performance and have to work reliably across various platforms; obviously scripting languages like Python are more useful there.

      BTW, Java is portable, well-designed language with very good safety while C++ and friends are here only because of performance.

      --
      USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
    4. Re:Oh noes! by octopus72 · · Score: 1

      OK, but one important point here: you can't afford (time,memory) to let runtime compiler optimize java bytecode as long as you can with C++-like compiler. Besides there's garbage collector, boundary checking, while you don't usually have that with C++ apps. Of course, C++ is dated and for today's standards somewhat poorly designed language(bitness and endinaness problems e.g.). "D" is a nice idea (as logical step forward in that language branch), but I don't think we will ever see it become popular. I'm not bashing Java and similar platforms/languages, they are very nice solution for many areas, but not performance critical applications where every bit of speed is important.

    5. Re:Oh noes! by Decaff · · Score: 1

      OK, but one important point here: you can't afford (time,memory) to let runtime compiler optimize java bytecode as long as you can with C++-like compiler.

      Oh yes you can. The Java Hotspot optimiser starts to work effectively within a few seconds of the application working, and it can run in very little memory - it is available even for Java Micro Edition running in a few 100 KB.

      Besides there's garbage collector, boundary checking, while you don't usually have that with C++ apps.

      Garbage collection can be finely tuned, and run as a background thread that does not significantly affect either performance or time-critical operations. Boundary checking can very often be removed by the run-time code analysis of the Hotspo t optimiser on modern JVMs.

      Without meaning to sound harsh, there seems to be an awful lot of posts in which statements are made about what Java can't do which directly contradict what Java is actually being used for these days.

      I'm not bashing Java and similar platforms/languages, they are very nice solution for many areas, but not performance critical applications where every bit of speed is important.

      Strangely, performance-critical applications is the area where Java is showing a lot of growth currently - real time systems, aeronautics etc. It is becoming a serious alternative to Ada in these areas.

  61. Re:So, what's it like? by Jesus_666 · · Score: 1

    Also, Java is semi-compiled while Ruby is purely interpreted, making it even slower. However, if computers keep getting faster as they have been I doubt that Ruby's performance will be much of an issue in the future.

    --
    USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
  62. Or ocaml. by Some+Random+Username · · Score: 1

    Its on par with C for speed.

  63. Don't forget Tcl by willdye · · Score: 1

    I love Ruby and Python, but in the general discussion of dynamic languages, be sure to mention Tcl. Tcl was heavily supported by Sun, until Sun decided to throw its full weight behind Java. Between Sun, AOL, and several other companies over the years, the language had enough development money poured into it to make it easily in the same league as Python, Perl, Ruby, and even Java. I realize that the topic here is Ruby, but since the general discussion has drifted to dynamic languages in general, Tcl should also be mentioned. If anyone is interested in learning more, I think the best place to start is the Tcl'ers Wiki: http://wiki.tcl.tk

    1. Re:Don't forget Tcl by Anonymous Coward · · Score: 0

      I agree 100% with you. I use Ruby but I've often wondered why TCL isn't mentioned as frequently.

      I think TCL is overlooked far too often. One reason might be the incorrect assumption that TCL/Tk products look rather awful compared to products written in other languages using other GUI toolkits.

      While searching for GUI toolkits with a BSD/MIT license, I came across this and was pleasantly surprised by the screenshots.

      http://tktable.sourceforge.net/tile/

    2. Re:Don't forget Tcl by MemoryDragon · · Score: 1

      Sorry to say that but I once did a project with TCL and it was a joke of a lanugage, on OO, no possibility for namespaces etc... the only merit of it was back then the TK library which made X-Windows interfaces easy to program (but only small ones, as soon as things became more complicated you ran into hell) Given the fact, that it has been some time, and things might have improved enormously, but even back then with Lisp, Smalltalk, Perl, Python and others already in existence, TCL was a joke of a language.

    3. Re:Don't forget Tcl by cflynt · · Score: 1
      I'm afraid it's been quite a while since you used Tcl. The namespace support was added about 7 years ago, and Tcl supports several different flavors of OO ranging from C++ like [incr Tcl] to Ruby-esque XOTcl (Exotical) and the delegation-based (not inheritance based) SNIT (Snit Is Not Incr).

      The Tk GUI rework started in earnest 3 years ago, largely driven by folks who use Tk for the GUI in commercial applications.

      If you were using Tcl/Tk before namespaces, you were probably using it before the better window organizers were added. The grid window manager is much easier to use for complex GUIs than the old pack and place tools were.

      The main problem most developers have with Tk GUIs now is that it's so easy to construct a GUI in Tk that they don't give it the thought that they would if the tools were harder to use. It's so easy to hack out a bad GUI that too few folks take the time to hack out a good one.

      Like the other small languages, Tcl is always evolving, stealing good ideas from Ruby and Perl just as they incorporate good ideas from other languages. If you last looked at Tcl/Tk more than 3 years ago, you haven't looked at Tcl.

  64. athletic programming performance by namekuseijin · · Score: 1

    "No matter how much you may try and justify things, your users don't care about the language you use to develop - they care about performance."

    Then why are you developing in java and its huge memory and cpu costs? To do anything in such limited language, you have to load tons of class libraries, running in the same runtime. By constrast, ruby has many good specialised data types and operators builtin, which do away with many uses for libs, and its libraries are thin wrappers to C compiled stuff running natively...

    "There are alternatives - you can use both Ruby and Java together (JRuby works on the JVM)."

    It sounds stupid to me to build a runtime on top of another runtime, if the goal is performance.

    If your users demand performance above anything else, i suggest you deliver your software without a slow, bulky runtime and have good, experienced programmers who can recognize bottlenecks and fix them, rather than rely on stupid compiler optimizations for things that can't be optimized (i.e: bad algorithms ). Of course, you have all the time in the world in your hands, since performance comes above all...

    --
    I don't feel like it...
    1. Re:athletic programming performance by Decaff · · Score: 1

      By constrast, ruby has many good specialised data types and operators builtin, which do away with many uses for libs, and its libraries are thin wrappers to C compiled stuff running natively...

      Unlike Ruby, Java does not require any C underneath, as it is compiled directly to native code.

      Then why are you developing in java and its huge memory and cpu costs? To do anything in such limited language, you have to load tons of class libraries, running in the same runtime.

      What huge memory and runtime costs? Java can run in just a few hundred KB.

      You don't, of course, have to load tons of class libraries. Unlike many other languages, Java only loads the classes it needs, not the entire library file, as with .SO files and DLLs.

      Next time you start to post about high memory and CPU costs you might want to consider that the fastest growth of Java today is in mobile devices, with their restricted memory and CPU power.

      "There are alternatives - you can use both Ruby and Java together (JRuby works on the JVM)."

      It sounds stupid to me to build a runtime on top of another runtime, if the goal is performance.


      Who said there was a runtime on top of another runtime? It might be an idea to research before you post. Ruby on the JVM uses the JVM as it's runtime - there are no additional layers.

      If your users demand performance above anything else, i suggest you deliver your software without a slow, bulky runtime

      Which is why I don't use a language with a slow bulky runtime. I use modern Java, and (of course) I get very good performance.

      You really need to get up to date.

    2. Re:athletic programming performance by namekuseijin · · Score: 1

      Unlike Ruby, Java does not require any C underneath, as it is compiled directly to native code.

      I don't think you understand: the approach used by scripting languages, like ruby, is to act as glue for already compiled software components. For this mean they have a high-level interface, a mere thin wrapper for native libs. Java libs (bytecodes), by contrast, are loaded into the JVM, then compiled (JIT), and finally run.

      Java can run in just a few hundred KB.

      Can run is not the same as runs. What are you talking about anyway? A stripped-down JVM for embedded devices or a stripped-down HelloWorld.java running in a similar constrained VM with no libs loaded?

      Here in the real world, java apps are some real resource hogs.

      Java only loads the classes it needs, not the entire library file, as with .SO files and DLLs.

      But then, you realize that many java classes are as bulky as a C library. Or, if not, depends on so many other classes, like component classes and others up in the inheritance chain, that end up in the same point as before...

      the fastest growth of Java today is in mobile devices, with their restricted memory and CPU power.

      "Write once, run anywhere"

      How untrue. Your swing app won't run in such environment, neither will you J2EE spaceopera...

      Ruby on the JVM uses the JVM as it's runtime - there are no additional layers.

      Sure, there's a layer: what do you think will be translating ruby's syntax and operational semantics into the JVM's? So, call it a runtime or otherwise, there's still one more step in the way: that sounds like a performance penalty to me...

      You really need to get up to date.

      and you should know it better

      --
      I don't feel like it...
    3. Re:athletic programming performance by Decaff · · Score: 1

      I don't think you understand: the approach used by scripting languages, like ruby, is to act as glue for already compiled software components. For this mean they have a high-level interface, a mere thin wrapper for native libs. Java libs (bytecodes), by contrast, are loaded into the JVM, then compiled (JIT), and finally run.

      I don't think you understand. We are talking about language performance here, not what languages are used for. Whether or not a language is used as a wrapper is irrelevant. You show little understanding of how modern Java works - it is not JITed in the way you indicate - there is no 'finally' run (I assume by 'finally' you are implying some sort of delay).

      Sure, there's a layer: what do you think will be translating ruby's syntax and operational semantics into the JVM's?

      But the code that does that is hotspot optimised to native code, so there is no difference from C.

      Can run is not the same as runs.

      Tell that to the millions who use Java games on mobile devices each day.

      What are you talking about anyway? A stripped-down JVM for embedded devices or a stripped-down HelloWorld.java running in a similar constrained VM with no libs loaded?

      No. Reasonably full-featured VMs that have things like Gaming 3D libraries.

      How untrue. Your swing app won't run in such environment, neither will you J2EE spaceopera...

      So what? Your Ruby TK app won't run in that either, and neither will your PHP Zope application.

      Here in the real world, java apps are some real resource hogs.

      There are resource hogs in all languages. Java is in no way special. Even Swing Apps can run in a few MB.

    4. Re:athletic programming performance by namekuseijin · · Score: 1

      "You show little understanding of how modern Java works - it is not JITed in the way you indicate - there is no 'finally' run (I assume by 'finally' you are implying some sort of delay)."

      yes, there's a delay while it's being JITted. that's what JIT means: just-in-time compilation. in other words: just in time for a run.

      "hotspot optimised to native code, so there is no difference from C."

      except while it's being "hotspot optimised" and analyzed for bottlenecks, which is, frequently... and which involves more memory and cpu cycles than just mere native code.

      "Tell that to the millions who use Java games on mobile devices each day."

      "java games" are using specific chips for graphics and sound and perhaps a thin java wrapper lib for some low-level device API. The logic behind the game is what probably deserves the java mention. And the logic behind most games is pretty lame and basic, specially mobile device games...

      "Reasonably full-featured VMs that have things like Gaming 3D libraries."

      Like I said, java wrappers for low-level native stuff...

      "Your Ruby TK app won't run in that either, and neither will your PHP Zope application."

      they don't sell that stupid slogan

      "There are resource hogs in all languages. Java is in no way special."

      so there we have it.

      --
      I don't feel like it...
    5. Re:athletic programming performance by Decaff · · Score: 1

      yes, there's a delay while it's being JITted. that's what JIT means: just-in-time compilation. in other words: just in time for a run.

      No, because Java isn't Jitted anymore, and hasn't been for years. Java starts up as a high-performance interpreter (like Ruby, PERL etc.), then is compiled to native code in the background. There is no 'just in time', because there is no 'in time' - it is later.

      "java games" are using specific chips for graphics and sound and perhaps a thin java wrapper lib for some low-level device API.

      No they aren't. It doesn't work like this at all. Java games can certainly use hardware acceleration where it is present, but they don't have to - all of the 3D stuff can be done in pure Java.

      Like I said, java wrappers for low-level native stuff...

      And you were wrong.

      "There are resource hogs in all languages. Java is in no way special."

      so there we have it.


      No. All this means is that resource-hogging programs can be written in Java, as in any language. There is nothing specifically resource hogging about Java itself.

    6. Re:athletic programming performance by namekuseijin · · Score: 1

      "Java starts up as a high-performance interpreter (like Ruby, PERL etc.),"

      thanks for the acknowledgement

      " then is compiled to native code in the background"

      "in the background" still means "in time": it's compiled just before it can run, and then the "hotspot" analyzer goes on looking for spots that can be optimized. It's a runtime, occupying memory and cpu cycles and no matter how many optimizations it does, the generated code still doesn't run at C/C++/OCaml levels...

      hey, i'm kinda tired. are you?

      --
      I don't feel like it...
    7. Re:athletic programming performance by Decaff · · Score: 1

      "Java starts up as a high-performance interpreter (like Ruby, PERL etc.),"

      thanks for the acknowledgement


      But even within a few seconds, it gets much faster.

      "in the background" still means "in time": it's compiled just before it can run, and then the "hotspot" analyzer goes on looking for spots that can be optimized. It's a runtime, occupying memory and cpu cycles and no matter how many optimizations it does, the generated code still doesn't run at C/C++/OCaml levels...

      It occupies some memory and CPU cycles, but not much. Hotspot optimisers run fine even in restricted memory and CPU situations like J2ME.

      And, no matter how many times you repeat it, saying that 'the generated code still doesn't run at C/C++.. levels' is simply factually wrong.

      Once the Hotspot optimiser has done it's work you are left with very highly tuned machine code that is as good as anything that is churned out by a pre-compiler. Loop unrolling is performed where necessary, variable and constant re-organistion, aggressive in-lining of function, and removal of bounds checking is just the start. There is also native machine code re-ordering to optimise pipeline use, and also the use of additional features on specific processors (such as MMX).

      This is exactly what pre-compilers do. You get the same performance. In fact, you can get better as the code is regularly (but in a low-priority background thread that does not impair performance) re-profiled so that optimisations can be changed and refined.

      If you wish to insist that Java is slower, you are going to have to explain how all these optimisations actually make code slower, when they have for decades been used to give high performance. The only difference with Java is that this aggressive optimisation takes place mostly during a short period after the application starts.

      Actually, I have simplified things. There are options on modern JVMs to control the balance between startup performance and optimising. The '-client' switch (on by default) says 'start up fast and concentrate on optimising later'. This means that, although the program is pretty fast, heavy optimisation may not happen for a while. The '-server' switch is designed for non-GUI apps. It says 'take a bit longer starting up and turn on full optimisation in the background immediately'.

      It is the use of the '-server' switch that allows Java to easily match the output of most C or C++ compilers in most benchmarks providing code runs for more than a few seconds.

      hey, i'm kinda tired. are you?

      Not at all! I'm just getting started....

    8. Re:athletic programming performance by namekuseijin · · Score: 1

      "But even within a few seconds, it gets much faster."

      a few seconds?! even SWTed Eclipse begs to disagree. Many very useful perl batch scripts are done while most Java apps are still loading!

      Yes, eventually it gets a bit faster, but at any one time it needs to load another class or the like, it boggles down with some stuttering...

      "Hotspot optimisers run fine even in restricted memory and CPU situations like J2ME."

      Which run thoughroughly simplified GUIs and the like. Let's focus on real everyday stuff running on current desktop systems, ok?

      "saying that 'the generated code still doesn't run at C/C++.. levels' is simply factually wrong."

      You can take a look here and compare for yourself:
      http://shootout.alioth.debian.org/

      It's just a run against simple algorithms, no libraries involved whatsoever except simple stream IO. So, it doesn't show everyday performance, but even then, even simple algorithms on java don't run as nicely as in C/C++/OCaml...

      "Once the Hotspot optimiser has done it's work..."

      and when is that exactly? AFAIK, it's always doing its job, trying to optimize even more. And, sure, there are other things involved to make it slower past the runtime: Garbage Collection, for instance.

      "This is exactly what pre-compilers do."

      they do it *before* compilation and certainly *before* running the code, not while loading it...

      "(but in a low-priority background thread that does not impair performance)"

      every running code incurs some performance penalty.

      "If you wish to insist that Java is slower, you are going to have to explain how all these optimisations actually make code slower,"

      " when they have for decades been used to give high performance."

      decades?! Java itself is barely 2 decades old, JITting is a pretty newer technique and the "Hotspot" compiler has just came out a few years ago. I think you making things up in order to give your arguments some substance they lack...

      "The only difference with Java is that this aggressive optimisation takes place mostly during a short period after the application starts."

      The compilation time, the library loading times, the Garbage Collector thread cycles, some eventual runtime introspection techniques... the actual scenario is a lot worse than what you paint it to be.

      "The '-client' switch (on by default) says 'start up fast and concentrate on optimising later'. This means that, although the program is pretty fast, heavy optimisation may not happen for a while."

      Which also means the optimizer is up and running and consuming memory and cpu cycles.

      "It is the use of the '-server' switch that allows Java to easily match the output of most C or C++ compilers in most benchmarks providing code runs for more than a few seconds."

      hmm, perhaps this influenced the java benchmarks above? i don't know.

      "I'm just getting started...."

      well, then i guess this will likely be the longest running _dialogue_ *nobody* in slashdot has ever witnessed... :)

      --
      I don't feel like it...
    9. Re:athletic programming performance by Decaff · · Score: 1

      a few seconds?! even SWTed Eclipse begs to disagree. Many very useful perl batch scripts are done while most Java apps are still loading!

      This is true. Java is not an appropriate language for for small apps that only take a few seconds (or milliseconds) to run. However, there are other performance issues with eclipse - SWT is not the fastest of systems.

      Which run thoughroughly simplified GUIs and the like. Let's focus on real everyday stuff running on current desktop systems, ok?

      This is irrelevant. The point was to show that Hotspot is not a CPU or memory hog. As for 'simplified GUIs', these platforms aren't simple at all - they have 3D drawing APIs, some of which are implemented in pure Java.

      You can take a look here and compare for yourself:
      http://shootout.alioth.debian.org/


      Which I have seen, and is missing the point. As I have already discussed, the optimisation in Java takes some seconds to kick in. Most of what you are dealing with in these benchmarks is the startup time of the JVM. This is like comparing the performance of two different operating systems but neglecting to exclude the boot times.

      In a recent Slashdot thread I showed that if you ran benchmarks like this for 5, 25, or 100x longer then Java easily caught up with C in most cases.

      Here are some benchmarks that run longer and illustrate what I mean:
      http://www.shudo.net/jit/perf/

      decades?! Java itself is barely 2 decades old, JITting is a pretty newer technique and the "Hotspot" compiler has just came out a few years ago. I think you making things up in order to give your arguments some substance they lack...

      No, you are misinterpreting me. I am not saying that Hotspot has been around for decades, I am saying that the optimisations it uses have.

      The compilation time, the library loading times, the Garbage Collector thread cycles, some eventual runtime introspection techniques... the actual scenario is a lot worse than what you paint it to be.

      You simply can't say this without evidence. Repeating that this 'must' impact performance is meaningless unless you can show that it actually does. I have already stated that the compilation time can be over with quickly, and the fact that Java can be used for high-performance real-time applications shows that garbage collection does not have an impact. After all, there are now modern garbage collectors that can be used with C and C++ - they usually have little impact when used in place of 'manual' memory handling, so which should things be any worse for Java?

      Which also means the optimizer is up and running and consuming memory and cpu cycles.

      Only 'every now and then', and as I have already discussed, the optimiser runs fine and with little impact on performance even in low memory and slow CPU systems.

      "It is the use of the '-server' switch that allows Java to easily match the output of most C or C++ compilers in most benchmarks providing code runs for more than a few seconds."

      hmm, perhaps this influenced the java benchmarks above? i don't know.


      Absolutely. If those benchmarks were run for 10 or 100 times longer, I suspect the results would be very different. When I have tried one or two of them, they certainly have been.

      well, then i guess this will likely be the longest running _dialogue_ *nobody* in slashdot has ever witnessed... :)

      No - because I always beat opponents in the end - through boredom if nothing else!

    10. Re:athletic programming performance by Decaff · · Score: 1

      You can take a look here and compare for yourself:
      http://shootout.alioth.debian.org/


      Further to my previous post - I just didn't believe some of these benchmarks, so I tried them myself. I tried 'nbody', as I have a particular interest in maths:

      I compiled the gcc and g++ code with exactly the same optimisations a specified, and I used both -client and -server switches with Java - the lastest Java 1.5.

      Here are the results:

      1000000 loops
      gcc 0.9 seconds
      g++ 1.1 seconds
      java -client 1.3 seconds
      java -server 1.1 seconds

      5000000 loops
      gcc 4.3 seconds
      g++ 5.2 seconds
      java -client 6.1 seconds
      java -server 4.0 seconds

      10000000 loops
      gcc 8.6 seconds
      g++ 10.4 seconds
      java -client 11.4 seconds
      java -server 7.6 seconds

      Interesting, isn't it? When given enough time to optimise, java -server is even beating raw C.

      Mind you, this is a bad general benchmark (most benchmarks are!), but it impresses me. Why don't you try it? The code is simple and easy to run.

      I think I am going to re-run more of these benchmarks, and for a longer time - this should make an interesting report.

    11. Re:athletic programming performance by namekuseijin · · Score: 1

      "SWT is not the fastest of systems."

      then i suppose Swing is?

      "This is irrelevant."

      how come?! sure is not!

      "The point was to show that Hotspot is not a CPU or memory hog. As for 'simplified GUIs', these platforms aren't simple at all..."

      The screen is of limited size and resolution. Specially size: menu items are big and bright, there are far fewer widgets on screen at any one time than on a regular 1024 x 768 NVidia-powered desktop system. It certainly makes up for smaller cpu and memory requirements.

      "This is like comparing the performance of two different operating systems but neglecting to exclude the boot times."

      ok, i'll give you the benefit of doubt, mister...

      "I am not saying that Hotspot has been around for decades, I am saying that the optimisations it uses have."

      never heard of them. Had them be around for so long, surely some languages may have used them before java? What was there before java that could use it? Not C++, for sure, since it uses ahead-of-time, the normal way to compile. Smalltalk was dynamically typed, so i'm not sure compilation would do it any good. I heard Self used many techniques that were later incorpored into Hotspot. But Self is not that much older than Java...

      "You simply can't say this without evidence."

      Oh, you want some evidence, huh? Just load any Swing based or SWT based java application and wait for it to be any usable. And then, take a look at its memory requirements.

      Any other "java powered" technologies i know also run like slimes: Lotus Notes, Oracle Process Admin...

      "I have already stated that the compilation time can be over with quickly"

      Quickly?! For hello_world.java and qsort.java perhaps. For large real world apps load several thousand classes and the like, it takes well about one minute or so to be done...

      "there are now modern garbage collectors that can be used with C and C++ - they usually have little impact when used in place of 'manual' memory handling"

      but somehow, people seem to not be using it a lot, huh?

      "so which should things be any worse for Java?"

      because it has an associated runtime which has to take care of such things as introspection among others...

      "No - because I always beat opponents in the end - through boredom if nothing else!"

      i'm starting to agree. perhaps you should live by your name and cut the java... :))

      --
      I don't feel like it...
    12. Re:athletic programming performance by Decaff · · Score: 1

      then i suppose Swing is?

      Actually, yes - if you look at it's performance metrics under Linux it is faster than SWT. It can use DirectX and OpenGL acceleration on various platforms.

      ok, i'll give you the benefit of doubt, mister...

      Don't :) - try it for youself! Take some of the programs shown in that benchmark, and run them for 10, 50 or 100x longer. You will almost always find that the ratio of performance java:C changes dramatically as time goes on.

      never heard of them. Had them be around for so long, surely some languages may have used them before java? What was there before java that could use it?

      The standard optimisations used by other languages. I have already mentioned them - loop unrolling, variable re-arrangement, inlining etc. Hostpot uses these (amongst others). I think you are misunderstanding me. I am not saying that Hotspot is doing anything special, all I am saying is that because it does the same sort of profiling and optimising as other languages have done for decades, then you are going to (and do) get high-quality code from it. Hotspot does for Java code what a high-performance C++ compiler does for C++ code - but just at run time.

      I heard Self used many techniques that were later incorpored into Hotspot. But Self is not that much older than Java...

      No, but self was and IS very fast, and it's optimisation techniques were included in Java (as HotSpot).

      Quickly?! For hello_world.java and qsort.java perhaps. For large real world apps load several thousand classes and the like, it takes well about one minute or so to be done...

      Actually, no. Such a large real-world app is Tomcat - it has tens of thousands of classes, but starts up in less than a minute, and has been shown (with version 5.5) to server most pages at a performance close to that of Apache.

      Why not try it and and see?

      Anyway, I think you are misunderstanding me again. Just because a program has thousands of classes does not mean that all these classes are compiled. This was a fault with older Java VMs and the 'traditional' JIT technique - you had to wait for all classes to be compiled - this gave rise to bad delays on start-up. With Hotspot, you don't wait. Instead what happens is that only the bits of code that give rise to poor performance get compiled and very highly optimised. In some programs this may be the majority of code. In others, it may be very little. Because there may be very little, this can be done very effectively and quickly.

      but somehow, people seem to not be using it a lot, huh?

      Yes, because there is (and I am sure, always will be) a persistent attitude amongst many C/C++ developers that everything has to be done by hand - that automatic memory management is somehow less effective, in spite of years of evidence from other languages that it isn't.

      because it has an associated runtime which has to take care of such things as introspection among others...

      Garbage collection has nothing to do with introspection. Introspection is a specific set of user libraries that allows user code to look at it's own methods and classes. Different Java implementations use different well-established garbarge collection techniques, that have been around for years.

      i'm starting to agree.

      Ouch!

      If I may be acid in return - surely the most boring thing is to keep repeating old 'myths' about Java performance?
      (sorry)

      perhaps you should live by your name and cut the java... :))

      Hey - I said being working was a winning strategy :)

    13. Re:athletic programming performance by namekuseijin · · Score: 1

      "if you look at it's performance metrics under Linux it is faster than SWT."

      oh, man! well, at least here is a 'myth' about java performance that isn't that old and that can be verified by hand, or should i say, eyes?...

      "the ratio of performance java:C changes dramatically as time goes on."

      somehow, i doubt the ratio will be that agressive once we walk away from simple algorithms to programs consisting of thousands of classes...

      "The standard optimisations used by other languages."

      ah, ok... thought it was something magical to do with JITting...

      "Hotspot does for Java code what a high-performance C++ compiler does for C++ code - but just at run time."

      well, it's exactly that "just at run time" part that is kinda silly...

      "has been shown (with version 5.5) to server most pages at a performance close to that of Apache." ...close to that of Apache running mod_php, mod_python and others... ;)

      "Just because a program has thousands of classes does not mean that all these classes are compiled."

      that even worse: they're compiled just short of being called!

      "With Hotspot, you don't wait."

      with GCC better yet: they're compiled way before any use...

      "In others, it may be very little. Because there may be very little, this can be done very effectively and quickly."

      but when you have thousands of these...

      "Garbage collection has nothing to do with introspection."

      i know. i was citing two reasons among others...

      "Introspection is a specific set of user libraries that allows user code to look at it's own methods and classes."

      yes, it's used heavily in certain applications. Hybernate, for instance. As a proponent of dynamically typed languages like myself, i like that java has a way to do it -- though a stupid and verbose one. But fact is: it slows down things a lot, because is all done at runtime...

      "surely the most boring thing is to keep repeating old 'myths' about Java performance?"

      i'm sure the swing vs swt 'myth' is pretty new. :)

      ok, i think i'll finally take a break for the holidays... how about it? :)

      --
      I don't feel like it...
    14. Re:athletic programming performance by Decaff · · Score: 1

      oh, man! well, at least here is a 'myth' about java performance that isn't that old and that can be verified by hand, or should i say, eyes?...

      Why not try it? I was a very strong critic of Swing years ago, but it really is fast on Java 1.5. I use NetBeans on Linux and Windows, and find no speed problems at all.

      "the ratio of performance java:C changes dramatically as time goes on."

      somehow, i doubt the ratio will be that agressive once we walk away from simple algorithms to programs consisting of thousands of classes...


      Why not? There is no reason why it should not. It is the same process - agressively optimising slow code. Why should the volume of code matter at all?

      yes, it's used heavily in certain applications. Hybernate, for instance. As a proponent of dynamically typed languages like myself, i like that java has a way to do it -- though a stupid and verbose one. But fact is: it slows down things a lot, because is all done at runtime...

      You insist on repeating this, but without evidence. If you actually have a look at how things are done, you will see that introspection performance improved dramatically between Java 1.3 and 1.4. So it simply does not slow things down.

      close to that of Apache running mod_php, mod_python and others... ;)

      No - close to 'raw' apache serving web pages and images.

      that even worse: they're compiled just short of being called!

      As I keep repeating - things don't work like this.

      well, it's exactly that "just at run time" part that is kinda silly...

      No it isn't, because it means (1) the developer need only ship one binary (not source code) for dozens of platforms and (2) there are good theoretical reasons why run-time profiling and compiling could soon exceed the speed of pre-compiling.

      After all, it is optimising what actually happens, and not what is predicted to happen.

      i'm sure the swing vs swt 'myth' is pretty new. :)

      It is not a myth. Obviously, an OpenGL/DirectX accelerated GUI (Swing) is going to be faster than one that isn't (SWT).

      ok, i think i'll finally take a break for the holidays... how about it? :)

      Fine - have a good break!

      All I would say is - don't believe a word I say! Try it for yourself - look at start-up times, and the speed of large Java applications like NetBeans and Tomcat. Don't stick with the myths about Java performance put forward by those who for whatever reason don't like the language. There are many reasons to dislike Java, but speed is not one of them.

    15. Re:athletic programming performance by namekuseijin · · Score: 1

      "I think I am going to re-run more of these benchmarks, and for a longer time - this should make an interesting report."

      I don't think that's necessary. It's pretty evident that, given enough time, yes, seems like java's optimizations and Hotspot correct identification of bottlenecks and targetting the current cpu architecture really pay off.

      I just said before, though: in real software projects -- not small, simple algorithms with a constant flow -- there's no time, nor enough memory, for doing nice runtime optimizations or bottleneck analysis in such huge codebase...

      --
      I don't feel like it...
    16. Re:athletic programming performance by Decaff · · Score: 1

      I just said before, though: in real software projects -- not small, simple algorithms with a constant flow -- there's no time, nor enough memory, for doing nice runtime optimizations or bottleneck analysis in such huge codebase...

      That simply isn't the case. Java is being used for real large projects and works well. The point is that Hotspot doesn't care about the side of the codebase, it works on what is actually being run at the time. Hotspot works best on these larger projects, as that is what it was designed for, in contrast to the far slower JIT process, which can cause significant delays.

      Let me give an example: An application running on the Tomcat web server involves a huge codebase, yet on Tomcat 5.5, application can serve web pages and even images at close to the performance of the latest Apache.

    17. Re:athletic programming performance by namekuseijin · · Score: 1

      "Why not try it?"

      why do you think i didn't already? i'm not talking out of my ass, that's for sure...

      "I was a very strong critic of Swing years ago, but it really is fast on Java 1.5."

      Well, that's nice to know. It's been known to be a hog and it was exactly because of that that SWT came to be.

      "I use NetBeans on Linux and Windows, and find no speed problems at all."

      Just a few versions ago, Netbeans and Swing run terribly in the face of Eclipse...

      "Why should the volume of code matter at all?"

      Because it's done at _runtime_! Some gcc compiles are pretty fast -- like hello.c or qsort.c. Some are knightmarish slow -- like a GNOME build. And it's done way before running the resulting code! I wonder how badly slow Gnome would be if written in java...

      "So it simply does not slow things down."

      sure you're not suggesting that a programmable runtime search for a class methods and attributes, or building of new methods or classes is as fast as statically doing them, right?

      "close to 'raw' apache serving web pages and images."

      I don't buy it. I see the servlets running on Tomcat at work and the regular Apache pages in the intranet. There's a difference alright.

      "there are good theoretical reasons why run-time profiling and compiling could soon exceed the speed of pre-compiling."

      Theory guys are know for disregarding the effects of real world phenomena upon their formulas, like completely "forgetting" that, while the optimizations are all fine and dandy by themselves, they are done during *runtime*.

      Simply disregarding the time and memory taken by the Hotspot compiler to do that -- at any time its analysis shows a bottleneck -- is not to be taken seriously. It only gets worse at large codebases.

      "After all, it is optimising what actually happens, and not what is predicted to happen."

      very funny. Here's a similar situation: the developer compiles a build and puts it into production. As users begin to put the software under a lot of stress, the developer tracks down a lot of bottlenecks and goes back to the whiteboard. He does his little coding tricks and hand optimizations and says to the user: "Excuse me for a moment", while stopping the user's own business, taking a snapshot of what he's doing, substituting the running code for the newer and optimized code, and then resuming the user from the snapshot.

      "Obviously, an OpenGL/DirectX accelerated GUI (Swing) is going to be faster than one that isn't (SWT)."

      Well, good to hear that Swing finally got a clue after the heavy beating by SWT. It was slow like a slime in its quest for a java purity ideal and now finally got some decent performance thanks for some native code backends. Of course, nothing impedes SWT of doing the same...

      "All I would say is - don't believe a word I say!"

      No problem: I don't! :)

      "There are many reasons to dislike Java, but speed is not one of them."

      yeah, perhaps runtime performance has got a lot better. Only thing lacking is a good language to tap such a nice platform. Oh, wait! There's always Jython... :)

      And a happy new year...

      --
      I don't feel like it...
    18. Re:athletic programming performance by namekuseijin · · Score: 1

      "Java is being used for real large projects and works well."

      Yes, it works well. Or, adequately. Just not as great as a simple algorithm looped well over 6000 times...

      "The point is that Hotspot doesn't care about the side of the codebase, it works on what is actually being run at the time."

      at the time. It means, whenever a new chunk of code is to be executed ( and there are many in a huge codebase ), the user experiences that nice stuttering feeling...

      --
      I don't feel like it...
    19. Re:athletic programming performance by Decaff · · Score: 1

      Yes, it works well. Or, adequately. Just not as great as a simple algorithm looped well over 6000 times...

      No - it works at C speed. The optimisation processes it used on code hotspots is exactly the same no matter what the code size. As there is no 'Just in Time' compiling of classes as they are loaded, there is no delay in executing them.

      at the time. It means, whenever a new chunk of code is to be executed ( and there are many in a huge codebase ), the user experiences that nice stuttering feeling...

      No.

      Java is no longer a JIT compiler. It is a hotspot system. The code starts up immediately with no delay under a fast java bytecode interpreter (Those who say 'ruby or perl is fast enough for most purposes' can't criticise Java), and then the hotspot optimiser kicks in as a background thread (so as not to impact performance) and the code starts to accelerate. As time-critical sections are optimised to C speeds.

      There are no delays. There is no 'stuttering'.

      I really don't know why this myth about slow speed and 'stuttering' persists. Java is now being used for real-time control in applications such as aeronautics (Boeing demonstrated a small drone flying entirely under the control of Java software last year).

      Do you really think that major aircraft and car companies would be using Java if there was 'stuttering'?

  65. Re:So, what's it like? by Nataku564 · · Score: 1

    True, although thats only on startup. Once its parsed the whole program its all binary anyway.

  66. Python loop array by Anonymous Coward · · Score: 0

    In Python, to loop through an array:

    for item in array
            print item

    Can Ruby do this in 2 lines?

    1. Re:Python loop array by Anonymous Coward · · Score: 0

      LOL, it's one:

      array.each { |item| puts item }

      HIBT? Hm.

    2. Re:Python loop array by binary+paladin · · Score: 2, Informative

      Actually in an array (it doesn't work so well in a hash) you can just do this:

      puts array

      That's it.

    3. Re:Python loop array by aurb · · Score: 2, Funny

      Well in Python you can just do

      print array

      Oh, wait, that's 1 character more. That's it, I'm switching to Ruby.

  67. Is Ruby desperate ? by what+about · · Score: 4, Interesting

    Given the number of posts in java.net and slashdot on how Ruby is the greatest thing of all (and no mention at all of any negative side) I start wondering why is Ruby desperate to move Java programmers from Java to Ruby

    Personally I do not trust a language that has no negatives sides (or at least the Ruby people seems to think so), until it becomes clear what is the other side of Ruby I am not going to use it.

    (Yes, I have visited the Ruby website)

    1. Re:Is Ruby desperate ? by Anonymous Coward · · Score: 1, Interesting

      I don't know any Ruby user that thinks the language has no negatives. Most of them simply think the positives outweigh the negatives compared to other choices.

      Ruby provides massive increase in developer productivity by sacrificing execution speed. That is the benefit and primary cost of using Ruby.

      Think of it this way (unscientific, numbers merely illustrate my point):

      A. Assembly, 5 coders, 24 months. Product needs 2 x 1Ghz Xeons x 0.5GB RAM
      B. Java, 4 coders, 12 months. Product needs 6 x 1.5Ghz Xeons x 1.5 GB RAM.
      C. Ruby, 2 coders, 3 months. Product needs 6 x 2.5Ghz Xeons x 2 GB RAM.

      Cost of extra hardware required by Ruby is pennies for every dollar saved in development cost. It is also easier to maintain because when you revisit code a year later, you have to wade thru substantially fewer lines of code to remember what you were doing.

      This is the business benefit of Ruby. But the primary reason many veteran coders use Ruby is because they find themselves suddently enjoying programming again after growing unhappy with a dozen other languages they've used during their careers.

      The cost of Ruby is execution speed which is pennies for each dollar gained by developer productivity, etc.

      One area in which Ruby should massively improve is its release process. I wish they would assign a release manager and do it more formally--like FreeBSD or Debian or Ubuntu.

    2. Re:Is Ruby desperate ? by Anonymous Coward · · Score: 0

      I don't think anybody is saying Ruby is the be-all and end-all; of course it has negatives.

      Firstly, it's interpreted. All the inferencing and reflection stuff has to have a run-time cost (or at least this is what I assume!) far greater than a strongly/statically typed compiled language.

      Secondly, it's a very dynamic language - it's harder to predict what your code is actually going to do, and how it will actually perform. There may be time-bombs in your code you don't know about, that could otherwise have been picked up in a more strongly-typed compiled language which you won't hit until that particular code path actually gets executed one day.

      A mitigating factor for this negative is the encouragement (and dead easy) unit testing.

      It's a bit like the old C++ vs Java debate: well engineered, highly tuned C++ is always going to kick the crap out of a Java implementation, but it's far easier to get acceptable results out of Java with moderate effort than out of C++. Indeed, good Java code can perform just as well as good C++ code (and the hiring costs are lower!).

      Ruby's a bit the same way: a highly tuned, well-engineered Java app will probably scale and perform much better than a Ruby implementation... it's all about using the right tool for the job.

      Ruby doesn't seem to have a reputation yet in the high-end enterprise stuff with apps that have zillions of LOC. Perhaps there are serious brick-wall performance issues if you threw Ruby at some of those very large scale problems, but I don't know...

      NB: I'm a beginner in both Java and Ruby - embedded ISO C/Handel-C/ASM with a bit of Perl thrown in is what I would call my "home" :-)

    3. Re:Is Ruby desperate ? by Decaff · · Score: 1

      Think of it this way (unscientific, numbers merely illustrate my point):

      It is totally unrealistic to think that the coding speed in a language is generally a major factor in the time for completion of any significant project. There are many, many more factors - designs, testing, feedback from users. If you are doing extensive testing of complex code, then the speed of a language can be pretty important in time-to-market.

      Cost of extra hardware required by Ruby is pennies for every dollar saved in development cost.

      I disagree. It depends entirely on the deployment situation. Having to potentially upgrade client workstations because someone has chosen an inefficient language for development is unacceptable.

      It is also easier to maintain because when you revisit code a year later, you have to wade thru substantially fewer lines of code to remember what you were doing.

      This is not always the case. Sometimes more lines of code can be more explicit about what is going on, so makes code easier to revisit. For example, it is well established that some apparently useful abbreviations (such as operator overloading) can potentially lead to serious problems understanding code later.

  68. Errata by lahi · · Score: 1

    Ah. The joys of previewing and still missing silly mistakes. And although English isn't my native language, I don't think that counts for much of an excuse.

    "where often teased with": read "were often teased about". Or something like that anyway.

    -Lasse

  69. Re:So, what's it like? by lahi · · Score: 1

    Good example; and in this case I would use code generation. I almost never write getters or setters in Java - my IDE does it (and then manages them) for me. If I look at the class properties in NetBeans, I only see the variables ('bean properties') - the code is all hidden and managed for me.

    I suppose that is becoming common. However, I would argue that you are then not actually programming in Java. You are programming in a variant language, which happens to be close to Java, and which generates Java. I'm not saying that is a bad thing, on the contrary. It also has a strong precedent, for instance using yacc generated parsers with C. I can think of two negative things to say about it, though:

    1. The language you use is probably not portable beyond the IDE, by definition. If I were to edit your code in vi or emacs, I would not be able to use your language. At the end of the day, it's just a hack to circumvent Java's (and Java beans') design flaws.

    2. The language you use can be viewed as a kind of domain-specific language. However it does not go all the way, and you are confined to whatever the IDE-makers decide to give you, unless you modify the IDE yourself. Of course that is the original SmallTalk toolbox idea, illustrated in the Taj Mahal cartoon in the August 1981 issue of Byte Magazine, and with open-source IDEs like NetBeans and Eclipse it becomes a possibility. (Of course some lisp weenies will tell us that they have been doing exactly that since forever, or at least since lisp was invented. But I don't lisp, although I am known to st-st-stutter sometimes.)

    -Lasse

  70. Re:So, what's it like? by Jesus_666 · · Score: 1

    Still, the loading time can be annoying. It is when you're working with many small scripts. At least Ruby isn't as bad as PHP, which I currently use as a shell scripting language (and which suffers from a hearty delay between the issuing of the command and the starting of the script).

    --
    USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
  71. Re:So, what's it like? by Decaff · · Score: 1

    I suppose that is becoming common. However, I would argue that you are then not actually programming in Java. You are programming in a variant language, which happens to be close to Java, and which generates Java.

    This is good point, but it is wrong and in a way which I think is interesting. It used to be that code generation and manipulation in Java was indeed done in ways which required non-standard and editor-specific code. An example is GUI development, where special markup (usually embedded in Java comments) would be recognised by a specific IDE and would be useless in any other.

    Things are mostly different now. Properties of Java classes such as getters and setters can be automatically handled by any modern IDE, and you can also manually edit them in, say, VI, without losing the ability to automatically process them. Code altered by one IDE is usable by any other. The same things works for persistence (EJB 3.0) - the information about code is stored in standard portable ways in Java code (annotations) that can be both hand-edited and are recognisable and changeable by any IDE.

    2. The language you use can be viewed as a kind of domain-specific language. However it does not go all the way, and you are confined to whatever the IDE-makers decide to give you, unless you modify the IDE yourself.

    So, as I explained above, Java has evolved (especially with the addition of annotations in Java 5.0) so this is usually not the case.

  72. Re:So, what's it like? by master_p · · Score: 1

    If I have a web app with thousands of clients, wouldn't I need performance? Some apps need performance, some don't. The process of a language maturing takes years, and speed of development is the most important criterion, but performance shouldn't be ignored.

  73. Re:So, what's it like? by ultranova · · Score: 1

    Performance matters up to a point, but it's important to realise that there is a point where it ceases to matter. Where this point is depends on your application. A user isn't going to care whether a function takes 1 millisecond or 40 time as long. So long as it is below the barrier at which the inefficiencies become noticable, these inefficiencies don't matter.

    Unless the user is letting the instant messenger run in the background while he does something else. Multitasking means that the IM program can't just assume that it has the machine all for itself, since the chances are that it doesn't.

    The user might not notice if a function takes 40 milliseconds instead of 1 millisecond when that's the only program running - but if he will most certainly notice if he has 10 background applications doing this while he's trying to do 3D modelling in the foreground. Now, replace CPU power with memory, and consider the difference between 10 applications taking a megabyte each, and 10 applications taking 40MB each ;).

    If anything, the latest 3D game might get away with worse performance problems than IM applications, since no one runs multiple 3D games in parallel, people expect anything but newest machines to choke on new games, and the furious competition between processor and 3D manufacturers ensures that pretty much anything will run acceptably after a while.

    People expect games to take lots of horsepower. On the other hand, no one expects an IM application to take a 100MB of memory and 100% of 1GHz Athlon...

    Someone mentioned a Quake engine reimplementation made with Java; I quess I'll go look it up and test it.

    --

    Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

  74. Re:So, what's it like? by minniger · · Score: 1

    Sit down and actually USE any of the following:

    JBuilder (for Swing apps), eclipse, netbeans, intelliJ, etc.,etc. etc....

    They all have built in refactoring and code generation utils that do NOT mark up the source in any unusual way. ( The main exception is the UI tools. Most have /*** do not edit **/ blocks and such. Except for jbuilder. It rouddtrips swing. ) For example... you add your object attributes and then rightmouse -> refactor -> 'generate accessor methods'. And blink... you have properly formatted, commented, and scoped getters and setters. Need to change the name of your attribute? Just rightmouse -> refactor -> rename. Change it's name and the accessor methods are changed and all uses of them in your code are changed. Refactor a class name? Same deal.

    Now of course this is a feature of the IDE and could/should be applied to any language your using. But the fact that the IDE handles this sort of thing means that I don't care about the verbosity of any language I might work with. I don't care about saving keystrokes when writing code since a good ide will save me that effort and come on... most of your time coding is NOT typing.. it's thinking about the problem.

    The article is the first time I've actually seen any Ruby. Looks nice... but some of the examples are quickly turning into code soup on the level of perl or c++. I don't want to be the compiler and have to decipher some compact syntax.... verbosity is not necessarily a bad thing. I would argue that for code maintenance it's better to be more explicit than not.

    Of course java has it's faults... But the notion that the syntax of a language needs to be super efficient for people using vi and emacs is kinda missing the point of what makes good maintainable code.

  75. Re:So, what's it like? by arevos · · Score: 1
    I find Java 1.5 features to be enormously useful.

    Seconded. Took them long enough to put it in, though :(

    To be honest, I find that code generation is actually best for more complex problems - the more that is automatically handled by the IDE the better, as the IDE can keep track of so much. Java code generation is usually not subject to the limitation of systems like Rails - it is not one-shot - it can be two way and adaptable. I agree it is not that elegant, as it is not a feature of the language itself.

    Agreed to an extent, but there are limitations to what code generation to achieve. Simple templates are trivial to accomplish via code generation, but code generation doesn't offer the power of the macros in Lisp, nor the dynamicness of Python and Ruby's metaprogramming functionality. It's also somewhat more unwieldly, though I do suppose a good IDE can make code generation usage transparent to the user (just a shame I've got used to using Vim; the text editors of IDEs always seem too basic in comparison).

    For most problems, such power isn't needed. But for complicated situations, it can prove to be quite a boon. I suspect it rather depends on what you're developing; certainly there are situations where Java is the preferred language (though I'd prefer to create my class files in Nice, myself), but I'd argue that there are also a lot of situations where Ruby or Python would be ideal for the job in hand.

  76. Re:So, what's it like? by Dare+nMc · · Score: 1

    > Java is semi-compiled while Ruby is purely interpreted
    when I started working with java, it was all interpreted (well, I would consider the byte code format to be interperted.) Their is nothing stopping Ruby from following the same path as java. IE. could be used to write stand-alone applications, that may or may not be called from a web browser (again the same path as java.) to get = to > performance at a simular footprint, and to be a language used to build compiled librarys to be called from self.

  77. Re:So, what's it like? by lahi · · Score: 1
    Verbosity is a bad thing. The code that is not written does not need to be maintained, debugged, or even considered at all. I am not talking of saving keystrokes, but about noise, I am talking about code where the important points get lost in all the boilerplate, and I've seen my share of that. The classic trivial contrived example is:

    class Hello { public static void Main(String[] arg) { System.out.println("Hello World"); }

    versus:
    print "Hello World\n"

    Of course it's a trivial, useless example - except it only gets worse from here. It doesn't matter if the IDE generates everything for me and can manipulate the AST correctly and transparently when refactoring - I don't want to see that mess.

    Interestingly enough, many people seem to prefer C syntax if(){}else{} for blocks, because it saves a few keystrokes, although many studies have shown that Ada-like "if then else endif" syntax (or the variant used in Ruby) is less error-prone, and IMO more readable. (And don't give me any crap about how noone makes mistakes with that anyway, so it doesn't matter, and the IDE prettyprints your statements and does everything for you etc. I have seen mistakes happen from this too.)

    As for using IDEs: I'd like to, but for some reason despite being written in Java and therefore allegedly portable, at least Eclipse seems to come with a platform-native startup-program that I haven't had much success with on NetBSD so far, despite having compiled working native NetBSD versions of Sun JDK 1.4 and 1.5 myself. I will get around to it eventually.

    Oh, and could you please show me an example of one of those "properly formatted, commented, and scoped getters [or] setters." I somehow strongly doubt that an IDE can automatically generate any meaningful comment for a getter or setter. The best I can come up with is this piece of garbage (carefully adapted from this):
    /**
      * Returns the foo of the object.
      * @return the foo
      */
      public Foo getFoo() {
        return foo;
      }
    Please be an honest, intelligent person and admit that that's just silly!

    -Lasse
  78. Ruby vs. Perl vs. Java by pfc · · Score: 1

    I haven't explored Ruby much, but as I read through each of the features touted the article, one thing that came to mind was how similar many of them are to Perl both in syntax and in usefulness. (Background: generally I use Java at work and LAMP(erl) for managing my own websites.) So let's do a little closer comparison of the three languages. If any Ruby experts want to jump in and correct anything, I'd be interested in hearing it.

    • Fast moving objects: All constructors essentially similar, using new classname(params) or some permutation thereof. Ruby has C++ style default values. In Perl you have to remember to bless(), but only in the constructor.
    • RubyBeans: Ruby definitely has the most compact property notation. Java is verbose but predictable. Perl is weird, with $obj->{prop} syntax or the use of tie(), and read vs. read-write isn't as easy to do.
    • Collections: Perl and Ruby both define lists with [...] and have [n] and [m..n] accessor syntax. Java, well...
    • Iteration: collection.each { |var| do something with var... } looks a lot like foreach $var (@collection) { do something... }. With Java 5, at least you have for (var in collection) { do something... }
    • . But this is probably the most important operation that needs a compact syntax!
    • Yes, yes, yes: Ruby has a while() construct, but the author claims that it's not much used due to the .each syntax. Not so sure I agree - I find while is best for looping when the termination status is calculated in some way.
    • Conditionally yours: postfix if statements - first saw it in Perl and hotly debated ever since. But it's no worse than the "optional braces" that derives from C. Perl and Ruby both have unless.
    • Polymorphism and Mixins: Match up those method names! Perl and Ruby are again similar. Ruby has mixins, Perl has @ISA. Ruby seems slightly more elegant, but the end result is pretty much the same - I don't how there's more than one sensible way to do OO in a dynamically typed language (no, I haven't seen Smalltalk).
    • Regex: var =~ /expr/ in both Perl and Ruby. I don't know whether Ruby has regex flags to compare with Perl. Java 4 regex package has a completely different syntax but is pretty compact and easy to use, though.

    Syntactically, Ruby seems to be much closer to Perl than Java - this feels like a apples-and-oranges article. I know Java and Perl both compile to bytecode, both approach native speed in practice, and both have a extensive set of libraries. I would only assume that Ruby is the same.

    I'm sure I'm missing many of the intermediate-to-advanced features of Ruby, but what would make me choose Ruby over Perl? Anyone else feel like diving in?

  79. Re:So, what's it like? by Decaff · · Score: 1

    I don't want to see that mess.

    Then don't. Most good IDEs have 'folding editors' that can hide this sort of detail.

    Please be an honest, intelligent person and admit that that's just silly!

    But it isn't. It says exactly what the method does, and what it returns. This is a good thing, as not all methods that look like accessors need do only this.

  80. Re:It's obvious by Decaff · · Score: 1

    Rails does not have all the answers and rails freaks always remind me of Microsoft employees promoting .NET

    Absolutely. There is an attitude that if Rails doesn't do something you obviously don't need it, and 'don't get it' if you think you do.

  81. Why compare Ruby with Java? by geezusfreeek · · Score: 1

    Ruby is nothing like Java! Granted, the two languages to both have frameworks for web applications, but this article, of course, has nothing to do with web applications. Ruby as a language should be compared with Perl, Python, Smalltalk, etc. Java was designed for completely different things. It's apples to oranges.

  82. Re:So, what's it like? by juhaz · · Score: 1, Insightful

    The article is the first time I've actually seen any Ruby. Looks nice... but some of the examples are quickly turning into code soup on the level of perl or c++. I don't want to be the compiler and have to decipher some compact syntax.... verbosity is not necessarily a bad thing. I would argue that for code maintenance it's better to be more explicit than not.

    If you think Ruby looks nice, but is too much of a "code soup", you definitely should take a look at Python. It has most of the advantages, but is IMHO, considerably more clean. Creator or Ruby likes Perl, and it shows.

  83. Re:So, what's it like? by lahi · · Score: 2, Insightful

    I must conclude that you don't think

    i++; /* increment i */ is silly either.

    Let's just leave it there, then.

    -Lasse

  84. Re:So, what's it like? by Decaff · · Score: 1

    I must conclude that you don't think

    i++; /* increment i */ is silly either.

    Let's just leave it there, then.


    Why conclude that? That statement (at least in a language which does not have operator overloading) is self-evident.

    However, in the example of a setter or getter, what happens is not self-evident, as the method may end up doing more than just setting or getting.

    So, simple comments at a method level, even if they indicate that somethings is just a setter or getter, are certainly not redundant.

  85. .NET framework in Windows by PeeCee · · Score: 1
    can anyone explain to me why Microsoft didn't include the .NET framework in Windows XP?

    Because it wasn't done at the time XP was released (2001). Since it was released, they have, however, made it available as an optional component via Windows Update. They will of course be including it with every new operating system: the Compact Framework has already been included since Pocket PC 2003, it's in Server 2003 and it sure as hell will be in Vista.

    As a developer of consumer software, I'm loath to burden my 6 MB download with the 20MB millstone of the .NET framework

    Many of the smaller Java applications don't bundle the JVM either (although some include it as an option), and it's worked out just fine for them. If a user can download your software (if you're on a slow modem, 6MB is nothing to sneeze at), they sure as hell can download one (1) executable file and go through the painful process of double-clicking it to install the framework. I'm pretty sure if you can't walk your grandmother through that, you won't walk her through installing your software, either.

    1. Re:.NET framework in Windows by Anonymous Coward · · Score: 0

      Because it wasn't done at the time XP was released (2001). Since it was released, they have, however, made it available as an optional component via Windows Update.

      They could have included it in SP2 or they could just force its installation through Windows Update. Why is it optional???!??

  86. Re:So, what's it like? by lahi · · Score: 1

    Oh. It occurs to me that you may have missed that we are talking about automatically generated accessor functions:
    For example... you add your object attributes and then rightmouse -> refactor -> 'generate accessor methods'. And blink... you have properly formatted, commented, and scoped getters and setters.

    I agree that a nontrivial accessor might benefit from a comment, just as a nontrivial statement, but it doesn't follow that therefore all accessors or all statements (including my increment example) deserve comments.

    Please explain to me how an automatically generated (thus presumably trivial) accessor function can have automatically generated comments that are not absolutely trivial. I agree that an accessor function could be bestowed with additional functionality, but then:
    - It might cross the border where it ceases to be just an accessor function, and should be named according to its behaviour, rather than getFoo/setFoo.
    - You provide the behaviour and the comment yourself.

    Perhaps in Java 6 we'll see something like:

    class Foobar { public Foo foo; ... }

    being taken as shorthand for:

    class Foobar { private Foo foo; public Foo getFoo() { return foo; }; public void setFoo(Foo newfoo) { foo = newfoo; } ... }

    and of course permitting you to make foo private in a subclass if you provide public accessor functions. (Presumably with additional behaviour.)

    Also, naturally, accessing foobar.foo would be understood as foobar.getFoo(), and foobar.foo = bar as foobar.setFoo(bar).

    If I remember correctly, Dylan does accessor functions more or less like this. Probably other languages do too. Ruby is arguably one of them. +1 for Ruby.

    BTW, I have read too much buggy, badly commented code, to trust any comment. Semantically significant annotations - such as Eiffel invariants, pre- and postconditions - would be a different matter.

    -Lasse

  87. Re:So, what's it like? by Decaff · · Score: 1

    Oh. It occurs to me that you may have missed that we are talking about automatically generated accessor functions

    No, I hadn't.

    Please explain to me how an automatically generated (thus presumably trivial) accessor function can have automatically generated comments that are not absolutely trivial.

    It can't, but that is not the point. The trival comments indicate that the method is doing something trivial, as against something non-trivial (see below).

    I agree that an accessor function could be bestowed with additional functionality, but then:
    - It might cross the border where it ceases to be just an accessor function, and should be named according to its behaviour, rather than getFoo/setFoo.


    I don't like this idea, as it breaks encapsulation - it is perfectly acceptable for a Java class 'bean property' (indicated by the presence of setXXX or getXXX methods) to not actually exist as an instance variable in the class. What may look like a simple accessor is actually getting a value by some other mechanism. However, to the code that uses this class (or looks at its properties by introspection) this is nicely hidden. This allows things like proxy instances to work neatly - the apparent accessor functions actually divert to another instance to retrieve or store values.

    Perhaps in Java 6 we'll see something like:

    class Foobar { public Foo foo; ... }

    being taken as shorthand for:

    class Foobar { private Foo foo; public Foo getFoo() { return foo; }; public void setFoo(Foo newfoo) { foo = newfoo; } ... }


    I really hope not, as it would prevent things like I have mentioned above working.

    If I remember correctly, Dylan does accessor functions more or less like this. Probably other languages do too. Ruby is arguably one of them. +1 for Ruby.

    This is potentially limiting, as it tries to make accessor functions limited and special in what they do.

    Using accessor functions only as ways to access instance variables in this way is far too restrictive. I think Java's more general use of these functions is more powerful, and this explains why you do need comments - to explain that this really is only a simple variable accessor!

  88. Re:Smalltalk by SolitaryMan · · Score: 1
    Wasn't Java itself once defined mostly in terms of C++, and isn't C# now defined in terms of Java?
    I would say that Java is mostly reinvention of Smalltalk.
    --
    May Peace Prevail On Earth
  89. Re:So, what's it like? by Estanislao+Mart�nez · · Score: 1
    It can't, but that is not the point. The trival comments indicate that the method is doing something trivial, as against something non-trivial (see below).

    I think that a crucial point that either of you has failed to notice or point out is that the autogenerated comment in question is a Javadoc comment. If we take only the perspective of somebody reading the source code of the class, then lahi is right that the comment is absolutely worthless. If we take the perspective of somebody reading the Javadocs, on the other hand, having the comment does convey some information.

    Still, I think that the stated reason you provide for having such comments ("to explain that this really is only a simple variable accessor") is no good. If I'm reading the Javadocs, why should I care at all whether the code for the getter is just a trivial return statement, or something more complicated? What I care about is the conceptual model that the class provides, not its implementation. The class models some kind of object within a problem domain; those objects have such-and-such properties, and these are the operations that one can perform on them.

    If on the other hand I'm reading the source code, then lahi's point applies--I can just see that the method is a trivial instance field access.

    This is potentially limiting, as it tries to make accessor functions limited and special in what they do.

    No, you've failed to understand the feature here. There's no limitation at all. In the case of Ruby, for example, there are no publicly accessible instance fields at all. All interaction with an object must be through method invocations. If you need trivial getters and setters, there's a class method that uses the language's dynamic features to define them for you on the fly--you just say attr_accessor :foo, :bar, and voilà, you've got yourself getters and setters for foo and bar. If you need non-trivial getters or setters, you just write them by hand.

    And what's even neater is that this is not a hardcoded feature of the language--attr_accessor is just a method that exploits Ruby's dynamicity; namely, the ability to generate code and extend a class at runtime. You can write attr_accessor in Ruby itself. Which means that (a) you can write your own custom boilerplate runtime method generation code just as easily, (b) you don't need a separate tool (i.e., an IDE) that knows how to parse your code and potentially decipher intent ("hmm, these two methods must be a getter/setter pair"), and most importantly, (c) the logic that decides what it means for something to be an accessor pair, and the implementation thereof, reside in just one place, instead of all over the damn code.

    It also follows that you hardly ever need to write proxy classes. You can trivially write a function that takes a class, and spits out a delegate class; and the standard library already provides such code. You subclass this latter one with a constructor that sets the object that you're delegating to, and override whichever methods are different, and you're done.

    [...] it is perfectly acceptable for a Java class 'bean property' (indicated by the presence of setXXX or getXXX methods) to not actually exist as an instance variable in the class. What may look like a simple accessor is actually getting a value by some other mechanism. However, to the code that uses this class (or looks at its properties by introspection) this is nicely hidden. This allows things like proxy instances to work neatly - the apparent accessor functions actually divert to another instance to retrieve or store values.

    You can't really reconcile encapsulation and documenting trivial implementations. If the point of getters and setters is to encapsulate access to conceptual "properties" of objects, then whether a particular getter/setter pair is trivial is exactly the sort of thing we're trying to hide from the clients, and thus, it's not relevant information for the comment.

    As to proxies: I've had to write proxy implementations of the JDBC interfaces. Ugh, that is hell.

  90. Re:So, what's it like? by Decaff · · Score: 1

    If we take the perspective of somebody reading the Javadocs, on the other hand, having the comment does convey some information.

    Exactly - I think you are finally starting to get the point.

    No, you've failed to understand the feature here. There's no limitation at all. In the case of Ruby, for example, there are no publicly accessible instance fields at all. All interaction with an object must be through method invocations. If you need trivial getters and setters, there's a class method that uses the language's dynamic features to define them for you on the fly--you just say attr_accessor :foo, :bar, and voilà, you've got yourself getters and setters for foo and bar. If you need non-trivial getters or setters, you just write them by hand.

    Of course I understand the feature. I use it.

    If the point of getters and setters is to encapsulate access to conceptual "properties" of objects, then whether a particular getter/setter pair is trivial is exactly the sort of thing we're trying to hide from the clients, and thus, it's not relevant information for the comment.

    You are missing the point. The information does not need to be hidden from the client - it needs to be hidden from tools and APIs that use the 'accessor' methods. There is no harm in letting a client (or other developer who uses your code) know that a getXXX method does something more complex; that is the point of comments.

    As to proxies: I've had to write proxy implementations of the JDBC interfaces. Ugh, that is hell.

    You may want to take a look at Spring (www.springframework.org) - it provides libraries that can hugely simplify JDBC use.

  91. Re:The FIrst Troll by Anonymous Coward · · Score: 0

    some things are just plain easier to do in Ruby than they are in the Java language

    Now, I really don't like Ruby (Python is the king of the hill), but this is a gross understatement. More appropriate would be every fucking thing .

    I never understood why Java is considered a language and not a stripped-down C with a bloated vendor-API.

  92. Re:So, what's it like? by minniger · · Score: 1

    OK fine... comment templates. We all know a good way to argue your point is to pick out a little mistake in my hastily written post and construe that I was saying that ides could magically write meaningful comments.

    RE Verbosity:

    My point is that if the IDE can generate and maintain the 'boilerplate' code then it doesn't matter if the language is concise or not. The IDE has effectively removed that feature of the language from consideration. All the ides will fold the code up so you don't even have to look at it if you don't want to.

    I'm not saying java is 'better' or that it couldn't use some cleaning up. Or for that matter that some of the new language features in 1.5 are not just way to complex. I am saying that a good IDE can smooth out the rough areas enough that you no longer have to worry about them. This is especially true for the IDEs that constantly compile the code while you edit it so that you immediately see compile time errors. HUGE time saver.

    I'm not the one to help with using eclipse on netbsd. If you're not used to using an IDE I wouldn't start with eclipse. Try jbuilder foundation or netbeans. They both are swing based and quite a bit more user friendly. And for that matter try them out on linux or os x. You'll be a lot happier with them.

    I've done all my java dev with jbuilder/eclipse on os x for the past 3 years and deploy to linux, solaris, aix, and win with little trouble. That is the portable part. The UI stuff requires dealing with the subtle window/event handling on different platforms and can get really funky.

  93. Re:So, what's it like? by rheotaxis · · Score: 1

    The user's application domain should indicate the need for performance. Ruby on Rails is a great tool for simple, easy to build and use web interfaces to back-end databases. Other stuff, like multi-processing on quantum devices trying to fathom the "grand challanges", should probably be based upon some other development process. Now, once your solution to the grand challanges produces some relation data, you could inform the public using Ruby on Rails, and you'd be happy becuase it wouldn't take very much time to do so.

    --
    Software freedom...I love it!
  94. Re:Smalltalk by Weedlekin · · Score: 1

    As with C++, Java owes far more to Simula-67 than Smalltalk.

    --
    I'm not going to change your sheets again, Mr. Hastings.
  95. Re:So, what's it like? by Anonymous Coward · · Score: 0

    if by "metaclass-like abilities" you mean " a way to iterate over a class's members" Java already got it, it's called reflection and I used it before to traverse a generated parse tre e, which sounds similar than what you were doing :)

  96. Re:So, what's it like? by lahi · · Score: 1

    Sorry, but that _was_ what you wrote, wasn't it? ;-)

    Actually, we probably agree to a large extent. Whether you use a preprocessor that generates Java or an IDE doesn't matter much. Effectively, you are programming in a language that is not quite Java, but hides some of its less fortunate properties. I just personally would prefer the language to be different, rather than having its rough edges smoothed over by an IDE. But viewed through the spectacles of semiotics, an IDE is not that different from any other language.

    I am certainly not complaining about Java portability. My homebanking works fine, and in the past I have had BEA WebLogic 6 running on NetBSD. But perhaps I will start with giving NetBeans a try.

    -Lasse

  97. Re:So, what's it like? by minniger · · Score: 1

    I'm finding netbeans 5 beta to be really nice when it's not barfing exceptions at me. Until that gets sorted out i've defaulting to eclipse. But again.. you're not going to have much fun with it on slower hardware or a slightly less used desktop os.

  98. Re:So, what's it like? by lahi · · Score: 1

    I think that a crucial point that either of you has failed to notice or point out is that the autogenerated comment in question is a Javadoc comment. If we take only the perspective of somebody reading the source code of the class, then lahi is right that the comment is absolutely worthless. If we take the perspective of somebody reading the Javadocs, on the other hand, having the comment does convey some information.

    You are right, I viewed the comment as a code comment, not as API documentation, which javadoc is supposed to be. As I stated in my other comment, it is my understanding that accessors are conceptually corresponding to public attributes, and should be documented as such. If there is a public side-effect, it should not be done as an accessor. The API docs of a public attribute should document the meaning of the attribute, without regard for whether it is a synthetic attribute (for instance through proxying) or a real attribute. After all the status as a real or synthetic attribute could change in a subclass.

    The only contrived trivial example I can think of at the moment is geometric points, where you could choose to have an interface with both polar and cartesian attributes. The cartesian implementation would have the polar coordinates as synthetic attributes and vice versa. Of course in practice you wouldn't make such a type mutable.

    In any case, the comment is as useless as documentation as it is as a code comment.

    Still, I think that the stated reason you provide for having such comments ("to explain that this really is only a simple variable accessor") is no good. If I'm reading the Javadocs, why should I care at all whether the code for the getter is just a trivial return statement, or something more complicated? What I care about is the conceptual model that the class provides, not its implementation. The class models some kind of object within a problem domain; those objects have such-and-such properties, and these are the operations that one can perform on them.

    Those well-intended IDE-autogenerated javadoc comments pave the road from here to Hell. I look at them almost every day, and they are useless, to the point that I don't bother with javadoc. You could argue that it is the fault of the programmers whose code I am reading, but I really think javadoc has to share the blame. Documentation is difficult, and good documentation is a lot harder than good code, and trying to fix this by adding a special type of comment to your code solves very little. Autogenerating such comments OTOH is plain offensive, because real documentation cannot be generated. If the IDE could tell you why you wrote the code, it could just as easily write the code itself. By putting parrot-talk in those comments by default, you give the lazy programmer (= any intelligent programmer) a good enough bad excuse not to fill in something meaningful.

    Having an IDE that could tie the documentation, and indeed the whole process from requirements, use cases and unit tests, together with the coding process would be a marvellous thing. Writing some documentation in a word processor, some in a UML tool, possibly interacting through some simple generation with the IDE and the code is not optimal, though.

    I am suffering from lots of code which may or may not be out of sync with documentation, so I'd love to see a solution.

    Meanwhile, I am very cautious about anything in a source file except actual live code. Even so, I sometimes look at what appears to be live code only to find out that it is dead, superseded by something else, but not thoroughly documented. Comments may be used as hints, but they can't be trusted. Period.

    Executable comments, in the form of invariants, pre- and postconditions, like in Eiffel, are different. They are part of the code, and necessarily up to date.

    -Lasse

  99. Re:So, what's it like? by lahi · · Score: 1

    Sorry, but it is my understanding that an accessor function provides an interface which conceptually is identical to a public attribute, only with the option to override with a method in a subclass. If you add behaviour to an accessor function, it should not be of any concern to the user of the class, and therefore whether you use it as foobar.setFoo(42) or foobar.foo = 42 shouldn't matter at all. OTOH, if your accessor has publicly known side-effects then it's not really just an accessor, and it is IMO wrong to write it as an accessor. Write a real method, with an appropriate name indicating the intended behaviour and side-effects.

    My suggested scheme for implied accessor functions does not prevent you from having things work as you like, though. If you don't provide the public Foo foo attribute, but write the accessors yourself, you would get precisely what you want. It's similar to the way Java provides a default constructor. You can add your own instead. There's no restriction, it just works by default without you having to write anything. Of course I don't suppose you would be bothered by having to write (or have your IDE write) trivial constructors for your classes.

    Being able to use plain assignment rather than calling the accessor methods is of course just nice glukosyntax.

    Having just recently achieved the dubious title of Java Certified Programmer I understand that public attributes are considered as breaking encapsulation. So, instead of doing it the way I suggested, Java requires you to add accessors in all cases where you would want to use a public member, because of the few cases where you might want non-default behaviour of accessors. I believe that is a case of language design being ruined by bad and wrong priorities. And I think this should be fixed in the Java language itself rather than swept under the carpet by a "helpful" IDE.

    My comments on comments come in another comment.

    -Lasse

  100. Re:So, what's it like? by lahi · · Score: 1

    Calling NetBSD a "slightly less used desktop os" must be the understatement of the year! That's very kind of you! :-)

    However, I am confident that with some effort, things can be made to work. It's only a question of finding the time. If I were really desperate, I'd just use the Linux version with NetBSD's Linux compatibility layer, but where's the fun in that? :-)

    -Lasse

  101. Re:So, what's it like? by Decaff · · Score: 1

    Sorry, but it is my understanding that an accessor function provides an interface which conceptually is identical to a public attribute, only with the option to override with a method in a subclass. If you add behaviour to an accessor function, it should not be of any concern to the user of the class, and therefore whether you use it as foobar.setFoo(42) or foobar.foo = 42 shouldn't matter at all. OTOH, if your accessor has publicly known side-effects then it's not really just an accessor, and it is IMO wrong to write it as an accessor.

    This is a good point. Java does not have accessor functions - it has bean properties which is a far more powerful concept.

    Write a real method, with an appropriate name indicating the intended behaviour and side-effects.

    This breaks the use of bean properties where those properties aren't simple variable accessors.

    In my view, this is the appropriate way to indicate additional behaviour: /**
      * Retrieve the value of X from the database
      * @return x
      */
    public Object getX() {...}

    Not

    public Object getXFromDatabase() {...}

    If you use the latter, you can't do useful things like have all sorts of tools handle the property.

    And.. this breaks encapsulation - the the user of the class should neither know or care whether or not X comes from a database! The method that implemements that sort of functionality should be private.

    Good OOP design implies that classes should be 'black boxes' with as little as possible of the internal mechanisms and states visible. Expressing the details of what goes on in terms of public method names is a bad idea.

    I believe that is a case of language design being ruined by bad and wrong priorities. And I think this should be fixed in the Java language itself rather than swept under the carpet by a "helpful" IDE.

    I think it is a step forward, showing how a language can encourage good coding practise and encapsulation. 'Fixing' it would make Java phenomenally less useful - in almost every Java project I develop, I use encapsulated bean properties like this in so many ways.

  102. Re:So, what's it like? by Decaff · · Score: 1

    Documentation is difficult, and good documentation is a lot harder than good code, and trying to fix this by adding a special type of comment to your code solves very little.

    Javadoc is not trying to solve the problem of documentation - it is only trying to provide a way that method- and class-level documentation in code can be indexed, cross-indexed and collated as web pages. Nothing more.

    I agree that there could be better ways to do things and keep things up-to-date, but to say that JavaDoc solves little is, in my view, way too harsh.

    Autogenerating such comments OTOH is plain offensive, because real documentation cannot be generated

    Autogeneration is simply there to create a skeleton comment with boiler-plate stuff filled in (parameter names, return types etc.). It is not intended as a replacement for real documentation - just as a time-saver for producing such documentation.

  103. Re:The FIrst Troll by Decaff · · Score: 1

    Now, I really don't like Ruby (Python is the king of the hill), but this is a gross understatement. More appropriate would be every fucking thing .

    Apart from things like high-performance numerics, portable multi-threading, secure networking, secure class loading .. just to name a few.

    So not 'every fucking thing' then......

    I never understood why Java is considered a language and not a stripped-down C with a bloated vendor-API.

    Because C doesn't have classes, unicode, built-in portable threading, a standard GUI library, exception handling, automatic stack tracing on error, a security manager, binary portability across different processors and word lengths, generics, standard APIs for portable relational database persistence and distributed code, internationalization, standard APIs for web page generation, standard APIs for high-performance image processing, standard APIs for high-performance 2D and 3D graphics, built-in datatypes for unlimited precision numerics....

    Oh - and most of the common APIs (Hibernate, Spring etc) used with Java don't come from a commercial
    vendor.

    Oh - and those APIs mentioned above aren't Vendor APIs - they are provided by all organisations that provide Java, not just Sun.

    Apart from that you are correct.

  104. Re:So, what's it like? by Decaff · · Score: 1

    Also, Java is semi-compiled while Ruby is purely interpreted, making it even slower.

    Java is fully compiled. The Hotspot optimiser translates the Java byte code to highly optimised machine code.

    However, if computers keep getting faster as they have been I doubt that Ruby's performance will be much of an issue in the future.

    I have heard this kind of excuse for slow languages for decades. The fact is that the demands made by users is continually increasing - speed always has been and always will be important. More interestingly, what will be important is multi-threaded performance when the new multicore CPUs become common on the desktop. Java was designed to be easily multi-threaded from the start.

    Actually, if Ruby can be effectively multi-threaded it may end up more efficient even interpreted than some single-threaded C/++ apps.

  105. Re:Smalltalk by SolitaryMan · · Score: 1

    Afaik, Simula-67 had no JIT and Virtual Machine (or did it?), while Smalltalk did. And JIT and Virtual Machine is the basis of Java's success. I meant not just the language itself but more a solution here.

    --
    May Peace Prevail On Earth
  106. Re:Smalltalk by Weedlekin · · Score: 1

    My comment was based on the Java language rather than how certain implementations of it work (not all Java compilers target byte code for a VM -- some directly emit native codes).

    And in any case, Smalltalk was far from being the first language to use a VM. LISP and some COBOL systems had them in the late 1950s, and a wide variety appeared during the 1960s and 1970s. Note that I am not talking about interpreters here, but compilers that emitted byte codes which are run by a "software CPU" that is then implemented on a variety of platforms. As for JITs, those found their way into some Smalltalk implementations _after_ they appeared for Java, not before.

    I would therefore contend that Java owes little if anything to Smalltalk. Its syntax and semantics are based on C++, which in its turn was heavily influenced by Simula-67; its use of a VM can be traced back to systems that predate Smalltalk by decades; and it uses a traditional "edit in any text editor, save the file, compile it, repeat" cycle rather than the Smalltalk method of programming by environmental extension.

    --
    I'm not going to change your sheets again, Mr. Hastings.
  107. Re:So, what's it like? by Decaff · · Score: 1

    "This is the same excuse I have heard for decades when fans of a language try and 'justify' it's lack of performance."

    Java:Ruby :: Pot:Kettle


    It has got to the stage where Slashdotters making flippant comments about Java's apparent lack of performance are making themselves look ignorant, not cool - as part being cool is understanding technology and being up-to-date, not keeping hold of ancient language prejudices.

    Just to give one example - last year someone wanted to do XML processing in Ruby. They could not believe how slow it was. Java's XML processing was about the speed of good C-based libraries. Ruby was about 50 times(!) slower.

    So, comments like

    Java:Ruby :: Pot:Kettle

    Are an old, out-of-date joke told badly.

  108. Re:So, what's it like? by arevos · · Score: 1
    People expect games to take lots of horsepower. On the other hand, no one expects an IM application to take a 100MB of memory and 100% of 1GHz Athlon...

    And if Ruby or Python needed that much memory and CPU power to run an IM, then I'd agree with you. But they wouldn't, because for IMs and other similar network applications, the bottleneck is most often not in the processor, or the RAM, but in the bandwidth and latency of the network connection. Bittorrent runs perfectly happily on my old machines, and what do you think that's programmed in? If my hacked NSLU2 with a 133MHz processor and 32M of RAM can run Bittorrent without trouble, then a 1GHz Intel processor isn't going to have any problems with it.

    Remember also that Python and Ruby farm out a lot to binary libraries. The GUI, socket handling and algoritms like SHA1 aren't implemented in Ruby or Python, they're accessed through libraries programmed in C and C++.

  109. Re:So, what's it like? by arevos · · Score: 1
    if by "metaclass-like abilities" you mean " a way to iterate over a class's members" Java already got it, it's called reflection and I used it before to traverse a generated parse tre e, which sounds similar than what you were doing :)

    Close, but no cigar. Metaclasses are to classes what classes are to objects. Python and Ruby have metaclasses because they're dynamically typed. Java is statically typed, and I don't believe it's possible for a statically typed language to have complete metaclass functionality without compromising type safety.

    Python and Ruby have mutable objects; it's possible to alter the behaviour, methods and variables held in an object at runtime. In the example I gave, I needed to create several classes that reflected certain attributes and descendants of an XML DOM Element. In Java, I had to create the getters and setters and the DOM parsing logic for each class. In Ruby, I could automatically create the getters and setters and DOM logic from a metaclass template, given certain arguments.

    Thus, 50 lines of code could be reduced to 4 through appropriate use of metaclasses. Metaclasses are useful for reducing types of redundancy that functions and inheritance can't eliminate on their own.

    Java's objects are immutable, so this level of abstraction is beyond the scope of the language. It has reflection, which can be useful, but to be frank, Java's reflection is pretty damn awful when compared to other languages :)

  110. Re:So, what's it like? by lahi · · Score: 1


    And.. this breaks encapsulation - the the user of the class should neither know or care whether or not X comes from a database! The method that implemements that sort of functionality should be private.


    If you believe that, then why do you put that very information in the docs? Make up your mind, should the user know about this or not? If yes, then it is relevant to put it in the docs and in the name; if no, then the property behaves for all intents and purposes as a public member variable and should be accessible as such, even if internally to the class it is represented differently.

    If it is relevant for the user to know that X comes from the DB, then it should be in the name. If you choose to give it a standardized, but meaningless name because of tools, then IMO your tools are broken.

    -Lasse

  111. Java fast? by richman555 · · Score: 1

    I know this is a bit a of a flame, but Java is anything but fast. I've seen too many bloated Java app servers to know of its 'speed'. If you have fast box and gobbs of memory, then Java runs adequately. Im sure Ruby is not a speed burning language either, but I would accept the tradeoff of easier and quicker development. I would like to see some examples of some larger scale Ruby web apps however.

    1. Re:Java fast? by Anonymous Coward · · Score: 0

      You've seen a slow "Java application", therefore, you extrapolated that the reason for the slowness was "Java" - did you consider the possibiliy of the "application" part of your equation? It is certainly the case in my experience, which has included (and still does), the largest Java application in the known universe. The 'largeness' of an application is logarithmically proportional to its 'slowness'. Is this a coincidence? Does it point to Java? Names omitted of course, to protect my means of survival.

  112. Re:So, what's it like? by ciggieposeur · · Score: 1

    So, comments like

    Java:Ruby :: Pot:Kettle

    Are an old, out-of-date joke told badly.


    You misunderstood the point. I wasn't knocking Java's speed from its 1.[01].x days.

    I am simply pointing out that knocking Ruby's speed now, given its abilities, is akin to dismissing Java in 1995 given what it brought to the table. And for a Java enthusiast to make a general statement about performance as a primary reason to avoid a language/platform is selective amnesia at its finest.

  113. Re:So, what's it like? by Decaff · · Score: 1

    And for a Java enthusiast to make a general statement about performance as a primary reason to avoid a language/platform is selective amnesia at its finest.

    Not at all. Firstly, I was not a Java enthusiast in 1995 because it was slow, so no hypocrisy here. Secondly, many of the comments here about Ruby aren't saying 'well it might get faster' - they are saying 'it is fast enough now'. Thirdly, it is difficult to predict which languages end up fast. A decade ago it looked like Smalltalk was on that route, but it failed and Java succeeded.

  114. JRUBY Ruby plus the java by Anonymous Coward · · Score: 0

    What about JRuby, Ruby written in java so you can call the java stuff from it.