Slashdot Mirror


Does C# Measure Up?

An anonymous reader queries: "Windows::Developer is offering a detailed, quantitative examination [free login required] of C#'s performance versus Java, C, C++ and D. 'Overall the results were surprising, although perhaps unexciting, in showing that C# (and to a less extent Java) is, to a good degree, on a par in efficiency terms with its older and (presumed to be) more efficient counterparts C and C++ at least as far as the basic language features compared in this analysis are concerned,' writes the author, Matthew Wilson. I'm only an amateur coder, and confess to not understanding most of the two-part article. I'd love to hear how true programmers view his results, which are too wide-ranging to summarize easily here. How about it Slashdot, as this special edition asks, 'Can C# keep up with compiled languages like C, C++, and D or byte-code based Java?'"

While we're on the topic of C#, rnd() queries: "It's been a while now, since Mono and DotGnu have begun eroding the market power of Microsoft by creating open source implementations of C# and the Common Language Runtime. Over the weekend I loaded Mono and did some informal benchmarking of object creation, intensive message passing, massive iteration, etc., and the results show that Mono is about 90% as fast as Microsoft's implementation after a very short time. I now want to switch my .NET development over to Linux/Mono exclusively, but I want to first settle on a free alternative to Visual Studio .NET 2003. Any suggestions?"

677 comments

  1. Differences by fredistheking · · Score: 5, Funny

    C# is higher pitch than C but less so than D.

    --

    1. Re:Differences by thesuperjason · · Score: 1

      I think C should be renamed B#

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

      This idiotic and perfunctory remark garnering a "Score: 5, Funny" explains why I so rarely read slashdot commentary and why I am so disappointed when I do.

    3. Re:Differences by oever · · Score: 0

      Still, I'd rather be a real programmer, instead of a c#ier.

      --
      DNA is the ultimate spaghetti code.
    4. Re:Differences by unclebulgaria · · Score: 1

      B doesn't have a sharp as such. A semitone up from B is C. So B# really translates to "C".

    5. Re:Differences by Sir+Runcible+Spoon · · Score: 1

      Hah! Well there is no C in the key of C# major. The note one semitone above B is B#.

      See Beethoven's Moonlight Sonata. Second note for the right hand, on the second line. Quite clearly a B#.

      Smart arse? Mooey? You are so kind.

    6. Re:Differences by MrBlint · · Score: 0

      Depends on the key. In the key of C# major the leading note (7th) is B#, In G# major B# is the mediant (3rd) and C is the subdominant (4th), etc. The basic rule is that you start naming from the root note and don't use the same letter twice.

      --
      That's very perceptive of you Mr Stapleton and rather unexpected in a G Major
    7. Re:Differences by Evil+Grinn · · Score: 1

      Hah! Well there is no C in the key of C# major. The note one semitone above B is B#. See Beethoven's Moonlight Sonata. Second note for the right hand, on the second line. Quite clearly a B#.

      s/major/minor/g

    8. Re:Differences by Sir+Runcible+Spoon · · Score: 1

      Of course. Of course. That is what I meant. Well spotted. There is no C in C# minor either.

  2. Whoa whoa whoa! by 77Punker · · Score: 1

    There's a D? What's next? Eb? Technology is moving at an incredible rate, indeed!

    1. Re:Whoa whoa whoa! by Anonymous Coward · · Score: 0

      I think it's important to point out that the letter of the languaged does not, in no way whatsover, represent how advanced or efficient it is.

      There was a language called B, and it is in no way related to C. Likewise, C may be better in different implementations than C++.

    2. Re:Whoa whoa whoa! by jemenake · · Score: 4, Funny
      There's a D? What's next? Eb? Technology is moving at an incredible rate, indeed!
      Actually, depending upon who you ask, "D" shouldn't be the next in the series. I remember reading somewhere that the "C" got its name because it came after "B"... not in the alphabet, but in the acronym "BCPL", which supposedly stood for "basic combined programming language". (For more info, go read "BCPL to B to C" here.

      So, with that line of thinking, C++ should have been "P" (insert favorite "P Object-Oriented Programming" acronym joke here), and C# (although it shouldn't have been created at all, but was) should have been "L".
    3. Re:Whoa whoa whoa! by wkitchen · · Score: 2, Funny
      So, with that line of thinking, C++ should have been "P" (insert favorite "P Object-Oriented Programming" acronym joke here), and C# (although it shouldn't have been created at all, but was) should have been "L".
      "L Object-Oriented Programming"?
    4. Re:Whoa whoa whoa! by ameoba · · Score: 1

      C++ is just a scenic detour, it's not really the next step in evolution; that honor belongs to Python (or maybe Prolog).

      --
      my sig's at the bottom of the page.
    5. Re:Whoa whoa whoa! by Anonymous Coward · · Score: 0
      There was a language called B, and it is in no way related to C.

      Apart from being C's immediate predicessor that is.

      There was a language called BCPL, from which was developed B. From B was developed C. This means the next language should be called P, shouldn't it?

    6. Re:Whoa whoa whoa! by smittyoneeach · · Score: 1

      See the discussion in comp.lang.c++.moderated over in google groups.

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    7. Re:Whoa whoa whoa! by willtsmith · · Score: 2, Interesting

      I would suspect that brininging a "managed environment" to system level programming would be a good step.

      C/C++ have served us all well. However, I suspect that something a bit more portable and simpler may be relevant, especially with the byzantine complexity of C++ behavior.

      On the application end, I would suspect aspect-oriented programming is next on the horizon. More structures to ensure quality (pre/post conditions). More programming by definition and constraint with glue (built in quality control).

      --
      -------- -------- Support Wesley Clark for president!!!
    8. Re:Whoa whoa whoa! by Jugalator · · Score: 2, Informative
      --
      Beware: In C++, your friends can see your privates!
    9. Re:Whoa whoa whoa! by Anonymous Coward · · Score: 0

      ... also, make sure you don't miss the alpha download if you wish to try it out (Windows and Linux).

    10. Re:Whoa whoa whoa! by Anonymous Coward · · Score: 0

      You're a very suspicious person ;)

    11. Re:Whoa whoa whoa! by dspeyer · · Score: 1
      According to Bjarne Stroustrup (of C++ fame), There have been at least a dozen languages called D.

      I wonder which one they benchmanrked.

    12. Re:Whoa whoa whoa! by Anonymous Coward · · Score: 0

      Larry Wall used up both the next two letters for Perl.

    13. Re:Whoa whoa whoa! by CinderellaMan · · Score: 1

      It's okay that C# was created, but it should have been called C--.

    14. Re:Whoa whoa whoa! by Stween · · Score: 1

      Though Prolog was around before C, I'm sure, so technically then Prolog should be C, and C should be P.

  3. In Java's case ... by Anonymous Coward · · Score: 2, Interesting

    Hotspot is really good about compiling bytecodes down to the native machine language. That code is real honest to goodness native code, and will execute at approximately C++ speed.

    Why use anything else?

    - David

    1. Re:In Java's case ... by Bingo+Foo · · Score: 3, Insightful
      Why use anything else?

      Templates.

      Any other questions?

      --
      taken! (by Davidleeroth) Thanks Bingo Foo!
    2. Re:In Java's case ... by JasonB · · Score: 5, Informative

      Java SDK v1.5 (not yet released) contains support for 'generics', which are very much like C++ templates for Java:

      http://java.sun.com/features/2003/05/bloch_qa.html

    3. Re:In Java's case ... by use_compress · · Score: 0

      Any other questions?

      What about the Object class? Having everything (with the exception of native datatypes that can be wrapped into classes) be a descendant of a superclass is a far more elegant solution than using c++'s hackish and syntactically awkward template feature.

    4. Re:In Java's case ... by molarmass192 · · Score: 1

      Templates are in Java 1.5 (see generics) so this argument is moot.

      --

      Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws-Plato
    5. Re:In Java's case ... by Trejkaz · · Score: 2, Insightful

      Yay! All the power of Java's Generics but with 10 times the code bloat.

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
    6. Re:In Java's case ... by yanestra · · Score: 1
      Why use anything else?

      Templates.

      Any other questions?

      In C++, templates are absolutely necessary. In any other language, they aren't... and not even useful...
    7. Re:In Java's case ... by Anonymous Coward · · Score: 0

      Templates are not necessary in Java. Every class instance is a subclass of Object, and primitive types can be wrapped in class instances. Since you can test Object references for subclass membership simply, generic algorithms in Java can be constructed using polymorphism, without any need for a preprocessing kludge like templates.

      There is no such universal polymorphism in C++, so it needs templates in order to make generic algorithms possible. Now some people like templates, stylistically, so this feature is going to be added to Java 1.5, but it is not as fundamental to Java as it is to C++.

    8. Re:In Java's case ... by Anonymous Coward · · Score: 0

      you're right. but many others care.

    9. Re:In Java's case ... by pyrrhonist · · Score: 1
      Templates.
      Any other questions?

      Generic types have been added to Java for public release in version 1.5.
      There is an early access release of the compiler for generics.

      For those people who want generics now, there is a non-Sun implementation of generic types.

      --
      Show me on the doll where his noodly appendage touched you.
    10. Re:In Java's case ... by Bingo+Foo · · Score: 3, Funny

      How are these mythical generics at metaprogramming? If Java eventually gets libraries like Blitz++, Loki, and boost::Spirit, I'll take a look. Oh, but that would require operator overloading, too. Maybe Sun should release the "J2UE" (Java 2 Usable Edition) as a JVM implementation of C++.
      </snarky>

      --
      taken! (by Davidleeroth) Thanks Bingo Foo!
    11. Re:In Java's case ... by Anonymous Coward · · Score: 0

      How big is that JIT compiler, JVM, and the rest of the runtime? My app has to fit into 64K bytes. I can do that with C and C++; any baggage (like the compiler!) remains on my development machine. With Java, the baggage has to come along for the ride for the app to run. If it takes 1.5M bytes to boot "hello world", it doesn't much matter how efficient the JIT compiler eventually makes some small loop.

    12. Re:In Java's case ... by pyrrhonist · · Score: 1
      I don't care about this Java template vaporware.

      It's not vaporware. There is already an implementation.

      Talk to us when it is production ready and all the third party tools support it.

      Oh, and C++ support for templates was instantly available.

      Third party tools already support it. I have no issues running ant and my ide with the new implementation.

      --
      Show me on the doll where his noodly appendage touched you.
    13. Re:In Java's case ... by Atzanteol · · Score: 1, Insightful

      Ugh. You must *love* casting variables... This would drive me nuts. It also removes the ability of an IDE to know member fn's/vars, as well as the ability of anyone to read your code...

      --
      "Ignorance more frequently begets confidence than does knowledge"

      - Charles Darwin
    14. Re:In Java's case ... by cakoose · · Score: 1

      Generics will take care of the syntatic part but templates are much faster (though they produce a lot of code).

    15. Re:In Java's case ... by cakoose · · Score: 1

      Many functional programming languages have template-like features that are absolutely essential.

    16. Re:In Java's case ... by HuguesT · · Score: 4, Insightful

      I was going to moderate, but there you go.

      Because it forces down your throat the concept that everything is an Object. Many people find this counter-productive as object-oriented programming is only well adapted to a subclass of problems (and trying to use that methodology when it just doesn't work is downright ugly).

      Besides inheriting from Object does not solve the same problem as templates do. Templates are super-macros designed for fast runtimes. Universal object orientedness with default virtual methods causes extra overhead that C++ programmers want to avoid a lot of the time.

      Notice that single-object-derived libraries for C++ exist, for example the NIH library, but that they were never as successful as the STL is.

      Inheriting from Object only solves the absence of multiple inheritance in Java.

    17. Re:In Java's case ... by HuguesT · · Score: 1

      Is 1.5 out yet? Can I try it?

      Don't take this personnally but some time ago all the Java programmers were saying "Templates, we don't need no stinking templates!". Mind you C++ programmers were saying "Garbage collection, are you kidding, what on Earth for" at the same time.

      Basically C++ and Java are going to end up pretty much the same a few years from now.

    18. Re:In Java's case ... by HuguesT · · Score: 1

      I take it you've never seen an ADA program with generics or never heard of ML?

      I don't understand what you mean. C++ did very well for a very long time without templates back in the days where OO was the rage. Then they were invented and made standard, and now they are useful since generic and template metaprogramming is the new fashion.

      Because Java does not have templates they are not useful in that language? what kind of tautology is that?

    19. Re:In Java's case ... by cakoose · · Score: 1

      Yes there is, and it's called void*. It's not exactly polymorphism but C programmers do just fine with it.

      C++ templates, howerver, speed things up and let you have collections that actually store the data instead of point to dynamically allocated memory. Templates also get rid of unnecessary type casts (which, in Java, are almost always the same as the slow dynamic_cast from C++).

    20. Re:In Java's case ... by pyrrho · · Score: 1

      except they can't compile away to no-overhead.

      right?

      in C++ templates are compile-time magic, which is nice... see Blitz++ for examples why.

      --

      -pyrrho

    21. Re:In Java's case ... by pyrrhonist · · Score: 1
      How big is that JIT compiler, JVM, and the rest of the runtime?

      The total size of Sun's implementation of the JRE (JVM+libraries) on Linux is about 55M, which is comparable to other interpreted languages.

      My app has to fit into 64K bytes. I can do that with C and C++;

      I can do that with Java.

      any baggage (like the compiler!) remains on my development machine.

      The compiler also remains on the development machine in the case of Java.

      --
      Show me on the doll where his noodly appendage touched you.
    22. Re:In Java's case ... by Anonymous+Brave+Guy · · Score: 2, Insightful
      Having everything (with the exception of native datatypes that can be wrapped into classes) be a descendant of a superclass is a far more elegant solution than using c++'s hackish and syntactically awkward template feature.

      Of course it is. That's why Java's adding generics now, I guess: to fix the loopholes that approach didn't cause.

      Not everything is an Object; didn't you first textbook tell you?

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    23. Re:In Java's case ... by the_2nd_coming · · Score: 1

      just because Java is a more safe language that makes you use readable form doe snot mean it is less powerful.

      --



      I am the Alpha and the Omega-3
    24. Re:In Java's case ... by pyrrho · · Score: 1

      roflmao

      --

      -pyrrho

    25. Re:In Java's case ... by Anonymous+Brave+Guy · · Score: 2, Interesting

      I don't think C++ programmers have ever underestimated the value of garbage collection; Stroustrup mentions it himself in several relevant texts, and garbage collectors have been available for C++ for years, for those who want them. Of course, garbage collection isn't nearly so important in a language with automatic variables and deterministic destruction, which is probably why few people actually use those libraries.

      C++ and Java will never be the same language, or even close. They are aimed at two different markets, they have different strengths and weaknesses adapted to those markets, and it's rather unlikely that those markets will converge. The similarity pretty much ends at syntax and basic OO concepts.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    26. Re:In Java's case ... by Anonymous+Brave+Guy · · Score: 4, Insightful

      In C++, casts are rarely necessary. When they are, tools like dynamic_cast allow for the same useful run-time type checking as Java et al support.

      In Java, you can't even pull an object out of a container without a cast, and you can't even use a basic type in a generic container without some sort of wrapper object.

      In C++, the RAII idiom lets you ensure the safe release of any resource type. In Java, you have to write the same finally blocks all over just to make up for the fact that finalizers don't work.

      Java is "more safe" than C++?

      Now that was funny.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    27. Re:In Java's case ... by Anonymous Coward · · Score: 0

      Smalltalk...

    28. Re:In Java's case ... by yanestra · · Score: 1

      C++ requires templates because its early linking schema. It's impossible to make e.g. a simple list base class which all other list classes inherit from.

    29. Re:In Java's case ... by SparafucileMan · · Score: 1

      The same thing, and then some, is also available in CLisp. Nevermind being easier to code, easier to read, easier to debug, easier to port, and, while we're talking about byte code compilers, Clisp has some damn fast compilers out there, equivilent to C and C++ speeds. ;)

    30. Re:In Java's case ... by Javagator · · Score: 1

      Exactly. C++ would not be nearly as powerful without templates, but Java's object model makes templates unnecessary. However, many of us have been taught that casts are a Bad Thing, so templates are being added to assuage our guilt.

    31. Re:In Java's case ... by pyrrhonist · · Score: 5, Insightful
      Did you ever stop for a minute and think that you're doing it wrong, and that there was probably another way to do what you want?

      What many C++ programmers fail to recognize is that Java and C++, though similar, are not the same language, and the paradigms they use in C++ will not work in Java.
      Good programmers learn the new paradigms, bad ones simply criticize that it doesn't work the same.

      --
      Show me on the doll where his noodly appendage touched you.
    32. Re:In Java's case ... by Anonymous Coward · · Score: 0

      Yes Learn to Spell.

      Overload + with a Word: Add for example.

      Like this is the Killer feature you can't do without.
      Give me a break.

    33. Re:In Java's case ... by Geek+of+Tech · · Score: 1
      > What many C++ programmers fail to recognize is that Java and C++, though similar, are not the same language

      Dang. So that's why I can't get my C compiler to compile Java! I thought it just couldn't handle the extra caffination!

      --
      Stop the Slashdot effect! Don't read the articles!
    34. Re:In Java's case ... by Geek+of+Tech · · Score: 4, Funny
      > Not everything is an Object; didn't you first textbook tell you?

      I never got around to that... my textbook was an object.....

      --
      Stop the Slashdot effect! Don't read the articles!
    35. Re:In Java's case ... by pyrrho · · Score: 4, Interesting

      but you have to remember that C++ is designed to open up the power of the machine to you, not make you think a particular way or be magical for you.

      The onus is on the "our language does it for you" crowd because you were not supposed to say "oh, you have to understand how the VM is working"... right?

      Of course, in the end, all languages will have to tell us this "oh, yes, well, you have to know something". Of course you do! It will always be this way.

      So choose the most efficient and effective language for you and learn it well, learn a different one if called for, etc.

      At least, I take this to be apparent.

      PS: "pyrrhonist"... right on!

      --

      -pyrrho

    36. Re:In Java's case ... by willtsmith · · Score: 1

      If you WRITE a bunch of code (mostly to facilitate typecasts) to incorporate a pre-built algorithm/data structure, isn't that code bloat. The difference is you had to spend a couple hours to bloat the code instead of the compiler doing it for you in a second.

      --
      -------- -------- Support Wesley Clark for president!!!
    37. Re:In Java's case ... by willtsmith · · Score: 1

      I remember in MSVC++ 4 using a TEMPLDEF tool. Basically I wrote my structures in a generic format and TEMPLDEF would generate any instantiation I needed.

      Tools do take a bit of time to evolve. Sun has done a good job (not a GREAT one) with Java. I trust they'll do a decent job with generics.

      Though, I believe that the C# implementation will be much, much better. Eventually, you'll probably see VB.net and other .net languages supplying access to IL/CLR generics mechanism.

      --
      -------- -------- Support Wesley Clark for president!!!
    38. Re:In Java's case ... by willtsmith · · Score: 1

      Inheriting from Object only solves the absence of multiple inheritance in Java.


      Actually, it doesn't solve that problem at all. It allows the JVM to allocate and manage stuff in a generic way. In C# it allows you to attach some methods to ALL objects. It also for easy implementation of reflection and RTTI.

      Just because something is an object, it doesn't mean it has to have a v-table (unless your programming Java in which all methods are virtual).

      --
      -------- -------- Support Wesley Clark for president!!!
    39. Re:In Java's case ... by willtsmith · · Score: 1

      Goslings attitude:

      don't need that, don't need this, I don't like that, you can simulate x using y, etc...

      The result was the need for C#.

      Java is a simple langauge that is probably a reaction to the byzantine complexity of C++. Now if we can only convince Microsoft to put checked exceptions (optional) into C#.

      --
      -------- -------- Support Wesley Clark for president!!!
    40. Re:In Java's case ... by willtsmith · · Score: 1

      Generic algorithms in Java aren't typesafe. Thats the whole point of not using (void *).

      i.e. they defeated the point.

      --
      -------- -------- Support Wesley Clark for president!!!
    41. Re:In Java's case ... by pyrrhonist · · Score: 3, Interesting
      but you have to remember that C++ is designed to open up the power of the machine to you, not make you think a particular way or be magical for you.

      I guess any language ends up indirectly making you think in a different way. Maybe that's the magical part.

      The onus is on the "our language does it for you" crowd because you were not supposed to say "oh, you have to understand how the VM is working"... right?

      Well, my point was that the languages are different in more ways than many C++ programmers (or Java programmers) realize. For instance, many C++ programmers think that finalize methods are destructors, and many of them use finalize incorrectly because of this. Then some of these programmers choose to complain loudly about Java, when the problem lies with them. They need to learn a new paradigm or their programs will continue to function incorrectly. There are definitely best practices in C++ that are bad ideas in Java.

      Obviously, this works in reverse, too. You can't go from Java to C++ without changing your thinking as well. Many Java programmers have made this mistake.

      Of course, in the end, all languages will have to tell us this "oh, yes, well, you have to know something". Of course you do! It will always be this way.
      So choose the most efficient and effective language for you and learn it well, learn a different one if called for, etc.

      Yeah, I agree. I use languages as a tool, not a crutch. If I see a problem that is better represented by Perl than Java, I'll use Perl. Or Python, or 6502 assembly...

      PS: "pyrrhonist"... right on!

      I like yours too. Pyrrho was cool.

      --
      Show me on the doll where his noodly appendage touched you.
    42. Re:In Java's case ... by Anonymous Coward · · Score: 0

      Not everything is an Object; didn't you first textbook tell you?

      From the parent post:

      Having everything (with the exception of native datatypes that can be wrapped into classes) be a descendant of a superclass

      The generics being added to Java are syntactic sugar for the approach suggested by the OP, ie they provide another way to express functionality already present in the language. In fact they don't even do away with the expensive casts, which could improve performance, in the actual implementation, although this could be fixed without changing the language spec.

    43. Re:In Java's case ... by cakoose · · Score: 2, Informative

      Um...do you know how templates work? I'm not talking about typecasts when I say "lot of code". I'm talking about the almost identical copies each template function (usually, the only difference is a tiny comparison operation).

      Now...I wouldn't consider the extra code to be a fault of template programming, since I can't think of a better solution that would be as fast (time-space, my friend). Templates don't even force you to have the extra code either, but libraries like the STL make use of the feature to speed things up.

    44. Re:In Java's case ... by cakoose · · Score: 1

      Does generics on VB.Net even make sense? If you don't want to bother with casts, can't you just declare a generic variable that can hold anything? And if you want speed, don't use VB.Net as it is clearly not designed for that.

    45. Re:In Java's case ... by zyridium · · Score: 1
      Overload + with a Word: Add for example.

      And how good would that be for strings, or integers?

      If operators are not necessary, then Java shouldn't need them for 'magical' things either...

    46. Re:In Java's case ... by Anonymous Coward · · Score: 0

      Right or wrong, who cares?

      RAII is great for releasing resources (memory, files, etc) based on scope.
      There is currently no way to do these things smoothly in Java (That's why you have to close your ResultSet's manually when done instead of waiting for the GC to free them).

      Operator Overloading would on the other hand, as i think Bruce Eckel once said, be much simpler to implement and use in Java, thanks to the GC.
      And i can't for my life see how this:
      value = new BigDecimal("1.2");
      value.add(2.5);

      is better or simpler than this:
      value = new BigDecimal("1.2");
      value += 2.5;

    47. Re:In Java's case ... by Anonymous Coward · · Score: 0

      C++ has templates partly because the early containers, either always used a Object base class and where not typesafe, or had to be subclassed for every type you would ever wan't to use them with.

      Further, templates let's you break out of deeply nested inheritance hierarchies and use classes based on signature or allowed operations instead of ineritance.

      I'm curious to how you'd go about writing a sort function that works for every type, including primitive ones, specialized with optimizations for certain types and that is easy to use.

      Can't be done without some kind of templates (In any language!).

    48. Re:In Java's case ... by Anonymous Coward · · Score: 0

      I'd argue that your statement says more about Java's object model than templates.

      However, i agree that the Java designers seem a bit confused when it comes to the concepts behind the language.

      Casts are a pain in the ass compared to using concrete types from the beginning and having the compiler check it for you.

    49. Re:In Java's case ... by Anonymous+Brave+Guy · · Score: 1

      If you'd taken the time to read any of my other posts, you'd realise that I do understand the differences between C++ and Java. I have even commented in this thread on their superficial similarities and real differences, and the need to use each as it was intended.

      Nevertheless, I stand by my original point. You do need an excessive amount of casting in Java (1.4), which is inherently less safe than the alternatives offered by numerous other languages (not just C++).

      Similarly, you do need to use finally an excessive amount because Java's garbage collection mechanism is only good for avoiding memory leaks, not resource leaks in general.

      If you have some technique or idiom for avoiding these problems, please share it, because I'm sure a lot of Java programmers would like to hear it.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    50. Re:In Java's case ... by dspeyer · · Score: 1
      An object class is not as powerful as templates. Consider: (apologies for syntx errors

      class foo{...}
      class bar{...}
      int f(foo){...}
      int f(bar){...}
      void x(Object o){

      int tmp=f(o); //Illegal, and you can't cast around it!
      }

      Yess, you could make foo and bar implement some interface, but the complexity costs quickly go through the roof. Yes, you could auto-generate that code (and they said Java was high-level!) but not for library classes. Yes you could wrap those, but this is getting really ugly, with so much code generation you may as well just write in python or something.

    51. Re:In Java's case ... by fredrik70 · · Score: 1

      So how would one go on and extract data from a container in java without all these endless casts?

      Generics is a thing java has been sorely lacking since it's birth, thank god they're getting it now at last! (yes, I do code java for a living)

      --
      if (!signature) { throw std::runtime_error("No sig!"); }
    52. Re:In Java's case ... by arkanes · · Score: 1

      wxWindows (since it pre-dates templates) has a macro-based typesafe container system where the macro generates a trivial, inlined, typesafe wrapper around a generic storage object that works on void *'s. You could probably use a similiar approach with an STL implementation - most of the code wouldn't be duplicated that way.

    53. Re:In Java's case ... by deanj · · Score: 1

      1.5 will be out in beta by the end of the year. If you want to mess with Generics, they've been available for more than a year. You can get the implementation here

    54. Re:In Java's case ... by Anonymous Coward · · Score: 0

      And Java programmers attempt to rationalize away any claims that the language isn't as powerful as X.

    55. Re:In Java's case ... by Anonymous Coward · · Score: 0

      > Having everything (with the exception of native
      > datatypes that can be wrapped into classes) be a
      ? descendant of a superclass

      You misspelled void*. Casting to an Object is the same stupid hack.

    56. Re:In Java's case ... by StillNeedMoreCoffee · · Score: 2, Interesting

      "Inheriting from Object only solves the absence of multiple inheritance in Java."

      I beg to differ the inheritance from Object has nothing to do with the mulitiple inheritance problem with C++. Interfaces in Java which allow you to define the functionality of a type without the conconmitant problems with name ambiquities of commonly inherited instance variables.

      The common Object class comes from Smalltalk where Object Oriented programming stems. It allows truely generic collection classes. That allows them to be written once and re-used as any ADT should. The generics added to Java allows the programmer to take advantage of the strong typing (they could with downcasting), and the re-use of the library. If you are concerned about code size. You could have an application in C++ with say 100 queues. With the template system in C++ you would have 100 different classes each implementing a queue. A major waste of runtime realestate. So Templates are not free.

      Template solve the problem that C++ had before templates, You had little or no code reusue because of the strong typing. If you wrote a Queue, you had to copy and modify it to create a int queue or a queue of your own object types. This was very cumbersom and a major hole in the languages capabilities when it first came out. Without templates the language was not very useful. C++ did not have reflection until later either. So its OOPs capabilities were crippled at the start and patched.

      It is true that C++ is usually used for non-oops or hybrid code that is designed to minimize overhead. There is a large class of problems, a very large class of problems that lend themselves to an OOP's approach. It depends on the job your in. You may just be solving problems that need extreme tuning. You probably just don't see the rest of the world.

      The power of the OOPs model is similar to the power of Databases. When Databases first came in, they were hugely expensive and very slow. But the problem that they solved, that is disconnecting the logical interface from the physical implementation made companies adopt DB's even then. They were spending more time maintaining old "tuned" code that they were not able to get anything new done. Then IT took off because they had a model for data that was more expressive and safer and more maintainable and robust. OOPs is the same model for programs and has the same benefits. It is much more cost effective to write something as ADT's and buy faster hardware than to code in a less maintainable form on slower machines, certainly for the long term it is many orders of magnitude better.

    57. Re:In Java's case ... by SatanicPuppy · · Score: 1

      Casting is ITSELF a safety measure. One of the easiest ways to exploit VB is to feed it binary executable data; it doesn't care. Java throws out ANYTHING that's not exactly what it's looking for.

      Wrappers are also safety features. Basic types are called "Primitives" for a reason.

      You're not talking about anything but potential memory leaks, which has nothing to do with safety or security.

      Sounds like the same crying everybody gives when they have to learn java for the first time. Just because you've got sloppy programming habits doesn't mean it's a bad language. And after having to warp my brain to figure out damn pointers, I've no sympathy if you can't get casting and garbage collection.

      --
      ad logicam Claiming a proposition is false because it was presented as the conclusion of a fallacious argument.
    58. Re:In Java's case ... by DimGeo · · Score: 1

      You must *NOT* rely on filanizers to do the clean-up. That is a bad Java practice. You should use try-finally blocks for that:
      InputStream fileIn = new FileInputStream("test.txt");
      try {
      in = new BufferedInputStream(fileIn, 1024 * 8);
      doSomeReading(in);
      } finally {
      fileIn.close();
      }
      Otherwise yes, I agree typecasts are a nuisance and that probably it is better to use a compiler that adds them for you. But adding generics on a VM level would break the compatibility with 1.1.8 on which many small embedded devices rely today.

    59. Re:In Java's case ... by cakoose · · Score: 1

      If there isn't much duplicated code, it's probably slower than templates. The wxWindows solution seems like it is more like Java's Generics than C++'s templates.

    60. Re:In Java's case ... by Anonymous+Brave+Guy · · Score: 1
      You must *NOT* rely on filanizers to do the clean-up. That is a bad Java practice.

      Yes, I know, thanks. Actually, relying on finalizers to do anything is a bad idea, given the lack of guarantee about when they will (not) run. In fact, they're a rather pointless feature, possibly useful for diagnostic purposes but not much else.

      You should use try-finally blocks for that:

      Yes. And that means that every time you use a resource, you must wrap the use in a try block and remember to add a finally section to release the resources. This frequently means duplicating the same resource release code everywhere -- assuming you never forget it, since you've got a serious bug if you do.

      This is not safer than the high-level alternatives, or even than RAII in C++.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    61. Re:In Java's case ... by willtsmith · · Score: 1

      I do see your point.

      However, the dearth of the pure generic variable is that there is no type safety. This is effectively the same as using (void*) for everything.

      Yes a developer could implement a generic algorithm quite easily. However, the compiler is unable to check wether the objects used will work properly.

      A VERY good rule in programming is to prefer compile time errors over run-time errors. Generic variables like (Object), Var, (void*) don't facilitate this. Even the in c++ is a run-time decision. Generic algorithms/data structures(called collections now I guess) do facilitate type safety at compile time which saves a LOT of time down the road.

      BTW, lest anyone think I'm a Microsoft zealout, I like Java's checked exceptions better than the C++ style exceptions. Once again it enforces a compile time constraint and forces a developer to think about robustness while writing code instead of as an afterthought.

      --
      -------- -------- Support Wesley Clark for president!!!
    62. Re:In Java's case ... by Anonymous+Brave+Guy · · Score: 1

      I love replies like this. For some strange reason, you assume that because I know about C++, I don't know about Java, or I expect one to behave like the other. You are mistaken.

      In fact, if you take a step back and look again, you'll see that the resource management issues to which I alluded go far beyond memory leaks. They also encompass closing files, releasing locks in multi-threaded apps, closing database handles, closing sockets, etc. Garbage collection, as provided by Java, doesn't help at all with these things, and that considerably limits its use and reduces the potential safety benefits for real world code.

      As for why wrappers around primitives are "safety features", I'm afraid you've got me there. How is requiring a wrapper to make them fit into the type system cleanly improving safety? Dozens of other languages manage just fine without.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    63. Re:In Java's case ... by StillNeedMoreCoffee · · Score: 1

      "In Java, you can't even pull an object out of a container without a cast, and you can't even use a basic type in a generic container without some sort of wrapper object."

      The Java generics solves this problem in a true type safe way (not a macro expansion such as Templates).

      "In C++, the RAII idiom lets you ensure the safe release of any resource type."

      This was a later add on to C++ and patched a serious hole in the language.

      "Java is "more safe" than C++?"

      C++ safe? now that is funny.

      Any language that can't be reasonablly coded without the use of a profiler that checks for memory leaks. Any language that does array checking by giving you an run time error pointing to Georgia. Any language that makes you walk hunched over, with one hand behind your back, and your shoes on the wrong feet so your programs don't blow up. C++ requires a much deeper knowledge of the quirks of the language, of the storage scheme before you can get any program to compile. It is said that it takes maybe 18 months of programming before a C++ programmer is any good. I suspect the pride in the language is more pride in the programmer's archane knowledge of how to get the language to do anything. Programming is not hard, it can be complex, but a language like C++ can make it hard, especially large complex projects.

      And give me Java's automatic garbage collection any day (Smalltalks for that matter). That alone saves millions of dollars in programmers time right there. Just think if you didn't have to worry about all those problems. Your code would be orders of magnitude "safer".

    64. Re:In Java's case ... by Anonymous+Brave+Guy · · Score: 1
      The Java generics solves [the type safe container] problem in a true type safe way (not a macro expansion such as Templates).

      Yes, Java needs generics to catch up with where the rest of us have been for years. And no, C++ templates aren't just a macro expansion -- please see my other post in this thread on why that's a fallacy. Not that it's relevant anyway, of course, since C++ templates are a type-safe solution to the problem too, and that was the goal.

      RAII was a later add on to C++ and patched a serious hole in the language.

      Um... No. Do you know what the RAII idiom is?

      Any language that can't be reasonablly coded without the use of a profiler that checks for memory leaks. Any language that does array checking by giving you an run time error pointing to Georgia. Any language that makes you walk hunched over, with one hand behind your back, and your shoes on the wrong feet so your programs don't blow up. C++ requires a much deeper knowledge of the quirks of the language, of the storage scheme before you can get any program to compile. It is said that it takes maybe 18 months of programming before a C++ programmer is any good.

      I could expose every sentence above for the myths that they are, but why bother? If you want to learn the basic C++ techniques to write programs without memory leaks and random pointer problems, just go buy a decent introductory textbook.

      I've worked on very large C++ projects, and I claim with some confidence that I don't introduce either memory leaks or random pointer errors in my code. I do this by using sound C++ programming practices. And yes, I do use tools like Purify to make sure that I'm getting it right. And yes, I am.

      To someone who bothers to do their homework, C++ is a safer language than Java in many ways. They usually come down to the same thing: substituting a powerful idiom that you have to write once for a "simple" solution that you have to remember every time you use it.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    65. Re:In Java's case ... by Anonymous Coward · · Score: 0

      My app has to fit into 64K bytes...

      I can do that with Java.


      Interesting. What tools do you use, and for which processor core? My impression of the available embedded Java systems is more along these lines:

      http://www.onjava.com/pub/a/onjava/synd/2001/08/ 15 /embedded.html

      "The Prechelt study determined that the average memory requirement of a program written in Java is two to three times greater than for one written in C/C++. Even the compact nature of bytecode, usually about 50 percent smaller than compiled C/C++ machine code, can't offset that overhead. Recognizing that trying to drop Java in its original, desktop-oriented form into embedded systems won't work, Sun Microsystems, Java's originator, took the language through several evolutionary steps in an effort to tailor it to the embedded environment. Today, the Java 2 Platform, Micro Edition (J2ME), represents the latest, most evolved, and slimmest version of Java for the embedded space.

      You can trim J2ME by eliminating classes and code components that aren't needed for your application. The JVM, native libraries, core classes, and application bytecode go into ROM. JVMs for embedded applications generally run under 500 kB, whereas class libraries for J2ME typically don't exceed 1.5 MB. Java components that affect RAM requirements include the JVM (for bytecode execution), the potential dynamic compiler, the Java heap, and the number of threads (the latter two obviously depend on the application). Executing as much of the application as possible using an interpreter -- while maintaining acceptable execution performance -- helps contain the memory footprint."

      Perhaps I should clarify that by "application", I mean every stich of code needed to make the system perform from a cold reset of the processor. That includes any run-time overhead, not just bytecode.

      Sometimes you see systems marketed like this:

      http://www.ibutton.com/TINI/software/index.html

      where the system requires some custom hardware support. In fact, there's a meg of flash and RAM out there to allow the device to have a mere 40K impact on your real application. Pushing the JVM onto another processor doesn't count; you've still got to buy the bits and cycles to make it go. ARM's "Jazelle" for the 940 at least integrates the two, but if you've got a ARM940 you're probably already in the multi-megabyte app size anyway.

      It seems like going to a lot of trouble just so you can say "I wrote it in Java". Where's the real advantage?

    66. Re:In Java's case ... by StillNeedMoreCoffee · · Score: 1

      "Do you know what the RAII idiom is?"

      Yes sorry I was in a hurry and was thinking of the RTTI which was added to C++ to allow objects to be self aware and thereby programs to utilize this fact.This follows the purer Smalltalk objects know not only what to do but who they are philosophy.

    67. Re:In Java's case ... by Magius_AR · · Score: 1
      Good programmers learn the new paradigms, bad ones simply criticize that it doesn't work the same.

      Damn, you really are caught up in all the new fangled hype aren't ya? I laughed out loud at this. To which I retort:

      Good programmers realize that "paradigm" is a buzzword meant only for managers to sound smarter than they really are.

    68. Re:In Java's case ... by pyrrhonist · · Score: 1
      Good programmers realize that "paradigm" is a buzzword meant only for managers to sound smarter than they really are.

      Alright, fine. This may be easier for you to understand:
      Yo, beeyatch! Yo best be down wit the new snootch else I put a cap in yo ass!

      --
      Show me on the doll where his noodly appendage touched you.
    69. Re:In Java's case ... by arkanes · · Score: 1

      It's inlined, so it's as fast as using the generic containers directly. The macros just create typesafety. All the work is done at compile time.

    70. Re:In Java's case ... by pyrrhonist · · Score: 1
      So how would one go on and extract data from a container in java without all these endless casts?

      I wrap all my generic containers in types that perform specific operations on the type I wish to contain.
      There's a lot of advantages to doing this:

      • It's more object-oriented.
      • You end up with a single cast inside the object which contains the generic container.
      • You get compile-time type checking.
      • It's easy to make drastic changes to the container implementation without having to recode the client.
      This is more than making a simple wrapper class, and thus I do this in C++ as well (even with templates).
      If you find this detestable, you can also use Generic Java.

      Generics is a thing java has been sorely lacking since it's birth, thank god they're getting it now at last! (yes, I do code java for a living)

      I agree. Unfortunately, it will probably be abused. :(

      --
      Show me on the doll where his noodly appendage touched you.
    71. Re:In Java's case ... by pyrrhonist · · Score: 1
      You do need an excessive amount of casting in Java (1.4), which is inherently less safe than the alternatives offered by numerous other languages (not just C++).

      I do an excessive amount of casting in C++, because many things return a void*.

      I'm assuming that what you're referring to is lack of templates in combination with the generic containers in java.util.
      Did you ever think for a minute that you're actually using them wrong?

      Similarly, you do need to use finally an excessive amount because Java's garbage collection mechanism is only good for avoiding memory leaks, not resource leaks in general.

      I'm not really sure why you think that the garbage collector should help you with resource deallocation.
      Java doesn't have destructors. Are you trying to use finalize() as a destructor? That's not what it's for.
      It's a last resort mechanism, which is the reason why uncaught exceptions get ignored in finalize methods.
      In Java, you explicitly tell an object that you are done using it, and then null out the reference.
      That seems pretty straightforward to me.

      What is so horrible about the finally block? It should make your code smaller, not larger.

      If you have some technique or idiom for avoiding these problems, please share it, because I'm sure a lot of Java programmers would like to hear it.

      These can help:

      • Effective Java - Joshua Bloch
      • Java 2 Performance and Idiom Guide - Craig Larman, Rhett Guthrie
      --
      Show me on the doll where his noodly appendage touched you.
    72. Re:In Java's case ... by BlackHawk-666 · · Score: 1

      *sniff* I really miss those old destructors in c++, they were the shitznik. This new model of garbage collection "when I damn well please" will never catch on ;->

      --
      All those moments will be lost in time, like tears in rain.
    73. Re:In Java's case ... by BlackHawk-666 · · Score: 1
      Any language that can't be reasonablly coded without the use of a profiler that checks for memory leaks.

      The power of C++ comes at a cost, and that cost is that you must program carefully and responsibly. I agree with your sentiment, you must run a profiler (Bounds Checker or the new fancy DevPartner) on your code to be sure it is all tickity boo, but once you have done that you have a fast, lean, well tuned piece of code. Well, you can have if your programming skills are up to it. It's a dangerous language for the many hobbyist programmers who fill professional positions in companies, but is quite safe in the hands of an expert.

      I write code that has to perform, and has to do that 24/7/365 without errors, and for me C++ is the only reasonable and sane solution.

      Any language that does array checking by giving you an run time error pointing to Georgia.

      Well tested code will not have an amatuer mistake like this in it.

      Any language that makes you walk hunched over, with one hand behind your back, and your shoes on the wrong feet so your programs don't blow up.

      This is just so not true. C++ is a fully fledged language which requires discipline to write quality code in, but offers the most flexible and full solution to hardcore coding problems. We may need to jump through a few hoops for string handling on the MS platforms (MS, you really did drop the ball on Win32 string/unicode handling...fucking awful...really) but really that is my only major complaint with the language.

      C++ requires a much deeper knowledge of the quirks of the language, of the storage scheme before you can get any program to compile.

      A simple hello world is no harder in C++ than in VB, etc.

      It is said that it takes maybe 18 months of programming before a C++ programmer is any good.

      Yep, it can take this long and longer, but it's well worth the effort.

      I suspect the pride in the language is more pride in the programmer's archane knowledge of how to get the language to do anything.

      Seriously dude, C++ is just not that hard a langauge to learn. Give it a go some time, it's good stuff. What I found hard was learning, and then constantly adding to the list of Win32 API calls. MS does not rest on it's laurels when it comes to creating new APIs.

      Programming is not hard, it can be complex, but a language like C++ can make it hard, especially large complex projects.

      Put too many inexperienced programmers onto a C++ project and you have a recipe for disaster...more so than if you did that on a Java/C#/VB project, but I still don't think it's that bad. Ok, the ATL stuff is abysmal, and strings are awful, but those are mainly Windows issues. C++ under Unix is still a beautiful thing to behold.

      And give me Java's automatic garbage collection any day (Smalltalks for that matter). That alone saves millions of dollars in programmers time right there. Just think if you didn't have to worry about all those problems. Your code would be orders of magnitude "safer".

      I can't say I'm a fan of a "method" of garbage collection that forces a dispose/finalise/etc pattern onto the programmers. It's a step forward from malloc/free, but not far. Good C++ programmers always match their mallocs with their frees, and write both at the same time to avoid the possibility of forgetting one.

      All in all I feel the sheer power and control that one gains from C++ more than makes up for it's difficulty...and yes, we C++ programmers are proud, but that's because the goods ones have reason to be proud :-)

      --
      All those moments will be lost in time, like tears in rain.
    74. Re:In Java's case ... by cakoose · · Score: 1

      Ok...but can containers hold anything besides pointers (or other values that are less than or equal to pointers in size)?

    75. Re:In Java's case ... by BlackHawk-666 · · Score: 1
      I find it kind of funny that all the Java programmers hang crap on the C++ for having to free their resources, but the Java crowd have to do the same thing, only without a destructor. Nowadays, in our shop anyway, non-memory related resources are far more common and need to be disposed of in a timely manner e.g. database connections.

      Ironic, now the language has moved to the point that it deals adequately well with the problems of the 80/90s we find ourselves with a new set of related problems that it doesn't handle very well at all.

      --
      All those moments will be lost in time, like tears in rain.
    76. Re:In Java's case ... by BlackHawk-666 · · Score: 1

      Bahahaha, well that's my paradigm shift for today. Time to go leverage some synergies now.

      --
      All those moments will be lost in time, like tears in rain.
    77. Re:In Java's case ... by arkanes · · Score: 1
      It's an implementation detail. The containers hold pointers, the typesafe layer can make it look like you're holding an object, though. There is a memory waste, of course. Some STL implementations have the same problem. Can't have everything.

      The STL is a cleaner, more powerful solution, I won't argue that - the wxWindows macro-based solution pre-dates the existence of the STL, never mind working compiler support - but it does have a downside that lots and lots of almost-identical code is generated.

    78. Re:In Java's case ... by fredrik70 · · Score: 1

      Yes, that's an idea. Seems like a bit of 'overkill' those time when you really just need a List or a HashMap or other container, even if it should clean up the code a fair bit.
      Yes, looked into Generic Java, we're not allowed to introduce any meta/pre compilers into our toolchain though at work, so I got to wait until 1.5. At home I prefer c++.

      --
      if (!signature) { throw std::runtime_error("No sig!"); }
    79. Re:In Java's case ... by Anonymous+Brave+Guy · · Score: 1
      I do an excessive amount of casting in C++, because many things return a void*.

      Really? In my experience, almost nothing uses a void* in C++. It's used occasionally in system call APIs, but rarely elsewhere. Templates have rendered it pretty academic in most other contexts.

      I'm assuming that what you're referring to is lack of templates in combination with the generic containers in java.util. Did you ever think for a minute that you're actually using them wrong?

      You keep implying that I don't understand Java, without giving any supporting reasoning. This isn't very constructive, not least because you're way off-target in guessing my Java experience. Why do you think that I think finalizers are supposed to be destructors? Why do you think I don't know how to do resource management properly in Java? Why do you think I don't understand what finally is for?

      OK, getting back to the point, how do you propose to store a set of Apples and pull them out of the container without casting in (pre-generics) Java? What is it that I, my colleagues, pretty much every book on Java I've ever read and Sun's own Java web site are all missing?

      In Java, you explicitly tell an object that you are done using it, and then null out the reference. That seems pretty straightforward to me.
      What is so horrible about the finally block? It should make your code smaller, not larger.

      Java's manual resource management is indeed straightforward. It is also error-prone and a waste of effort. C++ moved past this years ago with RAII. Similar idioms are evident in many other languages: a resource-controlling wrapper is a standard example in LISP. With these idioms, write your resource release code once, and then get it for free every time you use the resource, without writing any more code at all. In Java, you have to remember to write a finally block and get it right every time you use a resource. The alternatives are safer, and require less code to use, than finally blocks.

      As for the magical techniques we're all missing -- don't you think some of us might have read those books you mentioned?

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    80. Re:In Java's case ... by HuguesT · · Score: 1

      Honestly I believe the two languages will converge. Java is already used for scientific calculations for example. A few years ago that would have been unthinkable due to the non-standard floating point and the very poor speed, but both have been fixed to a tolerable extent.

      Now you find Java compilers that don't require a JVM (they compile to native object code). In a few years time one will be able to write an O/S in Java.

      I think the next round of C++ standardisation will include more Java-like features, such as standardized threads for example. With STL it has been possible to write good efficient C++ without using a single pointer.

    81. Re:In Java's case ... by StillNeedMoreCoffee · · Score: 1

      " This is just so not true. C++ is a fully fledged language which requires discipline to write quality code in, but offers the most flexible and full solution to hardcore coding problems."

      It is a full fledged language and is an extension of C which revels in obfiscated C code contests. I feel that there is syntax to the language like the array notation that actually implies allocation so that the same notation can not be used when passing parameters. You know the char** is usually an array, but is it? Maybe not. So code written to accept array, or arrays of arrays has a lack of clear syntax for what is actually needed to be passed, even it terms of the type. I contend that an array "IS" a type where in C++ you can allocate one and and you can use one, but you cant tell your function that thats what your passing. It is this sort of issue that I find a linguistic problem with C++.

      The garbage collection issue problem comes up as a design issue. You have to decide who is responsible for deletion of an object. The problem comes up most severely because you can make different decisions about who has that responsibility and when someone else picks up your code and modifies it, because you found a better job somewhere else, they make a different decision and you introduce leaks that then require a thorough deep analysis of possibly the entire system to figure out what design decision were made so you can change them or change the decision you made.

      "All in all I feel the sheer power and control that one gains from C++ more than makes up for it's difficulty...and yes, we C++ programmers are proud, but that's because the goods ones have reason to be proud :-)"

      Yes the power is a heady thing and the cleverness we exhibit as programmers often only we can understand but keeps us warm againt the cold nights. But I am reminded of the lesson learned from Databases. They were much slower and much more costly than the petal to the metal fixed field record formats that programmers used prior to there introduction. But soon that cleverness became a moras of maintainece, new work all but stopped. The simpler, slower, more costly solution that introduced the seperation of the logical interface from the physical interface was adopted in a short period of time and almost overnight we were able to get back to the business of creating new systems.

      It was not a problem with creating the systems in the first place, those systems ran fine and were effient to the max. Small code, well designed for that model. But it was when changes started happening that things feel appart.

      I would say that the extreme expertise needed to program complex systems in C++ is a red flag, I would say the garbage collection problems with C++ is a red flag, I would say the need for profiling tools outside the language is a red flag, I would say that the ambiguities with the pointer semantics is a red flag, I would say that, as other commenters have talked about, the use/need to use Idioms to keep you out of trouble, is a red flag.

      Of course C++ is Turing Complete so anything you want to program you can. But for many applications it is I feel inappropriate. Hell I have seen people write screen controlled database application compilers in Cobol. But you go with what you know best I guess.

      Its a wonderful language, I have, my self, created wonderful and complex things with C++ but have moved on. My job is more about getting up systems that are 24/7/365 that also need to be able to be gotten up quickly, and cleanly, run in different envirionments without issue, and are easily changed, and run over networks. C++ is good for writting tools that need extreme perfomance, I can get away with getting bigger hardware and multi threading.

      Of course C++ is Turing Complete so anything you want to program you can. But for many applications it is I feel inappropriate. Hell I have seen people write screen controlled database application compilers in Cobol. But you go with what you know best I guess. Viva Le Differance (or however the French spell it)

    82. Re:In Java's case ... by pyrrhonist · · Score: 1
      Seems like a bit of 'overkill' those time when you really just need a List or a HashMap or other container, even if it should clean up the code a fair bit.

      Oh, yeah, definitely The initial thought is, "Why am I doing this again?" Then your performance engineer comes back and says, "It's too slow". That's when you realize that that one little wrapper will keep you from working the weekend.

      Oh, one more tip: Don't use the concrete types like HashMap to the left of a declaration and in method parameters, use an abstract type like Map. It'll save you some agony.

      we're not allowed to introduce any meta/pre compilers into our toolchain though at work

      Too bad. GJ + AspectJ + JUnit is a killer combo.

      I hear you, though, in '96, my boss wouldn't let us add the CGI module in Perl, even though that was the defacto standard. Even after CGI got added in as part of Perl, she still wouldn't let us use it. So I spent a lot of my time enhancing and fixing defects in our cgi library. :(

      Anyway...

      --
      Show me on the doll where his noodly appendage touched you.
    83. Re:In Java's case ... by Anonymous Coward · · Score: 0

      My new paradigm is to never again use the word paradigm in a sentence. Buzzwords act like an egg beater on my brain.

    84. Re:In Java's case ... by pyrrhonist · · Score: 1
      In my experience, almost nothing uses a void* in C++. It's used occasionally in system call APIs, but rarely elsewhere.

      Not in the core language, no. C++ inherits its runtime from C, though, so many important APIs return void*. So, I end up casting quite often for system related functions in C++ where in Java I don't.

      You keep implying that I don't understand Java, without giving any supporting reasoning.

      Alright, that's fair. I'll try to be a little more clear. That's not to say that I'm going to straight out give you the answer.

      This isn't very constructive, not least because you're way off-target in guessing my Java experience.

      Okay, I'll give you that. There are certain programming idioms that you use in C++, right? Do you use Java's idioms, or do you try to apply C++ idioms to Java?

      Why do you think that I think finalizers are supposed to be destructors?

      Maybe I shouldn't have assumed, but it's been my experience that when C++ programmers complain about Java while citing RAII, it usually means that they've tried to use a finalizer as a destructor. "They tried and failed?" "They tried and died."

      Why do you think I don't know how to do resource management properly in Java?

      Well, let me ask you this: What happens when you forget to close a FileInputStream? Why? What are Reference objects?

      OK, getting back to the point, how do you propose to store a set of Apples and pull them out of the container without casting in (pre-generics) Java? What is it that I, my colleagues, pretty much every book on Java I've ever read and Sun's own Java web site are all missing?

      If you use the generic containers, you need to cast, because the containers return an Object type. However, you only need 1 cast. Ask yourself, why isn't it a good idea to use generic container types directly?

      C++ moved past this years ago with RAII.

      And, C++ doesn't force you to use it. You can still screw it up too can't you? That's because it's an idiom. So by the same token, yeah, you can screw up Java idioms or not use them too, right? The point is, the languages have different idioms, and if you're going to use C++ idioms in Java you're going to have a bad time.

      With these idioms, write your resource release code once, and then get it for free every time you use the resource

      Which class do I inherit so my code can release any kind of resource without having to recode it specifically for that resource?

      In Java, you have to remember to write a finally block and get it right every time you use a resource.

      Hmmm, never noticed. Probably, because I don't use it every time, and it's not that easy to screw up.

      don't you think some of us might have read those books you mentioned?

      Well, did you?

      --
      Show me on the doll where his noodly appendage touched you.
    85. Re:In Java's case ... by fredrik70 · · Score: 1
      Oh, one more tip: Don't use the concrete types like HashMap to the left of a declaration and in method parameters, use an abstract type like Map. It'll save you some agony.


      Ah, yes, program with interfaces. I try to keep stuff as Collections, handy if you need to swap from an ArrayList to a HashMap or other.


      So I spent a lot of my time enhancing and fixing defects in our cgi library


      sounds like my last job (c++ stuff)and their home rolled xml parser, which could only handle ascii, great when ended up in need of unicode. Great place to work but they had a bit of the 'Not-implemented-here' attitude.
      Great way to learn how things work, but when there are industrial strength xml parsers out there - why not use them.
      That's one thing I love with java though, You will always find something in the standard libs that'll do the thing you want to do. Some call it bloat, but I rather see it as a helping hand.

      --
      if (!signature) { throw std::runtime_error("No sig!"); }
    86. Re:In Java's case ... by Anonymous+Brave+Guy · · Score: 1

      These posts are getting long, but I'll try to respond to each point you made.

      Regarding using void*, yes, some C interface APIs do use it, because C lacks templates. However, I maintain that it is rare to need it in C++ otherwise.

      Regarding the RAII vs. finally point, yes, I realise plenty of C++ programmers make the mistake of equating finalizers with destructors. That's wrong for two reasons, of course: you don't know if the finalizer will ever be called, and even if it will be, you don't know when, so it's an inappropriate method for resource release.

      Regarding casting, yes, of course you can (and probably should, in Java) write a type-safe wrapper around a generic container class. The point is that this is another requirement imposed on the programmer, whereas again in C++ it's handled by the language itself via templates.

      My general problem is with the claim that Java is safer when the common idioms are manual (use finally, write a type-safe wrapper, etc.) whereas C++'s common idioms are more automatic (RAII, templated container classes). Automatic is always going to be less error-prone; that's the fundamental benefit of GC.

      Now, to answer your specific questions, since I don't like ducking such things...

      If you fail to close a FileInputStream explicitly and you're lucky, then the finalizer will kick in when the stream object is GC'd and close it for you. If you're unlucky, and the finalizer never runs, you have a resource leak. Alas, even Sun's own material sometimes implies that the finalizer will always clean up, which is not a safe thing to do. :-( At any rate, it's much better practice to call my_stream.close() explicitly in a finally block when you're done with the stream.

      I mentioned the use of wrappers for generic container types, and my problem with the idea, above.

      There is no class you inherit in C++ to guarantee resource release. Instead, for each resource type you typically have a manager class, which would attempt to acquire the resource in its constructor, hold the resource handle in some internal data member, and release the resource in its destructor. Examples of this idiom are the fstream, string and vector types from the standard library.

      In each case, you just use these to access your resources, and never have to write the release code again. If the resource ownership is handled by whatever library supplies the resource -- and in decent libraries it invariably is -- then you never have to worry about the release issue at all, and you never have to write even a single line of release code yourself.

      And yes, I've come across the books you mentioned. I think I first met Bloch's book when someone was discussed the type-safe enum idiom, for example. Didn't someone later write a lengthy criticism demonstrating that that idiom wasn't so safe after all, though? Of course, if you used C++ you'd have automatic enum handling and not have to do it manually anyway, but... (Yeah, yeah, I know that a language with proper disjunctive types kicks C++'s ass, I'm just messing now.)

      There, I think that's everything... :-)

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    87. Re:In Java's case ... by pyrrhonist · · Score: 1
      Ah, yes, program with interfaces. I try to keep stuff as Collections, handy if you need to swap from an ArrayList to a HashMap or other.

      Yeah, that works pretty good. Usually I have one of the methods on my wrapper class create a Collection for just such an emergency.

      Great way to learn how things work, but when there are industrial strength xml parsers out there - why not use them.

      True dat. I think the expat author said something to the effect of, "You don't write an XML parser".

      That's one thing I love with java though, You will always find something in the standard libs that'll do the thing you want to do. Some call it bloat, but I rather see it as a helping hand.

      You know, as far as I can tell, it's not any more or less bloated than Ada, Smalltalk, Perl, Python, or even STL. Everything has a little bit of bloat.

      --
      Show me on the doll where his noodly appendage touched you.
    88. Re:In Java's case ... by pyrrhonist · · Score: 1
      These posts are getting long, but I'll try to respond to each point you made.

      Probably should have taken this one offline. Whoops.

      However, I maintain that it is rare to need it in C++ otherwise.

      Especially if you use something like ACE.

      The point is that this is another requirement imposed on the programmer, whereas again in C++ it's handled by the language itself via templates.

      That's true, it's an idiom in Java. The good news is, a lot of people complained, so templates are going into the language for 1.5. Before Sun committed to that, a ton of people used GJ. I don't look on wrapping as much of a problem, because usually the generic container doesn't do everything I want, so I end up wrapping the container anway (e.g. I want to label all the apples).

      If you're unlucky, and the finalizer never runs, you have a resource leak. Alas, even Sun's own material sometimes implies that the finalizer will always clean up, which is not a safe thing to do.

      That's because there's a lot of myths surrounding garbage collection. The GC doesn't read minds, and if there is heap left above its threshold, it's not going to make an attempt at cleaning up garbage. In small programs, you may not even see finalizers run before the program exits, which is usually not an issue. In memory intensive or long running programs, you end up with gigantic pauses when the GC decides to suddenly clean things up, much to the astonishment of the horrified programmer standing in front of the large group of VC. The myth is that the System.gc() call has no effect (or can't be trusted to have an effect), so no one bothers to call it. The truth of the matter is that System.gc() should be called once in a while, simply because the GC can't read your mind. So Sun's documentation isn't lying about the finalizer. It will clean things up, but the GC has to get involved with the object first.

      At any rate, it's much better practice to call my_stream.close() explicitly in a finally block when you're done with the stream.

      Oh definitely. Although with your own classes, you may want to implement finalize anyway, and have it call close or whatever. That way, if somebody forgets to close, it'll get cleaned up eventually.

      In each case, you just use these to access your resources, and never have to write the release code again. If the resource ownership is handled by whatever library supplies the resource -- and in decent libraries it invariably is -- then you never have to worry about the release issue at all, and you never have to write even a single line of release code yourself.

      That's what I was trying to point out. There's quite a few interfaces in Java as well that manage their resources so you don't have to. Actually, you've given me an idea for something more generic.

      Didn't someone later write a lengthy criticism demonstrating that that idiom wasn't so safe after all, though?

      From what I remember, they didn't implement it correctly. However, this too will soon be a moot point. Check out who the spec. lead is.

      --
      Show me on the doll where his noodly appendage touched you.
    89. Re:In Java's case ... by Anonymous+Brave+Guy · · Score: 1

      I agree that GC is often misunderstood, but this is a very good example of my basic point: to make Java behave well, you have to do various things manually. The killer for finalizers is that they're still not guaranteed to run. Even if you do add a call to close(), there's still no guarantee it will ever execute, so somebody still needs to run close(), or at least System.gc(), explicitly. And of course, as you say, finalizers may not run promptly even if they do run automatically, because the GC can't be telepathic. That would make them inappropriate for resource release, even if their execution were guaranteed.

      With the deterministic destruction semantics of various other languages, this stuff is automatic, and my argument is simply that this is a safer way to design the language, and thus Java's claims of improved safety are... exaggerated.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  4. Alternative to Visual Studio by Vaevictis666 · · Score: 5, Informative
    I now want to switch my .NET development over to Linux/Mono exclusively, but I want to first settle on a free alternative to Visual Studio .NET 2003. Any suggestions?

    How about Eclipse?

    1. Re:Alternative to Visual Studio by Anonymous Coward · · Score: 2, Informative

      Eclipse do not seem to support c# natively (I confess to not having tried the c# plugin).

      I would recommend SharpDevelop. I understand work is underway to make it less dependent on WinForms so that it can run under Linux/Mono.

      If the original poster was looking for free-as-in-free-beer-IDE's, there's always the personal edition of Borlands C#Builder, as well.

    2. Re:Alternative to Visual Studio by Glock27 · · Score: 3, Informative
      Eclipse do not seem to support c# natively (I confess to not having tried the c# plugin).

      AFAIK, all language support in Eclipse is by plugin. You're basically saying you've never tried it, but you advise us to try something else.

      Huh?

      (I've used Eclipse a bit for Java, and it is excellent. I'm pretty sure it'll be a fine environment for many languages by the time it's all said and done.)

      --
      Galileo: "The Earth revolves around the Sun!"
      Score: -1 100% Flamebait
    3. Re:Alternative to Visual Studio by PianoComp81 · · Score: 3, Informative

      Eclipse can be good for other languages. My problem with it is that it's just too slow many times. I did have a problem in Windows getting C/C++ to compile, but I think it was looking for cygwin + gcc, and not the MSVC++ I had installed at the time. I too have used it extensively for Java, and probably wouldn't use anything else on a decent-sized project.

    4. Re:Alternative to Visual Studio by M1000 · · Score: 1

      For the moment, only on windows... SharpDevelop

    5. Re:Alternative to Visual Studio by Anonymous Coward · · Score: 0

      "I did have a problem in Windows getting C/C++ to compile"

      Probably due to the fact that your attempting to program in a non-existant language. Decide if your coding in C or C++ and go from there.

    6. Re:Alternative to Visual Studio by Hazelnut · · Score: 1

      Absolutely agree - Eclipse is excellent! I've been using it for Java for 4 months now. There are still a few niggles (like not being able to change the text selection colours - annoying because it's the same as my default background) and it takes some getting used to, but now I wouldn't use anything else. The refactoring support is wonderful.. You need a fair amount of memory though, at least 256Mb I would say.

    7. Re:Alternative to Visual Studio by gbjbaanb · · Score: 1

      Its not free ($35) but Antechinus C# Editor is out there, http://www.c-point.com/csharp.htm

      Or.. free ones:
      http://www.icsharpcode.net/
      http://www.sci ntilla.org/

      http://www.chami.com/html-kit/plugins/info/hkcom pc sharp/ (add in for the free-perosnal-use html-kit)

    8. Re:Alternative to Visual Studio by anomalous+cohort · · Score: 1

      Time to mention the emacs major mode for C#

    9. Re:Alternative to Visual Studio by Glock27 · · Score: 1
      My problem with it is that it's just too slow many times.

      Really? Too slow in what sense?

      Perhaps you should invest in some decent development hardware. It runs very well on my Athlon 2600+ with 512 MB.

      --
      Galileo: "The Earth revolves around the Sun!"
      Score: -1 100% Flamebait
  5. Hmm by Autistic_Treat · · Score: 0

    I referred this question to a colleague of mine, and I have enclosed his findings below for your perusal. http://web.ask.com/web?q=%27Can+C%23+keep+up+with+ compiled+languages+like+C%2C+C%2B%2B%2C+and+D+or+b yte-code+based+Java%3F&o=0&qsrc=0

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

      Thank you very much for your ultra cool link.

  6. Re:But there's just one problem... by Vaevictis666 · · Score: 2, Informative

    Actually VB apps tend to run just fine through Wine, or at least a few little projects I've done in VB have worked for me...

  7. Re:But there's just one problem... by __aagmrb7289 · · Score: 2, Insightful

    (a) That's not the only problem;
    (b) VB isn't the topic; and
    (c) That isn't even true.

    Wow, none out of three!

  8. I'm holding out for... by obladioblada · · Score: 0, Offtopic

    D flat, damn it.

    1. Re:I'm holding out for... by ThatDamnMurphyGuy · · Score: 3, Funny

      Remember though, C# and Db aren't the same note outside of the well tempered world!

    2. Re:I'm holding out for... by ScrewMaster · · Score: 0

      Well ... if you don't C#, you'll be flat.

      --
      The higher the technology, the sharper that two-edged sword.
    3. Re:I'm holding out for... by Anonymous+Brave+Guy · · Score: 1

      Oh, please... You're just making a major issue out of a minor detail.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    4. Re:I'm holding out for... by marko123 · · Score: 1

      This has to be prelude to someone saying fugue and your musical jokes.

      --
      http://pcblues.com - Digits and Wood
    5. Re:I'm holding out for... by Anonymous Coward · · Score: 0

      Its "enharmonic"

    6. Re:I'm holding out for... by ThatDamnMurphyGuy · · Score: 1
      Oh, please... You're just making a major issue out of a minor detail.


      And this is different than most of Slashdot how? :-)
    7. Re:I'm holding out for... by ThatDamnMurphyGuy · · Score: 1
      Its "enharmonic"


      Time to put 5.5 years and 2 worthless BA music degrees to the test.

      Enharmonic means:
      Of, relating to, or involving tones that are identical in pitch but are written differently according to the key in which they occur, as C sharp and D flat, for example.


      This is all well and good in "Western" music using the well-tempered system (C# = Db).

      However, in many non western systems, C# != Db given the true Pythagorean math behind tuning.

      Thanks for reading my worthless offtopic expunge of unused knowledge. I now have created more room for Perl snippets and Pr0n images in the brainpan.
  9. Microsoft license prohibits CLR benchmarks by Anonymous Coward · · Score: 4, Funny

    Raed it. Ingroe it. Bncehmrak aynawy.

    1. Re:Microsoft license prohibits CLR benchmarks by Snoopy77 · · Score: 1

      Hmmm ... how lnog unitl we get the jbulemd wrods out of our setsym.

      --
      "She's a West Texas girl, just like me" - G.W Bush Iraqis
    2. Re:Microsoft license prohibits CLR benchmarks by Anonymous Coward · · Score: 0

      I'm done already.

    3. Re:Microsoft license prohibits CLR benchmarks by MobyTurbo · · Score: 1
      Raed it. Ingroe it. Bncehmrak aynawy.
      Oy! Oy! Gevalt! Gevalt! Not yet another new +5 Funny meme! Just when I thought that the beowulf clusters and "In Soviet Russia" jokes were dead and we could finally get original humor here at /. there comes this.
    4. Re:Microsoft license prohibits CLR benchmarks by falzer · · Score: 1

      Complaining about tired repetetive jokes on Slashdot... that's a paddlin'.

    5. Re:Microsoft license prohibits CLR benchmarks by DrEasy · · Score: 2, Funny

      I find that the "I'm tired of repetitive jokes" thing is getting repetitive as well... ;-)

      --
      "In our tactical decisions, we are operating contrary to our strategic interest."
    6. Re:Microsoft license prohibits CLR benchmarks by Anonymous Coward · · Score: 0
      Even as I write this, repetitive jokes are commiting suicides on the walls of Slashdot.

      Happy?

    7. Re:Microsoft license prohibits CLR benchmarks by GroovBird · · Score: 1

      I for one welcome our new jumbled word overlords!

      Dave

    8. Re:Microsoft license prohibits CLR benchmarks by Molt · · Score: 1

      In Svoeit Rssuia jmulbed wrod oevrolrds wcleome YOU!

      --
      404 Not Found: No such file or resource as '.sig'
  10. Visual Studio .Net alternative - SharpDevelop by ObiWonKanblomi · · Score: 1, Informative

    I'm assuming you're asking for an IDE alternative to Visual Studio .Net. Take a look at SharpDevelop. According to its authors, it's open source under the GPL. I've given it a try on my old P2 300, and it's not bad at all IMO. It takes a little longer to load, but it has solid functionality and tons of features on an interface that looks very familiar to that of Visual Studio .Net

  11. Duh by be-fan · · Score: 5, Insightful

    This really makes sense if you understand how JITs work, and understand the nature of the benchmarks. These benchmarks are mostly microbenchmarks that test a particular operation in a tight loop. JITs can compile this loop once and run it directly on the CPU afterwords. This doesn't extrapolate well to situations where the JIT gets involved more often in the benchmark.

    --
    A deep unwavering belief is a sure sign you're missing something...
    1. Re:Duh by msgmonkey · · Score: 3, Insightful

      But having said that there is the "rule" that 10% of code runs 90% of the time, hence why caches work. If the JIT is only optimizing code that gets run 90% of the time and it's not doing a bad job (since the JIT compiler would most likely be in 2nd level cache) with the other 10% then the benchmark results would be relatively indicative.

    2. Re:Duh by dnoyeb · · Score: 3, Insightful

      The JIT can optimize code based on the computer its running on, and not just a generic compile time optimization. So JITs have advantages as well.

    3. Re:Duh by sosume · · Score: 0

      The article is wrong. In C#, you can mark blocks as unsafe and use pointers or directly write in MSIL. Using this you can gain amazing performance gains.

    4. Re:Duh by heh2k · · Score: 1
      The JIT can optimize code based on the computer its running on, and not just a generic compile time optimization. So JITs have advantages as well.

      and how many actually do that? yes, in theory, jit's can be faster than generic-target native binaries. i think ms's clr is the right why to do an isa/vm. it should be language independent, a superset of cpu features, and unrolling. however, clr has a major problem: it will likely be even less ported than java.

    5. Re:Duh by room101 · · Score: 1

      yeah, except compiled code is by definition compiled on the target platform, so therefore, more modern compilers can optimize based on the platform you will run it on.

      Sorry, try again.

      --
      room101 -- how much can you stand before they break you?
      (they always break you eventually)
    6. Re:Duh by whizzter · · Score: 1

      what the previous poster means is that the VM could identify the actual cpu/generation. f.ex. pentium,pentiumMMX,ppro,pII,..,athlon,athlon64.
      i f you want to optimize code for all those you usually need to add MMX,SSE,etc for runtime checking,etc. maybe use different innerloops and so on.

      a jit could be do the code generation differently on different cpus and free the programmers of doing runtime loading of loops or compiling multiple versions.

      / Jonas Lund

  12. Re:But there's just one problem... by Osty · · Score: 1

    Are you sure about that? Granted, that's VB.NET, and not VB pre-.NET, but it's still VB. It's also still under development, but the work is being done.

  13. VS Alternative by contrasutra · · Score: 5, Funny

    I now want to switch my .NET development over to Linux/Mono exclusively, but I want to first settle on a free alternative to Visual Studio .NET 2003. Any suggestions?

    VI. :-D

    C,D, I feel bad for the F Programmer.

    1. Re:VS Alternative by JamesOfTheDesert · · Score: 4, Funny
      C,D, I feel bad for the F Programmer.

      Ah, but there is F#

      --

      Java is the blue pill
      Choose the red pill
    2. Re:VS Alternative by yamcha666 · · Score: 1

      As a matter of fact, I actually do that. I am taking C/C++ at college right now. The school has Visual Studio .NET on all of the workstations right now. But when I go home to do the work, I jump right into an Xterm and use vi and g++

    3. Re:VS Alternative by Anonymous Coward · · Score: 0

      Not to be rude, but have you had a chance to see what VS .NET offers? Just the great debugger is enough to swear by it after all.

    4. Re:VS Alternative by Anonymous Coward · · Score: 0

      Try emacs instead.

    5. Re:VS Alternative by cakoose · · Score: 1

      Wow...a new low. Forget not reading the article. Thus dawns the age of not reading the summary or the comment you are replying to.

    6. Re:VS Alternative by yamcha666 · · Score: 1

      Yes, and VS .NET ain't half bad. I just don't have the $200 or whatever it costs to get a copy for home. So I have to do my work using OSS tools. But yea, it does have a nice debugger

    7. Re:VS Alternative by Anonymous Coward · · Score: 0

      The need for a debugger is a sign of weakness.

    8. Re:VS Alternative by Anonymous Coward · · Score: 0

      I have been using icsharp deloper. It is free and open source. www.icsharpcode.net/OpenSource/SD/Default.aspx

  14. Mono risks by alext · · Score: 2, Insightful

    Mono is a bit faster than Java, for some benchmark?

    Well, why didn't you say so before?!

    That way we could have avoided all that tedious discussion about IP infringements, functionality etc. in yesterday's Mono debate. Clearly some dude's performance figure should override all other considerations when choosing a platform.

    1. Re:Mono risks by Anonymous Coward · · Score: 0

      You must be new here. No one on slashdot is at risk for mono.

  15. Punked! by Anonymous Coward · · Score: 0

    Hahaha...

  16. Re:But there's just one problem... by __aagmrb7289 · · Score: 1

    Yeah, some day I'll be able to stop myself from doing that. *hangs head in shame*

  17. Uhm... by Black+Parrot · · Score: 4, Funny


    > Overall the results were surprising, although perhaps unexciting, in showing that C# (and to a less extent Java) is, to a good degree, on a par in efficiency terms with its older and (presumed to be) more efficient counterparts C and C++ at least as far as the basic language features compared in this analysis are concerned

    Could we have a few more weasel-words in that sentence, please?

    --
    Sheesh, evil *and* a jerk. -- Jade
    1. Re:Uhm... by Anonymous Coward · · Score: 1, Informative

      Had no idea what you were talking about so I looked it up. From College Campus:

      Weasel words. If your information is less than conclusive, acknowledge that either in summary or by choosing another argument. But don't undercut your argument with weasel words -- empty palliatives such as "to a certain degree," "it may seem likely that," or "in some cases." If your points are weak, they need no additional burdens. Note how much stronger the following become as the bracketed words drop out:

      * [It may even be, as] some experts have hinted that Thomas More was [somewhat] suicidal [anyway].
      * Josiah Royce was [to some extent] the Hegel of American philosophy.

      Weasel words dilute your thought, and hence your argument.

    2. Re:Uhm... by ScrewMaster · · Score: 1

      So, C# is about as efficient as C and C++, and maybe a little more than Java.

      --
      The higher the technology, the sharper that two-edged sword.
    3. Re:Uhm... by Anonymous Coward · · Score: 0

      I have a better example...

      [It may even be, as] some experts have pointed out that there are [some] WMD's in Iraq.

      You don't [possibly] think that [perhaps] weasel words have the effect of moderating a sentence? Add a degree of uncertainty that a writer wishes to communicate to avoid (for example) a war?

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

      Have some experts pointed out WMDs in Iraq? If so, it is correct to say so. If some experts have suggested that there are WMDs in Iraq it's a totally different story. One is factual, the other hearsay. Either can be weaseled.

  18. jump off the bandwagon by curtlewis · · Score: 2, Informative

    Java has received alot of attention over the last 7 or 8 years or so. It's a great idea in theory, but it falls way short in practice. It does remain viable for a few select uses, though: small widgets, servlets and web app servers. Pretty much other than that, using Java will mean excessive memory usage and slow performance.

    Garbage collection in Java is not guranteed. It's what I call Union. It'll clean up when it god damn well feels like it. In the meantime, the system slows to a crawl.

    Graphics in Java are abysmally slow. Even basic UIs lack the speed and responsiveness of GUIs written in C, C++ or similar languages.

    Java was supposed to be: Write once, run anywhere, but what it is in reality is: Write once, debug everywhere... over and over and over. Or perhaps more appropriately it is" Write once, run screaming.

    I've worked in a variety of Java development projects in the past and not once has it ever risen to the task to show itself as a worthy choice and/or a mature language. Instead it has invariably wasted companies time and money. Primarily because they failed to realize that Java is a small task tool, not suitable for major applications or those requiring performance.

    I know a lot of engineers like Java because it makes life easier for them by doing things for them, but those things it does it does very poorly.

    I'm sure I'll be marked as flamebait or troll by some Java loving mod, but what I've stated are facts and experiences from real life Java development. The results are in and frankly... Java sucks! Stick with C and C++ for most development, there's a reason they are the standard: they work.

    1. Re:jump off the bandwagon by trompete · · Score: 3, Interesting

      to add....

      GUI development isn't that bad in Visual Studio. In fact, it is easy as hell. With emulators like Wine available, it makes sense to develop the software with Visual Studio and its amazing debugging tools for WINDOWS and then use Wine to run it on Linux.

      One could use the GTK and GNU-C to develop multi-platform software in the first place, but then you are dealing with the parent poster's problem of debugging on multi-platforms, not to mention that GTK sucks under Windows (Anyone else use GAIM?)

    2. Re:jump off the bandwagon by Cnik70 · · Score: 5, Informative

      You apparently haven't taken the time to work with any of the newer releases of java (1.3 and 1.4). Java is a very mature and worthy language, especially when it comes to developing non platform dependent applications. I prefer java since I CAN program it on a Linux box, transfer it to a windows, mac or even a mainframe and the program will still run exactly the same without changing a single line. lets see c, c++, .Net or c# do that... Also don't forget about a little thing called J2ME which is slowly but surely making it's way onto cell phones and other small devices. You may want to take another look at todays Java before declaring that it sucks.

      --
      -Cnik
    3. Re:jump off the bandwagon by MikeApp · · Score: 4, Informative

      You claim to have worked on numerous Java projects, then complain only about GUI apps? The large majority of Java projects are server-side, which is where it really rocks. Write once and deploy on your choice of platform (Linux, Solaris, or Windows if need be).

    4. Re:jump off the bandwagon by fitten · · Score: 1

      In my experience as well, you write it on one platform and have to do a bit of debugging to get it to run on another, more debugging for a 3rd, etc. This generally isn't so bad if you use the same JVM on the different hardware/OS but switch JVM and you are out in left field again.

    5. Re:jump off the bandwagon by Trejkaz · · Score: 3, Insightful

      We're going to have to point out the separation of language and platform for you again. If the Perl community can figure it out, then anyone should be able to.

      Java 'the language' is good. Java 'the machine' is good. Java 'the platform' blows presumably because all the people who could make it better are sitting on Slashdot whining about Java's performance instead of doing something about it.

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
    6. Re:jump off the bandwagon by boomgopher · · Score: 1

      Informative my ass...

      Dude, show me a better IDE than Intellij IDEA which is entirely written in Java, and then we'll start talkin'.

      --
      Your hybrid is not saving the environment. Its purpose is to make you feel good about buying something.
    7. Re:jump off the bandwagon by Gunfighter · · Score: 5, Insightful

      I'm afraid I'll have to agree with Cnik70 on this one. I can remember struggling through Java programs back in the day and thinking to myself, "No way in Hell this will ever become what everyone is saying it will be." That was then, this is now. Internal benchmarks of our code under mod_perl, PHP, Python (Zope), and Java for our web development show Java (Tomcat) to be the winner by a landslide when it comes to scalability, performance, and rapid development. From what I understand, even eBay is switching to a Java platform (anyone know more about this?). Of course, this is all on the server side...

      As far as GUI applications are concerned, the only thing that is slow about running Java GUI apps on modern hardware is the startup time. This can supposedly be taken care of with accelerator apps which keep a JVM running in the background just waiting for Java apps to be run. Even without such acceleration, I still use jEdit as my text editor of choice for all my programming needs (http://jedit.org/), and as a sysadmin I don't even program in Java (where jEdit is best applied). I usually stick to Perl/Python for automating systems administration scripts. Nevertheless, I find that the features, performance, and overall ease-of-use in jEdit save me loads of time (nice CVS integration too).

      Bottom line, Java is already in enterprise computing environments and, with an experienced developer, ready for primetime in smaller applications as well.

      -- Gun

      --
      -- Stu

      /. ID under 2,000. I feel old now.
    8. Re:jump off the bandwagon by angst_ridden_hipster · · Score: 1

      I'll see your anecdotal evidence, and I'll raise you three cases of C++ disasters, ten C buffer overruns, and fifty million lines of legacy Jovial code that no-one can read.

      OK, I'll get this off my chest first: C is the only Truly Great Language ... well, other than assembler. But Real Programs are written in C.

      Still, I have to say that I strongly disagree with you. For certain tasks, Java's a great language. I wouldn't use it for GUI code, and I wouldn't use it for sysadmin scripts, but for servers, multithreaded network applications, and similar tasks, it's a good language.

      Sure, it's got some annoying aspects. It's overly "academic" in some of its approaches.

      Java doesn't suck (and C and C++ really aren't the standard anymore).

      --
      Eloi, Eloi, lema sabachtani?
      www.fogbound.net
    9. Re:jump off the bandwagon by PDHoss · · Score: 1

      okay

      [ducks]

      --
      ======================================
      Writers get in shape by pumping irony.
    10. Re:jump off the bandwagon by Dr.+Bent · · Score: 4, Informative

      I've worked in a variety of Java development projects in the past and not once has it ever risen to the task to show itself as a worthy choice and/or a mature language. Instead it has invariably wasted companies time and money.

      I would be willing to bet the reason they failed is because you do not understand how to use Java correctly. As long as we're playing the personal experience game, it has been my experience that hardcore C/C++ programmers tend to make horrible Java programmers because they think Java should behave like C/C++. It doesn't (obviously), and when you try to shove that round peg into a square hole what you get is a huge mess.

      At my company, we have a bunch of old school C/C++ progammers and a few Java programmers. As our Java products started to take off (now our #1 selling product line), we wanted to move some of those developers over to Java to help out.

      It was a disaster. They made object pools in order to try to manage thier own memory. They were calling System.gc() and yield() instead of using a Java profiler to find bottlenecks. The never used lazy loading. They never used failfast ("exceptions are too slow!", they said). The result was all the projects they worked on were extremely brittle, used twice as much memory, and ran much slower than our original Java stuff because they were constantly fighting against the system instead of working with it.

      Try reading Effective Java by Josh Bloch and Thinking in Java by Bruce Eckel. Do what these guys suggest and your Java apps will run just as well than as anything written in C or C++.

    11. Re:jump off the bandwagon by easter1916 · · Score: 1

      In 5 years of developing server-side apps using Java and web containers I've never encountered one of these bugs, with deployments to Mac OS X, Windows (many flavours), Solaris and AIX as the targets.

    12. Re:jump off the bandwagon by pla · · Score: 3, Insightful

      The large majority of Java projects are server-side, which is where it really rocks. Write once and deploy on your choice of platform (Linux, Solaris, or Windows if need be).

      Although true (in my experience), the idea itself has sooooo many things wrong with it...

      Portability - Server-side Java, by nature, does not involve any OS-specific activity. So, with no loss of portability or functionality, you could do the same in C/C++. Which, incidentally, will run on any platform for which GCC exists - About 30 *times* the number of platforms for which a JVM exists.

      Performance - Yes, servers tend to have fairly impressive hardware resources available to them. So lets cripple that hardware by making it run an interpreted language. JIT? Server-side apps also tend to have very short process lives, doing a small task and exiting. In such situations, JIT causes worse performance, as it wastes time optimizing something that will never execute again during this process' invocation.


      I believe (though I do not wish to put words in his mouth) that CurtLewis only mentioned GUI programming because if you use Java anywhere else, you have misused it. It makes it easy to write an app with a similar user experience on any hardware with the resources to run the JVM. If the idea of a "user experience" has no meaning to your app, using Java means you have made a suboptimal choice.

    13. Re:jump off the bandwagon by forgoil · · Score: 0

      First: J2ME. Have you tried coding anything on J2ME? The API is horrible and lacks even the most basic features that you must have for games. Then you have the problem that it runs dog slow on a slow 8-bit platform. And not to speak of the memory usage. You have 64kb of memory and the new operator is constantly run even for the most silly little things. The garbage collection is overtaxed to hell.

      So I'd rather use the incredibly much faster mophun (http://www.mophun.com) or if I could, pure assembler or C.

      Second: Java is an ill designed language, and there is no need to take my word for it. Learn a few languages well and I am sure that you will see how bad it is.

      Third: This is my opinion on the other hand, but platform independance is hell. Smalltalk showed this quite well, and is a way better language than Java ever will be. And if you just have to do it, I'd recommend a C++ + QT combination over Java any day (unless your needs are smaller, then there are a few quite good GUI toolkits out there that is X-platform).

    14. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      Shit man! I coded graphics stuff (games, demos) in motherfucking Turbo Pascal that run faster than Java shit and the language is super-easy to learn (hell you might as well call it pseudocode!)
      And for real work, I'd just as well code in Perl. Java takes too long to code, and ain't worth the hassle.

    15. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      "Server-side apps also tend to have very short process lives, doing a small task and exiting"

      I am not sure what server side applications you have been involved with but in my experience server side applications have LONG process lives. They are expected to be up 24 * 7, for as long as possible.

      Just as an example lets say Apache.

    16. Re:jump off the bandwagon by ScrewMaster · · Score: 1

      Java memory management seems to be a lot like Applesoft Floating Point BASIC. The program would run fine, allocating strings and variables until a garbage collection pass occurred. So, at unpredictable intervals your program would slow to a crawl, and then speed up again.

      --
      The higher the technology, the sharper that two-edged sword.
    17. Re:jump off the bandwagon by randolfe · · Score: 1

      I wish that the metamoderating actually worked, and this had been marked as flamebait/troll, where it belongs.

      A) You have clearly little to no understanding of Java. A few JDK/Swing app(let)s does not qualify you to speak with authority.

      B) Java is widespread within the server side of myriad Enterprise applications.

      C) Performance is not purely the result of any language's technology. Java enables a level of design-driven efficiency to well architected/designed applications.

      D) Antidoctal: Our company has a number of massive, high performance, mission critical telecom enterprise applications all of which are pure Java J2EE, WebSphere, Struts, etc. They outperform anything on the market in our domain space, and our competitors are based on everything from .NET/VB to PERL/hacky stuff to C++/C-S to even older Cobol/Assembler.

    18. Re:jump off the bandwagon by Lodragandraoidh · · Score: 1

      Why the heck would you run Gtk on a Windoze box, when a proper Linux box will do the trick?

      Learn from M$ - build-in incompatibilities so that users are forced to change OS... :p

      --

      Lodragan Draoidh
      The more you explain it, the more I don't understand it. - Mark Twain
    19. Re:jump off the bandwagon by Goozbach · · Score: 1

      a ditto marked redundant. who'da thunk?

      --

      I used to but then I quit.

    20. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      *cough* Servlets *cough*

      Program Java much?

    21. Re:jump off the bandwagon by pyrrhonist · · Score: 1
      Dude, show me a better IDE than Intellij IDEA which is entirely written in Java, and then we'll start talkin'.

      Eclipse.

      Oh, wait. That's written in Java too.

      --
      Show me on the doll where his noodly appendage touched you.
    22. Re:jump off the bandwagon by prowley · · Score: 3, Interesting
      I am not sure what server side applications you have been involved with but in my experience server side applications have LONG process lives. They are expected to be up 24 * 7, for as long as possible. Just as an example lets say Apache.
      Which just happens to not be written in Java... Server processes that do require to be up and running 24/7 are written in C (maybe C++) by people who know why. Servers written in Java for the 24/7 operation are written by people who read why in a magazine. Sorry, but I still cannot stifle a smile when Java and server are mentioned in the same sentence. I know there are many true-believers, but really, even if it does look good on paper, just wait til that garbage collector kicks in and I'll have yer 24/7 right here.
    23. Re:jump off the bandwagon by MikeApp · · Score: 1
      Server-side apps also tend to have very short process lives, doing a small task and exiting. In such situations, JIT causes worse performance, as it wastes time optimizing something that will never execute again during this process' invocation.

      Actually, the opposite is true - the server processes are long running and repeat the same code over and over within the same Java VM. You JIT should benefit in this scenario. [ You seem to be thinking of plain-vanilla CGI. ]



    24. Re:jump off the bandwagon by ForsakenRegex · · Score: 2

      I'll give you scalability, and I'm willing to give you the benefit of the doubt on performance, but Java is definitely not more "rapid" than Perl. If you were holding a gun to my head to get something done as quickly as possible, I would not hesitate to choose Perl over anything else (unless you're talking Windows GUI, in which case I'd use Delphi).

      --
      "A man talking sense to himself is no madder than a man talking nonsense not to himself."
    25. Re:jump off the bandwagon by EMN13 · · Score: 4, Informative

      Server side tasks are just great for java; your arguments don't add up.

      Any platform I've heard of for server stuff will run java. C/C++ may have a wider distribution; but not amongst relevant platforms. Irrelevant to the discussion are portable/client side/ small / light platforms, and the computation heavy things. Servers are about "service" - the naming is not a coincidence.

      Most server processes run forever, or as close as possibly; not very short lived at all. Starting a new process (aka application) for every client is generally not best practice - those are threads, and don't require constant re-JIT-ing or other JVM/CLR overhead.

      Rather, the larger the system, and the more data, generally the less code in relation to that data, and even less JVM in relation to data. So for the quintessential server with tons of data gunk, the c/c++ advantage is much smaller than in the GUI.

      Furthermore, it is a mistake to compare the portability of java to that of c++ in the manner you do. c++ implementations aren't generally compatible. Take a look at the mozilla coding guidlines for portable c++: http://mozilla.org/hacking/portable-cpp.html

      c++ isn't portable, normally. C++-- might be though. Then again, it might not be. The java language is very standardized; and in case you shouldn't have a compiler on that platform, the bytecode is too!

      In conclusion, if you're using c++ for a server-side task you should consider using java instead. As a matter of fact, most scripting languages are probably better suited than c++, I can hardly image a worse fit.

    26. Re:jump off the bandwagon by dvdeug · · Score: 1

      About 30 *times* the number of platforms for which a JVM exists.

      And? There's only a handful of server enviroments out there. Whether or not your code runs on Coherent has been a moot point for almost a decade, and whether or not it runs on IRIX and HP-UX is quickly approaching that point. There's JVM's for Linux, Windows, MacOS and every Unix that still matters.

      Yes, servers tend to have fairly impressive hardware resources available to them. So lets cripple that hardware by making it run an interpreted language.

      That's no different from using Perl. The question is, is it worth the time to rewrite in C or some other low-level language? I think the people who run the big sites on the net have usually decided that it's not.

    27. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      That's total bunk. I've been coding in C for 21 years, C++ for 14 years and Java for 6 years.

      Your arguments are the typical C/C++ bigot, ant-Java comments of an amateur developer who doesn't really understand any of the languages you have mentioned in this post.

      The fact is that on the client Java IS poor... but on the server, there's more work being done in Java than any other language and for good reason.

      Your comment about graphics being slow is not only laughable but completely incorrect. Look into the NIO and 3D libraries that were presented at, I believe, JavaOne 2001.

      I'd be interested in hearing the "variety of Java development projects" you've worked on... from your post it sounds as though Java was simply over your head.

    28. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      Do you work? Or are you some kind of clueless student?

      Server processes run fine in Java. The site I work on most likely supports a hundred times the concurrent users that anything you have ever seen does, and it does it with Java. And it does it just fine.

      You can't write boilerplate code to get Java to scale. Yes, some Java technologies do not address large numbers of users well. However, if you have some clue, and are careful when it matters, you can get it to scale well. The same is true with C and C++.

    29. Re:jump off the bandwagon by MikeApp · · Score: 1
      So, with no loss of portability or functionality, you could do the same in C/C++. Which, incidentally, will run on any platform for which GCC exists - About 30 *times* the number of platforms for which a JVM exists.

      Of course, all of the libraries on which your code is dependent must also move with the app (database drivers, XML libraries, LDAP/naming services, etc., etc.) and be recompiled, assuming you have source for it all. With Java, you can unzip a Tomcat installation, drop in your app and you are ready to go.



    30. Re:jump off the bandwagon by MikeApp · · Score: 1
      Java memory management seems to be a lot like Applesoft Floating Point BASIC. The program would run fine, allocating strings and variables until a garbage collection pass occurred. So, at unpredictable intervals your program would slow to a crawl, and then speed up again.

      A concurrent GC option is available and can decrease pause times significantly. The option is -XX:+UseConcMarkSweepGC Parallel GC is also available as an option.

      See Tuning Garbage Collection with the 1.4.2 JavaTM Virtual Machine
    31. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      you're a fucking retard

    32. Re:jump off the bandwagon by nathanh · · Score: 1
      Performance - Yes, servers tend to have fairly impressive hardware resources available to them. So lets cripple that hardware by making it run an interpreted language.

      You've just managed to discredit the value of every webserver running PHP or Perl.

      Or in other words, you don't know what the hell you're talking about.

    33. Re:jump off the bandwagon by Anonymous+Brave+Guy · · Score: 3, Interesting

      Give or take a few quirks, most recent (last five years, say) C++ compilers support all the major features acceptably well for most purposes. There are only a few issues that cause significant problems: the infamous export, Koenig look-up and partial specialisation of templates come to mind. None of these features is used very often anyway, though.

      Coding standards that forbid the use of templates, exceptions and half the standard library in C++ are common, but way out of date.

      By the way, I write code for a living that gets shipped on more than a dozen different C++ platforms. Alas, some of them are well pre-standard, and so don't support even basic template or exception mechanics properly, which sucks. But this is an issue we've looked into in some detail, so I'm pretty confident in my statements above.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    34. Re:jump off the bandwagon by EMN13 · · Score: 1

      Thanks for the update. I haven't heard of any of the problems you're referring to. As to those out-of-date coding practices, they sort of sound like my out of date c++ practice - I haven't (seriously) used it for years. I came across the mozilla guidelines recently and concluded I wasn't up for that anytime soon :-). Did you read the article? D, the language with templates and garbage collections sounds interesting.

    35. Re:jump off the bandwagon by glenebob · · Score: 1
      "It does remain viable for a few select uses, though: small widgets..."
      What do you mean by small widgets? My knee jerk reaction to that statement is that if it's small, you probably should NOT do it in Java.
      "...but those things it does it does very poorly."
      I'm speaking from .NET experience, but I think it applies just fine...

      I've fallen in love with the memory allocation stuff that leads to garbage collection. I like using references to everything. Complex applications eventually end up needing some form of reference tracking to make the complexity manageable. However, I miss two things:
      1) Destructors (proper ones).
      2) Real-time object disposal.

      I HATE background garbage collection! In many cases it works fine, but I hate it! Just give me real destructors that fire as soon as the last reference goes out of scope, and then dispose of that sucker in real time. Because of garbage collection, some classes have a Dispose() method, which must be called explicitly, but you don't have any way to know if you hold the last reference (if you keep track, you may as well be writing in c++), and if you call it early, you just effectively created a dangling pointer. An object has no idea whether it's referenced or not, has no idea when a reference goes out of scope, and has no control over when it gets disposed. Indeed, if memory never runs short, it may not be disposed until the process dies. GC gives us better memory allocation at the cost of horrible deallocation. Rant rant rant.

    36. Re:jump off the bandwagon by 1000StonedMonkeys · · Score: 1

      I believe (though I do not wish to put words in his mouth) that CurtLewis only mentioned GUI programming because if you use Java anywhere else, you have misused it. It makes it easy to write an app with a similar user experience on any hardware with the resources to run the JVM. If the idea of a "user experience" has no meaning to your app, using Java means you have made a suboptimal choice.

      Having a consistent look and feel across platforms is a very nice thing, but I think you're missing some of the benefits of Java.

      Performance: Sure, you can write CGI scripts in C++, but they really aren't going to be much faster because of the time it takes to execute the process each time the page is loaded. If you eliminate CGI, then all of the other solutions are interpreted (or JITed). Application servers for Java such as Resin perform as well as anything else out there.

      Security: Now don't get me wrong, you can write insecure code in any language you want too, but it's nice that the JVM eliminates buffer overrun exploits.

      Productivity: Writing in Java greatly reduces the development time for you applications. You can argue about what solution is the best here, but no natively compiled solutions come close.

    37. Re:jump off the bandwagon by pyrrhonist · · Score: 1
      Java memory management seems to be a lot like Applesoft Floating Point BASIC. The program would run fine, allocating strings and variables until a garbage collection pass occurred. So, at unpredictable intervals your program would slow to a crawl, and then speed up again.

      In Java, that's usually a sign that either you need to increase the size of the Java heap, or you have a memory leak somewhere. The pauses you are seeing are when the JVM does a "full" garbage collection. It does this whenever the heap gets close to being exhausted. This is a last resort mechanism to try to free up as much memory as possible before throwing an OutOfMemoryException. I would take a look at your program and determine if it needs more memory to run normally, and run OptimizeIt on it to check for leaks.

      --
      Show me on the doll where his noodly appendage touched you.
    38. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      I suggest you take a look at: http://www.aqsis.com and http://www.jrman.org Both implement the same algorithm to render images. This is a VERY CPU INTENSIVE task. Aqsis is written in C++ while jrMan is written in Java, and jrMan is typically 2 to 4 times faster than Aqsis.....

    39. Re:jump off the bandwagon by kaffiene · · Score: 1
      Garbage collection in Java is not guranteed. It's what I call Union. It'll clean up when it god damn well feels like it. In the meantime, the system slows to a crawl..
      Incremental GC has had the GC pause problem solved for years now.
      Graphics in Java are abysmally slow. Even basic UIs lack the speed and responsiveness of GUIs written in C, C++ or similar languages.
      Swing is somewhat slow, true. However Java can drive opengl - which is pretty damn quick. A java developer can also use SWT - IBM's GUI kit which is very fast, utilising the platform GUI.
      Java was supposed to be: Write once, run anywhere, but what it is in reality is: Write once, debug everywhere... over and over and over. Or perhaps more appropriately it is" Write once, run screaming.
      Absolute rubbish! In all my years of Java programming the only time I've ever had problems was way back in an old 1.1.6 release with some crappy Borland components which didn't work properly on Linux. Other than that one problem, I have never had issues with writing Java code for mutliple platforms.
      I've worked in a variety of Java development projects in the past and not once has it ever risen to the task to show itself as a worthy choice and/or a mature language. Instead it has invariably wasted companies time and money. Primarily because they failed to realize that Java is a small task tool, not suitable for major applications or those requiring performance.
      This is out and out FUD. There have been several reports showing that Java development is typically half the time of C/C++ development. It is also much cheaper to maintain, which is a code cost often ignored by Java's detractors.
      Java sucks! Stick with C and C++ for most development, there's a reason they are the standard: they work.
      Riiiiiight, so C/C++ coming from a position of having a huge user base and losing a large chunk of that to Java says nothing for Java's ability to get the job done? Face it, C/C++ - which are both languages that I have programmed in for years, and like a great deal - have lost a lot of ground to Java. I'm not saying that Java is going to wipe those languages out or anything, but there is no way that Java could have made so much inroads unless it provides something better than C/C++ at least for some territory.

      Your 'java is crap at everything' attitude is mindless FUD. Different tools have different uses.

    40. Re:jump off the bandwagon by pyrrho · · Score: 1

      >I would be willing to bet the reason they failed is because you do not understand how to use Java correctly.

      what a coincidence, it's the same with all the C++ complaints.

      --

      -pyrrho

    41. Re:jump off the bandwagon by C0deM0nkey · · Score: 2
      If you were holding a gun to my head to get something done as quickly as possible, I would not hesitate to choose Perl over anything else...

      The problem with this statement is that it only reflects your experience and those of similar experience. As always, the quickest tool to use is the one with which you are most familiar.

      Personally, as a J2EE developer, I would never dream of using Perl to code anything quickly. I recognize the value of Perl but have had little reason to develop proficiency in it. For me, Java would be the quickest route to success. For you, it is Perl and, I am sure, for someone out there it is Visual Basic.

      "Best", "Quickest", "Fastest" are very subjective terms.

      C0dem0nkey

    42. Re:jump off the bandwagon by deanj · · Score: 3, Interesting

      Start up time should be a lot better in the 1.4.2 release. Last JavaOne they specifically said work was being done on that. Further improvements are in 1.5 (when it comes out).

    43. Re:jump off the bandwagon by AetherGoth · · Score: 1

      I agree with parts of this, but not all...In recent releases, the core of Java has improved greatly...when you write straight code and algorithms, its performance (especially with Hotspot) is very decent. This means that as a serverside language, it is a really nice choice. Add to that the existence of Tomcat and JSP, and its case is only strengthened in this regard.

      I agree with you, though, that Java is a poor choice when developing client applications, especially those involving sound and graphics. I have a fair amount of experience in creating UIs and client apps, and as you mentioned, most API type routines (AWT, Swing, Java3D) are abysmally slow. Platform-independent? Not a chance. Java3D isn't even available for Mac, on Linux it suffers from OpenGL driver problems (especially on the popular NVidia cards). On the Mac, Swing has notable and serious bugs in glaringly obvious places. I've actually delayed the release of a Mac version of one of my Java apps until Apple gets their act together.

      Then look at other APIs - JavaSound? Notoriously unstable and bug-fraught on anything other than Windows. Apple did not even bother implementing audio recording (added to Windows as a standard as of 1.2) on their OSX JRE untl the 1.4.1 release, where it remains very buggy. And even on Windows, the Sun engineers over a period of several years 'forgot' to implement the Port interface (arguably the one thing that would make JavaSound pretty cool) until release 1.4.2 (where it still remains buggy or nonexistent under all other operating systems)

      In short, if you want to develop a nontrivial user-interface or graphics-driven client-type application that looks and performs well, Java is a dicey choice. For many other things, its speed and performance is excellent.

    44. Re:jump off the bandwagon by Angst+Badger · · Score: 1

      I'm sure I'll be marked as flamebait or troll by some Java loving mod, but what I've stated are facts and experiences from real life Java development. The results are in and frankly... Java sucks!

      You're right -- you will instantly be marked as a troll, even by people who feel much the same way. That being said, there's not much I can disagree with there, except that I haven't developed software in Java -- I do C, C++, and Perl -- so I can't speak to what it's like as a developer. Some people rave about it, some hate it, just the same as every other language.

      What I can say is that as a user Java sucks ass. I'm sure I'll get modded as a troll, too, but that's been my experience. Every damn time I've tried a Java app, it has been slow and memory hungry. And most times I've tried installing a large and complex Java application, especially under Linux but also to a lesser degree under Windows, getting the Java runtime environment and the usual long laundry list of required libraries set up properly has been a major pain in the ass. Speaking from the user side of the fence, there's not much reason for me to spend several hours -- or even fifteen minutes -- trying to get Java to work when there's an RPM or MSI that painlessly installs an equivalent compiled C or C++ application with a single commandline or click.

      Mind you, I wanted Java to live up to its promise. Near as I can tell, though, it has yet to be as fast, reliable, or even as cross-platform as ISO/ANSI C.

      --
      Proud member of the Weirdo-American community.
    45. Re:jump off the bandwagon by FiskeBoller · · Score: 1

      I'm sure I'll be marked as flamebait or troll by some Java loving mod, but what I've stated are facts and experiences from real life Java development. The results are in and frankly... Java sucks! Stick with C and C++ for most development, there's a reason they are the standard: they work.

      Hmmm. Can you point out where you listed these so-called 'facts'? ... Who's the troll here?

    46. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      Where is the "Completely Misinformed" moderation option?

    47. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      Java is compiled bytecode. If it isn't much faster than purely interpereted languages like perl/php/python, then something was done horribly wrong. Likewise, natively compiled binaries will blow java away unless something was done horribly wrong.

      If you're going to write something in-house and run it through a compiler anyway, you might as well write a native app. Use portable code and you need only compile once for each different platform.

      Of course, therein lies the rub. Nobody knows shit about portability because they all grew up in their homogeneous Windows environments.

    48. Re:jump off the bandwagon by platypus · · Score: 1

      hat was then, this is now. Internal benchmarks of our code under mod_perl, PHP, Python (Zope), and Java for our web development show Java (Tomcat) to be the winner by a landslide when it comes to scalability, performance, and rapid development.

      Ahem, sorry for a little zope advocacy, but you really can't compare the other alternatives to zope. It must be slower, since it is a complete application server and does much more for every request than the standard perl/php/servlet framework (like having a built in security architecture, preserving transaction integrity, etc.).

    49. Re:jump off the bandwagon by Moraelin · · Score: 1

      Actually, please get off that high horse.

      My experience actually does reflect that Java is good and fine for micro-benchmarks (most of which are optimized away by the JIT, hence bogus speed measurements), but fails to impress me in real life situations.

      No, I don't use object pools. No, I don't manually call System.gc(). Yes, I've read those books and a whole stack more.

      Java still fails to measure up.

      For starters, there is no allocating variables on the stack. There's also _no_ way to allocate an array of _objects_, all you can ever get is an array of _pointers_. Regardless of the bulls**t about how java's dynamic allocation and gc measure up to C's malloc and free, there's no way it can measure up against _not_ allocating anything dynamically and _not_ dereferencing an extra pointer level.

      The garbage collector is also good and fine, but it's a flaming disaster when the machine swaps. Whereas a C program could run just fine and dandy when it's just a bit over the available memory, a Java program will cause the whole machine to thrash. Why? Because that retarded garbage collector _has_ to go through the whole allocated memory, causing it to get paged in and immediately paged out.

      And so on and so forth.

      And I'm not even getting into the disaster that are EJBs (enterprise java beans.) Whoppee... using CORBA to call methods over TCP/IP connections, _inside_ the same program. How's that for a retarded way to waste CPU cycles?

      Yes, it's good and fine for server programs, because most server side programs really aren't that CPU intensive to start with. Heck, for most of them spawning a Perl process via CGI would still be fast enough. But that's all.

      And Java on the client is still sad. Just sad.

      And just like you say that C++ people make poor Java programmers, I'll go and say the opposite: if you're grown on Java, you have _no_ clue how it measures against C or C++. Even if you tried to compare, your C++ programs will be bloated, and will fail to use even the most elementary optimizations available.

      Basically you'd be writing Java in C++. And whoppee, no wonder that then they're almost comparable in performance. (With Java still losing, but comparable.) But if you compare a _competently_ written Java program, versus an equally competently program that's been writted from the ground up in C++, the C++ one wins every time. Period.

      --
      A polar bear is a cartesian bear after a coordinate transform.
    50. Re:jump off the bandwagon by master_p · · Score: 1

      It depends on the application. For applications that performance is the most important requirement (real time apps, defense applications, etc), Java is slow. Not only because of the JVM, but also of the language design (GC, casting, etc). On the other hand, for applications that the time-to-market is critical, Java is much better, because it allows for shorter life-cycle.

      I am a C++ developer myself, but I can't say that Java has many advantages over C++. Here are a few:

      1) no separation between header and implementation files
      2) no forward references
      3) a nice packaging system
      4) simplified syntax
      5) a large library with many things available, especially a cross-platform GUI

      The GC and auto memory management is a mixed blessing. It's nice when you don't want control of memory, but it's a problem when you do;and there is a surpisingly large amount of times that you need control of memory, unfortunately(this problem appears quite more often than you can imagine). C# is better, in the sense that for time-critical loop, C/C++ unmanaged code can be used.

      Some of Java's drawbacks are:

      1) no templates; this makes code unreadable after a while; generic collections must be specifically named after their key/value content, otherwise after a while it is forgotten; with templates, it's always there; and the compiler misses the chance for optimizations, based on the used types.

      2) the packaging system is tied to the directory structure; I don't really think this is useful. I'd like to arrange my files different on disk than within the project.

      3) access specifiers (public, protected, private) are declared on each member of the class; this is reduntant. C++ classes are usually more nicely laid out, with the public part coming first, then the protected part, then the private part. And it saves quite a bit of typing.

      4) the always dynamic casting; since there are no templates, there is a lot of casting going on; unfortunately, all casting is dynamic, which means a lot slower access than the analogous C++ code. This is especially critical in loops (I don't know if the Java compiler recognizes the invariant and moves it out of the loop; I highly doubt it).

      Another complain that I have is that companies don't offer pre-complied binaries of their Java static apps. For example, JDeveloper runs on the JVM. Whereas it would make a lot more sense if they made it an .EXE for the most widely used platforms, i.e. Windows, Mac, Linux and the Unix variants. It just takes a few minutes to enter a Java project in the compiler's application. And it makes miracles: some things may turn out to be 30 times faster than before.

    51. Re:jump off the bandwagon by _avs_007 · · Score: 1

      I've still had problems with the same JVM. I used Sun's JVM for Linux and for Windows. Same version even. On windows, the component traps mouse events. Under linux, the form did. It's these little quirks that irritated me.

      Other than that, I really haven't had that many problems I guess...

      I still found the C# code to run smoother/faster then the Java port of the same code tho. I also like the network interfaces of the .net libraries better than Java's. Probably because I like how the raw APIs are exposed in .net.

      The only real thing that irritated me about Java, (tho I think they fixed it in 1.4), is that when you try to grab the current IP address from the hostname of the local machine, Java cached the entries, such that if your ip address changed, you would never know about it, because it would return the old one.

      I also thought the XML libraries provided by .net were simpler to use. At least the SAX parser was. I had to write my own wrappers for the JAXP SAX parser, just to make the APIs a little more friendly/intuitive.

      But either way, I like both languages equally well. Perhaps I lean a little more to C#, but only because I prefer the delegate method of handling events, vs the whole inner-class thing. But its just personal choice I suppose.

      It would be nice if .net supported a concept similar to jars though, as its nice to be able to load resources into the jar file, and access them from inside your code.

    52. Re:jump off the bandwagon by cartman · · Score: 3, Informative

      I disagree.

      Garbage collection in Java is not guranteed... It'll clean up when it god damn well feels like it.

      This is false. Garbage collection in Java is guaranteed. The VM times the garbage collection to occur when the CPU was otherwise idle, or when additional memory is needed by the VM or by other programs. This is the most reasonable behavior.

      In the meantime, the system slows to a crawl.

      This is false. Garbage collection is deferred to improve performance. Deferring gc does not make anything "slow to a crawl," since unused objects consume no cache and take no processor cycles.

      Graphics in Java are abysmally slow.

      This is an exaggeration. It is noticeably less responsive however.

      Java was supposed to be: Write once, run anywhere, but what it is in reality is: Write once, debug everywhere... over and over and over.

      Java requires far fewer debug cycles than C or C++, since an entire class of bugs (tricky "pointer bugs") is eliminated. Thus, "over and over and over" is not accurate.

      I've worked in a variety of Java development projects in the past and not once has it ever risen to the task to show itself as a worthy choice and/or a mature language. Instead it has invariably wasted companies time and money.

      It's possible the difficulty was with you or your team, not Java. Perhaps you're unfamiliar with the tools or the language. Other organizations have produced enormous projects, successfully, in Java.

      Stick with C and C++ for most development, there's a reason they are the standard: they work.

      For backend development and enterprise applications, Java is the standard, not C or C++. It's been that way for some time. There's a reason for it.

    53. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      Why does everyone always forget about J2EE - prob the most useful aspect of Java.
      When it comes to enterprise computing e.g. dealing with a large organisation with windows machines, linux, solaris, etc. I cant imagine using anything but J2EE to tie everything together.
      All this talk of Swing, applets, etc is so last season.

    54. Re:jump off the bandwagon by DrXym · · Score: 1
      Java is as mature a technology as you'd find anywhere. While the GUI side is still a bit sluggish, I've used apps written in Java and they're quite tolerable and most of the time it doesn't matter. What does matter is that the apps run anywhere, the language is straightforward, there is a huge number of third party tools to choose from, and the thing is very very reliable and scalable.


      And when you're working on the server side with all the latency of networks and databases, any perceived performance issue with Java just disappears. If 99% of the time is spent waiting for some database to do something, it really doesn't matter what language you're using. What does matter is that it can take anything you throw at it, and there are dozens of platforms and third party database / EJB / servlet solutions to meet any requirement.


      Frankly it's a wonder why anyone would bother with .NET at all. So the GUI is a bit faster - big deal. If you want a fast GUI write it in C++. If you want to write server apps, write it in something that runs anywhere and in any configuration you wish to use. It makes no sense at all to lock yourself into MS products and operating systems when there is zero reason to do so.


      As for mono. I hope someday that it offers something comparable to J2EE, but at the moment it's little more than a runtime and a compiler. The mono boys should get the Apache & postgresql folks on board and see if they can throw out something akin to Tomcat for c#. It would be cool to see a Borland C# dev environment for Linux which could throw out enterprise apps with not a single piece of MS proprietary code, but there is a long way to go before that happens.

    55. Re:jump off the bandwagon by IkeTo · · Score: 1

      > c++ isn't portable, normally. C++-- might be
      > though. Then again, it might not be. The
      > java language is very standardized; and in
      > case you shouldn't have a compiler on that
      > platform, the bytecode is too!

      If you see non-conforming C++ implementation, you should go blame the compiler vendor, not the language. And Java is not standardized at all. C++ goes through the standardization process and now have ISO standards, Java has nothing about it. C# does have a ECMA standard as well, so Java is alone on the lack of standardization. Basically, Sun decide on it, and everybody has to follow. Now you can see why there are so many mis-features or lack-of-features in that language: it has never been beaten to death by vendors before it is set in stone.

    56. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      Take a look at wxWindows.

      You can have your cake and eat it too.

      Besides, Wine is not a good solution because it won't help you run your apps on a Mac, on *BSD, on Solaris, HP-UX, AIX, whatever...

      wxWindows will.

    57. Re:jump off the bandwagon by jrumney · · Score: 1

      Sure, Perl is rapid if you're fluent in it and working by yourself on a small project. But try debugging someone elses Perl code. The more rigid structure that the C-like languages impose does wonders for maintainability.

    58. Re:jump off the bandwagon by IamTheRealMike · · Score: 1

      Er, as a Wine hacker I think that's a terrible idea. You'd spend just as much time debugging Wine as it'd take to just write the program properly in the first place. I really would try the latest versions of GTK on Windows, they are pretty good these days. With GTK Wimp doing the skinning, and the last few wierd event/painting bugs fixed, it works pretty well.

    59. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      Portability: I suppose that you never tried to port a C program to different platform. Even using the same OS can be tricky if hardware is different.

      Performance: server-side apps are not loaded at every request, of course. And I repeat "of course".
      Is httpd lunched from inetd? No, of course.

      BTW: sun vm, don't jit everything, but only most requested classes.

    60. Re:jump off the bandwagon by CommandNotFound · · Score: 1

      I noticed a dramatic improvement in startup times in the latest version (1.4.2), both in console apps and in the browser plugin. If C# has done nothing else, it has at least put some fire under Sun's rear to clean up the client side of things.

    61. Re:jump off the bandwagon by gbjbaanb · · Score: 1

      I have to disagree with 1 point: with certain applications (real time apps, defence apps), Java is not simply slow - it is totally unusable.

      Any language with a GC, and Java's JIT is unsuitable for such apps that require real time-specific determinism. Java cannot provide those features, and the licence Sun hands Java out with even precludes their use in such apps.

      You also forgot Threads (Java's multithreading support is poor, unless you just want very simple, I-dont-mind-thread-contention type thread programming).

      Also, C++ has a cross platform GUI. consider QT for one. Its just that this isn't in the language by default, doesn't mean that C++ apps shouldn't be allowed to consider it as a feature.

      I'd say the only thing Java has over C++ is the time of coding, but then java is beaten hands down by Visual Basic :)

    62. Re:jump off the bandwagon by gbjbaanb · · Score: 1

      oh god yes. GC is all very well, but the creators of the language forgot that memory resources are not the same as all other resources. Sure, an object takes no CPU etc so it can be deleted it when the system feels like it, but what if it holds a network connection open, or similar? Tough! You have to delete it explicitly, and program around that - call the 'tidy up' method explicitly, hardly encapsulating an object's behaviour.

      I think this is the biggest single-most hated thing about.net (and Java). Java gave us the brain-dead finaliser (no-one can disagree with that, it was a hack right from the start. Anything that 'may or may not run', that you 'should not use as it impacts performance', and 'cannot be guaranteed to run when you expect' cannot be any good) and .NET simply copied it! madness.

      Deterministic destructors can be combined with GC - you have to keep track of objects (eg allow stack-based allocation of single-reference objects) and destroy them when they go out of scope (a rough way of creating 'stack-based' objects). Easy peasy, but no - the designers figured sticking everything on the heap was a good thing and you, the programmer, would have to be responsible for object lifetime (unless they were objects that used no resource other than memory).

      Damn, damn stupid. Damn Java for giving that to us. Makes .Net (and Java) programming barely more object-oriented than structured programming (remember to call Dispose() during program flow guys).

      I'll rant about this for the next 5 years until the next big thing comes along. Perhaps that'll have reference counts as the solution!

    63. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      Hello? Even Sun has abandoned the write once run everywhere lie. But to give you the benefit of the doubt, have you ever really tried to write an app and run it across platforms? I'm not talking about a command line tick tack toe here, I'm talking about something with swing and a robust UI.
      It does not run without changes across UI without if's in the code concerning the environment - oh, say things like file seperators and line end terminators. Built in you say? BS again, what if the app is running on Windows writing to a Unix file system? There is no magical solution. In any language, you as a programmer either need to deal with it, or your app is trivial.
      For your next comment, when was the last time you wrote a swing app to run on a PDA? Where the hell is write once run anywhere now? Jump on C#, write an app using grids and treeviews and SOAP remoting without any fancy steps whatsoever. As much as you hate to admit it, Microsoft is actually doing a much better job of supporting different platforms at the moment. Except for overpriced mid-range systems - Java has the (clueless) market there no doubt.

    64. Re:jump off the bandwagon by deanj · · Score: 1

      Your whole post is FUD.

      1) J2ME is designed for Cell Phones, and works fine Many many applications are available for it. J2ME API 2.0 is out by the end of the year.

      2) Java is a great language. I know many different languages, and I code in the language that's appropriate for the task. Just because YOU don't like it doesn't make it "ill designed". That's just silly.

      3) Java is fine for platform independence. I code on Linux, and deploy on Linux, Mac OS X, and Windows. It all works fine.

      Quit spreading FUD about languages you don't like. If you're going to convince people to like something YOU like, point out why things YOU like are good...just stop spreading the FUD.

    65. Re:jump off the bandwagon by mcoon · · Score: 1
      In conclusion, if you're using c++ for a server-side task you should consider using java instead. As a matter of fact, most scripting languages are probably better suited than c++, I can hardly image a worse fit.

      Hmm... So what you are saying is that all JAVA code is portable to whichever vendor's JVM and whichever version of that JVM happens to be in place? Well, one of the languages I program in for a living is JAVA & I have to say that portability issues can't be ignored. In fact, as some others here have said, C++ is portable to any platform with GCC (g++) which far outnumbers JVM supported platforms.

      As for C++ compatability issues, I can assure you that those are a non issue.

    66. Re:jump off the bandwagon by deanj · · Score: 1

      Better IDEs? That's like throwing a match on gasoline. Geesh, you might as well ask people which they prefer, vi or emacs.

      I use JBuilder.

    67. Re:jump off the bandwagon by Cnik70 · · Score: 1

      Um... if you knew anything about java, you would know that it is very easy to program an application to have it handle any platform (did we suddenly forget about System.getProperty("file.separator")???) As for me, yes I have written many applications that run on Mac, Windoze and Linux... all without recompiling and/or changing it for the machine. Have I written for a PDA... everyday... works fine on a Palm, works fine on a cellphone, and it works fine on a handheld scanner... just to name a few. MIDP is looking quite nice these days. And all those people who said that it couldn't handle games can now sit back and see how far J2ME has advanced. Microsoft supporting different platforms... now there's a joke. Thayt support only platforms running THEIR OS..which is how and why they missed the midrange market, as well as the embedded market. Guess that the java people were so clueless that they simply went to where Microsoft was afraid to go (ie: outside of their own OS, just as usual).

      --
      -Cnik
    68. Re:jump off the bandwagon by deanj · · Score: 1

      I've written Java apps since the beginning, and it entirely depends on how you code stuff...which is true for any language.

      I've done major projects using AWT, Swing and Java 3D. Hell, JBuilder uses Swing... I use that every day, and it works great cross-platform. Thank God I didn't have to do all my development on Windows, and I could stick with Solaris.

      No Java 3D on the Mac did suck. When Apple reps came to talk to us about doing our Java 3D on Mac, they tried to tell us to use Quicktime 3D.

      Java3D is on "hold", btw. Sun's now doing that OpenGL bindings to Java. I've used those, and it's pretty damn fast. A helluva lot faster than Java 3D was, but then, OpenGL isn't a scene graph API either. That's under Linux too. If you haven't seen it, check it out. It's great.

      Sound....done some of that, but not enough,

      I have to disagree with your conclusion though. Java's still my choice for most desktop apps.

    69. Re:jump off the bandwagon by GlowStars · · Score: 1

      And I'm not even getting into the disaster that are EJBs (enterprise java beans.) Whoppee... using CORBA to call methods over TCP/IP connections, _inside_ the same program. How's that for a retarded way to waste CPU cycles?

      EJB 2.0 offers "local interfaces". Your information is dated ;-)

    70. Re:jump off the bandwagon by AetherGoth · · Score: 1

      Hmm...I should definitely check out the OpenGL bindings. If it's fast and available on Linux too, it sounds interesting.

    71. Re:jump off the bandwagon by Captain_Chaos · · Score: 1

      Performance - Yes, servers tend to have fairly impressive hardware resources available to them. So lets cripple that hardware by making it run an interpreted language. JIT? Server-side apps also tend to have very short process lives, doing a small task and exiting. In such situations, JIT causes worse performance, as it wastes time optimizing something that will never execute again during this process' invocation.

      With this paragraph you give away that you 1) haven't looked at Java in a long time, if ever and 2) don't understand how Java server programs are constructed.

      1) HotSpot solves exactly the problem you mention by only compiling code that is executed often, so that it avoids compiling code for which that would not be worthwhile. This mechanism works very well. Cases are known where Java on a HotSpot VM outperformed C code.

      2) Maybe httpd with CGI scripts has very short process lives, but Java server applications don't. They are typically implemented as J2EE applications that run on an application server in one virtual machine which runs all the time. There's ample opportunity for a JIT to compile all the code.

    72. Re:jump off the bandwagon by deanj · · Score: 1
    73. Re:jump off the bandwagon by m_niessner · · Score: 1

      Don't forget about FreeBSD, OS X, and Mad Hatter.

    74. Re:jump off the bandwagon by StillNeedMoreCoffee · · Score: 1

      "Java has nothing about it. C# does have a ECMA standard as well, so Java is alone on the lack of standardization. Basically, Sun decide on it, and everybody has to follow. Now you can see why there are so many mis-features or lack-of-features in that language: it has never been beaten to death by vendors before it is set in stone."

      Well Java has a Sun sponored "standard" that goes through the "Java Community Process" which includes many companies, deveoplers and interested parties to propose, review, prototype, and comment on any and all changes before they go into the language. It is just a different standards body if you will. There is one version out there with "reference" editions that allow you to validate that any new compilers or JVM implementations meet that standard.

      I would venture to say retoric aside. That to code a transportable C++ project requires discipline and knowledge of what features and libraries are not standard. Without that programmer supplied discipline you havent a chance in hell of a transportable C++ program. That is not the case with Java. The only thing you have to worry about is version differences, of which you only have to worry about the standard Java version and not all the vendor versions and libraries.

      Don't confuse that well healed and trained programmers ability to finally come up with a style of coding that can be run on different boxes and a programmers abiilty to write transportable code right out of the box.

    75. Re:jump off the bandwagon by ForsakenRegex · · Score: 1

      My post was in response to a post comparing Java, PHP, and Perl. You must accept equivalent skill levels are present in all three languages in order to make such a comparison, so my response was perfectly valid in that context.

      --
      "A man talking sense to himself is no madder than a man talking nonsense not to himself."
    76. Re:jump off the bandwagon by ForsakenRegex · · Score: 1

      Once again, the issue here is the context of the discussion. The post was in response to a comparison of the languages. Equivalent skill levels must be assumed if the comparison is to be considered in even the smallest sense.

      However, in response to your specific point, though I do feel it was tangential to my point...
      I've been debugging C, C++, Java, Delphi, Perl, and PHP for over a decade (well, a decade for C, C++, and Perl at least), and I don't find anything easier or harder about debugging any of them. Any of them can be totally convoluted and illogical when written in a totally convoluted and illogical way. Perl and PHP can be just as clear to read as C, C++, and Java. You just have to read them in the appropriate mindset, which may or may not be similar to the one you need when deciphering C, C++, and Java.

      --
      "A man talking sense to himself is no madder than a man talking nonsense not to himself."
    77. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      "JIT causes worse performance, as it wastes time optimizing something that will never execute again during this process' invocation."

      You are wrong on both counts. Java server apps don't create a new process for each client. They create a new thread for each connection, thus the VM does not have to restart and recompile any code. It all runs on the same VM.

      And the suggestion that Java's VM will JIT code that will only be executed once is also wrong. (Though this is true for C#). Sun's hotspot JVM will only JIT compile methods that are executed frequently (A.K.A "hotspots"), thus avoiding compilation overhead for infrequently executed methods. To find out more try searching for "hotspot" + Java on google

    78. Re:jump off the bandwagon by Tukla · · Score: 1
      what if it holds a network connection open, or similar? Tough! You have to delete it explicitly

      Why? Just call the object's close() method in a finally block and forget about it.

    79. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      Done it in C++, given a reasonably good cross-platform library. If you use the JVM as your library, that's fine, too. :)

    80. Re:jump off the bandwagon by Anonymous Coward · · Score: 0

      Apache vs. Pure Java Servlet Containers

      So tell me why is then a line like this the default setting in the Apache httpd.conf:

      MaxRequestsPerChild 1000

      Does that have something to do with GC (or lack of it and therefore inherent memeory leaks)?

  19. Languages are not application-neutral by DaMeatGrinder · · Score: 5, Insightful
    These articles set a metric of what is "good". They judge a bunch of languages based on this criteria, and announce a "winner".

    This is just one way to slice the pie.

    Languages are appropriate for different uses. I use C while kernel hacking. I use C++ for its template abstractions. I use PHP for web pages, Perl for command-line scripting. I use bash/tcsh for boot-scripts. I respect VB as an accessible language, but I have no use for a single-platform language.

    What language you use depends on your application. Comparing C, C++, and C# is like comparing a wrench and a screw driver. And concluding they can both be used as a hammer.

    1. Re:Languages are not application-neutral by Waffle+Iron · · Score: 4, Interesting
      Comparing C, C++, and C# is like comparing a wrench and a screw driver.

      Moreover, languages like C and C++ can be used in very different ways, depending on the circumstances. You can code the "safe convenient" way using tools like STL or glib to manage strings, containers, etc. I've found that the overall performance of such an application often is in the same ballpark of a Java implementation (other than Java's obnoxious startup time).

      However, C and C++ also allow you to write in a "masochistic balls-to-the-wall" mode that gives you much higher performance in exchange for 10X the programming effort. To do this, you often have to analyze your algorithms over and over until you can implement them using only stack and static structures. You avoid malloc() at all costs, avoid copying any data unless absolutely necessary, etc. You might disassemble the compiler output, run profilers and arrange data in cache-friendly patterns to squeeze out even more performance. The implementation will be much more brittle and prone to bugs, but you can often get a 10X or more speed improvement over the "natural" C or C++ implementation. Obviously, very few problems warrant this kind of attention, but making blanket statements about "comparing" other languages to C/C++ really should acknowlege the large range of performance that these languages can cover.

    2. Re:Languages are not application-neutral by slapout · · Score: 1

      And don't forget, most games are written in optimized C or C++.

      --
      Coder's Stone: The programming language quick ref for iPad
  20. Competition is important. Whats really needed. by zymano · · Score: 0, Insightful
    Java is not what it was intended for. It's a decent language . More so for Sun though. Don't care for it's memory consumption .

    C# is good because it competes with java and therefore will make SUN competitive.

    Whats really needed is a FAST language that can be run on all computers so the software developers don't have to develop different code for each OS so applications don't need porting and speed and memory consumption wont be noticed by the user like they do with java. Something that can also be run on all handhelds with speed.

    Java will never be able to do that.

  21. I always said by Microsift · · Score: 2, Funny

    C# was Delphi b (best flat sign I could do)

    --
    My other sig is extremely clever...
  22. Conclusions by SimuAndy · · Score: 3, Informative
    After a quick registration, I'm enlightened by the conclusions I drew from his article:
    • C# fares rather well.
    • ... but almost never as well as native C and C++ implementations done "smartly".
    • Java suffers from runtime-based overhead, with the advantage of a well-tested set of runtimes for various platforms. Unfortunately, due to the Java implementation of client-side runtime libraries, programming in Java is still "write once, test everywhere. curse. port everywhere" for real applications.
    And most importantly, as a game programmer, I'm going to pay attention to the relative performance the author received from the Intel-branded compiler, written to the metal of the Pentium IV with streaming SIMD instructions. -andy
    1. Re:Conclusions by Cederic · · Score: 1


      Java is write once, run on your Windows development box, your Linux test box, and your HPUX production box with zero changes and zero hassle.

      Of course, I write server-side Java, usually for use in application servers. And the constraints on my projects typically include X amount of functionality in Y amount of time.

      Given those constraints, and the type of code written to meet them, Java continues to be the best option. Although I'm still only just starting to play with C#, so we'll see how that works out..

      ~Cederic

  23. What's with all of the bellyaching about speed? by defile · · Score: 5, Interesting

    OK lets get a few things settled.

    Given: two identical applications; A, written in low level language like machine assembly, C, or C++; B, written in high level language like Java, Python, VB, hgluahalguha.

    If the application is high in CPU burn (lets call it X), like oh, for (i = 0; i

    If the application is copying a very large file using basic read/write system calls and large enough buffers (lets call this Y), A and B will have very similar performance.

    If the application is printing hello world, they will have similar performance, although the startup costs for B may be higher, and A will probably finish executing faster.

    MOST applications written today are written to solve for Y. The code that most programmers write today is NOT the CPU intensive portion. Usually the CPU intensive portion is in the library called by the programmer: rendering a box, moving things around on a storage device, making something appear on a network.

    In these cases, a high or low level language makes no freaking difference on execution speed. However, your choice WILL make a huge difference on time to develop, maintainability, resultant bugginess, SECURITY, etc.

    OF COURSE THERE ARE EXCEPTIONS. Maybe you're writing a routine that needs to draw lines fast, or move bytes through a network filter at 100MB/sec, or you're compressing a file, whatever. In these cases you tend to write the performance critical code in a more low level language so you have greater control over the physical machine. Sometimes you write the entire application in the low level language.

    Many high level languages provide mechanisms for calling low-level code when it's necessary for performance. It's often pretty easy.

    The performance argument is a red herring.

    1. Re:What's with all of the bellyaching about speed? by Derivin · · Score: 1

      The performance argument is a red herring. I would not go that far. As many posters have pointed out, its not really about which single language is better overall, but which languages are best suited for which applications. There is a reason why perl and python have a published C/API for extending and imbeding, there is a reason for JNI, blah, blah, blah. As with many things in life, the intended purpose of the article is not its best use. After reading the article it has changed my opinion on when and where to draw the line between the different languages. Many times I have planned from the start to do my network programming in C over C++ or Java due to the belief that they were slower or contained undue overhead. Which language has the best performance may be what the author intended to write an article about, in the end it is more a helpfull guide to help decide which side of the fence to write that piece of code.

    2. Re:What's with all of the bellyaching about speed? by Aadain2001 · · Score: 1

      I disagree. When you are talking making one box appear on the screen or copying one large file into memory or to another disk location, sure the performance difference isn't something to use as a make or break deal. But when you talk about running something for a long time, say hours or days, the difference becomes brutely clear. I have a Java application (GUI based) that I need to run for up to 24 hours sometimes. The longer it runs, the worse it gets. Memory bloat, performance degradations, etc. They all add up. Remember: Java is running on an emulation layer, so each instruction has to be executed twice. Once by the Java code, and once by the Java machine. It's the reason emulators like Wine and WineX don't have as good performance as straight Windows.

      If the probject is small, does or or two small activities and doesn't have to run for more than short periods, the it's just fine. For something that will do big work, require lots of memory and run for long periods, Java will come to bite you in the ass.

      --
      Space for rent, inquire within
    3. Re:What's with all of the bellyaching about speed? by whizzard · · Score: 1
      Given: two identical applications; A, written in low level language like machine assembly, C, or C++; B, written in high level language like Java, Python, VB, hgluahalguha.
      compared to C, written in D...
    4. Re:What's with all of the bellyaching about speed? by abigor · · Score: 2, Informative

      Huh? Wine is a reimplementation of the Win32 API and some other stuff. It uses the C libraries directly; there is no emulation. Look at the code sometime.

      Some of the largest online systems in the world run Java. On the server, Java is unbeatable. I've personally witnessed massive uptimes with none of the degradation you mention. And there's this company called IBM that bases much of their server business on Java (both through WebSphere and through their consulting arm.) These apps do not perform "small activities".

      Your one little client app is probably written poorly, or with a buggy Java implementation. In short, you don't know what the hell you're talking about.

    5. Re:What's with all of the bellyaching about speed? by ScrewMaster · · Score: 1

      The performance argument is a red herring.

      Yes, absolutely. That's why environments like Visual Studio allow multilanguage calls. Write the components of your major application in the language that best suits them. Of course, that requires a programming staff that is competent in more than one language, but that's another issue.

      --
      The higher the technology, the sharper that two-edged sword.
    6. Re:What's with all of the bellyaching about speed? by Anonymous Coward · · Score: 1, Insightful

      You blame Java for one application that you run that performs poorly? I assume you blame the entire McDonald's corporation when you get one bad hamburger and never go there again do you? Any language can produce bad code.

    7. Re:What's with all of the bellyaching about speed? by good-n-nappy · · Score: 4, Interesting

      Maybe you're writing a routine that needs to draw lines fast

      This is one of the specific things you can't really do with JNI and Java anymore. Java graphics is now really complicated. There's no way you'll be able to use low level OS rendering methods and have them integrate with Java2D and Swing.

      It's actually a real problem. You've got no recourse when the graphics primitive you need is too slow. You end up with a Java workaround or you switch to OpenGL or DirectX, which don't have good support for fonts and strokes and such.

      This is where C# may end up beating Java, on Windows at least. Eclipse SWT has promise too since you at least have the potential implement your own graphics code.

      --
      Never underestimate the power of fiber.
    8. Re:What's with all of the bellyaching about speed? by Hard_Code · · Score: 2, Informative

      "For something that will do big work, require lots of memory and run for long periods, Java will come to bite you in the ass."

      Like, say, large scale enterprise/website computing? Oh, wait, that is exactly the area Java excels at. Swing is a notorious hog, and I'm not familiar with your exact circumstance, so I can't really comment on it. But Java is pretty damn rock solid for long, throughput intensive tasks. I say throughput as opposed to latency because low-latency gui stuff is exactly where a VM (and garbage collection) will bite you in the ass. If performance is unbearable there is the native SWT library (like AWT redone from the ground up, but right). Java is not known for its good GUI/client side performance.

      On the other hand, on the server side, latency is usually not the issue - most time will be spent on the network and database, NOT in your code. On the server side, VMs are here to stay. Python, PHP, Perl, Java, C#/Mono, all use VMs. The only real issue with VMs is latency, and with garbage collection its memory usage. I would strongly suggest though, that the vast vast vast majority of user-level/space applications in which C/C++ is being [ab]used, would be better written in a "safe", simpler, language like Java, precisely because in the vast majority of cases, CPU performance does not need to be optimized, and security, reliability, maintainability, and let's not forget, new features, take higher importance.

      --

      It's 10 PM. Do you know if you're un-American?
    9. Re:What's with all of the bellyaching about speed? by glenebob · · Score: 1

      I would add to that the point that slow code can be and is written in any language.

      If you use containers and you do a lot of inserting and deleting, things will naturally be slow if you use arrays. If you do a lot of searching, linked lists will likely be slow. Since containers are much easier to come by in higher level languages (I don't believe there are any micro-processors that provide good container libraries :-), it is much easier to write fast code with a high level language when you use containers.

      Memory copying is bad for performance. If you need fast code, avoid it. Allowing some other function to look at your data without changing it is NOT a good time to copy it. This is true no matter what language you write in.

      Memory allocation is bad for performance. Avoid it if you need fast code by caching things or using the stack. True with any language.

      Efficient coding practices will pay off much better in a low level language. Inefficient practices will kill you in ANY language.

    10. Re:What's with all of the bellyaching about speed? by spiro_killglance · · Score: 1

      stop complaining about garbage collection stalls,
      thats been fixed on the Server Side since 1.4,
      (provided you've got a SMP machine).

      invoke with:

      java -XX:UseParallelGC

      And garbage collection runs in the background.

    11. Re:What's with all of the bellyaching about speed? by MinusOne · · Score: 1

      > Remember: Java is running on an emulation layer, so each instruction has to be executed twice. Once by the Java code, and once by the Java machine.

      This is simply not true. Once the bytcode has been compiled by the JIT it is native machine instructions running without any intervention by the JVM.
      The Java app you describe is clearly a piece of crap, and probably would be no matter what language it was written in. I would go so far as to say that if it wasn't written in Java, it would probably be worse.

    12. Re:What's with all of the bellyaching about speed? by tyler_larson · · Score: 1
      If the application is high in CPU burn (lets call it X)

      Indeed. :)

      --
      "With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea...."
      RFC 1925
    13. Re:What's with all of the bellyaching about speed? by GrayArea · · Score: 4, Informative
      This is one of the specific things you can't really do with JNI and Java anymore. Java graphics is now really complicated. There's no way you'll be able to use low level OS rendering methods and have them integrate with Java2D and Swing.

      Sure there is. Have a look at jawt.h header file that's included in your SDK installation. It allows you to access native window system primitives from JNI.

      --
      "The deluded are always filled with absolutes. The rest of us have to live with ambiguity." - Aristoi, Walter Jon Willia
    14. Re:What's with all of the bellyaching about speed? by Angst+Badger · · Score: 1

      The performance argument is a red herring.

      So how come so many applications run slow as shit on anything but the latest and most expensive hardware?

      Geez, I wish programmers who start mouthing off about how unimportant it is to write tight, fast code were required to eat their own dogfood. Just because MS has trained the masses to accept that their 2.4GHz Pentium boxes seem to run no faster than a 286 doesn't mean we ought to accept it ourselves or inflict it on our own users.

      --
      Proud member of the Weirdo-American community.
    15. Re:What's with all of the bellyaching about speed? by defile · · Score: 1

      So how come so many applications run slow as shit on anything but the latest and most expensive hardware?

      Because they're either poorly designed or targetted at high end hardware.

      The best way to end up with an application that runs like dogshit is for the developers to have one project meeting to discuss making the application fast that ends up being centered on rating the "speed" of each programming language. They'll probably even reference articles like the one in this story to do so.

      Applications written in machine assembly can be slower than applications written in Java based on the algorithms used.

      In the end the overall design is more important for performance than the development environment used.

    16. Re:What's with all of the bellyaching about speed? by Richard_Davies · · Score: 2, Informative

      This is one of the specific things you can't really do with JNI and Java anymore. Java graphics is now really complicated. There's no way you'll be able to use low level OS rendering methods and have them integrate with Java2D and Swing.

      Fortunately, the API is being steadily improved so the need for native methods is diminishing significantly with each version of Java. Have a look at these improvements in 1.4 over previous versions (it includes benchmarks you can run to see for yourself).

      The key point here is that if you write your graphics code in pure Java, it will get faster with each new release, in many cases, without you having to lift a finger - and in 1.4, it can already take advantage of things like native hardware acceleration.

    17. Re:What's with all of the bellyaching about speed? by good-n-nappy · · Score: 1

      My point is that it doesn't integrate with Java2D. You either take what Java2D has to offer, or you do it all yourself using OS calls or OpenGL/DirectX.

      --
      Never underestimate the power of fiber.
    18. Re:What's with all of the bellyaching about speed? by Hard_Code · · Score: 1

      Oh, gee, thank you smart guy. Sorry for trying to make a point to somebody else. (yes I know about parallel and incremental GC thankyouverymuch).

      --

      It's 10 PM. Do you know if you're un-American?
    19. Re:What's with all of the bellyaching about speed? by MrScience · · Score: 1

      I'm actually writing a game in C# using managed DirectX. The initial game loop could support 600fps with vSync off. Think anyone would notice the tearing?

      --

      You quitting proves that the karma kap worked. The most annoying of the whores shut up. --CmdrTaco

    20. Re:What's with all of the bellyaching about speed? by Anonymous Coward · · Score: 0

      Graphics2D and Swing are hardware accelerated since JDK1.4, what are you talking about?

  24. Login by Anonymous Coward · · Score: 0

    Someone's set up slashdot:slashdot

    1. Re:Login by _Bucktooth_ · · Score: 1

      Read that as someone set us up the slashdot

      I need my caffeine...

  25. I've been coding most of... by rmdyer · · Score: 5, Insightful

    ...my life. It's been mostly C/C++ but also a good amount of assember and VB. Maybe someone here can answer one of the questions that keeps poping up when I write anything. My question is, why do we always end up creating libraries/classes that contain other code we will never use? What I would like is a compile environment where each function or object that I use is individually addressable, without having to pull in other "stuff" I don't need in my specific app. Is that so hard? Why doesn't the OS manage code better than pulling in a whole library? If I use only strcat() for example, why do I need to load in the entire C string library?

    The problem gets even worse with C++ and objects. Huge numbers of member functions and public variables that will never be used. Microsoft's .NET and Suns Java take the cake by making you load an entire "run-time" engine. This consists of vast numbers of "ready-to-go" objects that make your simple "Hello World!" app into an 11 Meg progam. Java can't even share the "run-time" between apps very well!

    Is there a program out there that can tell the efficiency of the operating system environment, apps and OS, by how many functions "aren't" getting used in a normal day by a user? I'm going to go out on a limb here and suggest that most RAM isn't being utilized by apps.

    What I would like is an extremely efficient programming environment that compiles my six line x++ program down to a few hundred bytes total...that's in-memory while running. I want to use my RAM for data and number crunching, not unusable code.

    +1-1

    1. Re:I've been coding most of... by Tyler+Eaves · · Score: 2, Insightful

      >If I use only strcat() for example, why do I >need to load in the entire C string library?

      Because strcat can call another string library function, which can call another, etc...

      Code duplication is bad, remember?

      --
      TODO: Something witty here...
    2. Re:I've been coding most of... by gewalker · · Score: 2, Insightful

      What you want is a smart linker. You still build libraries, modules, etc. But when the program builds the executable it notices that some functions are never referenced, so the code for these is dropped when building the executable.

      Some versions even recognize classes have functions that are never referenced, and these class functions are eliminated.

      You get used to using a smart linker (I've been using Delphi a lot and it has one), it changes your programming style as you build larger modules/libraries since the bloat penalty is not there.

    3. Re:I've been coding most of... by kinema · · Score: 1

      Can't this be accomplished by "stripping" your libraries?

    4. Re:I've been coding most of... by Tepic++ · · Score: 1

      I think this is already done in Linux (and probably most other modern equivalent OSes), although not per function but instead per disk page. Only the generally section(s) of disk that the function resides on will be loaded into memory, and this is done on demand.

    5. Re:I've been coding most of... by CustomDesigned · · Score: 1
      What I would like is an extremely efficient programming environment that compiles my six line x++ program down to a few hundred bytes total...that's in-memory while running. I want to use my RAM for data and number crunching, not unusable code.

      Borland Pascal. And its open source cousin, FreePascal. Borland Pascal is my low level language of Choice for the Windows platform (and for DOS before that). When statically linking a library, it pulls out only and precisely only the code and data needed for that application. It worked great for DOS TSR programs (which worked best with minimal memory use).

      The catch is, that this approach only works for static linking. If you want to share the library between multiple different applications, the shared part has to be constant. When you get to GUI controls, e.g. with Delphi, there is a large DLL (.so for the linux version). You can still use the smart static linker, but your hello world GUI app is about 100K on Windows, and goes up from there as you use more interface elements.

      I don't want to get into the tradeoffs of static vs dynamic linking, but when lots of apps use the same DLL/so, it saves memory and disk space, plus you can upgrade/break all the applications simply by upgrading/breaking the DLL/so. When all apps use a rather disjoint set of the DLL, static linking is better.

      On a related note, a lot of the GUI code is loaded with the OS in Windows. Java Swing ignores this and recreates it all in Java. This makes Swing programs much bigger and slower. There are other (non Sun) GUI APIs for Java that use the Windows API directly and are much smaller and faster. C#, naturally, doesn't make this mistake. Java should have stuck with AWT, enhancing its capabilities instead of reinventing the Windowing OS. A mostly Java implementation of AWT would suffice for platforms without a suitable native Windowing system.

    6. Re:I've been coding most of... by MobyDisk · · Score: 5, Informative

      Linkers already do this. At this point, it is ubiquitous functionality. The linker has a list of functions that are referenced, and functions that are not referenced. Functions and libraries not referenced are discarded. I know for MSVC, this is done by using /opt:ref which is part of the default RELEASE builds. This all works for OO code like C++ as well since the methods boils down to functions as far as the linker is concerned.

      There are some special cases:
      1) You mentioned strcat() which can be inlined by many compilers. In this case, you trade speed for code bloat - the library isn't really used at all here. In MSVC this is an "intrinsic" function.

      2) Dynamic libraries may be treated differently. It is more difficult to try to partially load them. I'm not sure how Linux handles this. Windows allows for a DLL to contain multiple code and data segments, which can be loaded individually if needed.

    7. Re:I've been coding most of... by sashang · · Score: 1
      My question is, why do we always end up creating libraries/classes that contain other code we will never use?
      Just because you aren't using those classes it doesn't mean that other people aren't.

      What I would like is a compile environment where each function or object that I use is individually addressable, without having to pull in other "stuff" I don't need in my specific app. Is that so hard?

      C++ allows for individually adressable functions and objects.

      As far as I know when you write a program in C or C++ the functions that are used get worked out at link time (assuming static link). Other functions or classes that may be in a package/library you've pulled in aren't included in the final exe. If using dynamic linkage the system is similar except at link time your program links against a stub library that references the dll so that it loads the appropriate functions at run-time. If you don't like the idea of sharing functions and classes between different programs using dynamic linking, just statically link and then your final exe will contain the minimal set of classes/fucntions required for the program to operate.
    8. Re:I've been coding most of... by Anonymous Coward · · Score: 0

      Maybe someone here can answer one of the questions that keeps poping up when I write anything.

      Oh well, it could be worse I guess: He could have spelled it pooping.

    9. Re:I've been coding most of... by Rykky · · Score: 1

      Not exactly a good example. The C library (libc (glibc)) is always loaded. One copy is in memory serving all applications that are running on the machine (except ofcource programs that for some reason use libc.a) Then runtime linking only links your program to those few calls in the library you use.

    10. Re:I've been coding most of... by tomstdenis · · Score: 0

      This is what libraries for.

      You make a library which is properly refactored [e.g. modular design not all one object unit] and while the lib may be a couple MB if you only use certain functions you win.

      For instance [cheap plug]. LibTomCrypt will build to about 267KB or so with GCC 3.2.3 on an x86 but if you only need AES and SHA-1 or whatnot then your application only goes by 10KB or so.

      Similarly glibc is 2.6MB on my gentoo box but when I write a simple hello-world application it's a mere couple KB...

      Libraries!!! Organized Modular Code! LOMC!

      Tom

      --
      Someday, I'll have a real sig.
    11. Re:I've been coding most of... by The+boojum · · Score: 1

      Stripping, at least in the Unix/Linux sense, simply strips out debugging info. It doesn't really re-link.

    12. Re:I've been coding most of... by Anonymous Coward · · Score: 0

      What are people supposed to use LibTomCrypt for, anyway? You've said in the past that it shouldn't be used for secure applications.

    13. Re:I've been coding most of... by cookd · · Score: 4, Informative

      Very complicated question. Ughh, there are answers at many levels, and they are all different. But here goes.

      Any decent linker nowadays is "smart." This means that it already does what you are asking for -- it knows how to figure out exactly what the dependencies are, and bring in only the symbols (a symbol in this context is a chunk of code or data) that are (directly or indirectly) referenced by your code. Even though you link against all of the C Runtime, or all of the string library, the linker realizes that you are only using strcat. For this example, we'll assume that strcat uses strlen and strcpy. So your call to strcat pulls in strcat, strcpy, and strlen, but nothing else. So what you mention actually is already happening. (Unless you turn off the "smart" linking, as is common for debugging purposes.)

      However, there are some additional factors at work. The first is the C Runtime (CRT). ANSI C has some very specific requirements about how the environment is to be set up before main() is called, and how the system is to be cleaned up after main() exits. C also has specs about how to prepare the system for unexpected termination and signal handling. Setup and cleanup reference a bunch of additional symbols, so you end up with much more than just main(), strcat(), strcpy(), and strlen() -- you also have atexit(), exit() and etc. There is usually a process by which you can get rid of this and start directly in main with no setup code, but then you can't use any of the CRT-supplied functions (since the CRT isn't initialized) -- you have to set up your process yourself, handle signals yourself, and are limited to calling OS functions directly (no nice wrappers like fopen, printf or such).

      Then there is the issue of linking. Static or dynamic? Static linking means that all of the symbols you reference, directly or indirectly, are compiled into your binary. Dynamic linking means that all of the symbols are converted to references to external binaries, and when your binary loads, the external binaries will also load and you will use the symbol as defined in the external binary. Static linking means everything you need (and nothing you don't) is right there, compiled into your binary, so you'll never load anything you don't need. On the other hand, every program that is statically linked has its own copy of the linked-in routines, which can be wasteful of disk space and memory. With dynamic linking, the entire external binary has to be available, even if you only need one symbol from it. On the other hand, there only needs to be one copy of the binary on disk, no matter how many times it is used. And most of the time, the operating system can arrange things so that only one copy of the binary's code is loaded into memory, no matter how many processes are using it. This can save a lot of memory. For most systems, it turns out to be much more efficient to load a multi-megabyte dynamic link library into every process rather than statically link just the 200k that you actually need from that library.

      Finally, there is the OS involvement. The OS has to do a certain amount of setup for any process, no matter how trivial that process is. It has to allocate a stack, map the process into memory, set up virtual memory tables for it, etc. On a modern OS, in order for it to provide the services we expect, it has to set up a bunch of stuff just in case the process decides to make use of it. It is the price we pay for having a lot of power available to us.

      So for an example, I wrote up two test programs. I'm a Windows guy, so everything was done using Visual C++ 7.1. The first test was just an empty main(). Compiled and linked statically, it takes 24k on disk. That is basically just the CRT startup and shutdown code and the signal handlers (plus error message strings, etc.). It also links (dynamically) to kernel32.dll, ntdll.dll, and the OS itself. It allocates 568k of user memory/136k VM, 7k of kernel memory, and holds 14 kernel objects (thread handle, process han

      --
      Time flies like an arrow. Fruit flies like a banana.
    14. Re:I've been coding most of... by Anonymous Coward · · Score: 0

      (jaw dropping to floor) Do you work for my company? I swear that is the kind of stupid stuff people say around here all the time. "i've been coding my whole life???" Stop coding and learn something about the system you're using. What you describe is exactly how static linking works. on most OS's you can either link the c libraries statically or dynamically. if you link statically only the functions you use get pulled in with the adverse effect being that you can have functions in memory in multiple locations if multiple apps statically link in the same stuff. the other option is to use dynamic linking - here your lib gets loaded once for the entire system (all apps can share it) with the adverse effect being that the entire thing gets loaded. "coding most of my life..." i'm stil shaking my head...

    15. Re:I've been coding most of... by EventHorizon · · Score: 1

      Your suggested optimization already happens at the operating system level in modern OSes. It's called demand paging.

      When a program enters a function in a dynamic shared object (DSO), the ~4kB pages which contain that function are pulled off disk (assuming they weren't already present in the file system cache). In general, user code or data which is not accessed ("faulted in") does not consume physical memory. The average program contains lots of code that is rarely executed, and allocates memory which is never actually used, so this optimization is pretty significant.

      Take a look in "ps aux". This behavior shows up as the difference between a process's "virtual" size (VSZ) and its "real" size (RSS).

    16. Re:I've been coding most of... by cgleba · · Score: 1

      I've wondered that too; but there is a solution if
      you compile statically with these flags on gcc:

      export CFLAGS="-ffunction-sections -fdata-sections"
      export LDFLAGS="-static -Wl,--gc-sections"

      On both the libraries and the code that links them.

    17. Re:I've been coding most of... by Anonymous Coward · · Score: 1, Insightful

      2) Dynamic libraries may be treated differently. It is more difficult to try to partially load them. I'm not sure how Linux handles this. Windows allows for a DLL to contain multiple code and data segments, which can be loaded individually if needed.

      When a DLL is loaded, the file is mapped into memory, however pages are only loaded from disk when the page is touched. So if I load a 10 MB DLL, (pretend it doesn't need to be rebased, it's already bound to all its dependent DLL's, and it doesn't have a DllMain), and I call one function that happens to live on a single page, only that touched page will be in memory. The remainder 9.96 MB will sit on disk.

    18. Re:I've been coding most of... by Anonymous Coward · · Score: 0

      Tom StDenis CANS THE MANHAM

    19. Re:I've been coding most of... by greazer · · Score: 1

      When you link into a dynamic library on most modern OSs you don't necessarily load the whole library into ram. Generally the library is memory mapped into the process address space and is lazily pulled into physical memory using the virtual memory system provided by the combination of the OS and MMU in your CPU.

      The same is true of your executable. Only the parts of the executable that are touched during execution are actually loaded into physical ram. That's why deleting an executable while a process is running it is no allowed or causes the process to fail.

    20. Re:I've been coding most of... by krumms · · Score: 1

      Python offers support similar to what you're talking about, with:

      from library import something

      Where library is a python module and something is a class/function/module within that module.

      That said, somebody else has already pointed out that certain C++ linkers usually throw in only what's necessary in the end anyway, so it's no biggie.

      I agree with your point only on the level that it would be nice to see which header a certain function/class comes from without having to search. Other than that, it's really not a problem.

      - TL

    21. Re:I've been coding most of... by Stephen+Williams · · Score: 1

      Dynamic libraries may be treated differently. It is more difficult to try to partially load them. I'm not sure how Linux handles this.

      Using mmap(2). Virtual memory is allocated for the library, but no physical memory is initially allocated to back the virtual store. When a page from the library is required, a page fault occurs, and it is demand-loaded; thus only code that is actually being used gets loaded into physical RAM. The memory allocated for a library is marked shared, so only one copy of the library code is required in RAM, no matter how many processes are using it. Data pages are copy-on-write.

      You can read the man page for mmap() for more information on memory-mapped files, shared memory etc.

      (Disclaimer: I am not a kernel programmer; this is simply my naive understanding of how it basically works).

      -Stephen

    22. Re:I've been coding most of... by Dewin+Cymraeg · · Score: 1

      Well, I see your point. Delphi, if you compile into a stand-alone exe, will only pull in those items it needs. Libraries are usually shared, so an OS may only load that library once, no matter how many applications use it. In theory, if you had, for example, an OO OS and a single dev environment for that OS, you could keep app memory low because there would be a high amount of object/library re-use. Have recently been thinking a Java based OS could be quite cool, where only Java apps would run. The VM would be available all the time, so startup times would be relatively quick, and maybe it could cache compiled code somehow and promote object pooling between applications. Commonly used packages would essentially be pre-compiled before an app started. The kernel the VM ran on could be relatively simple, so long as the VM was really stable. It could even suport the .net platform too, or compile .net apps to Java.

    23. Re:I've been coding most of... by chrootstrap · · Score: 1

      You can make programs much more size and memory efficient by not using standard libraries; use system calls instead. There are smaller standard libraries around, too, like dietlib and uclibc. The netbsd libraries are also reasonably small -- compiling statically yields programs that are more than a magnitude smaller than programs statically linked with glibc.

      I go over system call binaries on Darwin here:
      <a href="http://dom.neopoleon.com/Permalink.aspx/4e48 d9dd-4c28-4b89-a8e5-8cb158da44c3">http://dom.neopo leon.com/Permalink.aspx/4e48d9dd-4c28-4b89-a8e5-8c b158da44c3</a>

      Doing this is covered in Linux here:
      <a href="http://linuxassembly.org">http://linuxassemb ly.org</a>

      --
      Hacking articles at http://www.geocities.com/chroo
  26. What is "good"? by ljavelin · · Score: 5, Insightful

    I don't know if anyone has done any formal study on the complexity of development tools over time - but the fact is that programming tools are getting "lower" over time.

    When I started out in this business, a language like C was a high level programming language. It did a lot for the programmer, especially compared to assembler and FORTRAN.

    Everything we did every day was to save memory and CPU cycles. Can we squeeze a date field into 8 bits? You bet we'd try! And we did! Heck, we could ignore weekends and holidays. Phew!

    At the same time, databases were heirarchical. The databases were very close to the machine, so they were darn fast. As long as you didn't do any unexpected queries (like "sort by first name"), everything was blazing fast and tight.

    Then came the higher level systems. Ouch, they sucked! We were the very first customer to run DB2 in production (quiz- you know which one?) Anyhow, it sucked rocks compared to the heirarchical databases - they were just optimized for speed! Why would anyone ever want a relational database?

    But over years we came to see the light. With faster and faster machines, the number of cycles was less important. With bigger memory and disk, storage was less important. And it was butt-easy to use these tools. Easier and MUCH more maintainable.

    So yeah, Java and C# are going to use more memory and more cycles than plain old C (if using the languages as expected). But for most tasks, that isn't the whole story.

    The whole story is that Java and C# result in less expensive programs. And those programs should run fast enough. Yeah, not in EVERY case. But in most cases.

    Performance comparisons be damned.

    1. Re:What is "good"? by hey! · · Score: 2, Interesting

      First of all, I've been at this professinally for over 20 years. C has always been considered to be a "low level" language -- even compared to something like Fortran. Fortran, in the versions most of us learned it when back whe it was more or less mandatory to learn it, was not "low level", it was just primitive, which is not the same thing at all.

      The big change over the years isn't just that machines have gotten faster: systems have become more complex. Typical application programs are more complex than entire operating systems used to be. It isn't just that Java and C# make programs cheaper, being cheaper is another way of saying more complex systems can be built for the same budget (python takes this to a further degree).

      Making real applications in the real world, I'd say this: performance doesn't matter until it does. At some point you'll deliver a product that is just not fast enough. Probably you screwed up; you should have reorganized this or that, but often its hell to fix. I always tell my guys that there is no difference in a user interface between 100ms and 300ms, not much differnce between 1 hour and 3 hours, but a lot of difference betwen 1 second and three seconds. In those cases a "frees" 2x speed improvement (which we've seen with some library upgrades) or even 20%, is a godsend.

      WRT databases, I'd say this: I'd pit a modern RDBMS against an old hierarchical database -- depending on the query. Machines have got a lot faster, it is true, but databases have also got much, much larger, and the questions we are asking them are a lot more complicated. With the old databases, pretty much every question required some kind of hand coded program to answer. With modern RDBMS's, unless the question is something that can be answered by a trivial algorithm (adding a single column or traversing a single index), there's little doubt in my mind that a modern optimizer will beat what most programmers would produce in the time available to them, and what many programmers could produce with unlimited time.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    2. Re:What is "good"? by fishbowl · · Score: 1

      "We were the very first customer to run DB2 in production (quiz- you know which one?) "

      Mobil Exploration & Producing U.S.?

      --
      -fb Everything not expressly forbidden is now mandatory.
    3. Re:What is "good"? by Anonymous Coward · · Score: 0

      The whole story is that Java and C# result in less expensive programs.

      Trading execution speed for development speed is a false economy if you are producing code for use by the general public. The cost of programmer time is multiplied by the number of programmers you have. The cost of hardware is multiplied by the number of users you have.

  27. Try it before you knock it by nissin · · Score: 3, Interesting
    I've programmed extensively in C and Java, with some C++. I took a typical anti-Microsoft stance early on and refused to even look at C#. I was finally convinced to try it, and I must say that it has some nice features.

    I recommend that any programmers out there try using it before discounting it. It might be especially interesting for those C++ programmers out there who don't like Java for one reason or another.

    1. Re:Try it before you knock it by Anonymous Coward · · Score: 0

      Have to agree. I'd jsut add that I'd get Borland's IDE.

  28. Why do we need C# in the first place? by Anonymous Coward · · Score: 0, Flamebait

    When i first heard about C# i thought "Why is M$ making it's own language in the first place?" Then I thought i'd give it a try and I pretty much said "if there is nothing extrordinary about this lanugage then it's pretty much useless. C# would have to be something really great to replace C++ or Objective-C for me.

    So i dove into C# and found nothing extrordinary about it. If nothing else it looked like a confusing mix of C++, Java & basic. Well i've been wrong before so i asked my teachers after a meeting with industry bussinesses and their opinion was that "most developers don't want to learn another language just to learn another language that does not offer great benifets." They further said that it most peoples opinion they asked about C#/.NET it has had the exact oposite effect that M$ thought it'd have.

    I'd hate to say it but this is clearly M$ making it's own version of something JUST to have it's own version of it. Wake up people!

    1. Re:Why do we need C# in the first place? by spiro_killglance · · Score: 0, Flamebait

      Agree %100 percent, if i had mod
      points, i'd mod the above up.

      But theres one more reason he missed
      not to use C#, and that is of course.
      That using C# means trusting microsoft,
      and i trust microsoft about as far as
      i could comfutably split out a rat.

    2. Re:Why do we need C# in the first place? by willtsmith · · Score: 1

      A majority of people using C++ trust microsoft (not necessarily by choice) by using their dev environments and compilers.

      Beyond that C# offers accessibility to the "enhanced" VB style toolset (quick and easy) which having to choke on VB. VB programmers will most likely object. However, most hardcore C family (C/Java/C++/Javascript) programmers would rather tranfer to marketing than use that ugly skid-mark langauge VB.

      Microsoft isn't completely evil.

      --
      -------- -------- Support Wesley Clark for president!!!
    3. Re:Why do we need C# in the first place? by ogl_codemonkey · · Score: 1

      Also, a majority of people using C++ don't trust Microsoft, and signify this by using emacs and gcc (a vastly superior concept to anyone who has tried it).

      I used to be a VB programmer, then I got better. However, after my transition to C *AND* Java, I recognize that BOTH these languages could (or could have, during their evolution) take a page from VB's book of inheritance and ease of using code components.

      Microsoft IS completely evil.

  29. Can't do it by werdna · · Score: 1

    Microsoft has sought protection for a "programming language and compiler system capable of generating object code that performs comparably or better than C."

    1. Re:Can't do it by willtsmith · · Score: 1

      A performance metric isn't an invention.

      The CLR is not patentable. There is too much prior art namely Java, p-Code, and MAME ;-)

      A specific method used to implement it WOULD be patentable.

      --
      -------- -------- Support Wesley Clark for president!!!
    2. Re:Can't do it by mark_lybarger · · Score: 1

      do you understand what those three letters expand to? CLR == Common Language Runtime. That means the runtime, or the interpreter or vm if you will, can handle running multiple languages together at runtime. Your C# code can call your c++ code which can call your perl code which can call your C# code (i've only worked with c# calling c++ com+ objects, but i've heard it works). I'm not familiar with this MAME an p-Code, but java only runs one language, and you have to go outside the vm to run native code.

    3. Re:Can't do it by Anonymous Coward · · Score: 0

      Java runs more languages than .NET! There are over a hundred compilers targeting JVM bytecode.

  30. Re:Competition is important. Whats really needed. by cbreaker · · Score: 1

    "Java will never be able to do that."

    Says who? Computers are getting faster and faster. Java applications on my machine (AthlonXP 2200) appear to run just as fast as any native application. I'm sure some benchmark could tell the difference, but I can't.

    You wouldn't run a java database server at this point, but as computers keep getting faster... the performance hit will become less and less of an issue.

    --
    - It's not the Macs I hate. It's Digg users. -
  31. Wow...is this the best you can do? by Anonymous Coward · · Score: 0

    God..so typical for this site. Hardly any of you answered his question - most just throw out the 'java' answer..which isn't any sort of answer for client apps - it blows on the client - no one would use an app written in java if there were an alternative product written in anything else (god even VB).

    But, sorry dude, I can't help answer your questions as I am a windows coder and just lurk here for the interesting news and to laugh at the linux elitists.

  32. asking for comments here? by Anonymous Coward · · Score: 0

    Yeah right, like anyone on Slashdot knows two things about writing code or anything else valuable.

    troll on! w0ot kewl dood

  33. C# Rocks!! by Anonymous Coward · · Score: 0

    I've been using it exclusively for almost two years now and it's really the best language out there, at least as far as Windows programming goes.

  34. He's serious: D-flat is a programming tool by rfmobile · · Score: 1
    Mod parent up - D-Flat is an actual programming tool. There was a series of articles by Al Stevens on Dr. Dobb's Journal back in the 90's.

    http://www.ddj.com/articles/1991/9110/

    -rick

  35. Look at the game industry by bismarck2 · · Score: 1, Insightful

    These tests are very trivial. Basic string tests are one thing but they are very different from the complex performance implications of larger scale software.

    A good indicator is the game industry. Game developers are notorious early adopters and tend to care little and even hold contempt for backward compatibility. But they also require performance. There are plenty of Java puzzle games but any major game with fancy graphics that you find on a store shelf is C or C++ (with various graphic specific languages and custom game scripting type languages).

    If you start seeing competitive cutting edge 3D engines written in Java, then you will know the performance difference has become moot.

    There are plenty of non-game examples but that is the easiest to see.

    Java and C# are great languages. Eclipse is awesome. But the performance, of Java at least, still isn't there; even with native code compilers.

    1. Re:Look at the game industry by ergo98 · · Score: 1, Insightful

      Very true, and the truth is that a bunch of C#/Java developers write chatter like this to legitimize their choice, attempting to that whatever hammer they have is the perfect choice for any nail, screw, staple, or garden salad dressing out there.

      Having said that, I should clarify my position: I'm a huge C# fan. I think the language itself is tremendous, and the .NET Framework is a great remodeling of the Win32 APIs in a very clean architecture, plus a huge slew of fantastic functionality. However while C# is a very capable hammer for many business programming (which is what 99.9%+ of the programming out there is), I doubt it'll be causing any 3D, AI, speech recognition, etc, to be rewritten anytime soon.

    2. Re:Look at the game industry by maxmg · · Score: 1

      MOst game engines out there at the moment implement a scripting language layer that implements the actual game logic. Popular choices include Python, Tcl, Lua, and (gasp) Java. Vampire The Masquerade did implement most of the game logic in java. Sure, most of the heavy number crunching is currently done in C/C++, but all of this is moving into the graphics card anyway, so whatever environment feed the GPU will eventually become irrelevant.
      Furthermore, languages like Java were never designed to be used for games in the first place.

      --
      I asked for a refund - and got my monkey back.
    3. Re:Look at the game industry by Sivaram_Velauthapill · · Score: 1

      Furthermore, languages like Java were never designed to be used for games in the first place.

      I don't think ANY language is designed for games (unless you look at something like Lua or something). :|

      I'm not a gamer programmer but I'll bet that if you ask a game programmer for what helps him with programming, you won't find it in the language. Languages like C (and C++) are used for games but I'll bet programmers would avoid them if given the choice. A huge number of problems are simply due to the language. For example, saving game states (ie. saving your game) is one major cause of headaches. Not only is it error prone and doesn't work well, often the solutions are not badkward compatible (game version 1.0 doesn't load save files from v1.04). As someone above said, the vast majority of programming is for business use, so game programming isn't even considered.

      As you kind of eluded to, I think scripting languages might actually take over game programming.

      Sivaram Velauthapillai

      --
      Sivaram Velauthapillai
      Seeking the meaning of life... @slashdot of all places ;)
    4. Re:Look at the game industry by bismarck2 · · Score: 1

      There are thousands of games being released every year and the best example you come up with of a Java game is Vampire. That is based on Half-Life's Source engine which is completely C++ based and has not a drop of Java. I don't doubt that they implemented some piece of the game using Java or a Java-like scripting language but big deal.

      This really proves a point: When something is done in Java; it's highly touted. "Look, this was actually built using Java". The other 99% of the time, when the dev tools aren't so highly advertised, there is no Java.

      I specifically said in my original post that most games use a higher level scripting language of some kind. There's QuakeC, UnrealScript, and I'm sure lots of other proprietary languages. Myst was written in HyperCard, loads of games were written in Macromedia Director, heck parts of Abuse were written in Lisp.

      Java and C# are great languages. They are much better than C++ for LOTS of software tasks out there. But there are jobs where Java doesn't have significant advantages or just is not the most effective tool. C++ has plenty of well known rough spots and historical baggage, but there are many tasks where if you know how to use C++ properly, it is a highly effective tool for the job.

    5. Re:Look at the game industry by gbjbaanb · · Score: 1
      This really proves a point: When something is done in Java; it's highly touted. "Look, this was actually built using Java". The other 99% of the time, when the dev tools aren't so highly advertised, there is no Java.

      damn right. at a previous company, my boss wanted to use Java, so any excuse would do. He read an online article about how some US Airline was using java for its apps, and used it to show the board how java was completely used at this airline, etc etc.

      Unfortunately, if he'd read the article, he'd have seen that they were a) only investigating java programs, b) by using it for a very few totally-non critical apps.

      The parallels with /. are quite amazing, come to think of it :)

    6. Re:Look at the game industry by LarsWestergren · · Score: 1

      Not everything in games is Quake like 3d engines... in Europe, java games for mobile phones is quite popular.

      Sun is working on a framework for creating MMORPG backends. A lot of the incredible amount of programming that goes into doing fast, cheat safe, bug free servers for online games could already be solved, and teams could concentrate on doing content, artwork, and a good frontend engine.

      Not that I personally think the world need more MMORPGs, and we will have to see if Suns initiative becomes anything more than an intention, but anyway...

      --

      Being bitter is drinking poison and hoping someone else will die

  36. But, the compiler/os should... by rmdyer · · Score: 2, Insightful

    ...be smart enough to "know" what sub-functions each function you are using needs to be loaded. If strcat() only uses 3 sub-functions, then those should only be loaded for "it". And, if those functions are already loaded "somewhere in memory", the OS shouldn't load them again, and again, and again, as so often happens these days.

    I'm saying that the compiler/OS should be smart enough to "itemize" your entire application in terms of absolute functions/variables needed at compile and run-time.

    Where is that capability? Why aren't compilers smarter?

    -1+1

    1. Re:But, the compiler/os should... by Tepic++ · · Score: 1

      And, if those functions are already loaded "somewhere in memory", the OS shouldn't load them again, and again, and again, as so often happens these days.

      A library is only loaded into memory once on Linux, and I would guess on Windows (since Linux had the feature around 0.x/1.x times) and most other OSes, and the read only portions of that one copy is referenced by all applications that use it.

      It would only be loaded into memory again if it has been swapped/evicted from memory because another application needed the memory more urgently.

    2. Re:But, the compiler/os should... by WolfWithoutAClause · · Score: 1
      You're talking about DLLs. That's basically what they do. Nearly every OS supports them. There are downsides though- they are often harder to write and when they load the disk head has to jump around- the DLL is usually on a different part of the disk than the application so it takes longer to load the first time; whereas if it's all statically linked it's consecutive.

      After that it's often quicker for the second, third, fourth etc application, because it's already loaded.

      I'm saying that the compiler/OS should be smart enough to "itemize" your entire application in terms of absolute functions/variables needed at compile and run-time.

      Well, in C/C++ the unit that gets pulled in is at the object file level- a file gets pulled in or not. The designer decides what to put in the file, so it's up to you for your granularity. However the linker is somewhat smart in that it only pulls in the files that are needed- just pulling in a file that contains a function Z that needs a separate file won't necessarily result in that being pulled in unless function Z is used.

      I think Java does something similar, although its unit is the .class file.

      --

      -WolfWithoutAClause

      "Gravity is only a theory, not a fact!"
    3. Re:But, the compiler/os should... by xlv · · Score: 1
      ...be smart enough to "know" what sub-functions each function you are using needs to be loaded. [...] Where is that capability? Why aren't compilers smarter?

      Some compilers are smarter but there are restrictions on what can be built, and you lose some benefits of shared libraries.

      For instance, some Eiffel compilers can do that and the code is not too different from a garbage collector mechanism. It's not trivial but it's possible (and I'm speaking from experience implementing it in an Eiffel compiler and debugging them on large customer systems...).

    4. Re:But, the compiler/os should... by N7DR · · Score: 1
      This has nothing to do with compilers. This is a a function of the linker, which does indeed do exactly what you want: it makes sure that only the functions you actually use (either directly or indirectly) are inserted into the executable. So, in your example, strcat() will be loaded, as will the other string functions that it relies on (and the ones that those rely on, etc.). But a string function that does not get called by strcat() or its descendents will not be put into the executable. And, in particular, all these functions get loaded only once.

      In other words, this all works exactly the way that you say that it should work.

      At least, that's way classical edit-compile-link-load-run languages work. Now once you start to talk about languages and implementation that subvert this process (often in the name of some sort of efficiency), then all bets are off and you can easily end up with the archetypal 11MB Java "Hello World" program.

    5. Re:But, the compiler/os should... by Anonymous Coward · · Score: 0

      For someone as great at programming as you proclaim to be, you don't know shit.

      First, if its compiled in and not linked to at runtime, the compiler will remove all unused code as dead code, elimminating your argument for anything but shared libraries.

      Second, your complaint to some other guy that loading 50 functions for 1 function is inefficient is crap. Only the page containing the function used will be loaded into memory, the rest will reside on disk until something goes to access them and generates a page fault. If the rest of the 4096 bytes (on intel) that don't contain your function are going to waste, well boo fucking hoo.

    6. Re:But, the compiler/os should... by The+boojum · · Score: 3, Informative

      There are enough answers here, but I can't resist jumping in and clarifying.

      Most modern compilers in conjunction with OS's already basically do this. GCC and MSVC and the like all will link in only the functions that they deem referenced by your program and it's dependencies, provided you statically link the library.

      Dynamic link or shared libraries work differently. The OS "loads" them once and uses that one copy for all programs that require that library. The linker that builds the DLL has no way of knowing which functions in the library will be needed by the programs that may use. Some programs may only need one, others may need them all. So the DLL *has* to contain everything it needs to provide.

      The tradeoff is that while static linking means the linker only links in what's nescessary, all executables that use it must provide the same copies of those functions linked into each one. DLL's have to have the whole kit-and-kaboodle, but there can be a single, globaly available copy on this system shared by each.

      It's really a matter of pickin' yer poison.

    7. Re:But, the compiler/os should... by cheekyboy · · Score: 1

      why is mozilla always swapped out to swap?

      I hate sitting there watching the HD loadup 100meg into ram. Surely the core of mozilla can always STAY IN RAM. or is that some MS only secret API?

      --
      Liberty freedom are no1, not dicks in suits.
    8. Re:But, the compiler/os should... by maraist · · Score: 1

      As far as I understand, mozilla has
      A) a tremendous set of abstraction layers
      B) A javascript Virtual Machine.

      VM's mean lazy garbage collection which means a HUGE heap.

      For me (on Linux), mozilla takes up roughly 100M, swaps 230M and shares about 12M. That 12M shared suggests a lot of the shared libraries, which each will want a decent sized chunk of writable memory (which can be swapped if not in use).

      In fact you DON'T want mozilla to always stay in memory, since much of that shared library stuff is never going to be used (for the reasons discussed in this thread). The only problem is that Virtual Memory pagers will discard read-only pages before dirty pages, so if you leave mozilla running for some time, then it's very likely that some critical "core" executable code won't be there. The problem is exacerbated by the VirtualMachine which is constantly loading and dirtying pages for the purposes of garbage collection. The OS will try and evenly distribute available pages between actively running programs.. So if mozilla is consuming 50% of your available non-cached/buffered memory, then if four other apps are competing for the same memory, non-dirty least-recently-used mozilla pages will be invalidated (and require subsequent reloading from disk).

      So the only way to avoid swapping / invalidating-r/o-pages is to have enough memory to
      A) Allow all running apps to run (evident by having > 10Meg free, since 6Meg and less cause conservative page-flushing)
      B) Making sure that all your normally used files can be fully cached into memory (add size of your normally accessed mail-boxes, your full database+journal, you common /usr/bin files, etc)
      C) There is plenty of room left to build to like 100Meg of buffers.

      We're talking at least half a gig of memory so that you can run a 100Meg app like mozilla.

      --
      -Michael
    9. Re:But, the compiler/os should... by Anonymous Coward · · Score: 0

      You are a brain dead idiot.

    10. Re:But, the compiler/os should... by sashang · · Score: 1
      For someone who's been coding for years you still don't have half a clue. It's been metioned several times already, by myself and others, that the following are true:

      It's not the compiler's job to sort out what functions are used. It's the linker's job.

      Linkers already do what you're complaing about. The problem you're describing doesn't exist

    11. Re:But, the compiler/os should... by chrootstrap · · Score: 1

      You can make you own your own function loader very easily like this: http://dom.neopoleon.com/PermaLink.aspx/e36262bd-a 5a8-43ee-936e-0e68cc905740

      Compiling each function into its own .o file to build a normal library is also a way to reduce clumpy library loading.

      --
      Hacking articles at http://www.geocities.com/chroo
  37. Studies can suck by Luveno · · Score: 1
    I saw Don Box show C# to be a gazillion times faster than C++ doing simple integer math, but what he _really_ was showing (unbeknownst to the VB-heads in the audience) was the wonders of garbage collection.

    Ah well, .NET still is pretty nice.

    1. Re:Studies can suck by Anonymous Coward · · Score: 0
      Don Box is a load of hype. His "COM is love" mantra was so full of shit. And his "COM as a better C++" idea reveals the gross level of confusion in which he lives.

      Yeah, he's a .NET "guru" now, and of course in his latest book he tells us about ".NET as a better COM" (IOW, I'm into something else now, so that's now the coolest thing.)

    2. Re:Studies can suck by glenebob · · Score: 1

      Care to explain how integer math has anything to do with garbage collection?

    3. Re:Studies can suck by Anonymous Coward · · Score: 0

      I have no idea how the particular study was done, but I know that memory *leaks* (which would by an abysmally unfair test) can slow your computer down a lot when you start running low on physical RAM.

      It's so easy to bias these sorts of studies by comparing a well-written program in language A to a poorly-written one in language B, or by writing a program that shows off something language A is especially well suited for and language B isn't, etc.

    4. Re:Studies can suck by Luveno · · Score: 1
      It doesn't - that was my point.

      He had created a class that did nothing but expose a method to increment an integer. Then he new/delete'd the instantiation over and over again.

      Doing this, the C# version was considerably faster - but all that was doing was showing the wonders of garbage collection.

  38. As someone who's developed in C#, C++, C, VB... by Anonymous Coward · · Score: 1, Interesting
    As someone who's developed in C#, C++, C, VB, and Java, I think this article makes a very good point. C# really isn't slow. Bytecode, when implemented properly, is just as fast as native code. (.NET programs can be compiled to native code on installation, thus negating the issue.)

    C# is to C/C++ like what C/C++ were to assembly. Yes, Assembly is faster then C/C++, but most of the time it's not worth the trouble. Likewise, for a lot of programming that people do today, squeezing out every last processor cycle isn't always worth it! C# offers some very convienent features compared to C/C++, yet at a minor, (and sometimes no,) performence hit.

    Simply put, the language you use depends on the intended use of your application. If you're writing a number-crunching app for a single CPU type, then there's no reason to use C#. Likewise, if you're writing an application that needs to be developed quickly and be highly reliable, yet doesn't need to save each CPU cycle, then C# may be a better choice.

    Personally, I think C# is great for Windows GUI programming where there is a lot of user interaction.

    1. Re:As someone who's developed in C#, C++, C, VB... by 2short · · Score: 1

      "Yes, Assembly is faster then C/C++,"

      Not in the real world. Studies have compared "hand optimized" assembly to that produced by good optimizing compilers, and the compilers won, hands down.

      If there are 20 ways to do a particular construct in assembly, a human might know them all, and he might pick the fastest one in any given circumstance. But he'll miss the top few plenty of times too. The compiler might know only 19, but it can try all 19 and get the fastest of those every time. This boringly consistant very good code beats the humans occasional flashes of brilliance mixed with mostly only good code and occasional fumbles.

    2. Re:As someone who's developed in C#, C++, C, VB... by Anonymous Coward · · Score: 0

      If you're writing a number-crunching app for a single CPU type, then there's no reason to use C#. Likewise, if you're writing an application that needs to be developed quickly and be highly reliable, yet doesn't need to save each CPU cycle, then C# may be a better choice.

      And if you're writing a number-crunching app that neads to be developed quickly and needs to run fast, then you should write it in Matlab. :) Matlab can "compile" to C code, and call compiled C functions from dynamic-link libraries, so you can let Matlab handle the stuff it does well, and fine-tune the bottlenecks in C. (Also FORTRAN, if you want. Maybe others.)

  39. C is faster than Java, C#, etc. by Prof.Phreak · · Score: 2, Insightful

    No matter what you say, C is *always* faster. You *cannot* write a loop in C#, and claim that it will run faster than a comprable loop in C. For one, the interpreter for Java or C# is very likely written in C itself.

    Does the speed matter? Does anyone care? No. Well, not for a vast majority of applications. Most of the time the I/O speed is the bottle-neck, not the "code" speed. So if you write a word processor, or some database app in C#, or C++, or C, or Java, more often than not, their 'apparent speed' will be comprable to each other.

    A better question to ask is: Would you do numerical analysis, or number crunching/factoring algorithms in Java or C#? Would you even do them in C? (or would you go for Fortran or distributed Haskell?)

    --

    "If anything can go wrong, it will." - Murphy

    1. Re:C is faster than Java, C#, etc. by Anonymous Coward · · Score: 1, Insightful
      For one, the interpreter for Java or C# is very likely written in C itself

      AAAAHHHHHH!!! When will you learn??? C# is NOT AN INTERPRETED LANGUAGE! At worst, C# is a JIT language.

      With .Net, the developer can set the program to be compiled to native code on installation. A C# loop compiled to native code on installation will be just as fast as a C loop. (Assuming that both compilers are equal in quality, which is a different argument altogether)

    2. Re:C is faster than Java, C#, etc. by CharlesEGrant · · Score: 1
      No matter what you say, C is *always* faster

      I recently wrote a small program that generated one million random doubles and then sorted them by size. I initially wrote it in Java and then (because I had the same opinion as you) I re-wrote it in C. Much to my suprise the Java version was faster then the C version. I suspect the JIT compiler made Java a match for C in generating the random numbers, but on top of that, Java provided a standard library function specifically for sorting an array of doubles. The standard C runtime only provided a generic quicksort function. I had to pass it a comparison function which it used to compare elements within the sort. I suspect the overhead of this callback function killed the performace of the C version. If I had writen my own double specific sorting routine for the C version I probably could have bested the performance of the Java version, but then I would have had to start juggling how much time I wanted to spend writing the program vs how often it was going to be run.

      I find that I can write correct code more easily in Java then in C or Fortran. This allows me to spend more time on choosing and implementing algorithms and in many cases a superior algorithm will make the JIT/native differences irrelevant.
    3. Re:C is faster than Java, C#, etc. by 2short · · Score: 1


      You're correct about why the C sort was slower - the function calling overhead for the comparison. Note that in C++, that same sort function is a template, so the compiler has the comparison operator at compile time and can inline it. Giving you the same benefit as the Java double sorter, but for any type, and any comparison function.

    4. Re:C is faster than Java, C#, etc. by Anonymous Coward · · Score: 2, Informative
      No matter what you say, C is *always* faster. You *cannot* write a loop in C#, and claim that it will run faster than a comprable loop in C. For one, the interpreter for Java or C# is very likely written in C itself.

      That's just wrong. For one thing, "C" is a language, not an implementation; same for "Java." Languages have specs but they don't have any associated speed. Only specific implementations of languages have that. Thus, you can compare the speed of C code compiled with Microsoft Visual C++ 7.0 to the speed of code running under Sun's JDK 1.2.2, or you can compare "gcc -O2" vs "IBM JDK 1.3", but you cannot compare "C vs. Java" because those things are specs, and specs can't run code.

      For another thing, you're mistakenly assuming that C# and Java are interpreted languages; they are not. (Neither is C a compiled language; there's nothing in the spec that keeps C from being interpreted.) Again, this can only refer to specific implementations, but even if you had done that, you would still not be right because all popular implementations of Java (notably Sun's and IBM's) have used either Just-In-Time compiling or HotSpot virtual machines (which also compile code.) Sun's Java 1.0 release, about eight years ago, was interpreted, but no version since then has been.

      As far as the possibility of speed goes, languages that just variants of just-in-time compilation generally have a modest startup penalty. This was roughly 700 ms. the last time I measured it, but I understand it has gone down somewhat in more recent releases. (Scripting languages generally start up quite quickly, by way of comparison.) That makes Java unsuitable for things like "ls" that you run often, but it doesn't matter for many applications. As far as the possibility of optimization goes, virtual machine implementations have optimization options that aren't available to compiled languages. (The reverse is not true, to my knowledge.) For example, Sun's HotSpot VM optimizes at runtime and can dynamically take into account conditions at the time a program is run to make optimization decisions. Branch predictions that go one way with small files might go another way with large files, but (for example) a C++ compiler cannot possibly take this information into account, since all its optimization decisions are frozen when the code was compiled.

      For my own part, I have done several performance comparisons of gcc 2.95 with Sun Java 1.3 and 1.4, and I have found them to be roughly at parity. Gcc may have had an edge in the 5% to 20% range, but I also found some applications where java was faster. (gcc needed to have -O2 to be able to compete with Java; without it, Java won almost always.)

    5. Re:C is faster than Java, C#, etc. by CharlesEGrant · · Score: 1

      Thanks for that insight. I haven't used C++ since 1998, and unfortunately never got around to learning the C++ Standard Library or STL.

      I've read your other comments on this thread with interest. What are your views on the difficulty of writing correct code in C/C++ versus say Java or C#? My experience has been that while all C/C++ programmers promise to be very careful about memory management and bounds checking, most of them screw it up at some point, even quite talented and experienced programmers. It seems to me that languages with run-time bounds checking keep momentary lapses in concentration from becoming buffer overflow exploits.

    6. Re:C is faster than Java, C#, etc. by Keeper · · Score: 1

      You *cannot* write a loop in C#, and claim that it will run faster than a comprable loop in C.

      Sure I can. Write a loop that does a lot of memory allocations and deallocations, and C will come out the loser to any .Net language (and probably Java as well). To understand why, you'll have to do some research on the differences in memory allocation; cliffnotes: memory allocation in C/C++ is expensive. In .Net it isn't.

      I won't bother addressing your other points, as it looks like everyone else has covered them thoroughly.

    7. Re:C is faster than Java, C#, etc. by brainlounge · · Score: 1

      Not true. Java is an Interpreter but also does Runtime-Compilation. So, if you run that loop in Java the JVM may compile your loop at runtime and use CPU-specific optimisation. In fact, it does for 586-type CPUs. Your C code is or is not optimized for that CPU at compile time. If it's not, the Java-loop is faster.

    8. Re:C is faster than Java, C#, etc. by 2short · · Score: 1


      Well, I'm very careful about memory management and bounds checking :)

      Seriously though, some simple coding practices/standards can help a lot there. My first day on my first job with C++, my boss showed me a template he had written named "SmartPointer", and said "never call 'new' except on the right hand side of an assignment to a SmartPointer; never call 'malloc' at all". I have followed this advice (well, mostly), and thus have never had a memory management problem. SmartPointer acts just like a pointer, you don't have to think about it. But it reference counts, so the last copy to go out of scope frees the memory.
      I don't use char buffers except when forced (I use various string classes instead), and when I am forced I'm just uncomfortable enough with it to be very careful. I'm also concious of when I'm writing code that needs to be particularly security concious (not often).

      Anyway, my experience is that while Java protects you from a certian class of problems, there are vastly more ways to write bad code that it doesn't (and can't) protect you from, so you still need talented, careful programmers. Also, "protecting" you from this one class of problems costs too much, IMO. For example, consistant use of SmartPointer handles memory cleanup as well as garbage collection, but I know exactly when it's going to happen, if I need to care I. (more likely, I know it's not going to happen in the middle of somewhere I need all the CPU I can get)
      I must admit though, my opinions are undoubtably shaped somewhat by the programmers I have known: The C++ ones have covered the spectrum from poor to excellent. The poor ones were easy to weed out, as they immediately foundered. The Java ones were Poor to Good (I assume Excellent ones exist, but I haven't met them). Java did enable the poor ones to muddle along, which might be considered a strength. But they eventually failed at the myriad aspects of programming that are language neutral. More than half of the Java programmers I have worked with have produced huge amounts of code which presumably had no memmory allocation or buffer overflow problems, but still wasn't worth doing anything with but deleting. I suspect I've had a particularly bad experience, obviously YMMV.

      All that said, I think the best language for any job is one your programmers are comfortable with. So it's not that C++ is the best language, it's just that the best programmers like C++. Just kidding... mostly.

  40. None of them measure up to good old C for speed by dusanv · · Score: 1

    I write stuff that chugs through hundreds of megabytes of binary in real time data and nothing comes even close to C (and assembly if portability isn't an issue). I love STL and C++ in general (and use it a lot) but they are a murder when the highest performance is required. Don't even get me started with Java (haven't tried C# yet). Yes, it is still way much slower even with JIT (and yes the IBM VM is what I'm talking about).

    1. Re:None of them measure up to good old C for speed by 2short · · Score: 1


      Gotta disagree about C++ and the STL - they can be used so as to be just as fast as C, or faster. Take the sort function in the stardard c library versus in the STL. It's the same algorithm in both, probably a lot of the same code. It's a lot faster in C++. Since it's a template, the compiler can inline the comparison function, avoiding piles of function calling overhead.
      Lot's of people seem to think C++, and particularly templates, are a performance hit over C. But in fact, a lot of C++, and particularly templates, were designed specifically to avoid places in C where you had to make a choice between good (and easy) coding practices or performance (like using the standard sort rather than writing your own).
      I won't get you started on Java, since that would get me started on Java...

    2. Re:None of them measure up to good old C for speed by Anonymous Coward · · Score: 0

      I just wanted to say that I agree with you completely. I have had to deal with sooo many people who tell me "I don't want to use C++ because I've heard that it's way slower than C" (although they've never tried to find out for themselves). One thing I have found is that a debug build of C++ code seems to be substantially slower than an optimized build. I.e., the difference in speed between a debug and optimized build in C++ seems to be greater than for C - especially when using templates and inlining heavily. But so what? I generally slow my debug builds down even more by putting assertions all over the place anyway.

      I have recently re-written some old C code in C++. While I did, I took the opportunity to "update" the code so that it made use of C++ features like classes, etc. The resulting code ran about 2-3% faster than the old code on all our regression tests, and was easier to read.

    3. Re:None of them measure up to good old C for speed by 2short · · Score: 1

      "the difference in speed between a debug and optimized build in C++ seems to be greater than for C"

      Big time. With C, one section of assembly maps fairly directly to one section of source. All of C++s features, particularly the ones that make things go faster are based on the compiler doing extra work that breaks that neat mapping. When it inlines that comparison function into the code generated by the templated sort, it creates a specialized, very fast sort function that exists in machine code only, and calls that from your code. Debug builds need to keep track of what source everything corresponds to, so the things that made it faster either don't happen, or happen with extra bookeeping that makes it even slower than the simpler way.

    4. Re:None of them measure up to good old C for speed by dusanv · · Score: 1

      Well guys I actually did tests. For instance insertions (push_back() only) and accesses from std::vector are *much* slower (10x) than the good ond realloc and int*. Doing a '[]' on a vector in a tight loop is a big no-no. There is no way C++ will ever be faster especially when you start using inheritance and vtables/RTTI kick in. Ouch. Every function call suddenly carries a fat price. C++ is better in every other respect than C but my point is that even C still has its place.

    5. Re:None of them measure up to good old C for speed by 2short · · Score: 1


      What moronic compiler are you using? In mine, a vector of int IS good old realloc and int *. and "[]" cooks down to the same position + offset as it does in C (using the default optimizations there's also some code to grow the memory by jumps instead of steps, avoiding most of those expensive reallocs; i.e. the way you should have written it in C if you were after max speed and thought about it enough). Any possibility you were dealing with a debug build?

      C++ is slower when you use inheritance? So don't use it. C doesn't do inheritance at all, how can it be faster at it?

      I was saying that code doing the same thing, if well written in C++ should be just as fast as if well written in C, and in many cases faster.

      Even without inheritance, every function call already caries a fat price. C++, with templates and inlining, avoids a bunch of function calls C cannot.

      You can take your C code, call it C++, and with a minor tweak or two it will compile, probably to the same machine code. So you've got a hard case to make if you're saying C++ can't be as fast as C. C++ also has a bunch of features designed to let you make the code even faster, and a bunch that let you make it "nicer" without any performance penalty. And a couple that let you make it much nicer, with some performace penalty. But unlike Java (for example) none of the additional features are compulsory. So, honestly, I think C still has it's place only amongst those who don't know C++.

  41. Shared libraries by n0nsensical · · Score: 3, Insightful

    And, if those functions are already loaded "somewhere in memory", the OS shouldn't load them again, and again, and again, as so often happens these days.

    If the functions are in a shared library, they shouldn't be. Each library (including, for example, the C runtime) is loaded once into memory and every process uses the same code. If you modify that code in memory, Windows makes an individual copy of the page for the modifying process. I couldn't tell you exactly what the overhead is used for, but the OS isn't loading 20 copies of strcpy or whatever as long as each executable is dynamically linked.

  42. C# is not the only .NET language by tcleveland · · Score: 1

    C# has recieved the majority of attention but has everyone forgotten that their are other .NET enabled languages. It's perfectly acceptable to use C++ and all of it's features and familiarity to produce .NET executables.
    If fact it's probably the most likely migration path for existing applications.

    1. Re:C# is not the only .NET language by Anonymous Coward · · Score: 0
      It's perfectly acceptable to use C++ and all of it's features and familiarity to produce .NET executables.

      correct me if I'm wrong, but microsoft has said the preferred language for new development is C# and that the ultimate goal is to have windows developers use C#. They want to encourage managed code to reduce the security bugs/flaws in windows applications. Have you ever heard a CTO say "let's use 5 different languages to build the application." I've only heard CTO's say the opposite, "How can we reduce the number of languages we use to standardize and control development." The whole argument about multiple languages to me is total BS. It only increases the likelihood a project will go over budget and not meet the development milestones.

    2. Re:C# is not the only .NET language by willtsmith · · Score: 2, Insightful

      The multiple language angle is

      1) to allow anyone accessibility with there skillset.

      2) allow the integration and migration of legacy codebases.

      3) Not piss of VB customers who are perfectly happy with their ugly piglatin language ;-)

      Serious, there are large Fortran libraries out their. Microsft's approach allows easy integration.

      A cobol implementation exists. Though, COBOL is almost always spagetti code riddled with non-modular entry points. But I suppose well written COBOL code can be migrated into a mixed .net environment.

      Ultimately, distilling it all into cross-platform IL is a thing of beauty. Managed code that can be accessed from any language and run on virtually any platform.

      --
      -------- -------- Support Wesley Clark for president!!!
    3. Re:C# is not the only .NET language by Anonymous Coward · · Score: 0

      Haven't you head? VB.net are for weenies!

    4. Re:C# is not the only .NET language by Anonymous Coward · · Score: 0
      Ultimately, distilling it all into cross-platform IL is a thing of beauty. Managed code that can be accessed from any language and run on virtually any platform.

      Just like JVM bytecode, except fewer languages, far fewer platforms, and a far more untrustworthy vendor.

    5. Re:C# is not the only .NET language by willtsmith · · Score: 1

      I trust Ximian quite well. They are the managers of the Mono project.

      I trust Microsoft to do whats in their best interest. I don't trust Sun at all. Microsoft has placed C# before international standards bodies. They are being a bit coy about potential patents, but ultimately, clean room implementations like mono have stood up quite well in court.

      Sun has been VERY selfish about holding the exclusive keys to Java. I dare say it was going NOWHERE until Microsoft announced a competitor. Now they are forced to innovate again.

      The reason for Sun's tight grip is probably because of their increasingly FAILING server and workstation business. Along with SGI, they face extinction in the face of open source Java. Indeed, Java may be looked at as a fallback if Sun is forced to go "pure consulting" without it's overpriced computer business.

      At that point, I wouldn't expect Java to be as "free" as it is today. Nothing is stopping Sun from pulling the plug on free Java once they think they've got people hooked on it.

      Ultimately, I think both companies realize that the notion of a hardware platform is dissappearing rapidly. The virtual platform that can can exist universally may be the battle ground of the future. In such a case, it's good to be in the drivers seat instead of a passenger.

      I look forward to seeing both C#.net and Java/Java evolve into more mature products that will span any possible OS and host glue and UI code that interconnects various services.

      --
      -------- -------- Support Wesley Clark for president!!!
  43. Re:Slashdot contracts viral marketing piece, again by Len · · Score: 1

    I did that. He seems to be Australian.

  44. It all depends on the use by codepunk · · Score: 1

    It all depends on what you are trying to accomplish. I know a half dozen or so languages and use the one that gets the job done. I do however find myself reaching for python most of the time. It has reasonable speed, very maintainable and is one of the most productive languages in existance.

    One of my issues with java, qt, gtk, wx windows etc is the layout crap. It always seems someone is ramming their super duper ultra cool widget layout engine down my throat.

    Screw that crap, I want X,Y positioning and let me handle the darn layout specifics. In this reguard only borland has ever gotten layout working correctly.

    --


    Got Code?
    1. Re:It all depends on the use by willtsmith · · Score: 1

      crew that crap, I want X,Y positioning and let me handle the darn layout specifics. In this reguard only borland has ever gotten layout working correctly.


      I think you would like Visual Studio .net. Early layout engines specified things in psuedo-code structures. Visual Studio actually writes code. It's mostly done by setting properties. You can modify that code and it will be reflected in the designer.

      The neat thing is that you can create your own visual widgets and they will operate properly inside the designer. It just yanks the IL code for the object and executes the draw routines.

      --
      -------- -------- Support Wesley Clark for president!!!
  45. Why did MS move to C++ in the first place? by Anonymous Coward · · Score: 0

    I've heard they tried Pascal in the beginning.

    Guess why they moved to C and C++...

    Now, they want to change the world. Yeah, right...

    1. Re:Why did MS move to C++ in the first place? by EmbeddedJanitor · · Score: 0, Flamebait
      MS bought Lattice C back in 1983 or so. This came on two single-density 5.25 inch floppies. You could copy the whole lot onto a single double-density (360kB floppy) with room left for an editor. With a dual floppy system you were in heaven with the second drive for source etc.

      Back them, Microsoft viewed MSDOS as the single-user front end and Unix as the server/backend. Being multi-platfrm and portable was of benefit. I don't think MS pushed for C or C++, rather they were lead there by existing code and compilers which they subsequently destroyed and ruined platform nuetrality with their class libraries etc. Now by pushing C# they improve their lock-in, not just to applications but also to the Microsoft back-end services etc.

      --
      Engineering is the art of compromise.
    2. Re:Why did MS move to C++ in the first place? by Lucas+Membrane · · Score: 1
      There's an old quote from Bill Gates about how Smalltalk was going to rule the world. Unfortunately, most of the Smalltalk companies were mainframe-centric or worse (from MS's perspective), so MS couldn't acquire the technology, and Smalltalk did tend to run noticeably slow back in the daze of 1-digit Megahertz.

      Then C++ started to sprout features and the standard starting coming along, and these developments scared the juice out of all the little companies that had C++ compilers, because it was obviously gonna be so hard to compile it corrrectly and do an IDE and a debugger, and a linker, and a GUI lib and GUI builder, and all the things that have to be in the box to make a language product fly. Microsoft got behind C++ because they saw that most of the competition would shrivel up and die if they tried to compete at that task. Almost all of the competition folded. (Oregon C++, Topspeed, Symantec, Watcom, ... ) MS could afford to have 150 people developing and testing their C++ product. Not that it came out much better than most of the competition, but when everyone has a lame product, the biggest company is going to win. MS knew that.

    3. Re:Why did MS move to C++ in the first place? by Anonymous Coward · · Score: 0

      I disagree. It was a marketing thing.

      Back then, Borland was their main competitor and was kicking their ass. Borland was shipping a C++ compiler with an IDE, a class library for building Windows apps, and a (great) resource editor while Microsoft was still shipping MS C7 and much lower quality tools.

      OO was becoming the hot thing and MS didn't have it. Borland did have it and was pounding out the message that they had the modern approach to creating Windows apps while the MS compiler was still wallowing in the dark ages of pre-OO C development. And it worked. MS started to lose market share because it didn't have all the shiny new OO technology. Well, that and (IMHO) Borland was right. GUI development does map well into the OO domain.

      MS became so embarrassed by the situation that they pulled some of the brightest guys off of the NT project to work on VC++ (which is part of why it took so long to get from NT 3.0 to NT 4.0).

      Once they had VC++ and MFC done they turned the tables and used their, "We always win. Borland may not be around much longer." FUD to kill Borland's market share. Monopoly powers at work!

      The last time I used Borland (1996) it still kicked VC++'s ass, but the PHB's bought the MS FUD argument and forced the developers to switch, even though we didn't want to.

  46. Keep your eye on the lady... by S.Lemmon · · Score: 1

    You know, any time people talk about languages like Java and C# they always are quick to point out how it's "as fast as C or C++" and they have a pacel of tests to prove it. Similarly, C++ folks say "it's as fast as assembly" - some even go so far as to claim it's faster due to better optimizations.

    Now I believe in science and tests and so forth, and I'm sure there's some validity to these claims, but why is it every java program *seems* to run like molasses and every C++ emulator is lucky to get half the speed of the equivalent assembly version?

    Somehow I don't think people are being complete honest here. As video card buyers have known for years, something can get great results on carefully chooses benchmarks but still have crappy real world performance.

    1. Re:Keep your eye on the lady... by ScrewMaster · · Score: 1

      Somehow I don't think people are being complete honest here. As video card buyers have known for years, something can get great results on carefully chooses benchmarks but still have crappy real world performance.

      Of course they're not being honest. It's human nature to (ahem) adjust test results to suit one's own products. This is called "salesmanship". It's a rare organization or individual that can be completely honest in evaluating its own performance, particularly if that honesty will cost money.

      --
      The higher the technology, the sharper that two-edged sword.
    2. Re:Keep your eye on the lady... by EmbeddedJanitor · · Score: 1

      This is called "salesmanship". Bullshit, it's called lying.

      --
      Engineering is the art of compromise.
    3. Re:Keep your eye on the lady... by ScrewMaster · · Score: 1

      I guess the implied sarcasm in my post was too subtle. I'll try to be more overt next time.

      --
      The higher the technology, the sharper that two-edged sword.
  47. Limbo languishes, sadly by dido · · Score: 2, Insightful

    Too bad Limbo is too deeply tied to Inferno. It's unfortunate. From looking at how it's been designed it seems that Dennis Ritchie still hasn't lost his touch as an exceptional language designer. The Dis virtual machine that goes with it is supposedly designed to make a JIT simpler and more efficient, and well, according to Vita Nuova it gets something like 50% to 75% of the performance of compiled C/C++ code, which, if the article and Vita Nuova's benchmarks are accurate, totally blows C# and Java out of the water performance-wise. Now if only Vita Nuova would care to make it half as platform-neutral as Java... But hey, who cares, I'm already trying to do that. :)

    --
    Qu'on me donne six lignes écrites de la main du plus honnête homme, j'y trouverai de quoi le faire pendre.
  48. The problem is: that's not the problem by Spinality · · Score: 4, Insightful

    You're right. But with ever-increasing CPU horsepower, memory bandwidth, memory size, etc., there simply is no incentive for optimizing the things you're talking about. Moore's 'Law' has attenuated the advancement of software technology, by eliminating the need for efficient software.

    There are plenty of dinosaurian programmers like myself who remember hacking away on small machines. Save a byte by referencing a constant stored as an opcode in the instruction stream? Excellent! SLR R1,R1 is 60ns faster than SL R1,R1? Excellent! Decrease the size of the PDP-8 bootstrap loader by one word? Excellent! (Flipping those toggle switches took a lot of time.)

    In 'the old days' hardware was expensive and programmers were cheap. Hard problems were solved by incredible brainpower from great engineers. As a result, by the early 70's software had made huge advances over the punchcard/paper-tape era, and we had learned a lot about how to build quality systems.

    But there was a magic moment when the curves crossed between the cost of programming time versus the cost of hardware. Suddenly, it became easier to solve a problem by adding iron rather than by thinking harder. And so we slid backwards down the slope.

    As far as I'm concerned, hardly anything significant has happened in software architecture or praxis for a few decades. Sure, we have a bunch of fancy new widgets, and the common man's programming paradigm has changed. And the Open Source movement finally has given substance and a PHB-understandable framework to what Unix, LISP, Smalltalk, and other hacker communities used to do behind the scenes.

    But most of today's 'new' language, compiler, data management, operating system, and other computer science paradigms had their fundamental elements invented back in the 60's and 70's. We're finally RE-discovering many great concepts of the past. But it seems we've totally forgotten the importance of efficient, defect-free code, and the methods that might be used to create it.

    This is not to say that only great systems were built in 'the good old days' -- those days weren't that good, and there was plenty of crap. But the really bright folks figured out how to do things RIGHT; and yet they wound up being ignored, because 'doing it right' became less important than 'letting Bruce the part-time lifeguard do it over the weekend in Visual Basic.'

    So while I totally agree with your rant, and I've made a hundred similar rants of my own, the fact is we probably won't see fundamental improvements in software platforms until subatomic physics finally provides a wall against which hardware advances can bounce. As long as the answer to every performance/capacity complaint is "wait six months" there's no incentive to invest the man-centuries it will take to revamp our software environments. We probably need to build intelligent software that can optimize itself, because WE NEVER WILL.

    </rant>

    --
    -- We all have enough strength to endure the misfortunes of other people. La Rochefoucauld
    1. Re:The problem is: that's not the problem by 2short · · Score: 1

      "You're right. But with ever-increasing CPU horsepower, memory bandwidth, memory size, etc., there simply is no incentive for optimizing the things you're talking about. Moore's 'Law' has attenuated the advancement of software technology, by eliminating the need for efficient software."

      Bull. I hate it when people say stuff like that. The optomizations he's talking about are in fact exactly how good compilers/linkers do it. Because it is needed. The faster machines get, the more we ask of them. Efficient software is still necessary. Let's say your program takes twice as many CPU cycles as mine. Maybe you got it done a little faster, so you have some cash left over for a twice as nice box to run it on. Great. Now I want to deploy it to 5000 boxes; who's more cost effective? I write code that goes on servers being used by a bunch of users at once. We're constantly trying to balance how much CPU we can let one user monopolize vs keeping things responsive for the rest.
      If my software is twice as fast today, you can wait six months and be as fast as I am today, but I'll still be twice as fast as you.
      We do build intelligent software that optimizes itself, such as the very techniques he's talking about.

    2. Re:The problem is: that's not the problem by Jonboy+X · · Score: 1

      But the really bright folks figured out how to do things RIGHT

      Doing things "RIGHT" is a moving target. The "RIGHT" way to do something is defined by the person who pays the programmer. If the person cutting the paychecks wants you to code in such a way that you generate less efficient, potentially buggier code that's going to be done by the ship date that the marketing drones aggreed on over martinis, then it's your _job_ to comply. Everything's a tradeoff, and it's all about the bottom line.

      We probably need to build intelligent software that can optimize itself, because WE NEVER WILL.

      Modern compilers are way ahead of you. Remember that -O3 option? Granted, it's nowhere as efficient as a hardcore bit-flipping egghead inserting snippets of incomprehensible-to-everyone-but-him(or her) assembly into their C code, but it's a whole lot better than nothing.

      --

      "In a 32-bit world, you're a 2-bit user. You've got your own newsgroup, alt.total.loser." -Weird Al
    3. Re:The problem is: that's not the problem by clem.dickey · · Score: 1

      > SLR R1,R1 is 60ns faster than SL R1,R1

      It's the storage reference - unaligned, no less - which kills the SL R1,R1 performance. :-)

    4. Re:The problem is: that's not the problem by Spinality · · Score: 1

      D'oh! mistyped it. I meant SR R1,R1. SL R1,R1 is an error. SLR is faster because there's no condition code to set.

      --
      -- We all have enough strength to endure the misfortunes of other people. La Rochefoucauld
    5. Re:The problem is: that's not the problem by Spinality · · Score: 1

      We do build intelligent software that optimizes itself, such as the very techniques he's talking about. -- 2short

      We do indeed. But not enough of us. See my reply above. I agree that good compilers can help a good deal. But a great compiler won't fix a bad design. And too many systems today seem to have NO design. We know a lot, as an industry, about how to design and build good systems. We just don't all practice what we preach, or know how to.

      --
      -- We all have enough strength to endure the misfortunes of other people. La Rochefoucauld
    6. Re:The problem is: that's not the problem by Anonymous Coward · · Score: 0

      Doing things "RIGHT" is a moving target.

      That depends on your definition of "RIGHT"

      The "RIGHT" way to do something is defined by the person who pays the programmer.

      In my experience, that's usually the WRONG way to do something, but the way you must nevertheless do it.

      Usually the right way to do things works better but takes longer to write. The wrong way is buggier and less efficient, but will make more money. Such is life.

      it's your _job_ to comply.

      and that has nothing to do with whether or not it's RIGHT.

    7. Re:The problem is: that's not the problem by Aidtopia · · Score: 2
      But with ever-increasing CPU horsepower, memory bandwidth, memory size, etc., there simply is no incentive for optimizing the things you're talking about.

      Not entirely true. We've got more memory and CPU power, but the storage bandwidth has not kept pace. Every significant performance problem I've tackled in the past few years has had to do with cache misses and/or page faults. I've worked on shrink wrap code where the customers have decent though not high-end machines. Load times can be 30 seconds of building fix-up tables for the scores of dynamic libraries before you hit the first line of main(). Add another minute of thrashing while the minimal amount of data is loaded from disk into the far reaches of your address space, and you've got a user who's already wandered off to get another cup of coffee.

      Improving locality of data is nearly impossible if your language is too high-level or if you've delegated to a very general-purpose container library. I once improved the performance of a function from more than a minute to about a second. It was looking up 900 items in an STL map that had somehow spread itself out over zillions of pages causing endless VM thrashing. I replaced the map with a simple array and used bsearch. Zoom.

      I guess my point is we do need to fight the bloat. We need tools that load the bare-minimum. If we surrender some of our control to higher-level languages and libraries, then we need a back door to take control back when it matters.

    8. Re:The problem is: that's not the problem by RogerWilco · · Score: 1

      Your problem is that once computers were so expensive only smart people were allowed to program on them, today everyone can buy one and program some. (remember BASIC)
      I think there should be a movement in de software community for programmer validation. I mean if you want to practice law you have to get a degree, if you want to be an official XX repair shop, you have to have a certificate.
      I think we're going into that direction but the field is to young.
      We first have to figure out what are the right ways to do it.
      UML, Design Patters, OO, you name it.
      But I do think there is progress in software still, only maybe you're not at a site where it's happening anymore.
      Something like the field of Software Architecture wasn't around 10-15 years ago. Software Engineering is 20-25 years old.
      The move no longer is towards more efficient code, most compilers are efficient enough if you know how to use them properly.
      The move is towards being able to design and manage software of a complexity and scale of a whole new magnitude.

      --
      RogerWilco the Adventurous Janitor
    9. Re:The problem is: that's not the problem by clem.dickey · · Score: 1

      > SLR is faster because there's no condition code to set.

      No, that's not it. SLR does set the condition code. What you are trying to remember is fixed-point overflow, which is possible with SR but not with SLR.

      Whether SR really takes longer is arguable nowadays; IBM hasn't published instruction timings for S/370 (except 43xx) for many years. I think the non-DAT 370's may have been the last.

    10. Re:The problem is: that's not the problem by Spinality · · Score: 1

      I didn't mean to imply that these issues weren't important today. Just that, because of today's economics, relatively few of us worry about them. The examples you cite are spot-on.

      System/application load times are a great instance of what I'm talking about. There's no good reason that today's boot cycles and app launch cycles are so slow and painful. We know how to do a better job at these things. No good reason except -- who's going to pay to fix a problem that is just seen as a minor inconvenience? Loaders and linkers have rarely received the attention they deserve. (If you want to test how much a developer knows, ask for a discussion of the terms 'scope,' 'discovery,' 'binding,' and 'marshalling.')

      --
      -- We all have enough strength to endure the misfortunes of other people. La Rochefoucauld
    11. Re:The problem is: that's not the problem by Spinality · · Score: 1

      > the field of Software Architecture wasn't around 10-15 years ago. Software Engineering is 20-25 years old.

      WTF?

      > I do think there is progress in software still, only maybe you're not at a site where it's happening anymore

      Of course there's been progress. But we wasted a lot of really good ideas. For example, think of how many years our cheesy x86 C compilers forced programmers to worry about choosing a memory model. We knew better. The compiler could and should have taken care of such issues seamlessly, the way lots of 'real' compilers did for other CPU's. And I still can't believe the horrible virtual memory architecture that we use today. Cleaner, faster, better designs were in use in the '60's.

      Much of my complaint relates to a dumming-down of computer science, prompted by the PC. "It's not a real computer, so we can cut corners." There's no reason a great operating system couldn't have been delivered on early PC hardware. Instead, we got something that might have been written in 1965.

      It should be obvious, by the way, that most of my rants in this thread are related to the mainstream Wintel computing world. Plenty of developers are exempt from this complaint, including lots of slashdot folks. But they're in the minority, and more's the pity.

      --
      -- We all have enough strength to endure the misfortunes of other people. La Rochefoucauld
    12. Re:The problem is: that's not the problem by Spinality · · Score: 1

      Eeep. This is all too far back in my memory. (Obviously, I wasn't talking about 'nowadays,' but about back in the misty past, when worrying about relative instruction timings on a 360/67 or a 370/158 really made a (miniscule) difference. It was good practice to know and use the more efficient forms as a matter of course, particularly in compiler design.) My recollection was that SLR, ALR, etc. explicitly did not set the CC at all. But perhaps it was just that some bits were masked. My green cards, POO, instruction timings, etc. are all either packed away or thrown away. But I'm certain that, with the machines in use at the time (including both discrete logic and microcoded CPU's), there was a tiny savings. Anyway, it's all moot today, as you point out.

      > I think the non-DAT 370's may have been the last

      I definitely remember going over these issues in 1975-78 with timings from DAT 370's (also Amdahls), as well as more significant timings on page faults, segment faults, SVC, and DIAG. We were using IBM pubs, IBM internal docs, and field research. But who cares, I guess?

      --
      -- We all have enough strength to endure the misfortunes of other people. La Rochefoucauld
    13. Re:The problem is: that's not the problem by bobkoure · · Score: 1
      There are plenty of dinosaurian programmers like myself
      I'm one of those, too (even IBM 360s needed efficiency if you were writing disk drivers or LU 6.2 equivalents). But you and I missed the ramifications of the exponential phenomenon going on around us (Moore's Law). We weren't alone. For example, the OS/2 folks missed it big time (imagine demanding your OS be able to support an already-becoming-obsolete processor that essentially crippled that OS to unusability). They had no concept of how quickly the world was going to move from one processor to the next. (Neither did I - was busy building tiny modules in assembler and sometimes stringing 'em together in C.) We could have had a modern Multics. Instead we have VMS (AKA WinNT) and Unix, all over again.
    14. Re:The problem is: that's not the problem by RogerWilco · · Score: 1

      The problem is getting the knowledge to the people.
      And a way to measure/grade the knowledge of an individual.
      There is a huge distance from the average Wintel "programmer" to
      the "real" Computer Science world.

      Next to that we need a way to have the outside world/employers to be able to tell the difference between the 10 lines VB programmer and the
      video driver programmer. (just trying to think of somewhere that efficiency counts) To most people both are "programmers".

      I do think that although wintel has made computers affordable, its
      short-term gain focus has had some very nasty side-effects. I experience everyday the long term cost of cutting corners, and
      the short-term cost of doing things "right". It's very difficult to
      balance both, and unfortunately the decissionmakers are not able
      to make a well-informed decission. (you say it's crap, but it looks
      fine to me, so I sold it already / you're not a good programmer because we're getting all these complaints.)

      --
      RogerWilco the Adventurous Janitor
    15. Re:The problem is: that's not the problem by Spinality · · Score: 1

      > You say it's crap, but it looks fine to me, so I sold it already.
      > You're not a good programmer because we're getting all these complaints


      ROFL. We've all heard it. Of course, sometimes when they say "It looks fine to me" they're right. And sometimes getting complaints has nothing to do with the programming, but with training, sales expectations, or what some jerk in Redmonds sticks into a service pack.

      --
      -- We all have enough strength to endure the misfortunes of other people. La Rochefoucauld
  49. Re:Slashdot contracts viral marketing piece, again by ergo98 · · Score: 0

    Well the writer is clearly from a magazine called "windows::developer", so obviously a pro-Microsoft bias will be likely.

    Having said that, the same argument could be made for any article: Pro-Java? Clearly someone from the Sun\IBM camp. Pro-Pascal? Come on you Borland employees, quit trying to trick us!

  50. Who cares? Machine cycles are cheap... by supton · · Score: 2, Insightful

    Bruce Eckel sums it up best:
    "Programmer cycles are expensive, CPU cycles are cheap, and I believe that we should no longer pay for the latter with the former. " from a post by Bruce Eckel on artima.com.

    Perhaps people should stop obsessively benchmarking platform VMs, and start benchmarking coding productivity and teamwork, perhaps in Python, with the performance bits in C. For a real-world example, Zope does exactly that: 95% of the code in Zope ends up being done in Python - only the real performance-intensive stuff need be in C... and the stuff done in Python is easy to read, modify, reuse, and tweak (thus, better productivity for both developers that use Zope as and app-server platform well as developers who work on Zope's core).

    1. Re:Who cares? Machine cycles are cheap... by 16K+Ram+Pack · · Score: 1
      Spending money on Hardware also IMO makes code better to maintain.

      When code is built around business functionality alone, following what a program does can be quite straightforward. When you start adding efficiency changes in, the code becomes more complex to understand because it looks less like the business requirements.

      Any changes done to the code after the efficiency changes can also take longer and are more risky.

  51. Again, you are speaking... by rmdyer · · Score: 1

    ...in terms of a whole "shared library". I don't want shared libraries as much as I would like individually shared "functions/classes". You are right that if app A loads library A, and app B uses some function in library A, the OS should'nt re-load the same library A. But what if app A doesn't use but 1 function in library A? And, app B only uses 1 other function from library A? Now we've got two apps loaded that are using a library that may have 50 or more shared functions that aren't being used!

    -1-1

    1. Re:Again, you are speaking... by Anonymous Coward · · Score: 0

      Individually loading functions or classes is unfeasible for a number of reasons.

      Individual classes or functions may depend on other functions or classes or even some state that is global to the entire library. Determining these dependencies at compile time requires global analysis, which is generally difficult and slow. As a result, you would need to continuously be loading bits and pieces of a library as those dependencies come about. And if you think it's inefficient to load a whole bunch of useless crap into memory, wait and see how inefficient it is to continuously be hitting the hard disk to load up little bits of code. Better to load it all into memory (which is cheap and abundant nowadays) and amortize the cost of hitting the disk by loading a whole bunch of related stuff once.

      Also if parts of a library do use other bits of the library or shared state, then you'd need to use indirection to get at them if you're going to be dynamically loading them. Dealing with shared state also complicates the issue if you only bits and pieces of the library and state in memory.

      Finally, such an approach would complicate the job of compiler writers. Imagine the hoops you'd need to jump through to incrementally fix an object's v-table as bits of its functionality are loaded. Every virtual method call might have to load functionality and fix up v-tables all over the place. And I don't even want to think about the problems that function points
      would introduce.

      Seriously, I wouldn't be too concerned with wasting memory, unless your in the embedded software field where conserving memory is a priority (in the short term anyway). Loading a library or even statically linking a library is not a huge cost in terms of memory usage and the cost of freeing that memory will invariably be more processor cycles.

    2. Re:Again, you are speaking... by eloki · · Score: 2, Interesting

      But what if app A doesn't use but 1 function in library A? And, app B only uses 1 other function from library A?

      This is why Linux pages things in on demand. It doesn't read the whole library and load it into physical memory. The library is conceptually mapped into your address space, when you try to access a function foo(), if foo() is in a page that isn't currently loaded in physical RAM, the OS gets a page fault, and that page will be loaded.

      Just because you're linked against libc, that doesn't mean you're physically loading every string function into RAM when your program runs. The granularity you're talking about probably isn't worth the gain in extra complexity.

    3. Re:Again, you are speaking... by WNight · · Score: 1

      Obviously, if you wanted to be able to load strcat seperately from strtok, they'd need to be written to be seperated. If they both rely on the same globals it won't work. This would require a rewrite of the standard libraries, but probably not a painful one as old monolithic libraries would suffice and as new modular libraries replaced them statically linked code would just get smaller.

      As for performance, this shouldn't matter. Of course, if you hit the disk to load each function as you got to it, you'd have trouble. There's no reason to do this though. If you're statically linking you simply only include the code asked for, if you're dynamically linking you prepare a list of the needed libraries and the OS can load them all at once at the start of executing. (This is actually how it's done, but with whole libraries at a time instead of tiny little single-function libraries.)

      As for the compiler complexity, I think it's a nonexistant issue. Compilers already recursively evaluate include statements. Instead of specifically using #include you'd be including a namespace, so the compiler knew which strcat to include, but at this point it simply links the code. A hundred external functions is a hundred external functions, regardless of being in one file or fifty. There's a slight increase in disk IO but fairly slight.

  52. Managed C++ is faster than C# by xswl0931 · · Score: 1

    Related to this, I've read (sorry no references, search google) that Managed C++ code will run faster than comparable C# code due to the experience in C++ compiler optimizations. So if you want to write C++ and have the benefits of .Net, perhaps you should look into Managed C++.

  53. SharpDevelop - #develop - GPL .NET IDE by Sean+Clifford · · Score: 4, Informative
    Well, there's always vi a la vim win32 port. :)

    I do a lot of ASP3.0/SQL2k and some utility development on Win32, taking a stab at .NET. It would be nice to move over to Mono.

    Anyway, I've done a bit of poking around and ran across SharpDevelop - AKA #develop . It's open source a la GPL and looks a lot like Visual Studio, and compiles C# and VB.NET; has C# => VB.NET code conversion; does projects or files; has syntaxing for the whole MS shebang. It's a .97 - this build was released Friday 9/12/2K3, officially in beta, and you can get the binaries here, go snag the source here, and get the MS.NET1.1SDK here.

    To those folks who hiss and moan about the whole GNOME/.NET/Mono thing, take a gander at the rationale before playing jump to conclusions (mp3).

    SharpWT - AKA #WT is a .NET port of Java SWT on both Windows/.NET and Linux/Mono platforms. So...you can develop your .NET apps to run on both Win32 and Linux with pretty much the same GUI. Neat, eh?

    Anyway, intrepid Windows Developer, if you can pry yourself away from the MSDN Library for a few minutes, you might find there's something to this Mono business.

  54. In a related article... by MuValas · · Score: 1

    The hammer has been found to be a better tool that a screwdriver, while the saw fell somewhere in the middle.

    I personally always use a hammer...

  55. Re:I don't get it by Lodragandraoidh · · Score: 1

    SCO sucks. End of story.

    There you go.

    --

    Lodragan Draoidh
    The more you explain it, the more I don't understand it. - Mark Twain
  56. Almost as good as Delphi by occamboy · · Score: 2, Interesting

    I've been coding for a million years: 6502 machine code all the way up to a recent foray into C#, and almost everything in between. Here's my take, for what it's worth. And, it's your chance to mod me down for pontificating!

    Delphi is the best all-around language ever for producing Windows apps. The Delphi programmer has control over everything if they want it, but they don't need to muck around with nasty details unless they need to. It encourages clean coding. Performance is superb. And the IDE is excellent. The Delphi package (language plus IDE) has been the path of least resistance to getting an app done for the past six or seven years.

    Prior to Delphi, the way to go was VB with C DLLs. Do the UI in VB, do the internals as C DLLs. VB was great for abstracting nasty stuff, but it often overabstracted, and performance was ungood. Writing companion DLLs in C boosted flexibility and performance.

    Generally speaking, C is basically not much beyond portable assembly language. If a reasonable alternative is available, and it usually is, using C for anything beyond embedded systems or super resource-critical applications is probably not a good idea, as the code tends to be dangerous and obsfuscated. And keeping track of pointers is just nutty.

    C++ is a nightmare. In theory it's object oriented, but all of the code that I've seen is a total mess, more like C using the C++ libraries. Ugh.

    Java is almost good: it is pretty safe, and encourages good habits. But I find it clumsy - like it was designed by academics rather than practical developers. Lack of enumerated types, for example, is insane, and encourages unsafe programming. It's also a pig, which doesn't matter so much for a lot of things these days - we usually have lots of CPU cycles to spare. For doing GUI apps, Swing is a weird joke - a pig's pig - which should be forgotten immediately. And the Java IDEs have only recently become usable for command-line stuff, but they suck as bad as Swing for GUI development.

    Now C#. Having toyed with C# for an app recently, I'm quite impressed. It's sort of like the best of Java with some of Delphi's goodness added. It's ALMOST as good as Delphi - which makes sense, since the same fellow (Anders Hejlsbeg) was key in developing both of these languages. And .NET, to which C# is bolted, is pretty good as well. And the IDE is very nice. So, all-in-all, I think that C# is a good choice for Windows development. The web forms stuff seems interesting, but I have a feeling that using it would be something that I'd end up regretting - there's bound to be nasty gotchas that won't show up until late in the project.

  57. Not from my recent experience by GroundBounce · · Score: 4, Insightful

    I am in the process of coding a data collection server application in Java which collects data from remote devices that dail up over a phone line. The application must interface with the serial port at a low level, send email, generate XLS files, send faxes, create charts, and, of course, communicate with a DBMS. It also has a significant GUI component as well. Oh yes, this application must be able to run both on Linux and Windows (2000 or XP).

    I have been developing on Linux. All in all, to date I've coded around 30,000 lines of code. Because of the high level of portability of the APIs, I had to change all of about a dozen lines of code to get it up and running on Windows. That's one dozen out of 30,000. There's now way you could even come close to that using C or C++, regardless of how cross-platform the library developers say their libraries are.

    As far as performance, Java may have been slow three of four years ago, but the last several versions of the JDK and the HotSpot JVM have seen a steady and rapid improvement in performance and stability. SWING, although it has improved, may still be a bit slow, but computational code written in Java is only slightly slower than in C++. Even current versions of SWING, although arbuably slower than native GUIs like GTK+ or QT, are fast enough so as to not be noticable on any machine faster than 800MHz or so.

    Most people who say Java is unstable or slow are remembering their experience from the JDK 1.1 days. The current JDK 1.4 bears little resemblance to that in terms of performance and maturity.

    1. Re:Not from my recent experience by StormReaver · · Score: 1

      "Most people who say Java is unstable or slow are remembering their experience from the JDK 1.1 days. The current JDK 1.4 bears little resemblance to that in terms of performance and maturity."

      Most people who say this haven't used Swing enough. I tried to convince myself that Swing was fast enough, since I was trying to push Java as an alternative to VB at the workplace, and for some tasks it was indeed fast enough.

      When your GUI gets non trivial (try a large hierarchical table on one side of a split pane and dozens of moderately sized images [e.g. 160x160] on the other pane), resize times for the container widgets under Java get painfully slow while the resize times for the exact same layout under a native GUI change imperceptibly if at all.

      That is just one of many examples. In general, as of JDK 1.4.1, Swing is still horrendously slow for most non-trivial applications. Printing is also nearly useless under Java. It's a hundred times worse than the worst part of Swing. I can't damn Java printing harshly enough. What were those guys at Sun smoking?!

      All this takes place on 2.8 Ghz processors with 512MB of RAM. I had to accept that Java is useless for GUI programming, despite my strong desire to find otherwise.

      We've decided to standardize on C++ and Borland's C++ Builder.

      We were initially going to standardize on Java, but that is no longer an option given its horrendous lack of speed and its enormous system requirements.

      We were then going to standardize on web applications using LAPP, but there are many things for which our users will not accept a browser based interface (anything that requires printing reports, for example).

      We were then going to standardize on C++/Qt, but Qt's licensing fees are way too high for what it doesn't provide in comparison to C++ Builder. So now we're leaning heavily towards C++ Builder, and will standardize on it barring any show-stopping problems.

      Having programmed in Java since version 1.0, there is no possible way that any sane person can say that any Java GUI is comparable in performance to the identical GUI written using native components.

    2. Re:Not from my recent experience by Anonymous Coward · · Score: 1, Informative

      People keep saying that swing is only fast enough for simple gui's, but we've got a pretty good mapping system up with a fairly complex gui. The performance is slower than it would be in C++, but if you know swing, you can get pretty darn good behaviour from it.

    3. Re:Not from my recent experience by yamla · · Score: 1

      Counting comment lines, the app I'm currently working on contains approximately 26,000 lines of code. That's counting based on newlines. This is all written in C++ using Qt. It compiles and runs in Windows, Mac OS X, and Linux (though we are not releasing the Linux version). I have approximately 20 lines of code that differ between the three platforms and that is summing up the difference. This means I have approximately six lines of code unique to the Mac, six lines unique to Linux, and seven unique to Windows.

      Now, this is a non-trivial client application which uses XML, SOAP, has a functional GUI, etc. etc. It communicates with a server that happens to run on FreeBSD. I'm not counting the lines of code in the server here. The server hooks up to a database. I haven't tried porting that to Windows or Mac OS X but it works with zero changes (no lines of code different) on Linux.

      So what I am saying here is that my C++ experience certainly does not match yours. I find it quite easy to develop cross-platform apps (Windows, Linux, FreeBSD, Mac OS X) with one code base.

      --

      Oceania has always been at war with Eastasia.
  58. ...and the .NET Framework is language-neutral by kylef · · Score: 5, Interesting
    What language you use depends on your application. Comparing C, C++, and C# is like comparing a wrench and a screw driver.

    And this is where the .NET Framework shines, because the CLR is a generic virtual machine to which any number of languages can be compiled. Currently there are C#, C++, VB, and even Java (under the moniker J#). There has been talk of writing a Python compiler and even possibly a Perl compiler. So you can choose your language of choice, and your resulting binaries or objects will fully interoperate with the other .NET languages and class libraries.

    And as far as this article is concerned, I think the interesting point is not that they're comparing apples to oranges, but just that the performance numbers for CLR-compiled C# aren't so horrible that they should scare off the majority of developers.

    1. Re:...and the .NET Framework is language-neutral by Anonymous Coward · · Score: 0

      Are You Reading the MS adds again?
      It better work with C# that was the target.
      C, Java? similar sytax. Not a big strech.
      VB no not quite. It had to be modified to work.
      VB6 code is not compatible. It did not fit the mold.
      A lot of languges are similar. How hard is it to port Pascal to C. I have ported Basic (Not VB) to C several times. Take away the goto's and it is easy.

    2. Re:...and the .NET Framework is language-neutral by more · · Score: 1
      Even though there are many languages in .NET, it does not "shine" on diversity. All of the languages are limited to the CLR, removing many options that exists in truely compilable languages. Thus, .NET has a limited application area compared to all the other languages.

      In my company, we spend several man years each year to optimize the speed of the algorithms in a complex 10000000 line application written in C++. Coding that with C#, we would be usually 10 times slower as the starting point of the optimization, and most likely could not compete against a competitors FORTRAN-version of the application.

      .NET is nothing but Java-clone with patent-protection in the right hands.

      --

      -- Imperial units must die --

    3. Re:...and the .NET Framework is language-neutral by Daimaou · · Score: 2, Interesting

      You know, I used to think that the idea behind .NET supporting all these languages was interesting, but now that I've actually used it, I can't see what the big deal is; especially since the development environment to program for .NET is different for each of the different languages. Sure, you can hook a smattering of languages together, but who on Earth really does that? I have never worked for a company that says "write in whatever language you want to, we code to .NET so it doesn't matter!" What a nightmare that scenario would be. Most companies force standardization on one or two languages and then hire people with appropriate experience.

      What I find much more useful, and therefore of a much higher "cool" factor, is Borlands new C++BuilderX. Now that is a damn fine looking development tool. I can't wait to try it out.

      C++BuilderX allows a C++ or C developer to pick from several compilers (Borland, MS, GCC, Forte, etc.), it will compile to Windows, Linux and Solaris, and it supports the EXACT SAME development/debugging environment regardless of which combination of compiler/OS you choose. It also lets you seemlessly interface with a variety of version control systems. To me, that seems much more useful than having a bunch of different environments that will compile a bunch of different languages to one VM.

    4. Re:...and the .NET Framework is language-neutral by Captain_Chaos · · Score: 1

      The same goes for Java which consists of a virtual machine and byte code spec for which compilers for many different languages exist, and the Java language spec and API's which describe just one language that runs on the Java VM. In fact, the Java language contains concepts that the JVM doesn't even know about, so that doesn't necessarily have to be a problem.

    5. Re:...and the .NET Framework is language-neutral by Panaflex · · Score: 1

      Obviously, you've never been through a merger.. or a series of mergers.

      Personally, I prefer to keep the platforms rolling as they are than try to port all code back to the company standard. Things like messageing and database unification can often solve the worst problems.

      Pan

      --
      I said no... but I missed and it came out yes.
    6. Re:...and the .NET Framework is language-neutral by Daimaou · · Score: 1

      I worked at Novell. Does that count? :)

  59. Not possible by lseltzer · · Score: 1

    Any benchmark that shows interpreted or bytecode languages to be on par or better than compiled languages must be understating the optimizations possible with compiled languages.

    1. Re:Not possible by mabinogi · · Score: 1

      That would be true..if it were bytecode or interpreted languages being benchmarked.

      Java and C# are JIT compiled - to native machine code. And I believe CLR stuff can be compiled at installation time, making it even better than JIT.

      --
      Advanced users are users too!
    2. Re:Not possible by Dan+Guisinger · · Score: 1

      Right On. .NET's CLR will store a cached copy of the x86 native binary after first execution

  60. Why offtopic? by Anonymous Coward · · Score: 0

    Troll, maybe. Flamebait, perhaps. But, how can a post that replies the question asked in the article title be offtopic?

  61. Re:There's no D. by ryancerium · · Score: 1

    Yes, there is a D language. As far as I know it's still academic, but it does exist.

  62. Java is suffering... by pyrrho · · Score: 1

    ... from evangelical believers, who, not unlike Microphants, seem to think Java is right for everything!

    When it does something poorly, it's as if we're supposed to believe that it's supposed to... not efficient... not supposed to be, machines are fast now... etc.

    I agree with you... server side java makes a lot of sense. But are their Java advocates that just want to use Java where it makes sense?

    --

    -pyrrho

    1. Re:Java is suffering... by deanj · · Score: 1

      Oh, stop it. You act like this is exclusively a Java thing. Grown-up programmers know when to use the right language for the right thing.

      I've run into many more goofballs that think C/C++ is the "one true answer" to all of lifes ills, and then spend most of their time tracking down pointer problems with impossibly complicated code.

      The point is, there's NO one language that should be used for everything.

      What to do really tough number crunching? If you use C for something like that, most computational scientists would laugh in your face and head back to their Fortran programs... and they're right to do so, because for THEIR apps, Fortran is the thing to use.

    2. Re:Java is suffering... by pyrrho · · Score: 1

      I have not found C/C++ programmers thinking that. But who knows, you are right there are evangelical people of all technical persuasions, but that doesn't mean you cannot compare relative evangelical tendencies related to particular products. I don't like the tendency in general. I still think it's too strong in the Java camp, it's not just some people, it's Sun et al, and I think it creates a false idea of what Java is about or is for.

      C++ programmers tracking down pointer problems? They are not using C++ very well are they? Because giving you tools to avoid that is what C++ gives you over C with it's class structures.
      I find this repeated canard like telling me that in C/C++ you spend all your time tracking down close parentheses. If you allocate memory, you have to free it. This is not hard to memorize. In C it can be a pain to implement, in C++, it shouldn't be.

      Indeed, you can choose a C++ paradigm that does not have you using pointers at the application level in C++, although that's overkill since usually it's good enough to clarify who owns memory so the app programmer, while using pointers, knows they don't have to free them personally.

      I especially mind this criticism when Java is the subject, because it's utter fantasy for people to argue there are not memory management bugs in Java. People actually believe that, because they think that leaking memory is the only memory problem in the world, and they overlook the fact that it's possible to leak memory in Java as well --- it's not? Well I've seen Java applications that grow in memory usage as time goes on, must be something keeping unneeded references. That is a leak.

      That is, memory management isn't really just about alloc/free, it's about knowing what you are using memory for, understanding where you have something with multiple readers will read, understanding where you reference it. By telling Java newbies they won't have to worry about memory, they are done a disservice, it's not true.

      Gargage collectors have been available for a long time. There are ones that hid beneath class systems or inside malloc/free, many options. They are not widely used, and especially, no particular one is dominant in the C/C++ world... why? You cannot manage memory well unless you understand the semantics of the memory, what is it being used for. You HAVE to know that to know the best time to free, the best time to realloc, the best time to use alternate heaps, etc. You don't want to get to forget these things, it's not worth it. Better for the systme if you think harder about them.

      Fortran has problems with it's syntax. It's only advantage is that, as a language with no pointers, the compiler can optimize better. This is not the only factor in coding, even number crunching applications. More flexible memory management, OO idioms, etc., are leading event he scientific community away from Fortran.

      And of course, it's possible in C++ to make class systems in such a way as to do very well performance-wise against Fortran with the benefit of the additional idioms C++ makes available. It's not automatically that way, C++, if you just take a pass at making a number crunching class, it will be all screwed up and slow. But that's the thing about C++... if it's important there will be ways around it, to carefully make a class system which THEN can be used rapidly (more carelessly, more intuitively), C++ never shuts you out from something the machine itself can do. Run into the same situation in java, or any VM based language, and you are SOL.

      I don't think that C++ is the language for everything, but it is generally the most efficient, and therefore ideal if time and cost were not an issue (although to a degree I'm saying C++ when I should say "compiled languages"). IOW, the only reason not to do everything in a compiled language are practical matters, which of course are the most important matters of all, and therefore are deciding factors. But does that mean C/C++ isn't the best ideally?

      --

      -pyrrho

  63. They all pale when compared too......... by h8macs · · Score: 1

    BASIC.

    Not any of that wimpy namby pamby visual, object oriented stuffage. The big meaty pain in the arse line code BASIC.

    Basic BASIC ;-)

    Yeah now that is coding! 500 lines of code to watch 2 blobs on a see-saw, now that's living! Woohoo!

    --
    :-( --- argh. Despair, I owe again. :-b
  64. D comes after C# by mangu · · Score: 1
    First of all, I've read that, actually, "B" didn't come from BCPL at all, but from Ken Thompson's wife Bonnie (at least, that was the story Ken told at home). So, the letter after B should be either C, if coming from alphabetical order, or O, if coming form Bonnie Thompson's name.


    But that has nothing to do with C#, which, clearly, comes from musical notation. C# is the same note as Db, or D-flat. After C# comes D, and after D comes Eb, or E-flat.

    1. Re:D comes after C# by maheshm · · Score: 1

      D is also known as C double sharp - Cx

    2. Re:D comes after C# by Anonymous Coward · · Score: 0

      Come ON people... B -> C -> C++ -> C#.... doesn't anyone get it....
      Of course B -> C is simple enough...
      C -> C++ is a pseudo-recursvie pun...
      But what about C++ -> C#
      Don't give me that "musical notation" bs... THINK PEOPLE...
      C++ ++
      C++ -> C++ -> C#

    3. Re:D comes after C# by Anonymous Coward · · Score: 0

      So the next would be C##. Then C####, or perhaps C#^4.

  65. And you can get away with that because... by alispguru · · Score: 1

    ... most server-side apps are bottlenecked by either internet bandwidth, or database access speed. Java is just fast enough that the cost of bytecode-interpretation and JVM semantics-preservation can be covered up with big beefy servers.

    Riddle me this: if Java rocks on the server, why are there no industrial-strength databases in native Java? You would think Oracle would be thrilled to write once and deploy everywhere...

    --

    To a Lisp hacker, XML is S-expressions in drag.
  66. Re:But there's just one problem... by ScrewMaster · · Score: 2, Insightful

    Possibly true for pure VB, but major VB apps aren't. In order to do a lot of things that aren't intrinsic to the language, you end up calling C/C++ or Windows API functions to get the job done. That tends to blow compatibility with non-Windows runtime environments (hell, it tends to blow compatibility with Windows environments.)

    --
    The higher the technology, the sharper that two-edged sword.
  67. Re:Competition is important. Whats really needed. by Trelane · · Score: 1

    Actually, FWIW, I created a very responsive Swing application that found the energy eigenvalues and the corresponding eigenstates inside of a quantum well.

    I should say, it was very responsive on my ultra-modern K6-II 450Mhz 160MB monster laptop. I didn't really notice much of a lag at all in interactivity. I found it very useful.

    Couple that with the fact that it ran great on my boss's Windoze box, and all was good in Javaland.

    --

    --
    Given enough personal experience, all stereotypes are shallow.
  68. You mean suns platform of choice? by Anonymous Coward · · Score: 0
    Write once and deploy on your choice of platform (Linux, Solaris, or Windows if need be)
    Except that my platform of choice is none of the above. Everything has a C compiler, not everything has a jvm. Java was supposed to be an open platform to develop once, run anywhere. Its neither. Its suns platform for you to develop once and only run where sun says so.
  69. #insert <obligatory_Java _generics_rant> by Anonymous+Brave+Guy · · Score: 4, Interesting
    Java SDK v1.5 (not yet released) contains support for 'generics', which are very much like C++ templates for Java:

    I really can't believe this thread. Why do people always come up with this worn out line whenever someone suggests that C++ templates are an advantage? And how come so many people have done so in replying to the same post? All but the first are (-1, Redundant), and the first is (-1, Ill-informed).

    OK, please, read this carefully, for I shall write it only once (in this thread):

    Java's generics are not even close to the power of C++ templates. They are glorified macros to fix a bug in the type system that should never have been there.

    C++ templates were at that level around a decade ago. Today, they're used not only to create generic containers (for which they are, no doubt, very useful) but also, via metaprogramming techniques, as the tool underlying most of the really powerful developments in C++ for the past few years: expression templates, high performance maths libraries, etc.

    If you didn't already know that, please read it again and understand it before proceeding.

    Java's generics don't even come close to the same power. They're a cheap knock-off, aimed at just one of the uses of C++ templates, which fixes a glaring flaw in the previous Java language. For that, they serve their purpose well, but please don't pretend they're anything more.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  70. Relative performance of languages is irrelevant by Anonymous Coward · · Score: 0

    If one language is twice faster than some other language in certain situation, it does not garauntee that the first language is always a better choice than the latter one.

    Consider if a plain C/C++ based text editor starts up in 200ms while Java/C# based one starts up 400ms. Who cares for that extra 200ms? But on the same time, If it took 2 month/2 expert C/C++ programmer for the first text editor while it took only 1 month/1 average Java/C# programmer, it makes huge difference if you're project admin for that text editor project.

    I don't mean speed is not important, or C/C++ development cost too much money. But what really matters is not the relative performance between languages, but acceptable performance for that particular project and customer's need. Who cares if a server daemon took up 30 secs to load if you only restart them once or twice a year? If all that matters is raw performance, we would all develop kernel module in plain C to handle HTTP request and write HTML response directly to build a personal homepage and write an assembly program to directly contact mysql daemon with tcp socket to retrieve the new messages on guestbook.

  71. And both generics and templates are kiddy toys... by alispguru · · Score: 4, Insightful

    ... compared to the code-generating power of lisp macros.

    --

    To a Lisp hacker, XML is S-expressions in drag.
  72. No benefit from Java/C# for 3D engines by LightStruk · · Score: 1

    A 3D engine is doing a lot of math. C code that just does math is already portable across platforms, and usually across compilers too.
    You're never going to see cutting edge 3d engines written in Java, or any other interpreted, scripted, or bytecode language, because those languages lose their typical advantages in this case.
    The rest of the game, however, can greatly benefit from high-level languages, because it simplifies game object creation and handling. Do you really want to be managing memory when you could be writing the interface?

  73. It depends on use by EmbeddedJanitor · · Score: 1
    If your code is just gluing together Windows API calls, database engines etc, then is won't matter a damn what language you're using since almost all the time is spent inside the API/DLL.

    If, however, you write code that does a bunch of computation etc, you will see difference. C will outperform C++, C# and Java.

    --
    Engineering is the art of compromise.
  74. Don't Believe the Hype by g_goblin · · Score: 0

    Give it a rest. We all know C and C++ are faster than JAVA and C#. The only reasons why IT chooses either one is because of the time it takes to get the app to Production.

    If C or C++ application didn't take as long to develop, then we would all be writing our code in either one.

    According to IBM, it's not what's underneath but how "Productive" you are.

  75. Anyone played Quake II.Net? by Anonymous+Brave+Guy · · Score: 2, Interesting

    Microsoft have had a .Net version of Quake II mentioned on their developer pages for some time now. It's a port to Visual C++ .Net 2003, using the CLR.

    Has anyone tried this? It's presumably managed C++ rather than C#, but it should give a fair indication of the performance you'd get from C# if it's using the same run-time framework. If they can get comparable performance in a FPS using the .NET run-time, it might be worth looking at for games development after all...

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    1. Re:Anyone played Quake II.Net? by selderrr · · Score: 1

      dude, Q2 is so old, you could run the PC version inside VirtualPC on a 2GHz G5 and still get 20fps. Does that make VPC a solid alternative for games ?

  76. I, like Judas Priest, by ellem · · Score: 1

    only write in A and E.

    Breaking the law breaking the law!

    --
    This .sig is fake but accurate.
  77. C, C++, and Java by SHEENmaster · · Score: 2, Informative

    share portability in common. I can write an app in C, and run it on my server, laptop, palmtop, ancient SunServer, or even a Windows machine. The same goes for Java and C++.

    If I use C#, I'm effectively locked into .NET. Mono is a good start, but not enough to make my code reliably portable.

    C# has all the speed of Java with all the portability of X86 assembly linked to Windows libraries. Microsoft's BS patents will help ensure that the portability problems aren't corrected.

    The real purpose behind .NET is to make the platform compatibility promised by NT 4 available without opening the source.

    --
    You can't judge a book by the way it wears its hair.
  78. Re:#insert by Anonymous Coward · · Score: 0

    Anonymous Brave Guy, you're my hero.

  79. You're missing something by Anonymous+Brave+Guy · · Score: 2, Insightful
    No matter what you say, C is *always* faster. You *cannot* write a loop in C#, and claim that it will run faster than a comprable loop in C.

    Actually, in practice, no it's not and yes you can.

    What you're ignoring is the "late optimisation" effect of virtual-machine and intermediate language execution models. The installer or run-time can take intermediate code and convert it to native code, just as a C compiler would, but with full knowledge of the environment in which that code is going to run. That allows for specific optimisations based on the execution environment that are rarely, if ever, practical for C-based programs. (How many C programs ship with different optimised executables for each Pentium and Athlon series processor, for example?)

    You seem to be writing as someone who knows how things are supposed to work, who has a certain mindset and isn't prepared to look outside it. So-called just-in-time compilers actually have a lot of potential. They aren't, in general, as fast as something like C or C++ yet. However, in theory they could actually be faster once they've matured and caught up, because they can do all the same low-level optimisation tricks as a C or C++ compiler, with more knowledge of the target environment to get the best out of them.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    1. Re:You're missing something by pantherace · · Score: 2, Interesting
      Actually things like this have been done (re-optimizing compilers) for binary programs. Please note that this is not run-system optimization (as is the case for the c# compile on install, or something like gentoo) this is run-time optimization, which produces faster code. I know of experements on alphas (based on what fx!32 did (which is interpretive emulator+translator+run-time optimization (might be where more jits try to go, and may be considered a very early, and very very advanced jitc.) and in production (as I recall) on pa-risc. This is nice for all the byte-code languages with jit's but under those run-time optimiziation of the code, (and the ability to store it to disk permanantly, vs when the jit loads, or changes (admittedly may be never)) pretty much always found that the c and other binary generating languages would be faster in the beginning, and end.

      Essentially: all languages have a lot of maturation to go through, and more optimizing. :) Hell, I will be impressed when a language runs well on EPIC, with it's lack of hardware support for things most procs do in hardware, as a design idea.

      I look foreward to a reply.

    2. Re:You're missing something by Anonymous+Brave+Guy · · Score: 2, Interesting

      I agree completely: a lot of it is down to the maturity of optimisation technology for the language in question. This is part of the reason that some high level languages -- OCaml, for example -- can generate code of a comparable speed to low-level beasts like C and C++: with a simpler underlying model, it's easier to perform good optimisations. It's also the reason C is still faster than C++ for some things, even though theoretically, C++ should never be slower.

      I was including dynamic optimisation (during the program run) within the "late optimisation" idea, but in practice, I get the impression it's not used much yet. It's far easier to do platform-specific optimisation on installation or loading, effectively, just doing the optimisation phase of a compile late. Effective dynamic optimisation is a very hard thing to do, because you have the overheads of monitoring code speed to overcome before you can even hold your own, never mind gain an advantage. I suspect that in time, dynamically optimising run-times will gain a much stronger foothold in the market, but probably not until a lot more research has been done.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    3. Re:You're missing something by pantherace · · Score: 1
      Might be nice if it were, but I have yet to encounter a non-very-custom project using it, or anything.

      FX!32 would do this as it ran, and would run the apps you used most fastest. I may have to dig out a copy of NT for Alpha to experement with it some.

      I am an alpha-geek! Long live alpha!
      If that was DEC's alpha, I can't wait until the beta!

  80. C/C++ is for pussies by Anonymous Coward · · Score: 0

    Hah! Writing anything in c or c++ is a total waste of time. Instead of getting good coders, you get these hot shit young-uns who think they know everything.

    Dammit, machine language is the only real language - put some hair on yer chest, boy (or gal)!

  81. Free C# IDE - #Develop by ArghBlarg · · Score: 1

    http://www.icsharpcode.net/

    It's still rough around the edges (some parser bugs in the syntax checker) but the team is very responsive to bug reports and suggestions. It's got real potential. And it's GPL, so get in there and help them out!

    --
    ERROR 144 - REBOOT ?
    1. Re:Free C# IDE - #Develop by Anonymous Coward · · Score: 0

      Or you could just use VIM...

  82. ...Sometimes. by Anonymous+Brave+Guy · · Score: 1

    Programmer cycles are much more expensive if your end product runs too slowly to be useful, and nobody buys it.

    Performance still matters in a lot more areas than many people seem to give credit for: scientific apps, graphics, high load server work, firmware and instrument control software, games of course, any smart AI, heavy duty data processing... If performance for other things really no longer matters, why do today's applications somehow run as slowly on 2GHz+ PCs as they did on 200MHz boxes a few years ago? Sure, some of it is feature creep... but not that much.

    When people say things like "performance no longer matters" and "processor cycles are cheap", I get the impression that the pinnacle of their programming expertise is writing UIs for databases.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  83. Flaws by Anonymous Coward · · Score: 0
    I have a few issues with this article. Most center around the lack of info on the java vm settings. (maybe I missed it)

    There is no mention of the memory settings for the java vm. I ran strcat4 with the default heap and saw 40% GC times. When I reran with a sufficient heap, the compiler had a chance to kick in and made a 50% difference. After increasing the eden size, I could avoid GC altogether and the times improved another 20%.

    On the strcat profiling, there is no mention of the number of iterations, hence no way to verify the numbers.

    Java uses StringBuffer, not StringBuilder. (last sentence, page 8)

    In the strswtch example he cites 850K iterations and the java vm exhausts memory. Tell me the vm settings and I might believe you. I have one piece of framework code that does a 58 element switch using a hashmap to map the string to an int and then using that in a switch statement. It runs millions of switches per day and doesn't run out of memory. This approach is 10x faster than using nested if/thens as long as the switch is using consecutive ints.

  84. How about Python? by MikeBabcock · · Score: 2, Insightful

    I know the article is about C#, but every time I read something about C# I think to myself "I can do that in Python". Python is cross-platform, interpreted, object-oriented, fast, easy to extend with C or C++ and even more exciting for some people, usable transparently with Java as Jython.

    I've found that almost all the programs I've written I could've written smaller and better and more obvious (and therefore easier to debug and maintain) with Python. None of those that I have rewritten show any noticeable performance penalty for having done so either.

    Just wondering if you've dealt with it at all yet.

    --
    - Michael T. Babcock (Yes, I blog)
  85. This is getting ridiculous... by FooMasterZero · · Score: 1
    This whole performance argument is getting really really old in my opinion. This is about as bad as the whole GTK vs QT vs visual-c++ vs Java Swing as the best windowing toolkit.

    Clearly this kind of argument continues to promote zealousness amongst ourselves as developers. C# is faster than Java, Java is faster than C#, C is faster than C++ and so forth, when you realize that speed is relative in the computer world, this whole argument becomes moot. In order to avoid a lot of rhetoric that could easily be mentioned here, I regress. I will only say that attention to detail in any programming language yields good results.

    My experience with C# is mostly on an academic level, I have never done anything *practical* in C#. Java and C are my languages of choice, and I have worked with a variety of other languages. Out of all of theese experiences I learned that any language can produce very efficient code for what it is designed for, kind of like why cars don't make very good boats.

    Lastly...
    Java and C# are both 4th generation languages, which means they are generally more disconnected from the CPU's native assembly language, and are generally made from another procedural type language. It is also noteworthy that 4th generation languages are more complex and in terms of mainstream age they are still quite young. Since 4gl are in fact young they should be given a far greater window of evolution to grow and stabilize with. Java is still fairly young and volatile, JDK 1.1.8 was hardly usable by any sense of the word and JDK 1.2 was released in roughly in 1999-2000. C# having the advantage of knowing Java's mistakes will not likely suffer the same roadblocks and stumbles as Java, it could in fact encounter new roadblocks which Java can learn from and viola you have a nice competitive and reasonably fair environment where you have options and choices to do the best job to suit your needs. It is funny that /. users can't seem show this as they are constantly yearning for the much *equality* with MS Windows and possibly Mac OS X.

  86. linux IDE by Anonymous Coward · · Score: 0

    try out Anjuta it has native supprt for the mono project when you want to run your program from within the IDE. www.anjuta.org

  87. Re:#insert by Anonymous Coward · · Score: 0

    Hey, are you coming on to him? :)

  88. Ironies by Anonymous+Brave+Guy · · Score: 1

    The conclusion, as ever, must be that good programmers can do well in any decent language, and bad programmers will shoot themselves in the foot in any language.

    The great irony, of course, is that a big selling point of Java was its ease of use. They took out all the "over-complicated" bits of C++, to make it faster to learn and less prone to programmer errors. If you're going to get the same sort of problems coming up in Java as in C++, you might as well stick to the latter and at least make the power and flexibility available for the good guys...

    (I'm only considering that specific selling point here. Obviously there are other relevant issues to consider when choosing which language to use as well.)

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  89. one annoy thing with C# by Anonymous Coward · · Score: 0

    the default random class does not provide a robust random number generation. This is very easy to test. Generate random number between 1 and 30K for 5K times. The result is repeatable. To get better random number generation, you have to use a win32 native library or something else. This would indicate a pure C# library for encryption would be weak and is easily compromised.

  90. Old School C++ Programmers by mrcparker · · Score: 2, Funny

    You mean all the way back 1994-95 era computing? sheesh. You work in a museum.

  91. Re:#insert by pyrrhonist · · Score: 2, Interesting
    Today, they're used not only to create generic containers (for which they are, no doubt, very useful) but also, via metaprogramming techniques, as the tool underlying most of the really powerful developments in C++ for the past few years: expression templates, high performance maths libraries, etc.

    Translation: Today they are used to butcher a perfectly fine language and add new impediments to understanding.

    --
    Show me on the doll where his noodly appendage touched you.
  92. why i'm learning c++ instead of java by nester · · Score: 1

    i have been looking into learning c++ or java (i've known c for about 5 years). the unclutteredness (from what i've gathered) of java had me leaning towards it.

    until i tried it.

    i have a dual 833 alpha, and even compaq's 1.3.1 jdk makes it run like a 386. part of this is compaq's fault (my 333mhz ultra5 running solaris runs netbeans faster - and compaq's jvm is buggy). the other part is inherent (no pun intended ;) with java. java apps are only as portible as the jvm is ported. netbeans is unusable on my alpha (running linux, btw). i tried kaffe, but it's even slower - it only uses one thread per java app!

    my other problem, of course, is hp's ignoring linux/alpha. there is no (and i doubt will ever be) a 1.4.1 jvm. not that i blame them a whole lot, since alpha is dieing.

    back to c++. it's more portable than java(!) and way faster on alpha. not to mention, java seems to be adding more and more c++ features.

    to conclude, java may be more ideal than c++, but at least c++ is usable! java has had plenty of time to mature, and is disappointing (at least to me). i doubt .net/mono will be much different.

  93. Every Good Boy Does Fine by Anonymous Coward · · Score: 0
    and FACE... thats all I can really comment on. Oh yeah, it is amazing how unmusical a plastic Recorder sounds especially when coming out of a gaggle of 8 year olds.

    Parents, just as you would ensure you children learn the best programming language to master the cyber-universe in, please don't stoop to nightmarish "musical instruments." If you aren't going to use modern instruments, then by all means teach the kids the classical ones. (shoot, just go to a Scottish Festival and load up on the various goodies there)

  94. aw, crap - jump to conclusions audio : ( by Sean+Clifford · · Score: 1
    Talk about irony - sorry I shoulda better known better to link straight to the friggin' files...which are all nice and warbly when you save them.

    20 min of googling for replacements to no avail

    well, 10 min of googling, 1 second of pre-ordering TTT:Special Edition, and 9:59 of wandering off into something totally unrelated, then absently realizing I was in the middle of submitting a post.

  95. ok by zymano · · Score: 0

    if you were game developer , would java swing be your language. NO. For you and your science program, it fits. Got to disagree with you on swing though.

    1. Re:ok by cbreaker · · Score: 1

      If you were a game developer?

      Someday we could. I'd like to see someone put in a real effort to make a modern Java game. I bet it wouldn't run as shitty as you think.

      Even still, my point remains.. the performance hit will become less and less of a factor with each new shiney processor release.

      --
      - It's not the Macs I hate. It's Digg users. -
    2. Re:ok by zymano · · Score: 0

      so a new computer every 2 years ?

    3. Re:ok by cbreaker · · Score: 1

      If you want to run all those shiney new games and stuff, then two years doesn't sound too unresonable to me. You can always give your old PC to someone else with none or a 4 year old one =)

      Or, get a system you can easily upgrade.

      I dunno. A decent computer these days isn't very expensive. You wouldn't have to replace the monitor or keyboard or mouse.

      --
      - It's not the Macs I hate. It's Digg users. -
  96. Re:Competition is important. Whats really needed. by zymano · · Score: 0
    Not for gaming.

    Yes , i used java on a Pentium 5 2.6 ghz and it was good.

    But startup was not.

    And why does java have to be used and nothing else. A programming language for each problem ? !

  97. Re:Fsirt Psot? by HarryCallahan · · Score: 1

    Not eevn colse

  98. Yes! (And No...) by NotQuiteReal · · Score: 1
    Yes - C# rocks, for writing Windows programs.

    No, it is not the be-all end-all of programming languages.

    There are none of those. They ALL suck.

    I have been a well paid programmer (yes, even in today's economy) for 20+ years. I have used VMS, DOS, Windows whatever, Macs, and various real-time OS's as platforms. I have used BASIC, Z80, i860, FORTRAN, ALGOL, C, C++, C#, VB, and countless scripting languages (including the write-only language known as Perl).

    They all suck, and I like it that way. I get paid more because of it.

    If your PHB could just ask the computer do do what he wanted, I would be out of a job.

    Bottom line: Different languages for different tasks. If I want to write a nice windows app, quick (and know the end user has the 20MB download for the environment) I'd not hesitate to use C# today. If I want a nice, small statically linked exe - you don't pick C#.

    --
    This issue is a bit more complicated than you think.
  99. Re:And both generics and templates are kiddy toys. by Anonymous Coward · · Score: 0

    Yep. Although several other functional languages also have good macro facilities.

    C++ templates are actually pretty useful; they're just incredibly hard to read.

    Java generics are junk, to be honest -- they don't even optimize out the typecast. Basically just syntactic sugar.

  100. Windows Developer Website by codepunk · · Score: 0, Flamebait

    Why would create a free account on the Windows Developer Website. Hell you can get the same effect by visiting the goatse.cx website.

    --


    Got Code?
  101. Since you aske for that feature ... by Lucas+Membrane · · Score: 1
    Where is that capability? Why aren't compilers smarter?

    Actually, Modula-3 has been doing that for years.

  102. Oracle by Un+pobre+guey · · Score: 3, Interesting
    So, with no loss of portability or functionality, you could do the same in C/C++.

    Try this:

    Write a backend app in Java, and one with the same functionality in C or C++. Make sure they both read and write data to an Oracle database. Now, with stopwatch in hand, make them both run on Win2K, Cygwin, Solaris, and Linux.

    Guess which language will allow you to finish first.

    1. Re:Oracle by TheRaven64 · · Score: 1
      Why not start the stopwatch before you start coding, and stop it after you finish debugging. I can happily knock out a few hundered lines of Java code containing no bugs other than typos (which the compiler catches.) The same amount of code in C++ would have several hard to track down bugs (usually caused by the fact that libraries seem to not have any idea when to use pointers, and when to use references. Please, just use one.) Personally I consider my time to be more valuable than my computer's time, so I would choose Java (except in some cases when Java really isn't suitable, but for most of them I would choose C over C++ anyway).

      Of course, if you write better C++ code than Java code, then C++ is probably the better language for you.

      --
      I am TheRaven on Soylent News
  103. C# IS compiled by HarryCallahan · · Score: 1

    It is compiled Just In Time by the JIT compiler i.e. at runtime. Once an assembly has been compiled the machine code will stay cached and that is what will be called subsequently. Code will run slow the first time it is used after that it should be just as quick as a C++ binary. The reason the IL (intermediate language) is distributed is for portability i.e. a Linux .Net CLR (as if) will run the same IL as can run on Windows. C# is not interpreted like the old days, it IS compiled, just only at runtime.

  104. why then isnt GENOME 100% in hava and 500x smaller by cheekyboy · · Score: 1

    Tell me that dude

    if java/c# is so great, why isnt there one VM running that handles the whole genome desktop with all its apps.

    we could then have a 20meg genome install :)

    oh and you wont see j2me on pocketpcs

    --
    Liberty freedom are no1, not dicks in suits.
  105. Re:#insert by Anonymous Coward · · Score: 2, Interesting

    Correction: generics are unglorified macros. Templates are glorified macros. Templates can add type safety at compile time with no runtime penalty. Generics macro expand their type safety into java casts, which incur a decent runtime penalty (especially for large container intensive algorithms).

    Additionally, I once saw someone (saurik from saurik.com) use templates to do dynamic programming at compile time. He wrote an exponentially increasing algorithm to have an exponentially increasing compile time but constant run time when an arbitrary limiting value n was increased. Not actually useful, but still really damn clever and it illustrates the versatility of templates for meta-programming. And more importantly, I am pretty sure the same program is illegal for generics.

  106. Free .NET development environment by xD3Wolfx · · Score: 1

    There's a firly good one out there... it doesn't compare to VS.Net 2003, but it serves its purpose, called SharpDevelop. Here's their homepage: http://www.icsharpcode.net/OpenSource/SD/Default.a spx Hope that helps.

  107. A short note on C portability by SuperKendall · · Score: 1

    As someone who once did extensive work on a system that ran across nine different UNIX flavors AND both VMS's AND MPE (HP300), let me tell you that C "portability" is almost a complete myth - yes you can compile it everywhere but you are going to have a lot of ifdefs to maintain. Just look at any project of real size, like GnuMake or GnuEmacs. You always end up with some annoying architecture specific code.

    I've done work in Java for a number of years and it offers very real portability much better than C or C++. I can develop on NT or my Mac and then deploy the same compiled code on UNIX without a hitch. I can also run GUI apps across platforms and they work, more or less (though there the portability starts to falter).

    To make a long story short, the very worst problems of platform portability in Java are like a pleasant dream compared to the darkest dilemmas of the C programmer.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  108. "Effective Java"=oxymoron; It's all C in the end by xeo_at_thermopylae · · Score: 1
    The book concentrates on how to make up for the poor language design of Java, e.g., how to speed up string concatenation et al, work that is unnecessary if you use a well-designed language.

    C# is nothing to write home about: I don't believe any benchmarks that show it running alongside C++. OTOH C++ is a notoriously bad design-time language, so while the C++ developer is writing code, the Java developer is testing the final product.

    C#, C++ and Java are all 3rd-generation languages no better than C. Until the vendors step up to the plate and deliver something similar to the old "4th-generation" languages, productivity will be in the basement. If I were an optimist, I might believe that this is the chance for the old "5th-generation" languages to enjoy a revival.

  109. Some (at least one) games use Java for AI by SuperKendall · · Score: 1

    I forget which game exactly, but one major game at least (overhead forced perspective 3D) action game dealing with vampires used Java for the AI portions of the game, and seemed to have no problems.

    I think there might be at least one other, but I can't remember anything more specific.

    There's more than just a 3D engine to a game, you know (unless you are ID :-) ) - and Java can help out for those parts.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  110. Prolog kicks ass! by xeo_at_thermopylae · · Score: 1
    Am I the only MoFo who thinks that Prolog rules? While everyone else is writing code to solve the problem, I'm finished as soon as I've written Prolog code that defines the problem. Who cares about CPU and memory: BillG has promised us an infinity of both. I'm gonna take him at his word and leave his development tools in the dust.

    I love my Prolog!8-))

    1. Re:Prolog kicks ass! by Anonymous Coward · · Score: 0

      Define me a distributed transaction, bitch.

      That shut you up.

    2. Re:Prolog kicks ass! by xeo_at_thermopylae · · Score: 1
      Distributed transactions are not language-dependent; I can do them in C#, Java, Prolog, or whatever. But for some Prolog-specific distributed processing, see BinProlog's Agents and blackboards for more sophisticated processing than is available in other languages.

      I don't know WTF you were thinking, but am certain it was wrong.

  111. Re:And both generics and templates are kiddy toys. by Waffle+Iron · · Score: 1

    (define (lisp-fanatic? username body sig)
    (and (map (lambda (text) (string-index text "lisp")) (list username body sig))))

  112. Ignorant Idiot by Anonymous Coward · · Score: 0

    Why be stupid in public? Oh, you linux fatties...

  113. The Tao of Programing by kfg · · Score: 1

    Book 1: The Silent Void

    1.2

    The Tao gave birth to machine language. Machine language gave birth to the assembler.

    The assembler gave birth to the compiler. Now there are ten thousand languages.

    Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao.

    But do not program in COBOL if you can avoid it.

    KFG

  114. jar shrinker by Admiral+Burrito · · Score: 1

    For Java, there is ProGuard, which can shrink and obfuscate a jar (or just shrink, or just obfuscate). The shrinking works by stripping out classes and members that are not referenced (directly or indirectly) by the entry point (main()). Obfuscation also shrinks things further, by shortening symbol names.

    There are others, but ProGuard looks like the best free one.

    I don't think this really saves memory though, it just results in a smaller .jar file. The Java classloader does not load the whole multi-megabyte runtime into memory all at once, it loads and initializes classes as they are referenced. Unused classes are neither loaded nor initialized.

  115. blitz++ by pyrrho · · Score: 1

    IOW, go read how blitz++ works and hang your head in shame that you said Java generics are up to matching C++ templates.

    --

    -pyrrho

  116. Re:#insert by pyrrho · · Score: 3, Interesting

    I posted this already... go see how blitz++ works.

    It doesn't make the language butchered in the least, quite the opposite, the end result is very clear to use and the confusing part is hidden inside the classes, where it cannot cause trouble.

    the thing about C++ is, sometimes things are hard, but the reason you do them anyway is because they are worth it, and you can get high levels of abstraction (arbitrarilly high) without taking runtime hits. You have the ability to control your overhead, templates are a great example, especially the examples the parent poster mentions, expression templates, and high performance math libraries.

    Blitz++ uses templates in an elegant, mind blowingly cool way. It might not be clear how it works to many, but that doesn't change how it works. Truly beautiful. And it makes the code easier to read, not harder.

    --

    -pyrrho

  117. Try fltk by Anonymous Coward · · Score: 0

    Try fltk

  118. OT: ancient philosphy by pyrrho · · Score: 0, Offtopic

    pyrrhonist, as in The Outlines of Pyrrhonism?

    --

    -pyrrho

    1. Re:OT: ancient philosphy by pyrrhonist · · Score: 0, Offtopic
      pyrrhonist, as in The Outlines of Pyrrhonism?

      You got it, dood.

      --
      Show me on the doll where his noodly appendage touched you.
  119. Don't forget power user bias by mattgreen · · Score: 1

    Say you have two apps in a crowded app category.

    One is written in C and is hacky, memory leaky code.
    Another is written in C# and is garbage collected and cleaner to read. For argument lets also suppose this one has a few more features.

    Now, if they are both free, then one thinks the superior product wins.

    Actually, not always. Since one app is managed code, it by definition has less control over how memory is allocated. All it takes is *one* "power" user who notices that the managed app has a working set size of 28,000K, and they immediately post "OMG SO BLOATED!!!!!!" on some bulletin board. Misinformation like this tends to spread like wildfire, and soon you have joeuser298182131 on slashdot saying "no way would i ever use that memory chugging program" and being modded up informative.

    Differences with how memory is treated in managed code will not be easy to train to the power user group, which prides themselves on their knowledge of computers but can be resistant to changes like this. Remember when ACPI first came out? We were told that "IRQ SHARING IS VERY BAD!" Now no one even thinks about it.

    In time our metrics for 'good' programs will change. Personally I think that even many unmanaged programs use up way too much memory for what they do.

  120. Not quite what I meant by Spinality · · Score: 1

    A couple of these replies suggest that my original point was that good programming is sitting around writing hand-optimized assembler. Not at all. I totally agree that a great choice of priorities is to focus on excellent compiler design. I totally agree that no developer should have to worry about which instruction is faster -- other than the compiler writer, or somebody working very close to the hardware. No arguments. I always liked the famous comment by (I think) Alan Kay: "An operating system is what the language designers left out of the compiler. There shouldn't be one." Or words to that effect.

    My point was that we spend too little time on high-quality software. Some individuals do, but as a field we sadly do not. Well, actually 'sadly' isn't right. Your comment about moving targets, priorities, and where to spend your budgets is quite correct -- it's not wrong to rely on faster hardware to fix our software problems. If we have the cubic inches, we should use them, for sure. But the price we pay for poor quality is in the thousands of security holes, endless Windows service packs, nonorthogonal languages, cheesy user interfaces, missing features, poorly-thought-out feature sets. No time to do it right, must get it out the door.

    Back to compilers -- there are indeed some decent compilers being written today, but I think most of the interesting strides in compiler algorithms were made 30 years ago. I think that our whole approach to language and compiler design stagnated, and perhaps regressed, for a couple of decades. Or how about data management! How many applications are built today by folks with no clue about how to normalize relational tables, nor any understanding of the mechanics of a database? Most of the data structures I see in production use today are crying out for help -- for skills that used to be much more common among practitioners. We've dummed-down our methods to a lower common denominator.

    My feeling is that the overall direction of software practice has been coopted by a quick-and-dirty mindset that discourages us from investing in good architectures, good designs, good documentation, good test plans...good engineering.

    There are plenty of exceptions, of course. But back to my original point: when hardware stops being so cheap (i.e. when the rate of improvement drops) we'll again have a reason to focus on building smarter software. And we will.

    --
    -- We all have enough strength to endure the misfortunes of other people. La Rochefoucauld
  121. Good programmers are good in any language by Anonymous Coward · · Score: 0

    Your story about good C++ programmers being shitty Java programmers is complete crap. They must have sucked at any language they used. Any good C++ programmer WILL BE a good Java programmer. Why? Because C++ is a fucking difficult language. If you can master that, then you can take on any language - especially one as simple as Java. Save your bullshit for your boyfriend.

  122. EBay and J2EE (Was:jump off the bandwagon) by Anonymous Coward · · Score: 0

    EBay moves from a 3.3 million line C++ ISAPI DLL to Java, and now handle a billion transactions a day. YMMV.
    http://servlet.java.sun.com/javaone/resourc es/cont ent/sf2003/conf/sessions/pdfs/3264.pdf
    http://ser vlet.java.sun.com/javaone/sf2003/conf/se ssions/display-3264.en.jsp

    Other case studies:
    http://www.artima.com/weblogs/viewpost.j sp?thread= 8142

    Rick DeBay

    1. Re:EBay and J2EE (Was:jump off the bandwagon) by Anonymous Coward · · Score: 0

      Running ISAPI DLLs through IIS is godawful, flaming hell slow. A performance boost from switching to servlets isn't much of a bragging point.

  123. The hell? by Anonymous Coward · · Score: 0

    You must not understand C++ templates very well, or you'd never compare them to Java generics.

    The only thing the two have even remotely in common is their abstraction properties, which still aren't all that similar. Generics provide abstraction for abstraction's sake, maintaining it all the way through runtime where it causes a performance penalty. The only thing generics do is correct a casting problem inherent to Java, and at a runtime cost to boot.

  124. eBay is running on Java by Anonymous Coward · · Score: 0

    75% of eBay is J2EE code. They started off on .Net and were highlighted by MS. But mid transision they ran into a brick wall of .net promisses != features... Anyway they started over with J2EE but used a compatible infrustructure so when you access the web site you get portions of the old C++ code and portions of the new J2EE code. They talk about huge improvements in scalability, features and performance.

    1. Re:eBay is running on Java by Anonymous Coward · · Score: 0

      eBay never used dotNet. The rewrite was all J2EE, as MS was one of the losers in the bid competition.

      Rick

      http://www.baselinemag.com/article2/0,3959,65906 0, 00.asp

  125. Server side code isn't portable by Anonymous Coward · · Score: 0

    You obviously only programmed "simple servers" transaction management (not simple DB transactions), threads, communications protocols (even TCP/IP, winsock...) are not easy to port. The advantage of J2EE is also portability between application servers that ofer features you probably can't even imagine if these are the things you claim.

  126. Thats a lie, Java runs more languages by Anonymous Coward · · Score: 0

    .Net supports 20 languages on top of the CLR and the JVM supports over 60 (such as REXX, Python, Basic, JavaScript etc...).
    You fell for marketing hype, MS emphasized this ability which is not truely different since their VM is very much fitted for C# and didn't fit VB at all so it had to be changed in huge incompatible ways since VB.Net is nothing like VB.

  127. The adoption of C# by the industry cannot be said to be a good thing. Developers, who mostly program for Windows, may not mind it. However, from a computer industry point of view, it isn't so good. Will C# ever take off on Linux or Mac or whatever? Nope.

    Sivaram Velauthapillai

    --
    Sivaram Velauthapillai
    Seeking the meaning of life... @slashdot of all places ;)
  128. Re:#insert by pyrrhonist · · Score: 1
    It doesn't make the language butchered in the least, quite the opposite, the end result is very clear to use and the confusing part is hidden inside the classes, where it cannot cause trouble.

    I just posted my comment, because some people really revile metaprogramming techniques. It was a bad joke.

    Blitz++ uses templates in an elegant, mind blowingly cool way.

    That's what scares the crap out of me. ;) I've got it bookmarked now, so I'll check it out.

    It might not be clear how it works to many, but that doesn't change how it works. Truly beautiful. And it makes the code easier to read, not harder.

    Hopefully better then the way ACE uses them. Man, that thing was a pain to debug. It also took several hours to build on a Sparc with the Sun compiler because of the templates, AND I had to add swap. Sheesh.

    --
    Show me on the doll where his noodly appendage touched you.
  129. Bad Kool-Aid. by rjh · · Score: 4, Interesting

    Currently there are C#, C++, VB, and even Java

    If I understand the .NET framework correctly, there is no way to support either multiple inheritance or templates--in which case C++ cannot be accurately modeled in .NET. Nor will Java be .NETtable after 1.5, which will introduce pale imitations of templates (but imitation enough to give the CLR a hissyfit).

    The .NET CLR does not support multiple languages. It supports one language--C#. Its "multiple language support" comes from being able to compile down many functionally-identical languages with different syntaxes down to the same bytecodes.

    But truly different languages are not representable in the CLR. Show me how to do a Scheme continuation in the CLR, please, or export a C++ template, or a LISP macro.

    The only languages .NET supports are those which are subsets of C#. And once you realize that, .NET becomes much less interesting.

    (Warning: haven't used .NET much in the last few months. Last I checked these things were true, but after being very unimpressed with .NET I haven't kept up with things.)

    1. Re:Bad Kool-Aid. by Bazouel · · Score: 1

      You said you haven't checked .Net in the last few months. I would in the last year ...

      Have at least a look at those :

      SmallTalk (S#)

      Fortran (F#)

      Also, templates ARE supported in managed C++. It's just butt ugly as if it wasn't already enough with templates ...

      --
      Intelligence shared is intelligence squared.
    2. Re:Bad Kool-Aid. by CodeBuster · · Score: 1

      Clearly, you do not understand the .Net framework correctly. The Common Language Runtime was designed in such a way that all the expected features from any assembly language are either directly supported or an equivalent combination of CLR instructions exists which implements them. Thus, since scheme, C++, and Java all run on current systems they can be run under CLR too. The idea of using a common assembly language with virtual machine is a proven concept and has been shown to work well on cross platform applications (Java anyone) and Microsoft even wrote a compiler which compiles java byte codes into CLR byte codes. Likewise with Scheme and other LISP languages...if they can run on Intel, Sun, or other chips in assembly then they can run under CLR because CLR is a full assembly language with Virtual Machine.

      Back to the C++ argument...how often do you use multiple inheritance and can you name one circumstance where multiple inheritance is either:

      1) Absolutely necessary OR

      2) Is worth the time to debug because your multiple inheritances is causing some weird run-time error which has already wasted several hours of your time which could have been used to write the same code without using multiple inheritance.

      And don't pull out the template argument. Templates were vastly overrated in terms of value and the common object hierarchy provided by Java and .Net combined with the dynamic link library (DLL) concept renders the whole template issue a moot point. How many times (and be honest) did you find yourself tweaking your templates each time you re-used them when they were supposed to be "write-once". C++ was never a write once use anywhere type of language whether you used templates or not. I suggest that you take a second look at .Net and CLR, there is more there than you might think.

    3. Re:Bad Kool-Aid. by Keeper · · Score: 3, Informative

      If I understand the .NET framework correctly, there is no way to support either multiple inheritance or templates--in which case C++ cannot be accurately modeled in .NET. Nor will Java be .NETtable after 1.5, which will introduce pale imitations of templates (but imitation enough to give the CLR a hissyfit).

      The next version of .Net (2.0) is supposed to introduce native template support to IL. Not sure about multiple inheritance, but I doubt it.

      The .NET CLR does not support multiple languages. It supports one language--C#. Its "multiple language support" comes from being able to compile down many functionally-identical languages with different syntaxes down to the same bytecodes.

      If you want to get technical, the CLR supports IL (implementation language), which is interpreted by the virtual machine. The virtual machine has a set of instructions it understands, and the various .Net compilers compile to those set of instructions. This isn't very different from taking a C++ program and building an executable that consists of instructions for an x86 cpu. The machine (virtual or not) provides the facilities for performing the operations you want to do.

      If you can represent what you want to do in IL, you can write a compiler for it. There's some guy out there who wrote an 386 asm->IL compiler (why? because he could I guess...) for example. Not that I think it's a terribly great idea, but it is neat.

      But truly different languages are not representable in the CLR. Show me how to do a Scheme continuation in the CLR, please, or export a C++ template, or a LISP macro.

      IL doesn't have special instructions designed to support those things, but they can be done; they just won't be necessarily be done fast or efficently; for instance, you could do C++ templates the way your average C++ compiler does them --> your compiled code has a unique object for each templated type required. And I can pretty much guarantee you that you could write a Scheme or LISP compiler -- it'd just be a pain in the ass to do (which I'd imagine any proper LISP compiler would be), and it wouldn't be wicked fast.

      The only languages .NET supports are those which are subsets of C#. And once you realize that, .NET becomes much less interesting.

      A more accurate statement would be that IL supports object oriented / functional languages very well, and other things not so well.

      Most commonly used programming languages are OOP or functional in nature. I haven't used a non object oriented language since I got out of college. Perl, C, C++, Java, Basic, Fortran, Pascal, Python, Cobol, Smalltalk, various shell languages, etc. are all either functional or object oriented languages.

      I'd argue that implementing optimal support in a form that most languages translate well to (as opposed to a form that rarely used languages translate well to) was a good design decision.

      The power of this allows you to write code to get what you want done, instead of spending a lot of time writing code to get a round peg to fit in a square hole. There are many other peripheral benefits that .Net brings to the table, and I personally think this isn't one of the big ones -- I think it's more of a "cool" factor than anything else -- but dismissing it outright because the design doesn't perfectly suite some obscure language that is generally used by AI researchers is kind of silly in my opinion.

    4. Re:Bad Kool-Aid. by mrdlinux · · Score: 2, Informative

      I don't know why the OP mentioned Lisp macros, because they certainly have nothing to do with the backend of a Lisp compiler. However, problems still do exist with compiling to IL, mostly focusing around calling-conventions and potential limitations instituted by the CLR.

      For example, Common Lisp has advanced object-oriented features such as multiple-dispatch methods and method combination, and this would most have a large conceptual mismatch with the typical calling conventions used by languages in IL, hence the CL compiler would need to use its own calling conventions and would be incompatible with other languages (thus defeating the point of IL).

      Same goes for memory layout, stack management, etc... all due to Common Lisp's advanced data types and capabilities such as multiple-inheritance, CHANGE-CLASS, resumable conditions...

      As far as I know, all real Common Lisp compilers that support Windows have not yet made any serious steps towards adding an IL backend, since there is very little benefit to be gained until those issues can somehow be worked out. Franz, in particular, put out a list of roadblocks a few years ago, but I do not know what became of it.

      Scheme, on the other hand, has call/cc which requires heap-allocated stacks. This has been a sticking point with Scheme on JVM; the Schemes there simply do not support the full call/cc as a result. JVM is very limited with what the call-stack can do, for "security" reasons. I imagine CLR has similar issues, unless someone clever found a way around it.

      In general, the problem of an ideal "Universal Intermediate Representation" for all languages, so that only one backend is needed per platform, has been extensively studied for probably 30 years and I do believe the conclusion so far is: it's not possible.

      I highly doubt that Microsoft has beat out academia in this regard.

      As for your other statement regarding various languages and their supported paradigms, I would like to clarify something:

      C, Basic, Pascal, Fortran, and Cobol are not regarded as functional nor object-oriented languages. I highly recommend you consult the definitions of said terms. In addition, I would not count the following as object-oriented languages, in an ideal world: C++ and Java, due to their mostly static (and pain-in-the-ass) nature.

      (Hint: functional language means higher order functions and closures)

      --
      Those who do not know the past are doomed to reimplement it, poorly.
    5. Re:Bad Kool-Aid. by mrdlinux · · Score: 1

      Many languages run on existing hardware, but can they easily call each others' functions and share each others' objects/data? I understand that CLR attempts to make this work, but that is a very hard problem when the languages in question have a large conceptual mismatch.

      --
      Those who do not know the past are doomed to reimplement it, poorly.
    6. Re:Bad Kool-Aid. by Kryptoff · · Score: 1

      Please take a look at Eiffel ENViSioN! if you're looking for templates (called generics in Eiffel and Ada, and more appropriately so IMHO) and multiple inheritance in .NET.

      Also interesting is the new F# language from MS that is an implementation of (the functional language) CAML for .NET.

    7. Re:Bad Kool-Aid. by Keeper · · Score: 1

      C, Basic, Pascal, Fortran, and Cobol are not regarded as functional nor object-oriented languages. I highly recommend you consult the definitions of said terms. In addition, I would not count the following as object-oriented languages, in an ideal world: C++ and Java, due to their mostly static (and pain-in-the-ass) nature.

      I didn't state that the languages mentioned were purely functional or purely object based. But they are functional (your program is based around functions) and/or object oriented (your program is based around objects).

      The distinction you are making is academic. While it may be an important distinction to you, it isn't to me. But then again, I get the distinct impression that your work regarding computers is purely academic in nature (where such things are important) while mine is in industry (where such things aren't).

      In general, the problem of an ideal "Universal Intermediate Representation" for all languages, so that only one backend is needed per platform, has been extensively studied for probably 30 years and I do believe the conclusion so far is: it's not possible.

      I highly doubt that Microsoft has beat out academia in this regard.


      I never stated that Microsoft came up with a universal backend. I did state that they came up with a backend that accurately models languages commonly in use, and such a backend would probably work for languages that don't fit that model well, albiet poorly (I probably should append that with "and a crapload of work").

    8. Re:Bad Kool-Aid. by gglaze · · Score: 3, Interesting

      How can this comment be (+5 Interesting) while each of the subsequent comments are 1's and 2's? When I first read this, I almost jumped to write a diatribe, and found that the other replies had already covered most of the important points very nicely. This comment should be marked (-1 : Ill-Informed) or some such rating, as it is highly misleading to anyone on /. who might be trying to learn about .NET.

      As the others have mentioned here, the CLR is an abstraction of the assembly instruction layer, not the "object-oriented" layer. Thus, a statement such as "CLR does not support {select archaic c++ OO concept}" does not make any sense. This obviously applies for things like multiple inheritance, templates, etc.

      Furthermore, the idea that the CLR "does not support multiple languages" is the most ridiculously malinformed statement I have ever heard about .NET, and trust me, I've heard plenty. One of the major objectives, if not the most important, is to bring to prime-time quality Microsoft's idea of supporting many languages on the same framework. They started this idea a long time ago with COM, and as it evolved, they realized all of the flaws in the COM architecture, and .NET is the next generation of multi-language support, in that sense. .NET currently supports what, like 20+ languages? Not all of them developed by MS, btw... Many of these languages use different paradigms (scripting-oriented, functional-oriented, procedural, etc.), and they all have access to the full breadth of the .NET framework. If that's not "multi-language support", I don't know what is.

      To assume that languages supported by .NET are "subsets of C#" is either naive or very malinformed. Anyone who knows the history of this knows that VB has always been Microsoft's baby, and C# is just the new kid on the block. Yes, now that C# has realized its potential, perhaps it is overtaking VB in popularity. But to claim that VB provides a "subset" of C#'s functionality is precisely backwards - in fact it is literally backwards - if anything, C# provides for the most part a subset of VB functionality, although technically the two provide somewhat intersecting but not fully overlapping sets of functionality - there are some things you can do in VB that you can't do in C#, and there are some you can do in C# that you can't do in VB. And the same goes for all languages on the .NET platform.

      Features like templates and multiple inheritance are first and foremost a feature of a language at the OO-level of abstraction - not the assembly level. As one poster noted here, Eiffel is a good example of a .NET language which already supports these concepts. If you wan't to complain that C# doesn't support them, that's ok. But to complain that "CLR doesn't support them" really doesn't make sense. Get your argument straight first.

    9. Re:Bad Kool-Aid. by AndyS · · Score: 1

      The template stuff in 1.5 is bytecode compatible with 1.3 to my understanding. The generated code sticks casts in behind your back.

      Obviously, for the point of optimisation and compilation, you can still extract whether a type supports generics (there's a Signature attribute added to methods and fields), but it shouldn't cause .NET any problems.

    10. Re:Bad Kool-Aid. by sosume · · Score: 0

      According to microsoft, they have *never* *ever* needed multiple inheritance for a commercial software product(read in msdn). And they probably never will.

      The .NET clr supports C++ (mixed native/managed), perl, eiffel, pascal, jscript, c#, vb, and more. These languages all have their own paradigms.

      Just because the parent poster has programmed a whopping 30.000 lines in his life (I do that in a month or so) doesn't mean he's all-seeing and all-knowing. Java sucks big time. (to me). Ever tried mixing Java with, for example, php or perl? Or, calling java from c++ or .NET?

    11. Re:Bad Kool-Aid. by hey! · · Score: 1

      Nor will Java be .NETtable after 1.5, which will introduce pale imitations of templates (but imitation enough to give the CLR a hissyfit).

      This doesn't make sense. Templates are pretty much just type definition macros. I suppose you could implement them in a way that would give CLR a hissyfit, but why would you?

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    12. Re:Bad Kool-Aid. by Anonymous Coward · · Score: 0

      If you're talking about ActivePerl, then I wouldn't really say that's using the CLR. It's comparable to ActiveState's PerlApp program, which generates a glorified self-extracting archive with the perl interpreter DLL (native code) and perl bytecodes. The .NET version simply has an IL wrapper which extracts the aforementioned and hooks into the (still native-code) interpreter whenever a method is called on the exposed interface.

      Aside from Eiffel, the other languages you mention aren't very different in structure to C#, which is to my knowledge the only Microsoft-supplied language which generates assemblies which don't require a runtime library. (JScript is a special case, and from what I can tell uses similar mechanisms to the Perl wrappers, albeit with an interpreter compiled to IL rather than native code)

    13. Re:Bad Kool-Aid. by ChannelX · · Score: 1
      if anything, C# provides for the most part a subset of VB functionality, although technically the two provide somewhat intersecting but not fully overlapping sets of functionality - there are some things you can do in VB that you can't do in C#, and there are some you can do in C# that you can't do in VB. And the same goes for all languages on the .NET platform.

      And this is part of the problem isn't it? First off: I don't use .NET. I am only talking about what I've read about it. But in the C# books I've read there are limitations on just how "interfunctional" languages on .NET can be. There are definitely limitations you have to work around when using/developing objects in different languages in .NET if you want them available by all others. This seems to be missing from the .NET spin I see from MS or others (big surprise right?). I don't necessarily think its a problem...just that its not mentioned much.

      --
      My blog: http://jkratz.dyndns.org/~jason/blog/
    14. Re:Bad Kool-Aid. by Malc · · Score: 1

      "If I understand the .NET framework correctly, there is no way to support either multiple inheritance or templates--in which case C++ cannot be accurately modeled in .NET. "

      x86 assemply doesn't support multiple inheritance or templates either. What's your point? It's up to the compiler to generate the correct code for the target platform.

      "The .NET CLR does not support multiple languages. It supports one language--C#. Its "multiple language support" comes from being able to compile down many functionally-identical languages with different syntaxes down to the same bytecodes."

      That's odd, I've used multiple languages with .NET. C# gets compiled down just like all those other languages. VB.NET certainly isn't functionally identical to C#, or numerous other languages that have .NET compilers. I don't think you know what you're talking about. .NET assemblies don't get distributed in C#, but in a compiled form. Go and read any basic intro the platform.

      How you got modded +5 Interesting I don't know. The moderators are probably as clueless as you. Par for the course here on /. - everybody feels the need to criticise MSFT products, but few of them actually have any real knowledge about them.

    15. Re:Bad Kool-Aid. by lor3 · · Score: 1

      This is completely wrong, why the +5 score? Managed C++ does have multiple inheritance.

    16. Re:Bad Kool-Aid. by Anonymous Coward · · Score: 0
      the parent poster has programmed a whopping 30.000 lines in his life (I do that in a month or so)

      yep

    17. Re:Bad Kool-Aid. by adrizk · · Score: 2, Informative


      Most commonly used programming languages are OOP or functional in nature. I haven't used a non object oriented language since I got out of college. Perl, C, C++, Java, Basic, Fortran, Pascal, Python, Cobol, Smalltalk, various shell languages, etc. are all either functional or object oriented languages


      Imperative, they're imperative or OOP, not functional. Functional languages are languages exactly like LISP or Scheme. You construct a C program out of a bunch of statements, not a bunch of functions.

    18. Re:Bad Kool-Aid. by hobo2k · · Score: 1

      Really. I haven't had any problems with C++ features in C++.net. It can be a pain marshalling between the managed and unmanaged code. But I don't feal like I'm working with a subset of regular C++.

    19. Re:Bad Kool-Aid. by toriver · · Score: 1

      Fortran (F#)

      Did you read the link you posted? The F isn't Fortran, but Functional - it's an ML/CAML implementation that doesn't even support all of CLS.

    20. Re:Bad Kool-Aid. by gglaze · · Score: 1

      I wouldn't really classify it as a problem of .NET. Obviously, if you have "objects" which are built to be accessible by an object-oriented language, you are going to have challenges in integrating those concepts with a language that operates on a different paradigm, such as functional (Scheme) or procedural (Fortran), etc. However, these are problems which are inherent in the gaps between different language paradigms, and are not a product of .NET or any other cross-language framework. In any case, the more relevant point is that these challenges clearly have little to do with the CLR, which is an abstraction of the assembly layer, not the OO-layer or whatever other paradigm-specific layer you have. Since assembly is built on top of the machine layer, presumably there is no paradigm which is "better" or "worse" suited to that layer. Of course some languages can give you more or less access to such low-level instructions, but that clearly is nothing new in the programming world.

      The ".NET spin" is not saying that all languages now become interoperable at the OO-level - clearly not, because not all languages on .NET are OO languages. .NET is about providing a common assembly instruction layer for cross-language development, not just an OO layer (although there is that too, for languages which will utilize it). If the point is that .NET prefers OO languages, I would certainly agree, but let's be clear on terminology then - let's not say "just C#" or whatever - VB.Net, C#, J#, C++, etc. all have approximately the same level of support and functionality in .NET, with certain language-specific advantages for each. Those advantages are primarily a product of the language developers, not the .NET framework, and certainly not the CLR!

    21. Re:Bad Kool-Aid. by gglaze · · Score: 1

      Sorry, didn't finish my thoughts...

      I certainly don't want to give the impression that I believe interoperability between all OO languages on the .NET platform is seamless. There are certainly some issues. But in the overall scope of things, these issues are truly negligible. I have worked on fairly large enterprise-level .NET projects with a mixture of C# and VB.Net, and the minor cross-language issues have never been a hinderance to the success of these projects.

      Here's why: from what I've seen (talking primarily C#/VB.Net/J# now), 100% of these issues are due to usage "non-standard" conventions allowed by a particular language - conventions which are technically not meant to be supported across all OO languages in .NET. IMO, VB.Net is the worst of these because it has carried over way too many stupid conventions from VB6 and before. For example, VB.Net allows you to do things like optional parameters, and it still allows you to call "built-in" functions such as Len(str) instead of calling the proper OO .NET Framework-supported str.Length which is available in all .NET langauges.

      So if you're still with me, the point is that the incompatibilities and challenges faced are entirely due to stupid programmers using conventions they learned back in their VB days, and failing to "upgrade their skillset" to understand the "right" way to do these things in .NET.

      It's not just VB, by the way - C# also has a few of these little things. So did MS make a mistake to allow these things to creep in to the languages? Possibly, but it was a huge tradeoff and a huge debate - if you remember back in the day a couple of years ago when the first VB.Net specs were released, there were HUGE debates over this. Some of us wish there were less incompatibilities, while some of us wish there was more backwards compatibility. The tradeoffs have been made, for better or for worse.

      But these are certainly not fundamental issues with .NET, or the CLR - they are simply higher-level language choices, which could be changed at any time. And when a team uses a proper set of standards and conventions, I am confident that they can achieve 100% seamless interoperability between their .NET modules regardless of what language different parts of the team are working in. As many of us have seen from experience, the model works, and it works very well.

    22. Re:Bad Kool-Aid. by gglaze · · Score: 1

      I couldn't agree more with what you are saying, Keeper.

    23. Re:Bad Kool-Aid. by Waffle+Iron · · Score: 1
      But they are functional (your program is based around functions)

      Every language has functions. That doesn't make them "functional languages". At the very minimum, a functional language needs to treat functions as a first-class data type and support closures. These concepts are the distinguishing characteristics of funtional programming; just "calling functions" isn't sufficient. C, C++ and Java do not support the features required to qualify as functional languages.

      Functional programming is a well defined technical term; it's not just academic. (FWIW, I'm not an academic type, and I'm not a big fan of purely functional programming either.)

    24. Re:Bad Kool-Aid. by Keeper · · Score: 1

      Imperative, they're imperative or OOP, not functional. Functional languages are languages exactly like LISP or Scheme. You construct a C program out of a bunch of statements, not a bunch of functions.

      *smacks self on forehead* You're right ... that's what happens when I post at 2am. :)

    25. Re:Bad Kool-Aid. by gglaze · · Score: 1

      FYI, Lahey and Fujitsu have released a .NET version of Fortran. Also I thought Digital was releasing their Fortran on .NET, but not sure... (this is different from F#)

    26. Re:Bad Kool-Aid. by Bazouel · · Score: 1

      mea culpa. Wrote that too fast, I knew there was Fortran and ML implementation available, just mixed up the names.

      Thanks for pointing it out.

      --
      Intelligence shared is intelligence squared.
    27. Re:Bad Kool-Aid. by Anonymous Coward · · Score: 0

      But they are functional (your program is based around functions)

      Way to show yourself to be shockingly ill-informed. Amazing. Now go learn something.

    28. Re:Bad Kool-Aid. by Keeper · · Score: 1

      Yeah, like you've never gotten something backwards before ... *rolls eyes*

    29. Re:Bad Kool-Aid. by mrdlinux · · Score: 2, Interesting

      As I hinted, without built-in support for higher-order functions and closures, a language cannot be considered to be `functional', because you would essentially have to implement these features yourself in your program (and most likely need to work around the limitations of that language also).

      Does attending a university make me an academic? I don't think so---I also work, and understand the practical viewpoint of a coder; I just don't see it as adequate justification for throwing away the dictionary. As it is, `functional programming' is also supposed to mean `no side effects' but that has now been relegated to `pure functional programming'.

      Personally, I backed away from the pure FP stance a long time ago, but I still think that higher-order functions and closures can be an extremely useful tool for any programmer and they can easily be mixed into other paradigms (just look at Smalltalk and Common Lisp).

      --
      Those who do not know the past are doomed to reimplement it, poorly.
  130. C# Measures Up Fine by Enonu · · Score: 1

    But the .NET Class library is incomplete and immature to the point of frustration. Two bits for somebody who can tell me what class will allow me to browse for a directory without interfacing with COM.

    1. Re:C# Measures Up Fine by thebatlab · · Score: 1

      This is the best I could find http://www.dotnet247.com/247reference/msgs/9/46244 .aspx

      I didn't try it out to see if it works though.

      Seems like a lot of work for what is a pretty standard control....

    2. Re:C# Measures Up Fine by cookd · · Score: 1

      1.0 Library: Yeah, you have to do the COM thing. But it really isn't that bad, and the problem has been solved for you -- just take the file (160 lines of code), add it to your assembly, then call the function. That wasn't so bad, was it?

      1.1 Library: Use System.Windows.Forms.FolderBrowserDialog.

      --
      Time flies like an arrow. Fruit flies like a banana.
  131. Clarifications by jtheory · · Score: 1

    I won't say that Java is right for every task, but I don't think you have a good grasp of how it is normally used, and what it offers.

    I spend almost all of my time nowadays working with Java (mostly server-side, but also a few GUI apps), so I can clear up some of these confusions with good examples.

    Portability - Server-side Java, by nature, does not involve any OS-specific activity. So, with no loss of portability or functionality, you could do the same in C/C++. Which, incidentally, will run on any platform for which GCC exists - About 30 *times* the number of platforms for which a JVM exists.

    I ported a large J2EE application from OS/400 to win2K (for testing and development) and Solaris (production environment). The only changes required in the application were updating some properties file (different JDBC database connection strings, logfile locations, etc.), and some changes to embedded SQL (for differences in database syntax). That's it. Once those glitches were ironed out, I could deploy updated, compiled code to either platform by just copying out the updated JAR files.

    I'm doing the same thing now with an even larger application, where I use a win2k server for development and as/400 for test and production. You're *sure* I can do this safely with a C++ app? Let me point out as well that the only bugs that have shown up on one OS but not the other have all been either configuration mistakes, or database issues.

    JIT? Server-side apps also tend to have very short process lives, doing a small task and exiting. In such situations, JIT causes worse performance, as it wastes time optimizing something that will never execute again during this process' invocation.

    What server apps are you talking about? Old-style CGIs? Utilities like grep or wc? I'm talking about the big server apps (the server half of client/server), where performance really matters. Never mind Java - if you're writing these in C/C++, you'll be using threads instead of dropping everything and needing to reload all of your resources, reconnect to the database(s), etc. on every client request.

    In theory (skipping over hardware maintenance, some kinds of code changes, etc.), most server-side apps don't need to ever go down. A lot of application servers now allow hot code swapping, so they can stay up forever. That's exactly why Java is seeing so much use on the server-side -- it fits that model perfectly by costing a little more in the startup time (where it doesn't matter) for benefits later.

    There are a lot of limits to talk about re GUI programming -- the portability factor was a much stickier issue there in AWT, and Swing just turned the apps into nice-and-portable memory hogs.

    But the server-side benefits are hard to fault. Obviously I'm biased, but I think most developers would agree with me on these points alone.

    --
    There are only 10 types of people: those who understand decimal, those who don't, and, uh, 8 other types I forget.
  132. SharpDevelop, alternative to VS2003 by Bazouel · · Score: 2, Informative

    There is an open source alternative IDE for .NET called SharpDevelop, which you get at http://www.icsharpcode.net. It is not as good as VS2003, but quite near :)

    --
    Intelligence shared is intelligence squared.
  133. Compile at installation vs. JIT by Anonymous Coward · · Score: 0

    And I believe CLR stuff can be compiled at installation time, making it even better than JIT.

    Not necessarily! Some optimizations that cannot be done without runtime data. You can get some of this info by profiling (and recompiling with profiled data), but you can do better with realtime data. Here's one example of such a system: ADAPT (at the University of Toronto). There are probably others.

  134. C# vs C, C++, and Java by CodeBuster · · Score: 1

    I have been using C# for the past 6 months on a mid-sized distributed business application with multi-threaded socket handling, web services, ADO.NET, and XML and I have to give Microsoft some credit where it is due. When one compares the features that are built into C# such as callback delegates, custom event handlers, excellent threading support, and the extensive class library provided with the .Net framework it is difficult to understand why anyone would want to write a new piece of business software with C++/MFC, or platform SDK and C. That being said, both C and C++ have advantages in niche application development such as drivers, operating system kernels, and the like but they are far to expensive to use and maintain except where absolutely necessary or in the largest scale projects. The Java question is an entirely separate issue since C# and .Net were designed, more or less, to directly compete with the features offered by the Java platform. They often speak about a concept at Microsoft which they call developer mindshare and how it can be extended and maintained. Now, I know that Java is frequently taught in Universities and C# is not...but think about it. If you are a new Computer Science grad in a tough job market then your odds of obtaining employment are significantly enhanced by choosing the C#, .Net, Windows route, rather than the Java, Sun, Linux route. Regardless of what you may think about Microsoft, the world uses their software and there are many more Windows programming jobs out there than Sun, Linux, and UNIX jobs. For my part I usually choose the route of least resistance when I write software and in my situation C# has been a good choice. I really hope that something comes of the whole Dot GNU project so that C# and .Net applications which compile to the Common Language Runtime can run on Linux too. In summary the features which I find most useful in C# are:

    1. Excellent XML support including Xml Document Model, Xml Serialization, Xml Schema Validation, and of course Xml Web Services (this is VERY useful).

    2. The combination of the Windows Forms with the power of a full featured c-style language. If you ever worked with C++/MFC or C with Platform SDK then you know that this was a long time in coming and a welcome relief.

    3. Callback delegates - you never realize how useful these are until you start using them in your applications.

    4. Advanced threading library including thread pooling, support for various synchronization methods, and easy to use asynchronous framework.

  135. such one-dimensional thinking by penguin7of9 · · Score: 1

    Of course, C# and Java compilers "measure up" in terms of simple benchmarks: they are statically typed languages, somewhat simplified from C/C++. They don't have pointers, but pointer manipulation does not speed up code with modern compilers on modern architectures. They do have garbage collection, but garbage collection is generally at least as efficient as manual storage management. Many library routines (string handling, etc.) are coded in C or assembly anyway. The only places where there is potentially more overhead is in a few more places where they do error checking, but that overhead is a few percent at most.

    The biggest difference between C/C++ and Java is probably in terms of memory usage. Java slaps a three word (!) header onto every object. So, an array of one million structures consisting of two shorts each takes 20Mbytes in Java, while it only takes 4Mbytes in C or C++. In C#, you can avoid that overhead by using value classes, although for heap allocated objects, it still uses more memory than C and probably C++.

    These days, the real question is how these language "measure up" in terms of facilities, and that does have a profound influence on performance. Both languages use read-only string types, which result in enormous overhead for string manipulation code written in what programmers consider the "natural" common way. One can argue that that overhead is acceptable, but it is there. To avoid it, you have write your Java code completely differently. C# has value clases while Java doesn't, which means that writing a lot of scientific code is much easier in C# than in Java.

    Libraries are another big issue. The standard Java libraries are inefficient in many places: often, their implementation is bad, and in many cases, the API simply does not allow an efficient implementation. I would guess the C# libraries are pretty similar, given that they are so closely modeled in Java.

    Note that this is also a major problem with C++ libraries: the compiler can be as good as it gets, but if the libraries are designed and implemented badly, the resulting programs will still be bloated and slow. That's why so many programmers still prefer C: programming in C is such hard work that C programmers don't make their libraries very complex and general, and as a result, they tend to be more efficient.

    With these high-level languages, the question is not whether they perform well on microbenchmarks--they do--the question is how well they encourage and support writing efficient code. Java downright discourages it. C# is a little better. C++ lets programmers write efficient code easily, but it also makes abstraction so easy that many programmers still end up writing overly general and inefficient code.

    1. Re:such one-dimensional thinking by Keeper · · Score: 1

      Both languages use read-only string types, which result in enormous overhead for string manipulation code written in what programmers consider the "natural" common way. One can argue that that overhead is acceptable, but it is there. To avoid it, you have write your Java code completely differently.

      In C#, you just have to use a class called StringBuilder. It works just like you would expect a string class to operate, it's efficient, and converts itself to a string type when it's needed...

    2. Re:such one-dimensional thinking by penguin7of9 · · Score: 1

      In C#, you just have to use a class called StringBuilder. It works just like you would expect a string class to operate, it's efficient, and converts itself to a string type when it's needed...

      Yes, so does Java (in fact, that's just one of the many design decisions Microsoft copied from Java).

      But, fundamentally, read-only strings mean that pretty much whenever you need to construct a string to hand to some function, there is at least one memory allocation happening somewhere. The overhead for that is enormous compared to the kind of string code people regularly write in C or Cobol. The StringBuffer or StringBuilder classes only keep an already bad problem from getting even worse.

  136. Re:In Ada's case ... by nimblebrain · · Score: 1

    I prefer Ada's treatment of generics for the way it makes the use of the generic explicit. To make an integer-based stack, you'd declare a new type based on the Stack generic with an Integer as a type.

    I remember when C++ got its templates (IIRC, that was in the 2.0 specification); it took compiler developers a long time to integrate the features. Before that, we'd put together token-pasting (##) macros.

    Trying to track down troubles in a C++ template used to be utterly atrocious; define-at-first-use (e.g. first time the compiler encounters Stack<int> per target file) combined with the way the compile/link actually generated the templates behind the scenes made for... to put it mildly... a cryptic experience in a very long error log, usually at link-time. *laugh* Based on some more recent MSVC error listings I've seen, I don't think it's gotten much better ;)

    (P.S. Does anyone know whether IBM has removed all the unnecessary #pragmas from their 'STL' implementation? :)

    I'm personally interested in generics in any given language for a few reasons:

    • Less typing
    • Less typecasting
    • Changes to the algorithm occur in one spot
    • Type-safety at compile-time
    None of those reasons make or break using a language. I've survived with and without generics for years on end.

    Java should do quite well by generics. They will be useful. C++ got along famously without them, but did better with them. Indeed, lack of them in a language is no indication that the language wouldn't be useful with them.

    Delphi has no official generics, either, but just like C++'s old token-pasting, there are ways to do generics in Delphi, too.

    --
    Binary geeks can count to 1,023 on their fingers :)
  137. it's called library granularity by martin-boundary · · Score: 1
    What you want is to use a runtime library with fine granularity. The granularity is the size of the typical object file included in the library. When the linker needs a function, it links in the full object file which contains the function. So if your library contains one object file for each function, then the linker only links in the code for the functions you use. But if your typical util.obj file contains twenty functions, then those get added even if you only need one of those functions.

    AFAIK, the watcom compiler (openwatcom) has the best granularity performance. The compiler has a switch (iirc) which can compile automatically each function into its own unique object file when creating libraries. Then the linker only adds the code you actually use.

  138. Re:I've been coding most of... Virtual Memory by RoundSparrow · · Score: 1

    Ok, I agree with what you say relative to RAM... however...

    Modern operating systems are going to do paging of these large loaded files. They don't care what functions you use, they track the usage of the memory by pages (4k ON I386 IIRC). So if you load a 8MB library (Windows DLL for example) and are only using 16K of code in it... windows will page out the unused part when RAM is tight.

    It isn't a perfect solution, but it does solve the problem. Loading the massive libraries (paging them all in to init) tends to be the big hit.

  139. Old age programmers questions by Anonymous Coward · · Score: 0

    Can I write in c#:

    1 - a kernel
    2 - a device driver
    3 - a videogame

    so that almost nobody will notice any substantial performance|system-load|code-size differences from the same code written in asm or c?

    In other words, is this an application only language or a general purpose one?

  140. Fast Java by Anonymous Coward · · Score: 0

    Many Java API's are in fact implemented in fast native code. I've written a Swing application that loads 150 meg files over the network using Java NIO, relying on memory-mapped and random-access file channels. Behind the scenes these are implemented on the OS level. The user can browse around in the files and the display is updated instantly. Now, I understand that it might be *slightly* faster in C/C++, but is it worth increasing my development time by a factor of 2 to 5? No way!

  141. Computers are too slow! by Frans+Faase · · Score: 1
    Although you argument seems to true, it is not. The real fact is that computers are still far too slow for what we want them to do. If computers were fast enough, languages like C and C++ would have gone a long time ago. There sole reason for existence is that they produce fast code.

    All comes down to the fact that we still need hand-optimize code to get computers to do something reasonable. Nowadays, most software engineers are not aware of the memory piramide. At the top we have a little very fast memory and at the bottom we have a huge amouth of memory which is relatively slow. The differences are in the order of 10^9 (if you include the Internet).

    Computers spend most their energy in moving data in an efficient way between different forms of memory, and managing available memory. This has lead to incredibly complex systems, beyond the comprehension of a single individual.

  142. strcat is an elementary function by Frans+Faase · · Score: 1
    strcat is really nothing more than two loops:

    void strcar(char *a, char *b)
    {
    for(; *a != '\0'; a++);
    for(; *b != '\0'; *a++ == *b++);
    }

    And it would not surprise me if some CPU's have a single instruction for doing this!

  143. The reason I like Java by chewy · · Score: 1

    Though I have coded in various environments before, back-ends is where I usually try to end up at, so I speak mostly from experience there. (Also, only with C, C++, Delphi, Java and Python).

    Java and C++ are alot cleaner than C when it comes to managing a large amount of code. Namespaces help alot. :)

    C++ I don't like because of all the rules I have to remember. Frankly, it's just too much.

    Java and Delphi (python aswell?) both have powerful standardized APIs, less sort routines to write. :) 3rd party code is ALWAYS a pain. Open source code is much better. The *other* reason Java Is Good (tm).

    Now, I think Python is a spunky language as well, and are finding excuses to use Jython in my stuff (I code java-things for a living), and writing Python scripts whenever I'm hungry. But I feel Java + Python have different problem-domains to tackle, IYKWIM.

    So there you are.

    Eat dirt.

  144. C++ a nightmare? C not good for big projects? by Phosphan · · Score: 1

    When you think C++ is a nightmare and all code you've seen is a total mess, you maybe should start looking somewhere else. For example at the rapid progress of the KDE project. Btw, perhaps you should tell the Gnome team that using C is no good idea, maybe they just didn't notice yet.

    1. Re:C++ a nightmare? C not good for big projects? by Anonymous Coward · · Score: 0

      You are citing only open source projects, which have fundamentally different contingencies than commercial projects, epecially when it comes to "time-to-market" issues.

      I've worked on several large scale projects, most of which between 500,000 and several millions LOC, in C and C++.

      I confirm this impression, along with most software engineers I've talked to : low level languages like C and C++ are a nightmare. Testing and maintaining larger programs written in these languages is a real pain. And multi million lines programs are extremely difficult to port.

      My experience : use high level languages (and even functional programming languages like Objective Caml, for instance, which are much faster to develop with) wherever possible.

    2. Re:C++ a nightmare? C not good for big projects? by Phosphan · · Score: 1

      I don't think that C++ is correctly classified as a "low level language". It allows low-level constructs, sure. But you can also use it at arbitrary high levels of abstraction. C++ can be painful, admitted. But it doesn't have to. It is simply nonsense to say "programming in C++ is like this" or "programming in C++ is like that". This is a multi-paradigm language. It makes a hell of a lot of difference if you are bit-banging and abusing C++ as some kind of C with additions, or if you use mature class libraries like Qt and design your program from the start using the benefits of the language you are using, not of the one you are used to.

      It's quite often seen that C programmers who learned a bit C++ produce horrible programs... seeing you put both together as "low level languates like C and C++" makes me afraid you didn't get the right impression. And yes, I believe that you can get the wrong impression no matter how big the projects were you have worked on.

  145. There's no performance overhead for a VM by cartman · · Score: 2, Interesting

    I've done significant work in benchmarking Java programs versus equivalent C/C++ programs. I've found that garbage collection is the sole reason that Java is slower than C++; having a "virtual machine" imposes no performance penalty whatsoever. This is unsurprising, when you think about it; a JIT compiler simply moves the latter phases of compilation ("byte code->assembly") to runtime.

    Contary to what many people think, even most traditional C compilers work by compiling source to byte code, optimizing the byte code, then compiling byte code to assembly. There's no reason to expect that the resultant assembly will be any slower just because the final phase is done at run time by a JIT.

    Programs compiled using IBM's Java compiler routinely outperform equivalent programs compiled using "gcc -02", if garbage collection is not used in the Java program being compiled.

  146. Dubious choice of benchmarks by gibara · · Score: 2, Insightful

    Since registration is required to read the article, I have not read it. But given the title of the publication I was alert to the possibility of bias, and I think it's quite strongly present in the introduction. Java is the platform against which .Net will be measured for the forseable time and I think that the choice of benchmarks in Part 1 strongly favour .Net.

    application invocation (time to load and execute)

    It seems likely to me that the CLR will be be preloaded/vigorously cached by a Microsoft OS whereas the JVM is treated like any other application. Startup times will be skewed appropriately

    algorithms and recursion (calculating Pi and Eratosthenes's sieve)

    One of the small number of additional features of the CLR over the JVM is support for tail-end-recursive algorithms. This test will favour the CLR for the reason.

    conversions (int to float, float to int, int to string, string to int)

    A valid test but half useless. How much time is spent in an application casting from float to int or vice versa? Conversion between ints and strings is a valuable benchmark (XML based applications have to that often).

    string comparison, string concatenation, string tokenization

    Java has a weakness (actually it has had many) with its treatment of String handling. They are slow to manipulate and memory heavy. Further changes are being made in 1.5 (introduction of non-synchronized StringBuilder class). If the .Net libraries can't do better than the Java libraries then I'm appalled.

    From the outside, this article just looks like another opportunity has been taken to falsely bash Java with .Net

    --
    Programmers of the world unite, you have nothing to lose but your strings.
  147. Could C# FAIL to measure up? by Anonymous Coward · · Score: 1, Insightful

    Seriously, the MS EULA's forbid publishing benchmarks of any .net components unless MS approves of them. And this isn't even the .net EULA, its standard in all of their security updates.

    This study shows C# isn't so bad... how many are being censored by MS?

  148. Microsoft EULA by curious.corn · · Score: 1

    Since Microsoft EULA forbids to disclose and/or perform any sort of benchmark on .NET I don't trust any performance roundup that pitches the Microsoft .NET platform against it's competition. Peer reviewed repeatable measurements is science, all the rest is just infomercial.

    --
    Mi domando chi à il mandante di tutte le cazzate che faccio - Altan
  149. Re:#insert by Anonymous Coward · · Score: 0

    On Wintendo only Microsoft compilers were lagging, Borland more or less was tracking the draft standard. MS products were a joke, MFC my ass, more like MFM (Microsoft Foundation Macros)...

  150. Am I the only person who read the article? by Ninja+Programmer · · Score: 3, Informative

    First of all -- what's the deal with this whole "WARMUPS" thing? This is just the most explicit way possible of training the JIT mechanisms without measuring its overhead. That might be fine if you believe that the overhead asymptotically costs nothing, however, I don't know what evidence there is of this. The test should use other mechanisms other than this explicit mechanism to allow the language itself to demonstrate that the overhead is of low cost.

    The way this test is set up, the JIT people could spend hours or days optimizing the code without it showing up in the tests. This is the wrong approach and will do nothing other than to encourage the JIT developers to cheat in a way such as this just to try to win these benchmarks.

    Ok as to the specific tests:

    1. FloatInteger conversion on x86 are notoriously slow and CPU micro-architecturally dependent. It also depends on your rounding standard -- the C standard dictates a rounding mode that forces the x86s into their slowest mode. However using the new "Prescott New Instructions", Intel has found a way around this issue that should eventually show up in the Intel C/C++ compiler.

    This does not demonstrate anything about a language other than to ask the question of whether or not the overhead outside of the fi rises to the level of not overshadowing the slowness of the conversion itself.

    (That said, obviously Intel's compiler knows something here that the other guys don't -- notice how it *RAPES* the competition.)

    2. Integer to string conversion is just a question of the quality of the library implementation. A naive implement will just use divides in the inner loop, instead of one of the numerous "constant divide" tricks. Also, string to integer will use multiplies and still just be a limited to the quality of implementation as its most major factor determining performance.

    3. The Pi calculation via iteration has two integer->floating point conversions and a divide in the inner loop. Again, this will make it limited to CPU speed, not language speed.

    4. The Calculation of Pi via recursion is still dominated by the integer divide calculation. It will be CPU limited not language limited.

    5. The Sieve of Erastothenes (sp?) is a fair test. However, if SLOTS is initialized to millions, and the comparable C implementation uses true bits, instead of integers, then I think the C implementation should beat the pants off of C#, Java, or anything else.

    6. The string concatenation test, of course, is going to severely ding C for its pathetic string library implemenation (strcat, has an implicit strlen calculation in it, thus making it dramatically slower than it needs to be.) Using something like bstrlib would negate the advantage of C#, Java, or any other language.

    7. The string comparison with switch is a fair test, and gives each language the opportunity to use whatever high level "insight" that the compiler is capable of delivering on. It should be noted that a sufficiently powerful C compiler should be capable of killing its competition on this test, however, I don't believe any C compiler currently in existence is capable of demonstrating this for this case. I.e., this *could* be a legitimate case to demonstrate that C# or Java's high level abstractions give it an advantage over where the state of the art is in C compilers today.

    8. Of course the tokenization is another serious ding on the rather pathetic implementation of the C library. None of strtok, strspn, etc are up to the task of doing serious high performance string tokenization. If you use an alternative library (such as bstrlib or even just PCRE) you would find that C would be impossible to beat.

    -----

    Ok, while the results here are interesting, I don't think there were enough tests here to truly test the language, especially in more real world (and less laboratory-like) conditions. Please refer to The Great Win32 Computer Language Shootout for a more serious set of tests.

  151. Computer Language Shootout by Lio · · Score: 1

    If you are looking for a real nice performance comparison of different languages, check out the The Great Computer Language Shootout at http://www.bagley.org/~doug/shootout/. Why I did not link it directly? Because it has a "slashhole"!

  152. Re:#insert by Anonymous Coward · · Score: 0

    Templates and Generics are synonyms. The difference lies within a) what name a particular language chose to use, and b) the implementation within that language.

    What you are talking about, I suspect, are pattern matching constructs. Those are found in Haskell, ML, and to some degree in C++ (if you are so inclined...), and probably in a hundred other languages I don't know of.

  153. Re:#insert by jpc · · Score: 1


    Actually I worry about this. I seem to remember that the template system is in fact turing complete and you can write your entire program in it, making the language unnecessary. Compile time is run time.

  154. Re:#insert by Anonymous+Brave+Guy · · Score: 1
    Templates and Generics are synonyms.

    No, they aren't, because C++'s template mechanisms go beyond the generics applications. That's kinda the point.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  155. Open Source IDEs for .Net by catherder_finleyd · · Score: 1

    There are 2 open-source IDEs for the .Net Environment of note:

    1. Web Matrix, an ASP.Net oriented IDE. Can be downloaded from:

    http://www.asp.net/webmatrix

    2. #develop, a more general IDE for C# and VB.Net. Can be downloaded from:

    http://www.icsharpcode.net/OpenSource/SD/Default.a spx

    Both of these IDEs are only available for Microsoft OSs at this time.

    3. A C# plug-in is available for Eclipse. It can be downloaded from:

    http://www.improve-technologies.com/alpha/esharp/

    It should run on Linux, using Mono.

  156. One-handed Programming by Nurgled · · Score: 1

    Okay, I admit that I would program much slower while holding a stopwatch in one of my hands. OKAY?!

  157. Re:#insert by dspeyer · · Score: 1

    Are you sure about this? That would mean there must exist legal C++ code that will never finish compiling. I have a really hard time picturing code like that.

  158. bull by cabes · · Score: 1

    That's bull. I've found that for massive text and XML processing that Perl kicks C#'s butt, hands down. We're talking parsing a 200 MB XML file takes 5 minutes in Perl, using 6MB of RAM and C# took 45 minutes and 400 MB of RAM.

  159. C# is NOT what's being tested by ClubStew · · Score: 2, Insightful

    When are people going to learn that languages that target the Common Language Runtime (CLR, only part of the .NET Framework) compile to the same thing (Intermediate Language - IL)? C# is not being tested here. The C# compiler optionally optimized and compiles source code into IL which is later JIT'd and executed. Because of this, it's the CLR and the base class library (BCL) that are being tested.

    This could just as easily been done with VB.NET (not that I condone anything resembling VB) or J#, although MC++ is a different monster because it can (but doesn't have to) use native code in mixed mode and, thus, is not verifiable).

    The only differences besides language syntax is the specific language compiler and the optimizations it makes. The C# compiler does - as far as I've tested - a better job of optimizing. The VB.NET compiler, for instance, automatically adds an extra local var to support the syntax FunctionName = ReturnValue whether or not you use it!

    So, let's get the facts straight. C# is not being tested here. The .NET CLR and BCL are.

  160. AIX is smarth enough by Anonymous Coward · · Score: 0

    The AIX linker loader combo are smarth enought to load only the functions they need. So it doesn't matter how much dead code the library has, it won't be mapped into memory.

    Upgrade your Linux to AIX then...

  161. The GNU IDE by amightywind · · Score: 1
    ...but I want to first settle on a free alternative to Visual Studio .NET 2003. Any suggestions?

    How about Emacs.NET?

    --
    an ill wind that blows no good
  162. Re:And both generics and templates are kiddy toys. by tricorn · · Score: 1

    Really? It is certainly possible to add a proof from the compiler that a particular cast is unnecessary, with the verifier checking that and then short-circuiting the cast. Article in Dr. Dobbs described it quite well a couple years ago. Even was backward compatible with old VM.

  163. Real life programs create garbage to collect by Anonymous Coward · · Score: 0

    so your point is moot. Saying "Java would be fast as long as it did not have to collect garbage" is like saying "McDonalds would be a good restaurant if it did not serve all that fast food".
    Java is essentially a statically typed compiled language (javac) not unlike C++. If you want a good and expressive garbage collected language use Python instead.

  164. free alternative to Visual Studio .NET 2003 by mardoen · · Score: 1

    SharpDevelop -- www.icsharpcode.net/OpenSource/SD/

    GPL'ed IDE, not (yet) as mature as Eclipse, but targeted specifically towards C# development, and very usable. It even has a GUI builder. Highly recommended!

  165. Fortran? by Anonymous Coward · · Score: 0

    F# is not Fortran, but a CLR implementation of ML. Of course, this required a few extensions to the VM, but the point of the exercise was to show that it wouldn't be hard to add functional language (hence the 'F') support to the CLR.

    aQazaQa

  166. -1: Ill-Informed by brlewis · · Score: 1

    Languages that are conceptually different from C# have to make compromises to run on the CLR. They aren't quite the same language after that. That's why they get names like Scheme#, etc. The parent post is not as ill-informed as yours is.

    The parent post is only ill-informed about Lisp macros. Those are done at compile time, and there's nothing about the CLR that would preclude them. However, the parent post was dead on about Scheme continuations. CLR changes to better support continuations have been "coming soon" for the past couple of years.

    1. Re:-1: Ill-Informed by gglaze · · Score: 1

      First, I'll ask you to please refer to my reply to ChannelX above, so that I don't have to copy and paste the same things again.

      My main points are:

      .NET favors OO languages, not just C#. There is as much, if not more, functionality and framework support available in VB.Net than there is in C#. Similarly, J# and C++ also have there own advantages. So if you are really talking about OO languages vs. everything else, then yes, perhaps I agree with you to some extent - .NET favors OO languages, because in many ways it is an Object-Oriented framework. But let's be clear about terminology.

      That's why they get names like Scheme#, etc

      Ah, now I see what you are getting at. In my opinion the reason a language like Scheme (or any other inherently non-OO language) gets a # at the end is primarily to distinguish it for the .NET-accessibility enhancements that have been added here. What I am really talking about is the additional functionality which has been added to the language in question in order to allow it to access objects. This is not a .NET concept, as much as it is simply a paradigm-bridging concept.

      In any case, I don't see why this would be a negative thing (having the # added to the name). If we all agree that a framework such as .NET should be targeted at a specific paradigm, and that OO is probably the most relevant paradigm for today's age, then it is logical that any non-OO languages should have an indication to distinguish them from their counterparts. Otherwise, it could be very interesting for me to send you a helloworld.scheme file, and for you to see me referencing some framework objects using extended language syntax features.

      You think this sounds like a bad idea? Then either don't use an object-oriented framework like .NET, or don't use a functional language like Scheme. You can't have your cake and eat it too. If you want to cross paradigms, I can't think of any way of doing that without some type of technical paradigm-bridging enhancements. If you're not happy with this particular implementation of the paradigm-bridging technology, that's fine - let's discuss it. But let's be clear about what we are discussing.

      In the case of other languages, there are more obvious reasons that they have received modification marks to distinguish them from the original languages:

      VB.Net - obviously important to distinguish from the non-object-oriented VB.

      J# - Java is already object oriented, so obviously the biggest reason for a different name here is legal, because as far as I'm aware, MS can't throw a product out there and say, "this is Java, running on .NET!" However, from what I've seen, J# code looks identical to regular Java code. In fact, if you had the proper packages to replace the .NET framework (System.*, etc.), I would guess that 99% of J# code would compile with no problems and run on a JVM.

      In any case, I still have no idea what any of these paradigm and framework issues have to do with the CLR. It's like arguing that Intel architecture really supports only C, and not any other languages.

    2. Re:-1: Ill-Informed by brlewis · · Score: 1
      In any case, I still have no idea what any of these paradigm and framework issues have to do with the CLR.

      Yes, I noticed.

      It's like arguing that Intel architecture really supports only C, and not any other languages.

      The Intel architecture lets you do certain low-level things like copy stack frames around. First-class continuations rely on such low-level tricks to be efficient. You can create a higher-level implementation of continuations using the CLR, but it will be terribly slow, and there's no guarantee that language A's high-level implementation will be able to invoke continuations from language B's high-level implementation.

      More generally, I'm saying that the CLR provides little, if any, additional language independence compared to the JVM.

    3. Re:-1: Ill-Informed by gglaze · · Score: 1

      More generally, I'm saying that the CLR provides little, if any, additional language independence compared to the JVM.

      I'm certainly not disagreeing with you there. I'm responding more to the original point that (1) The CLR is really only built for C#, and therefore all other .NET languages are "subsets" of that functionality; and (2) That the CLR (or IL) prevents a .NET language from supporting certain OO concepts such as multi-inheritance or templates;

      Forgive my ignorance on this "The JVM supports more languages than just Java" idea - any links you could refer me to would be enlightening.

      If the discussion is about CLR vs. JVM, I think there are many more similarities than there are differences. Both are runtimes designed to support certain environments and scenarios, and while one or the other may be "better" in certain niche areas, generally the decision for CLR vs. JVM is not going to be a simply academic decision about which one supports more languages - it is going to be a decision about support for a specific language/platform/technology/toolset or whatever other factors are considered in choosing an overall set of technologies for a project. No one says "I want to do a project on the CLR, thus I choose .NET/C#!", just like no one says "I want to do a project on a JVM, thus I chose Java!".

    4. Re:-1: Ill-Informed by Ambassador+Kosh · · Score: 1

      http://www.jython.org/ That is python on the jvm

      --
      Computer modeling for biotech drug manufacturing is HARD! :)
    5. Re:-1: Ill-Informed by brlewis · · Score: 1

      I'm not arguing (1), that the CLR is really only built for C#. I really don't know. It might also have been built for VB.NET. Nor do I particularly care about its support of multi-inheritance or templates.

      What I am saying is that one unique feature of Scheme, namely first-class continuations, cannot be done on the CLR without a huge performance hit. Thus the original poster's "subset of C#" description is not far off. You get an alternate syntax, but not alternate concepts.

      Where the JVM comes in relates to this comment by you:

      Furthermore, the idea that the CLR "does not support multiple languages" is the most ridiculously malinformed statement I have ever heard about .NET, and trust me, I've heard plenty. One of the major objectives, if not the most important, is to bring to prime-time quality Microsoft's idea of supporting many languages on the same framework.

      Sun never intended the JVM for anything but Java. People implemented compilers for other languages to target the JVM anyway, with certain restrictions due to the JVM abstraction. Seeing how those exact same restrictions come up when you try to target the CLR belies "Microsoft's idea of supporting many languages on the same framework" as mere marketing hype. Yes, there are many more similarities than differences between the JVM and the CLR. Both are OO virtual machines, and neither was designed with many languages in mind. Prime-time quality? I'll believe it when I see it.

    6. Re:-1: Ill-Informed by gglaze · · Score: 1

      Prime-time quality? I'll believe it when I see it.

      I'm not exactly clear what you're arguing against. That .NET's multi-language ability is now prime-time quality? That's exactly how I would put it - as I said, I've seen large-scale .NET enterprise projects developed successfully with modules spreading multiple languages seamlessly. I'm not sure what else we need to see before we can give this the "prime-time" badge.

      Sun never intended the JVM for anything but Java.

      That's all well and good, but at least since the advent of COM, MS *did* intend for it's platform to support multiple languages. I'm not claiming this is an "original" MS idea, but it is certainly the idea MS has had all along, at least since COM.

      Thus the original poster's "subset of C#" description is not far off.

      But it is in fact very far off. As another poster here noted, managed C++ (another ".NET language") supports a superset of functionality supported by C#, including the two OO features in question, multi-inheritance and templates. Additionally, as I claimed earlier, in many ways the functionality available in C# is a subset of of that in VB.Net.

      Just because you can find one example of something from a language outside of C# which is not easily implementable on top of the CLR, it does not logically follow that C# is the superset of all possible CLR functionality. I can show you many examples of functionality in .NET languages, which are not available in C# - namely the two mentioned above in managed C++.

      What I am saying is that one unique feature of Scheme, namely first-class continuations, cannot be done on the CLR without a huge performance hit.

      I certainly won't debate that - I've tried to be very clear, and so have other posters here, that I think .NET is first and foremost directed at object-oriented languages. It is essentially an object-oriented framework. Let's not confuse "cross-language" with "cross-paradigm". It does claim to be the first, but not the second.

      As a follow up, I am only vaguely familiar with my studies of functional languages, and perhaps I need to brush up - if you could provide a bit of info on first class continuations, I'd appreciate it...

    7. Re:-1: Ill-Informed by brlewis · · Score: 1

      If you want to define "cross-language" as "languages that fit into this one paradigm", then yes, it's cross-language. You can make any statement true by redefining its terms.

      But, just for fun, let's stick to the OO paradigm. Let me share some interesting paragraphs from an Eiffel Page on the subject.

      The virtual machine provides a number of mechanisms useful to the implementers of all languages: signal handling, exception handling, security, memory management, garbage collection, debugging support. The last point is particularly interesting for object-oriented languages; although a bit apprehensive at first about the efficiency of the GC process, we were interested to discover that it uses many of the same techniques that we have applied to ISE Eiffel over the years; in particular it moves objects around, as needed to compact memory, and gives excellent performance results.

      Not all applications will want to rely on these services. This is where the notion of "managed code" comes in. Code is managed if it relies on the runtime's services, unmanaged otherwise. Managed and unmanaged code can coexist; as noted above, C++ will only let you enjoy the benefits of full managed code if you limit your use of the language to a subset that roughly corresponds to a C#/Java style of programming (no multiple inheritance except from interfaces, no "friends").

      You can bring in features like multiple inheritance if you're willing to let the dotnet framework give you nothing. Why implement in the dotnet framework in the first place?

    8. Re:-1: Ill-Informed by gglaze · · Score: 1

      Why implement in the dotnet framework in the first place?

      For the sake of this discussion...

      (1) to have an abstraction layer over the platform-specific assembly-instruction layer

      (2) to have a shared set of services accessible to all applications written on the platform, in whatever language (and paradigm)

      This seems fairly straightforward to me. I really don't see what something like multiple inheritance has to do with "The .NET Framework" or with "The CLR". Multiple inheritance is a high-level language concept, and it is up to the language implementor to include or exclude that feature. I cannot imagine why you would want to convolute anything at the assembly layer with such object-oriented concepts. Managed C++ does not require any additional support from the CLR or the framework in order to support multiple inheritance - it uses the same CLR and .NET Framework that C# uses. But it still has multiple inheritance, because it keeps it where it belongs - in the object-oriented language implementation. The exact same applies to Eiffel in this case. In fact, I would be suprised to learn that IL even has the concept of *single* inheritance.

    9. Re:-1: Ill-Informed by gglaze · · Score: 1

      If you want to define "cross-language" as "languages that fit into this one paradigm", then yes, it's cross-language. You can make any statement true by redefining its terms.

      Actually, I would define "cross-language" as supporting seamless integration of code from 2 or more languages. Obviously it is not meant to intend that it is "cross-all-languages". If .NET supports C# and VB.Net, then guess what, it has "cross-language" or "multi-language" support. I don't know why you are stuck on this idea that a multi-language technology must also cross all paradigm boundaries. If someone ever invents something capable of doing that (moreso than .NET already is, that is) I'll be impressed. It's just not possible to have complete seamless integration across all paradigms, and .NET makes no claim to do that.

    10. Re:-1: Ill-Informed by brlewis · · Score: 1
      I would be suprised to learn that IL even has the concept of *single* inheritance.

      Want to be surprised? Google for clr object system and check out the powerpoint presentation on research.microsoft.com that includes a couple of IL examples. Single inheritance is right there.

      Making OO into "low-level" runtime operations is important if you want objects from different languages to interoperate. Try getting multiple-inheritance objects from Eiffel to work in C++, or C++ objects to work in S# (Smalltalk).

      If MSFT were really interested in supporting multiple languages, even just multiple OO languages, they would have built-in multiple inheritance support; C# and VB.NET just wouldn't use it. As it is, there's only built-in single inheritance (plus interfaces) support, exactly like with the Java framework. Not surprising. The Java framework is not trying to support multiple languages. The dotnet framework isn't trying either, except in marketing materials.

    11. Re:-1: Ill-Informed by gglaze · · Score: 1

      But VB+C#=="multiple languages".

      In any case, I agree - what you are saying about the possibility of having multi-inheritance built in at the IL level might make sense. Although I can't quite imagine the idea of C# and VB.NET, not being able to use it, but still having access to the interfaces of those objects. Is that possible? It seems to me that this would still basically deny C# and VB.Net access to any objects that carry interfaces inherited from multiple objects, unless it does some funny tricks underneath.

    12. Re:-1: Ill-Informed by rjh · · Score: 1

      But VB+C#=="multiple languages".

      Strange. I know Java pretty well. Learning Java pretty well, coming from a C++ background, took me a few weeks. I was productive inside of two days, but it took me a fair bit of time to start thinking in Java as opposed to thinking in C++. I.e., I was trying to apply C++ solutions to Java problems, and was having real troubles.

      Once I had Java thoroughly in hand, I picked up the O'Reilly book on C#. I figured if I'd drunk Sun's Kool-Aid, I should really take a gulp of Microsoft's, too. It took me four hours to reach the same level of proficiency in C# that I have in Java. Yeah. Four hours. I still had to look up things in C# in a Nutshell, but I thoroughly understood everything from interfaces to inheritance to events to I/O to basic Winforms in four hours flat.

      Any language where you can become proficient in four hours is not a "different language". It's the same language, just with a different syntax.

      As Dijkstra famously said, "Any language which does not change the way you think about programming is not worth learning."

      C# is not worth learning. Hasn't changed the way I think about programming. LISP did (two years to become proficient). C++ did (eight years). Scheme did. Modula-3 did. PROLOG did. Smalltalk did.

      C# did not. As such, I don't think "VB + C# == `multiple languages'". I think at best you can call them the same language, highly derivative of Java which is in turn highly derivative of Smalltalk with C++ syntax, with a slightly more flexible VM than the JVM and better support for foreign syntaxes.

    13. Re:-1: Ill-Informed by rjh · · Score: 1
      The parent post is only ill-informed about Lisp macros. Those are done at compile time, and there's nothing about the CLR that would preclude them.

      Just to clarify what I said--

      I didn't mean it to be interpreted as "LISP macros cannot be called from C# or VB.NET". As you said, LISP macros are just compile-time entities, and they'd reduce down to CLR just fine (modulo other LISPisms which wouldn't reduce--CLOS is mostly macro calls, IIRC, and CLOS doesn't reduce).

      What I meant was, you can't use LISP macros from non-LISP .NET languages. For instance, if I write an object Foo with method Bar in C#, I can export it trivially to VB.NET. Great. Whee. This is surprisingly useful and very limited all at the same time. What would be really impressive is if I could do something like
      (with-session-key key (gen-random-key 128)
      (with-blowfish-cipher blowfish key
      String s = blowfish.encrypt("Hello World!");
      System.Console.WriteLn(s); ))
      I.e., if .NET was really as crossplatform and multilanguage as it claims, there should be some way to export a LISP macro. I'm unaware of any way a LISP macro could be sensibly exported to another .NET language.

      Take a look at my original formulation again--

      Show me how to ... export a C++ template, or a LISP macro.

      Hopefully that makes it clear as to what I was talking about--not whether LISP-style macros could be supported in the CLR (they can be), but whether or not they could be exported to other languages (I'm deeply skeptical).
    14. Re:-1: Ill-Informed by gglaze · · Score: 1

      First, I'll ask you to please see my comments in the other response to you...

      As Dijkstra famously said, "Any language which does not change the way you think about programming is not worth learning."

      Ah, classic Dijkstra. At the risk of becoming flamebait for millions of CS-Drones, let me tell you a little something about him - I had him as a professor one semester - he was not always in touch with the real world, aspecially as he got older and the world got older - apparently they seemed to take divergent paths. He may have been dead on in the 70s when he "ingeniously" realized that GOTO was a bad idea, and maybe there was a better way. In fact, even his "brilliant" graph algorithms may have been top-class during his time.

      But the statement above is a classic Djikstra statement, and although I don't specifically recall it, I have no doubt he said it, because it embodies exactly who he was. If in your academic mind you truly believe this, then that's good for you - you have an interesting career ahead of you, always looking for the next paradigm. But in the real world, there are many languages in each paradigm, and sometimes the reason it is "worth" learning a new language is not for academic interest - sometimes it is productivity of toolsets supporting that language, or ability of integration with other technologies, or *shock!* money! In the real world, there are many reasons it might be "worth" learning a new language, even if it's just like another one you already know.

      As it relates to .NET, when people say it supports multiple languages, what they are talking about it the real-world effect of that - the idea is that if I have 2 teams with different skillsets (i.e. one with VB background, one with Java background, but both with new "upgraded" .NET skillsets), I can still have them working together in harmony, with little integration overhead, because .NET provides *this* type of cross-language integration. This whole cross-paradigm thing is extremely interesting, but given that the major market of developers .NET has to target right now are split between C++, VB, and C# - since all of those can be adapted to be OO languages, the market does not really dictate that MS must focus right now on building cross-paradigm tools.

    15. Re:-1: Ill-Informed by rjh · · Score: 3, Interesting

      First, I'll ask you to please see my comments in the other response to you...

      Done.

      In fact, even his "brilliant" graph algorithms may have been top-class during his time.

      As far as I can see, remember, or am concerned, Dijkstra's contributions to computational graph theory are fundamental to the field. If you think they're brilliant-in-quotation-marks, all I can ask is what you've discovered that's comparable.

      That's not meant as an insult or a challenge, incidentally. It's meant to say that in hindsight many things become obvious which required real genius to see them in the first place. Dijkstra's graph algorithms are simple and straightforward, and in hindsight they're obvious--but let's not forget that the only reason they're obvious to us is because Dijkstra had the insight to see, in foresight, what's obvious in hindsight.

      If in your academic mind you truly believe this,

      You keep on calling me that, an "academic". The reality is I'm nothing of the sort except in the sense that I'm a graduate student. I'm a hacker, not an ivory-tower academic. I believe in solving problems and sharing those solutions with the world.

      It's axiomatic that if you're faced with a problem, one of the worst things you can do is stubbornly insist that it be solved with X technique. You have to show some flexibility. You have to be able to approach the problem from different angles. For GUIs, I've found object orientation is almost always best. For scientific programming, I've found template metaprogramming best. For using computers in math theory courses, I use LISP or ML. For writing system-level software, I use C++. Etcetera.

      My insistence on multiple paradigms is unequivocally not born out of "academia", a word which it seems you're using as an insult. My insistence on multiple paradigms is born out of my demand that I use the right tool for the job. .NET claims it will support all programming languages. It doesn't. It doesn't even come close. Once you realize .NET is just another VM that can be more easily targeted by compilers, you realize that "hey, this is ... really ... not all that interesting or useful," as I said in the post which kicked all this off.

      Why is it not all that interesting or useful? Because we already have that with Java. We've got a virtual machine which provides managed services and is targeted by over 60 different languages, all of which can use all the facilities of the other languages once their code has been reduced down to bytecodes. We've got a VM which allows you to interface with the native hardware to get a massive speed boost.

      Am I talking about .NET or am I talking about Java? In this case, Java. (I can't confirm the 60+ languages bit, but that's the number I see. Last I heard, Java supported more languages than .NET, but this gap was rapidly closing and the numbers are a couple of months old.)

      So where is .NET interesting? It was interesting the first time Sun did it with Java. (Or, for us dinosaurs, it was interesting the first time I saw UCSD Pascal do it with their VM.) It's not interesting this second time around.

      Where is .NET useful? If you're married to the Microsoft platform, then I guess it's useful. But really, where's the huge win for .NET over Java? There isn't one. It's an alternative to Java, not really something new and innovative, not something which allows you to solve more problems than Java or even allows you to solve them all that much differently.

      That said, is it useful for Company A, which prefers VB, and Company B, which uses Java, to be able to collaborate on software, each using their preferred language, with their results able to be executed on a shared VM?

      Sure it is. That's not what I mean when I say ".NET is neither useful nor intere

    16. Re:-1: Ill-Informed by gglaze · · Score: 1

      rjh, Not sure if you're still following this thread - if you have some kind of auto-email thing turned on let me know, because I'm a relative /. newbie and have no idea how to set that up if it exists...

      Thanks for taking the time to continue this discussion and write such a thought-out post.

      It's meant to say that in hindsight many things become obvious which required real genius to see them in the first place.

      Totally agree, and in the case of graph theory, as I said, Dijkstra definitely seems to have made a significant contribution, even if many of his findings do now seem somewhat obvious. What I really wanted to point out was the fallacy of the "language worth learning" quote, in that it only uses "worth" in once sense of value, when in fact the majority of people in the world who deal with technology use a completely different set of criteria on which to place the "value" of learning a language - and this usually comes down to $ in the end.

      My insistence on multiple paradigms is unequivocally not born out of "academia", a word which it seems you're using as an insult. My insistence on multiple paradigms is born out of my demand that I use the right tool for the job.

      Let me apologize as I see that it probably sounds like that's the connotation I'm putting on this word. I absolutely don't mean that - I simply mean that in this particular discussion, I am talking more about industry values, because that's what seems most relevant. I am all for the academic interest in alternative paradigms, and to a certain extent I fully agree with what you're saying here - that paradigms are a part of the "right tool for the job" decision. I simply don't believe I've seen this to be the case as much in real-world scenarios. I would love to have a particular area of the projects I work on which is best suited to Lisp, and at the same time to have the appropriate toolset to do so - but today it just isn't happening. Granted - one of the previous companies I worked with was a civil engineering firm, and the architecture of their systems was all about putting the engineering/mathematical models in Fortran, and then integrating that with object-oriented and COM tools on the front end and business layers - but I honestly believe the choice for Fortran was primarily a result of (1) applicable skillsets and low budget for training/upgrading of skillsets; and (2) technical capabilities of the particular toolset (Digital Fortran) in relation to certain mathematical optimizations (i.e. optimized array/matrix calculations); certainly these are great reasons in the real-world, but in what I'm calling the "academic" sense, there is actually nothing really interesting or even nice about this particular cross-paradigm use - if they had the same skillset level and also the same level of mathematical optimizations in a Java toolset, my academic sense tells me that the applications we built would have been much more nicely architected because there is no reason those parts of the application couldn't have taken more advantage of an object-oriented environment.

      Interestingly enough, on the project I am currently involved in, a major strategic part of the project is a business-level "intelligence" layer, which essentially should allow for the development of intelligent strategies to manipulate interaction with the market. Our team made an attempt to build this layer to enable the strategies to be developed fully in an alternative paradigm language. The language is called ILog, and from what I understand, it is some sort of rules-based language, essentially based on pre-conditions and post-conditions, causing certain rules to fire. Unfortunately I wasn't involved on that part of the project, so I don't know much more about it.

      But suffice it to say that this is a case where I can certainly validate your claims - extreme challenges were found when trying to integrate an object-oriented .NET architecture with an engine based on a different par

    17. Re:-1: Ill-Informed by rjh · · Score: 2, Interesting

      if you have some kind of auto-email thing turned on let me know, because I'm a relative /. newbie and have no idea how to set that up if it exists...

      Check your User Page.

      You'll see a dropdown box saying "Comment Reply". Select "Email", then save your changes and you're done.

      That said, I hope you enjoyed that act of friendliness, because I see nothing but disagreements in the near future. :)

      What I really wanted to point out was the fallacy of the "language worth learning" quote, in that it only uses "worth" in once sense of value, when in fact the majority of people in the world who deal with technology use a completely different set of criteria on which to place the "value" of learning a language - and this usually comes down to $ in the end.

      I'm utterly unconvinced that the software industry has any sensible valuation of worth, particularly in the management field. Paul Graham has a great essay on why this is--what it boils down to is management's knowledge of the field and languages is primarily imparted by marketing glossies and marketing departments (either Sun's or Microsoft's, it appears). Hackers' knowledge of the field is primarily imparted by catastrophic disasters.

      As an example of this, Java is being used in a lot of places today where it really shouldn't be. In 2000 during the height of the Java hype, a friend of mine who worked for a major United States bank was driven up the wall by a management decision to migrate all their COBOL apps to Java. "After all," Management said, "COBOL is a dead language and these are fifty-year-old legacy programs."

      To a hacker, COBOL may well be a dead language, but a program that has a fifty-year record of reliability basically swaggers around the RAID array menacing newer programs with <DenisLeary>"yeah, I may be written in COBOL, but I haven't crashed in fifty fucking years, guy, okay?"</DenisLeary>

      So was this major U.S. bank wise in their decision to migrate all their legacy COBOL apps to Java? By your logic, yes, because industry knows the value of software and can properly evaluate things in a dollars-and-cents manner. I'm certain there was a great business case made for this mass migration. I can't imagine what else could make a bank decide to undertake something that risky.

      And after about 150 man-years of work--optimistically, about $15 million of development--the program was abruptly cancelled due to the fabled dollars and cents failing to materialize.

      Wherever you look in the industry there are all sorts of examples like this. In the commercial software industry, I've seen far more projects fail than succeed. How does the industry respond to this? By declaring any software project that comes in at under 500% cost overrun and a year late to be a "qualified success".

      The thing is, we all know this. We've all read The Mythical Man-Month. Most of us--I imagine you do, I know I do--have horror stories about death marches and the Project That Would Not Die And Yet Never Truly Lived, Either.

      Given the spectacularly poor state of software management nowadays, I'm deeply skeptical of any claims that the software industry is in a position to make accurate estimations of value, whether that value be in a financial or a technical sense.

      I'm a hacker. I don't know about how to value software in a financial sense. (I'm heartened by the fact that nobody else does, either.) On the other hand, I do know how to value software in a technical and artistic sense. My estimations will differ from the next hacker's, but in general we can make certain agreements--that COBOL is crufty but COBOL legacy apps that run for fifty years rock, that LISP is woefully underused, that people keep on using C when they really want to be using something else, etc.

      if they had the same skillset level and also the same level of mathema

    18. Re:-1: Ill-Informed by gglaze · · Score: 1

      thanks for the user page tip - i now realize that my profile is already set up for this, but unfortunately i've been receiving all my notifications on my hot[spam]mail account... i'll have to adjust that...

      i'm finding that at least philosophically, we have more agreement than we have disagreement - i certainly don't debate your feelings about what is "interesting" in the software world, or who is able to "accurately" predict software value - for the most part, i entirely agree.

      my point about valuations is not to imply that i believe the method to arrive at those valuations is anywhere near correct or accurate - but the fact remains that while a language like C# may be nothing really new under the sun, there is still "value" in learning it for some (a lot of) developers, because those developers realize that that skillset == $$$ in their particular cases. in this case, developer income == the value or "worth" in learning the new language.

      As a result, I don't see that .NET is doing anything new.

      While the list you've given contains a number of wonderful names, I still stand by my point. The point is that 95% or more of the world's paid developers today are split between Java, VB, and C++ - and maybe Cobol and Fortran still make up a big chunk, but even then the point still stands...

      Thus the "interesting" thing in this case is not a "software-interesting" thing - it is a "marketshare-interesting" thing - MS has released into the programming world the first set of tools *feasably capable* of meeting the needs of a vast majority of developers out there today.

      To do this, you can't just have Java, a bunch of legacy languages, and a bunch of revolutionary new paradigm and scripting languages - you must also have the other staples of the market - thus you must have VB and C++. If for no other reason, this is because stubborn C++ guys are never going to give up, and a miserable majority of VB developers are sadly never going to make it to another environment before they have a career change.

      Not the "interesting" you were hoping for? Hmm, maybe not - maybe not for me either - but for my team which may consist of a few hopeless VB and C++ guys, it makes all the difference.

    19. Re:-1: Ill-Informed by rjh · · Score: 1

      While a language like C# may be nothing really new under the sun, there is still "value" in learning it

      I never said there wasn't. I said it was neither interesting nor useful--that's all. Are there jobs out there which require proficiency in .NET/C#/VB.NET/pick-your-CLRed-language? Sure. There are rather a lot of them in comparison to other older languages. If you're looking for employment, there's a lot worse you can do than adding C#, VB.NET and Java to your resume.

      But that said... there's a difference between "what will increase my income" and "what is interesting or useful".

      Although, with benefit of a few days' hindsight, "useful" may not be precisely the word I'm looking for--English is often admirably precise in its vocabulary, and other times maddeningly vague. I don't mean "useful" in the sense of utility. It's beyond question in my mind that C#/VB.NET/.NET possesses utility, in that it's an effective tool for solving certain problems.

      I mean "useful" in the sense of "advancing the state of the art, and/or making hackers' lives significantly easier". As I've said before, I see very little difference between .NET and Java, save for .NET was designed from the get-go to be targetable by multiple languages (within the same paradigm--not to harp on it, just to make clear that I still think it's not multi-language in any interesting or useful sense), while the JVM was always closely tied to Java and other languages grew to target it more by necessity than design.

      So how does .NET make programmers' lives easier? If your programmers are married to Microsoft and unwilling to broaden their horizons by learning new (non-MS) languages, then yes, I imagine it makes their lives easier. But speaking personally, I don't quite feel comfortable saying that making life easier for the lowest common denominator equates to being "useful".

      By that logic, Terminator 3 is a more "useful" movie than Seven Samurai, because it more successfully catered to the lowest common denominator of moviegoers.

      So--after yet another longwinded post, I fear--my position is basically this:

      C# and .NET are meant to leverage the skills of the lowest common denominator of programmers, at the cost of the skills of the hackers. If a hacker sees that a Scheme continuation would solve a problem elegantly and quickly, s/he can't do that in .NET; the CLR is specifically designed to cater to a totally different sort of programmer than the hacker.

      If you're in an environment where you're surrounded by lowest common denominator programmers, then yes, .NET makes a lot of sense. So does Java, if you can get them to learn a non-MS language.

      But if you're a hacker, look elsewhere. Because there's nothing interesting or useful to you in .NET. It's stuff you've seen before. Learn C# and .NET, if only to put it on your resume and increase your marketability. But don't drink Microsoft's Kool-Aid and think that it's better than sliced bread. It's just another VM which targets a specific paradigm of languages.

  167. Large projects are what matter by Junks+Jerzey · · Score: 1

    Microbenchmarks about string concatenation and method calling are mostly irrelevant. What's important is too see how an implementation scales up to huge programs, say 500,000 lines of code and 1GB of data. There have been plenty of cases of fast languages not scaling up well (like C++), because you have to add so much cruft to hande the kind of problems you hit at that level, and much "slower" languages outrunning them because they were architected for that kind of problem.

    One interesting case is Yet Another Web Server (YAWS), which is written in an interpreted language and completely blows the socks off of Apache under high load.

  168. C# on Unix? by careysb · · Score: 1

    Can I run a C# on a Unix platform?

  169. Except that it isn't true by epepke · · Score: 1

    It's all fine and dandy to say that, with Moore's law obviating the need to be careful.

    That is, up until the point when you have to write some code for a Palm device, or a cell phone, or even a wristwatch. Then all of the old virtues become relevant again.

  170. Re:why then isnt GENOME 100% in hava and 500x smal by deanj · · Score: 1
    oh and you wont see j2me on pocketpcs

    BZZZT! Wrong answer. Thanks for playing.

  171. Parse error by Mr+Z · · Score: 1
    makes you use readable form doe snot

    Talk about a typo making you do a double-take. Thanks for the visual. Now I'm imagining deer with runny noses trying to drink coffee.

    --Joe
  172. Re:#insert by Ear+Phantom · · Score: 1
    First, I want to respond to the notion that generics in Java are "mythical." They are indeed very real; it is a legitimate JSR already developed by the Java community. I can assert (no pun intended) that the capability for generics has been in the Java compiler since 1.3, but has been stubbed out for several years to avoid rolling out significant language changes in short amounts of time (thereby breaking people or getting them too frustrated at keeping up with change). It's a simple switch to the compiler to turn it on, and you can preview them at your leisure here.

    Now, in response to the above thread, the type system in Java was a deliberate choice, not "a bug." Sure, it's ugly. Sure, it's inconsistent. Howevever, it's been extremely successful--it was more in appearance like C++, so that businesses were more quick to adopt it. Smalltalk and Lisp have been around for decades, but how many businesses out there use them?

    Anonymous Brave Guy is correct, generics are NOT templates, or even close to their "power." A lot of people are really into power. One can stockpile their home with bigger and bigger armaments; personally, I'd rather not live with a few live grenades under my pillow.

    You see, I have also been in the receiving end of having to debug C++ templates. You can only lose so many brain cells doing this intricate exercise before realizing that what efficiency and elegance was gained during development was lost many times over during maintenance. It's very sad but true.

    I've seen C macros used and abused to redefine the language until it wasn't even C anymore, and I've seen C++ templates overload the syntax of operators until a pointer wasn't a pointer anymore and you have no idea what you are looking at or even what

    &A->foo
    means. The real question is, why would anyone in their right mind want to, especially when so many easier options exist?
  173. ready for primetime in smaller applications as wel by Anonymous Coward · · Score: 0

    Its sure not ready for my set top channel guide. That thing was programmed in Java and it takes me 90 seconds to scroll through all my TV channels.

  174. I wish that were true (and a question). by Stone316 · · Score: 1
    But from my experience, which is rather limited, i've run into different bugs on different OS's because of problems in the jre.

    When you guys write java applications/applets, do you state they need a certain version in order to run it? I coded a simple web application that worked well within Jdeveloper but when I loaded it into tomcat I had a ton of trouble with different browsers and I can only assume that if I actually made this accessible to the internet i'd have a dozen different browsers and versions of the jre trying to connect.

    How do you get past those issues?

    And also, i've had tons of GUI issues between linux and windows. For some reason the fonts used in linux are larger and it makes the whole thing look messy.

    --
    "Thanks to the remote control I have the attention span of a gerbil."
    1. Re:I wish that were true (and a question). by Cnik70 · · Score: 1

      When I write any application, be it a full blown java app, an applet, a JSP class/page, whatever. I assume that it's going to be run under alot of different circumstances. This is why I take full advantage of grabbing any and all system properties to adapt to my working environment. Just like a web programmer has to deal with different browsers, you have to assume that the user of you program may not be using what you had in mind. So you either warn them or adapt to them. This is what I like about java though. It really can be a chameleon, whereas other platform dependent languages tend to be touchy as to if they will work under varying conditions (even WINE cannot handle all Windows apps).

      --
      -Cnik
  175. Not really accurate.. or fair to Java by cmburns69 · · Score: 1

    This is not exactly an accurate test. In many cases the author states that since the "stock" version of the feature runs slow in C/++, he has provided a replacement.

    Any truly accurate test would have to ignore most of the "stock" implementations in all languages. The composer of the study would also have to be equally skilled in the languages, for the test to be accurate.

    It would also be good to know which JVM he was using to test with. I assume it is the one he used to compile with (JDKSE 1.4.1-02 by Sun). The Sun reference versions have been shown in other tests to be inferior to implementations by other vendors. As we can see here, different implementations have VERY different performances.

    To sum up, while this may be a fair comparison between C# and the C derivatives, it does not seem to be an objective study of ALL of the langauges tested.

    --
    Online Starcraft RPG? At
    Dietary fiber is like asynchronous IO-- Non-blocking!
  176. Re:#insert by StillNeedMoreCoffee · · Score: 1

    "If you didn't already know that, please read it again and understand it before proceeding."

    Well there is that effect of a people taking bad language features and accepting them as good things because they can do very clever things with them which are un-intended conscequences of language features.

    The new Java generics are not a macro capability. They are actually integrated into the language and are just a syntax with symantics. There are no macro/pre-processor side effects nor opportunities like C++ Templates have.

    Some of the issues you might consider are what object oriented programming means vs. what strong typing means. There are some languages that combine the two but others that don't. They are different features with different goals.

    Smalltalk is Object oriented with objects having a type and respond to services. Its clean, expressive and tremendously powerful. I would say many times more powerful than C++ in its power to express ideas simply and cleanly. Variables don't have type, they don't need to, objects have type from the class they are an instance of. You don't need templates, you never needed templates.In the object world template are meaningless. You do, however, have to adopt very good discipline to not have runtime errors, but those runtime errors are relatively soft and harmless.

    In a Dynamically Typed language like Smalltalk, you can have a collection of object (of different types, in object terms thats just different objects) without trouble. Maybe you have different business objects that you want to queue up and process. You don't need to have them all from the same class (or ancestor class, base class for you C++ only programmers) to put them into the queue. You don't need to have them service all the same messages to put them into the queue (this is a requirement for strongly typed languages, you use downcasting to get around that). You can ask the object what it is and route it or use double dispatching to do that in a more OOPs way. That is a much more powerful scheme that the 2 dimesional one that the strong typing places opon you. Your entire system's design is controlled fundementally by this strong typing requirement. You give up so much power to have the safety of strong typing. Programms written in OOP's system with strong typing and without are very very different.

    So strong typing in C++ came from C and is a non-object oriented technique/restriction on the language to try and move some potential programming errors from run-time back to compile time. So I am sure we would all agree that this feature in C and in C++ has made those coding environments runtime bug free. (pause for laughter).

    Templates are a way for C++ to have a facility that to not have to copy and retype every damn queue, stack, list, tree .. structure if you wanted to use that structure again. Make no mistake, C++ did not have this feature originally. They were a response from the OOP community that the language had thereby not very useful. OOPs which promises re-use wasn't there yet. The language actually fought re-use. It was added so that it could patch a serious deficency in the language against other languages like Smalltalk that were competing for OO programmers back then. The strong typing of C prevented C++ from being a serious language because of this lack of re-use. So Template were needed to make C++ viable and people have found that the way there were implemented that you could use it for things it was not intended for. Which means of course that there is no hope of fixing the problems with template (oh sorry features) which allow it to be used for compile time metaprogramming. It as a language feature acts outside the language more like a pre-processor exention.

    Java on the other hand adopted a more purely Object Oriented approach, with every class having a common ancestor class (in C++ you for some reason call it a base class, whats that all about, well windows calls them folders not directories..) the Object class which

  177. Re:#insert by Jim+the+Bad · · Score: 1

    one.cc:

    #include "two.cc"

    two.cc:

    #include "one.cc"

    Of course, this will cause a precompiler stack-overflow, but of course, to be Turing-complete assumes a machine with infiniate storage.

    --
    -- And when Justice is gone, there is always... Force. --Laurie Anderson, "Oh Superman"
  178. well put by pyrrho · · Score: 1

    >I guess any language ends up indirectly making you think in a different way. Maybe that's the magical part.

    you are correct but let me clarify.

    I claim that C/C++ never takes you away from how the machine works... the way it makes you think is "like the machine thinks"... so it can introduce OO concepts, but not to the point they conflic with how the machine works.

    --

    -pyrrho

    1. Re:well put by pyrrhonist · · Score: 1
      I claim that C/C++ never takes you away from how the machine works... the way it makes you think is "like the machine thinks"... so it can introduce OO concepts, but not to the point they conflic with how the machine works.

      Yes, I agree with that. C++ doesn't entirely disconnect you from the machine.
      This is either one of C++'s strong points, or weak points depending on how you look at it. I think it's a strong point personally.

      So here's a question: Does the same argument hold for Java, where the machine in this case is the Virtual Machine?

      --
      Show me on the doll where his noodly appendage touched you.
    2. Re:well put by BlackHawk-666 · · Score: 1
      Gah, I have to begrudgingly disagree with this statement. C++, although getting you "closer" to the metal is by no means an assembler equivalent. It has high level language constructs like looping and branching for which there are no real equivalents at the machine level...and no, a JMP LNG is no more a looping construct than it is the fallthrough on a conditional jump.

      C++ also has a reasonble library of code that can help abstract OS issues to aid portability e.g. streams, etc.

      --
      All those moments will be lost in time, like tears in rain.
    3. Re:well put by pyrrhonist · · Score: 1

      I don't think we disagree with that either. We're just saying that C++ doesn't abstract everything away from the way the machine works. For instance, in C++ there is the register storage class, which other languages don't have an equivalent to.

      --
      Show me on the doll where his noodly appendage touched you.
    4. Re:well put by Hognoxious · · Score: 1
      C/C++ never takes you away from how the machine works... the way it makes you think is "like the machine thinks"...
      If that's what you want, there's a language that's been around for years.

      Oddly, it's not called Earlgrey, Abraconda, or Stutter.
      Nor is it Modulo17, BigBen, E, or Yacblase.

      It's called machine code.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  179. Benson Mates by pyrrho · · Score: 1

    I had the pleasure of taking a class on skepticism from Benson Mates at Berkeley, while he was finishing his translation of Sextus' Outlines of Pyrrhonism...

    Ok, it's a little tacky to name drop in general... but cool, eh?!

    --

    -pyrrho

    1. Re:Benson Mates by pyrrhonist · · Score: 1
      Ok, it's a little tacky to name drop in general... but cool, eh?!

      That's very cool actually. That must have been sometime around 95-96 or so.
      I'm jealous, when I get the opportunity to learn from a decent scholar like this, it's usually when I'm too busy and can't go. :(

      --
      Show me on the doll where his noodly appendage touched you.
    2. Re:Benson Mates by pyrrho · · Score: 1

      ~1991 iirc.

      --

      -pyrrho

    3. Re:Benson Mates by pyrrhonist · · Score: 1

      Ahh, I was just a tad off there. Does he teach logic as well?

      --
      Show me on the doll where his noodly appendage touched you.
    4. Re:Benson Mates by pyrrho · · Score: 1

      He was retired already at the time and taught only special classes, e.g. he taught this class as a way of going through his translation.

      He was primarilly a logician, and not a skeptic. It was clear he was very in love with skepticism as a subject of study, but as a logician primarilly I think he was not inclined to advocate it directly... which in a way made him a pyrrhonist. :)

      He loved it because of the logic no doubt, and the fact that despite years of trying, no one has ever logically refuted skepticism. He used to say, he was waiting for some of his Positivist colleagues to come up with something, but really, no one ever did.

      I think his logic textbooks were used widely for undergraduate first order logic classes... but I don't really know, one of his books was used in my logic courses, but of course, he was a professor at the school I went to, and they lean toward that sort of thing.

      I don't know a lot about him, actually, but I was told he was a well respected logician, and I do know that logic was his main area of expertise/study.

      --

      -pyrrho

    5. Re:Benson Mates by pyrrhonist · · Score: 1
      He was primarilly a logician, and not a skeptic. It was clear he was very in love with skepticism as a subject of study, but as a logician primarilly I think he was not inclined to advocate it directly... which in a way made him a pyrrhonist. :)

      Cool, that's what I thought. He's got a book called Skeptical Essays, besides the translation of Sextus Empiricus, BTW. It looks like it could be interesting.

      I don't know a lot about him, actually, but I was told he was a well respected logician, and I do know that logic was his main area of expertise/study.

      Me either, I just knew that he had a book on logic. Now I know he's got some books on skepticism as well. Thanks for that information.

      --
      Show me on the doll where his noodly appendage touched you.
  180. Re:#insert by Anonymous+Brave+Guy · · Score: 1
    Well there is that effect of a people taking bad language features and accepting them as good things because they can do very clever things with them which are un-intended conscequences of language features.

    Indeed. That effect is responsible for many of the most useful advances in programming technique since forever.

    Java's generics are not even close to the power of C++ templates. They are glorified macros to fix a bug in the type system that should never have been there.
    Not so, of course, one might argue that Templates were added to C++ to patch a hole in there Object Oriented system that should not have been there.

    One might argue that, but it wouldn't have the same relevance. C++ is designed, from the start, to be a multi-paradigm language. By Stroustrup's own admission, templates probably should have gone in earlier. However, as it stands today (and has for many years) C++ is not a purely OO language, nor meant to be one. Keeping the fundamental types clear of the OO baggage is one reason compiled code in C++ can be so efficient.

    Java, on the other hand, has hyped OO from day one. It maintains that everything is an Object, and non-OO programming is inferior. Hell, for years, Java evangelists have claimed that templates are a bodge and they don't need them. In that context, having your primitive types not being Objects is just plain out of place. It leads to rather absurd concepts like the wrapper types, and those in turn to "boxing", which is a poor man's excuse in a language that doesn't properly distinguish between value and reference semantics.

    The only thing I can think of reading your opinion is that you are young, were not around when C++ was first introduced, did not know its progression, do not have a keen understanding of why we have strong typing or OOPs, or what each is for.

    I'm afraid I'd like a little more credit than that. I've been using C++ for more than a decade and Java for several years, and I've got more than a passing familiarity with ML, Python, Perl, various assembly languages and several more besides. I have an active interest in language design, and am familiar with a lot of the background theory, including structured programming, lambda calculus, formal type deduction systems and the principles of OO.

    And by the way, you seem to confuse the concepts of strong/weak type systems with static/dynamic ones. There's a very significant difference, and all four combinations are possible.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  181. quote: "the CLR integrates all prog. languages" by brlewis · · Score: 1

    Straight from Microsoft's own propaganda:

    The common language runtime comes into play by allowing individual components of specific applications within a company to communicate. Through its standard set of types--self-describing type information (meta data) and common execution environment--the common language runtime integrates all programming languages and allows objects created in one language to be read with equal weight by code written in a different language.
    1. Re:quote: "the CLR integrates all prog. languages" by gglaze · · Score: 1

      Yes, but in the same phrase it then says "...allows objects..."

      Clearly the domain of "languages which can understand objects" is implied. furthermore, although this is not written in the most straightforward way, "all languages" is clearly meant to imply all languages in the domain of ".NET-enabled programming languages".

      In any case, I don't care much for this marketing spheel. I was under the impression that we were discussing the actual real-world multi-language capabilities of the CLR. Clearly .NET does not support "all programming languages", so any argument derived from a marketing statement based on that premise is flawed from the start.

    2. Re:quote: "the CLR integrates all prog. languages" by rjh · · Score: 1

      "all languages" is clearly meant to imply all languages in the domain of ".NET-enabled programming languages".

      Sorry, but I call bullshit on this one.

      All languages equals all languages. To say "all languages" and then subtly change the meaning of "all" to "object-oriented languages only" (when OO languages are a small part of the programming language world, and often not the optimal choice) is to engage in sophistries that not even lawyers would use.

      All means all. And when Microsoft says the CLR supports all languages, they can only mean it in the very tenuous manner by which they'd say "... well, it is Turing-complete, you know."

      CLR supports C# and subsets of the C# functionality. That's it--bam--period--end of sentence. While technically you can get away with non-C# subsets in some languages, you do so at the price of throwing away everything that's good about the CLR. For that reason, I stand by my original statement (long since forgotten in this thread, I'm sure):

      CLR and .NET are not multilanguage in any useful or interesting sense. In order to be multilanguage in a useful and/or interesting sense, it would have to support a wide variety of programming paradigms. It doesn't. It doesn't support such wonderfully cool things as LISP object-orientation, Scheme continuations, PROLOG declarative logic... it supports the OO paradigm, which is today's Buzzword Bingo word. If it's going to be useful tomorrow, it needs to support a lot more than that.

      Look at LISP. It's going on sixty years old and it's still being used. Why? Because it supports lambda calculus and functional programming--it supports OOP--it supports procedural programming--it supports logic-based programming--name the paradigm; LISP supports it.

      C++ is much the same way. It supports procedural, OO and templatized programming out-of-the-box, and you can do functional programming in C++ without too much unpleasantness if you're willing to use the STL and do template metaprogramming.

      I expect LISP and C++ will still be used in 30 years. No, I'm not kidding. I don't think they'll still be used in their present forms, but I do expect they'll still be around.

      I'll be very surprised if Java and .NET survive that long.

    3. Re:quote: "the CLR integrates all prog. languages" by gglaze · · Score: 1

      CLR and .NET are not multilanguage in any useful or interesting sense. In order to be multilanguage in a useful and/or interesting sense, it would have to support a wide variety of programming paradigms.

      This statement may be true in your academic mind, but in the real world, .NET is clearly multi-language for all practical purposes. Just because you refuse to make a distinction between "cross-language" and "cross-paradigm", it does not follow that no such distinction exists. .NET supports more than one language, hence it is multi-language. How much simpler can it be?

      In regards to the rest of your comments regarding more historically interesting languages, and their likelihood of sticking around for a while - I am all on board with you. Lisp has long been one of my favorite languages, primarily because for me (and I'm sure others as well) a way of recursive thinking suits me better. I certainly won't disagree with you on the academic points, nor on your points about what may remain in the distant future. However, in the real world, and in the domain where this discussion started, the here and now is what was supposed to count.

      The day I can find a job working on Lisp projects as interesting (in a business sense, not an academic sense) as the projects I work on in .NET are, let's continue this discussion.

  182. Debugging templates by Anonymous+Brave+Guy · · Score: 1

    It's true that debugging templates can be a royal PITA, but that's really down to the quality of your development environment, and things are improving. The thing is, you only have to debug the templated code in your library once, and then you get cleaner higher level code forever -- and that cleaner code is much easier to debug thanks to templates and operator overloading, because the logic errors are easier to spot.

    Incidentally, anyone who uses Visual Studio might care to note that you can do a lot with AUTOEXP.DAT to simplify debugging when working with complex UDTs, templated or otherwise.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  183. Scheme implementation of lisp-fanatic? by brlewis · · Score: 1
    There's a bug in your program. Map always returns a list, which is a true value; not what you intended. I think if you had used a macro things would have been clearer. Pardon the lack of indentation; I can't seem to strongarm Slashdot into including it.
    (define-syntax all
    (syntax-rules ()
    ((all pred? arg ...)
    (and (pred? arg) ...))))

    (define (lispy? str)
    (string-index str "lisp"))

    (define (lisp-fanatic? username body sig)
    (all lispy? username body sig))
    1. Re:Scheme implementation of lisp-fanatic? by Waffle+Iron · · Score: 1

      By gosh, you're right. I've been using too much Python.

  184. Re:#insert by Anonymous+Brave+Guy · · Score: 1

    Something like this ought to do it.

    template <int N> struct Counter {
    static const int value = Counter<N+1>::value;
    };

    I guess you'll get integer wraparound in the compiler breaking that eventually, but if you had arbitrarily large N available, as Turing-based stuff pretty much implies, then it would recurse indefinitely, no?

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  185. Re:#insert by StillNeedMoreCoffee · · Score: 1

    "However, as it stands today (and has for many years) C++ is not a purely OO language, nor meant to be one. Keeping the fundamental types clear of the OO baggage is one reason compiled code in C++ can be so efficient."

    This is true, but I would counter that C++ was never designed to be a purely OOPs language.

    "templates probably should have gone in earlier."

    I agree that the templates gave C++ something it lacked and made it a viable language for OOP type development. It also allowed re-use and with the STL some form of collection classes. Which are needed if you want to program at any level above assembler c-esk programming. Much of C++'s strength comes from its ability to couple these to very different paradigms. This is especially useful when you are writting code that has to have maximum performance. That perfomance is often a compromise of good coding practice.

    " It maintains that everything is an Object, and non-OO programming is inferior. Hell, for years, Java evangelists have claimed that templates are a bodge and they don't need them. In that context, having your primitive types not being Objects is just plain out of place"

    Well it is the paradigm and most any system can be coded as a series of ADT's as a veiw to algorithm creation. That everything is an Object really comes from Smalltalk for with everything really is an object from the programmers point of view. It is the compilers choice (an ADT if you will) to implement that more or less efficiently. Java having primative types I feel was a hold over from C++ and made some of the compiler choices probably simplier. After all it was originally designed for set top boxes.

    "It leads to rather absurd concepts like the wrapper types, and those in turn to "boxing", which is a poor man's excuse in a language that doesn't properly distinguish between value and reference semantics."

    Well this is true but gate back to my other comment about the compiler as and implimention of the ADT that is the language itself. It does not matter really what it does as long as the contract you have with it is maintained about the expected result. That is the compiler creates a program that is logically and/or mathematically equivalent to what you said you wanted done. The new autoboxing will make that disappear from view as it should. This feature like C++'s template should have gone in from day one. But you know what perfect hidsight looks like.

    "And by the way, you seem to confuse the concepts of strong/weak type systems with static/dynamic ones. There's a very significant difference, and all four combinations are possible."

    Well I don't really confuse them but thanks for pointing that out. C++ also allows seperating what I term "data polymorphism" from "functional polymorphism" i.e. allowing a variable to point to different objects, but some of the behaviour are not overridden by the sub-classes code. So you can get all sorts of combintions of questionally usefull and complex relationships in your programs. I think of it as OOP's rococo.

    I prefer to keep the model simple. It is much easier to write, understand and maintain.

    I appologize for my critcism of your being young. but I do feel that your programming world revolves around those application and problem domains for which C++ is a good fit. Mine does not and never has been. In that I have been involve in application that solved problems quickly or problems that needed to added to or maintained over relatively long periods of time. (you know those projects that started out as only to have 6mo lives but end up many years later still useful and in use). For what I do, the OOP paradigm saves much time, the language features in Java such as garbage collection mean that I don't have to spend time engineering things that have absolutely nothing to do with the task at hand. The OOP's modeling has a close fit for the problems (business problems) that need to be solved. So my experience comes up through, Fortran, algol, PLI, C C++ Smalltalk, Java, and all the side languages and scripting as well.

  186. Writing correct code in C++ by Anonymous+Brave+Guy · · Score: 1
    What are your views on the difficulty of writing correct code in C/C++ versus say Java or C#?

    The question wasn't directed to me, but I hope you won't mind if I chime in here.

    Modern C++ allows you to cut out whole classes of errors by following just a few simple rules. If you're interested, here are some starting points to consider.

    • You should almost never use a "raw" array. Arrays are a primitive, low-level tool. In higher level code, they are best replaced by container classes. The standard library provides several useful basic cases: vector, string, list and map are perhaps the most useful. These are all more powerful and safer than raw arrays.
    • You should almost never use a "raw" pointer. For many tasks where pointers were used in C, references are a cleaner and safer solution in C++. For simple dynamic memory allocation, "smart pointer" classes are both more powerful and safer: the standard library provides the somewhat limited auto_ptr, and several more are widely available. For complex data structures involving many indirections, smart pointers are a good starting point, and may be enough even in quite complicated cases. If not, you can build your own tools using the same ideas, and then use these in your higher level code.
    • Understand the "resource acquisition is initialisation" idiom, and use it religiously. It's mentioned in several of the better textbooks, and I'm sure a quick web search will find you an explanation. This idiom is the basic reason why containers and smart pointers are safer than the raw equivalents. Using it always will pretty much guarantee that you never leak a resource -- memory or otherwise -- from a C++ program again.
    • Read Josuttis's book on the standard library.
    • Visit Boost. There are many wonderful toys here, some fixing basic limitations the standard library forgot, some useful general purpose tools (such as various smart pointers, as mentioned above) and some just awesomely powerful extensions (full blown libraries for regular expressions, expression templates, and other goodies).

    If you're interested in learning how to program C++ safely, cleanly and efficiently, I promise you that all of the above are worthwhile investments of your time. When you're done, you'll find it even more offensive that so many C++ programs have memory leaks, buffer over-run vulnerabilities and seg faults through following NULL pointers. Your programs won't, though.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  187. Anders Hejlsberg - interview by hackrobat · · Score: 1

    Sometime back, I had posted a review of a 1999 interview of Anders Hejlsberg.

  188. They can't be using this at Microsoft! by mdonalds · · Score: 0, Troll
    Here are my observations after an hour:

    - The Visual Studio IDE isn't as good as eclipse. In fact when I think about it, it sucks.

    - The IDE's refractoring is no existant. This is fine if you're copying existing design/code or working on something Mickey Mouse.

    - Define an ArrayList add two items. Now how many items do you think will be in the set. 2? Nope, some other amount. And therefore you constantly need to TrimToSize to the empty items. This sucks big time.

    - Threads. Better than Java is some fringe areas, but far worse in key areas. Like how threads aren't reuseable. This leads to more code. Sucks again.

    - foreach is ok. But big deal!

    In summary, C# is just like Java, renamed and changed slightly, slightly better in minor ways, and really overworked and dud in key areas. I perfer languages/libraries that are clean, simple and logical. C#'s aren't.

    There's no way Microsoft developers use this or SourceSafe!

    1. Re:They can't be using this at Microsoft! by Anonymous Coward · · Score: 0
      Threads. Better than Java is some fringe areas, but far worse in key areas. Like how threads aren't reuseable. This leads to more code. Sucks again.

      Threads are reusable, but every call has to go through a delegate and you have to manage the sleep cycle yourself. I guess Microsoft forgot the reason why Java spec uses strong monitoring to make reusing threads consistent and reliable. I've read two books that specifically cover .NET threading and both of them sucked. The topic of building and using a pool of threads in a robust and reliable way is summarized with "use semiphores, sync and strong monitoring." Like I trust a VB programmer to learn OOP and multi-threading under RAD deadlines. Don't think so.

  189. Dinosaurs of the world unite by Spinality · · Score: 1

    > We could have had a modern Multics. Instead we have VMS (AKA WinNT) and Unix, all over again.

    Exactly. I've said the same thing in the same words. In those days, the pace of hardware advance was largely managed (and shrouded) by IBM. Their hegemony, like Microsoft's, shaped the development of the industry. We pay the price today.

    Though I'm not sure that the practitioners 'missed the ramifications' of the advances, as you say. We saw that new, faster CPU models came out every year; that memory footprints expanded rapidly; that DASD got bigger and faster. We saw small computers come onto the scene, first with 4K, then 8K, then 32K. We saw bitslice microprocessors arrive and said "Damn, with some AMD 2901's I could build a perfect instruction set." We realized that the little machines would proliferate.

    But being able to glimpse the future doesn't mean you can change it or profit by it. Suppose you and I and a few pals had sat down and BUILT that 'modern Multics' you mention. It would probably have been squashed by market forces, the same fate of many promising systems. Our investment would probably have gone down the tubes. We would have been better spending our time and money on a BASIC interpreter.

    For example, in 1979-82, two partners and I built what today would be called an object-oriented message-passing microkernel multiprocessor operating system. This was not an academic project but a commercial venture. It totally kicked butt. And it totally died as a business venture. Oh well. The Ellisons and Gates of the world always triumph. <sigh>

    --
    -- We all have enough strength to endure the misfortunes of other people. La Rochefoucauld
  190. portable assembler by pyrrho · · Score: 1

    that's why C has been called a portable assembler, and C++ mol follows in that vein.

    All the power of machine code, but you get to use function names, structure definitions, class syntax, type checking... etc.

    C/C++ do a lot of that nasty work involved with machine code (and indeed, most assemblers also provide some such features, but far less than C), such as working out the offsets and aligning for structures.

    It's called the best of both worlds.

    --

    -pyrrho

    1. Re:portable assembler by Hognoxious · · Score: 1
      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  191. too true by oliverthered · · Score: 1

    I tend to prototype using STL and then redesign performance critical areas.

    The good choice of design patterns help reduce the complexity and bug count.

    Heigh performance/ low footprint techniques such as copy on modify and lock pre-emption can ?easly? be coded in C/C++, but you need a whole framework that is far out of the reach of STL &co.

    --
    thank God the internet isn't a human right.
  192. It's obvious you're an academic! by tommck · · Score: 1
    You actually write concisely and properly!


    (That, and you like LISP!) ;-)

    T

    --
    ---- It puts the lotion on its skin or else it gets the hose again. It does this whenever it's told.