Slashdot Mirror


C# Under The Microscope

For anyone not following the story thus far, C# is here, courtesy of Microsoft, Anders Hejlsberg, and a raftload of other languages from which its features are derived (or added to). Napster's Nir Arbel here dissects what C# means to programmers used to other languages, and explains a bit about where it fits into the grand scheme of things. Be warned: Nir takes a pragmatic, low-dogma approach which may be unsettling to some readers. Please watch your head.

To Begin at the Ending

I'm a big fan of programming languages, possibly more than of actual programming. Every once in a while I hear about this new language that is just "brilliant", that "does things differently" and that "takes a whole different approach to programming". I typically then take the necessary time off my regularly scheduled C++ programming, learn enough about the language to get excited about the new one, but not enough to actually do anything useful with it, rave about it for a couple days, and then quietly and without protest go back to my C++ programming.

And so, when I learned of Microsoft's new up-and-comer, C# (pronunciation: whatever), I became duly excited and went forth to learn as much about it as possible.

Last things first: On paper, C# is very interesting. It does very little that's truly new and innovative, but it does do several things differently, and through this paper I hope to explore and present at least some the more important differences between C# and its obvious influences: C++ and Java. So, skipping the obligatory Slashdot "speaking favorably of Microsoft" apology, let's talk about C#, the language.

How is it like Java/C++?

In the look & feel department, C# feels very much like C++. More so than even Java. While Java syntax borrows much of the C++ syntax, some of the corresponding language constructs have a slightly different form of use. While this is hardly a complaint, it's interesting to note that the designers of C# went a little further in making it look like C++. This is good for the same reason it was good with Java. Being a professional C++ programmer, I use C++ way more than any other language. Eiffel, for instance, has a much cleaner syntax than either C++, C# or Java, and at face value it does seem as though one should bear with new syntax if this is going to lead to cleaner, more easily understandable code, but for an old dog like myself, not having to remember so much new syntax when switching to another language is nothing short of a blessing.

C# borrows much from Java, a debt which Microsoft has not acknowledged, and possibly never will. Just like Java, C# does automatic garbage-collection. This means that, unlike with C and C++, there is no need to track the use of created objects, since the program automatically knows when objects are no longer in use and eventually destroys them. This makes working with large object groups considerably simpler, although, there have been a few instances where I was faced with a programming problem where the solution depended on objects *not* being automatically destroyed, as they were supposed to exist separate from the main object hierarchy and would take care of their own destruction when the time was right. Stroustrup's vision of automatic garbage-collection for C++ sees automatic garbage-collection as an optional feature, which might make the language more complicated to use, but would allow better performance and increased design flexibility.

One interesting way in which C# deals with the performance issues involved with automatic garbage collection is that of allowing you to define classes whose objects always copy by value, instead of the default copy by reference, which means there is no need to garbage- collect such objects. This is done, confusingly enough, by defining classes instead as structs. This is very different from C++ structs, which are defined in exactly the same way; C++ structs are just classes where members are public by default, instead of privately. Another idea that was lifted directly off Java, and one which turned out to be very controversial is that of multiple inheritance. In what seemed like a step backwards, Java did not allow you to define classes that inherit from one than one class. Java did let you define "interfaces", which work like C++ abstract classes, but were semantically clearer: an interface is a functional contract that declares one or more methods. A class can choose to "sign" such a contract by inheriting it, and providing a working implementation for every method that the interface declares. In Java, you can inherit as many interfaces as you want. The rationale to all this being that multiply inheriting more than one class raises too many possible problems, most notably that of clashing implementations and repeated inheritance. On a side note, the cleanest separation between interface and implementation that I know of is that of Sather, where classes can provide either implementation or interface, but not both.

So what else is new?

One new feature that I mentioned already was that of copy-by-value objects. This seemingly small improvement is a potentially huge performance saver! With C++, one is regularly tempted to describe the simplest constructs as classes, and in so doing make it safer and simpler to use them. For example, a phone directory program might define a phone record as a class, and would maintain one PhoneRecord object per actual record. In Java, each and every one of those objects would be garbage collected! Now, Java uses mark-and-sweep in order to garbage collect. The way that this is done is this: the JVM starts with the program's main object, and starts recursively descending through references to other objects. Every object that is traversed is marked as referenced. When this is done, all of the objects that aren't marked are destroyed. In the phone book program, especially if there are thousands and thousands of phone records, this can drastically increase the time that it takes the JVM to go through the marking phase. In C#, you'd be able to avoid all this by defining PhoneRecord as a struct instead of a class.

Another thing that C# does better than Java is the type-unification system. In Java, all classes are implicitly descendents of the Object class, which supplies several extremely useful services. C# classes are also all eventual descendents of the object class, but unlike Java, primitives such as integers, booleans and floating-point types are considered to be regular classes. Java supplies classes that correspond with primitive types, and mapping an object-value to a primitive value and vice versa is very simple, but C# makes it that much simpler by eliminating that duplicity.

Personally, I found C# support of events to be a very exciting new feature! Whereas an object method operates the object in a certain way, object events let the object notify the outside world of particular changes in its state.. A Socket class, for instance, might define a ReadPossible event or a data object might release a DataChanged event. Other objects may then subscribe for such an event so that they'd be able to do some work when the event is released. Events may very well be considered to be "reverse- functions", in the sense that rather than operate the object, they allow the object to operate the outside world, and in my programming experience, events are almost as important as methods themselves.

While you could always implement events in C by taking pointers to functions, or optionally in C++ and Java by taking objects that subclass a corresponding handler type, C# allows you to define class events as regular members. Such event members can be defined to take any delegate type. Delegates are the C# version of function pointers. Whereas a C function pointer consists of nothing but a callable address, a delegate is an object reference as well as a method reference. Delegates are callable, and when called, operate the stored method upon the stored object reference. This design, which may seem less object-oriented than the Java approach of defining a handler interface and having subscribers subclass the interface and instantiate a subscriber, is considerably more straightforward and makes using events nearly as simple as invoking object methods.

Events are one example of how C# takes a popular use of pre-existing object-oriented mechanisms and makes it explicit by giving it a name and logic of its own. Properties are another example, even though they're not as much of a labor-saver as events are. It is very commonplace in C++ to provide "getters" and "setters" for private data members, in order to provide controlled access to them. C# treats such "protected" data members as Properties, and the declaration syntax of properties is such that you have to provide getter and setter functions for each property. In fact, properties do not have to correspond to real data members at all! They may very well be the product of some calculation or other operation.

And then, by far the ugliest, most redundant and hard-to-understand language construct in C# is the Attribute. Attributes are objects of certain types that can be attached to any variable or static language construct. At run-time, practically anything can be queried for the value of attributes attached to it. This sounds like the sort of hack someone would work into a language ten years after it's been in use and there was no other way to do something important without breaking backwards compatibility. Attributes are C#'s version of Java reflection, but with none of the elegance and appropriateness. In general, and especially in light of C#'s overall design, the Attributes feature is out of place, and inexcusable.

What is it missing? Being an unborn language, there is much that C# does not yet promise to deliver, and for which it can't be criticized. First of all, there is no telling just how well it would perform. Java is, in many ways, the better language but one of the prime reasons it's been avoided is its relatively slow performance, especially compared to corresponding C and C++ implementations. It's not yet clear whether C# programs would need the equivalent of a Java Virtual Machine or whether they could be compiled directly into standalone executables, which might positively affect C#'s performance and possibly even set it as a viable successor to C++, at the very least on Windows. While there is much talk of C# being cross-platform, it is unclear just how feasible implementing C# on non- windows platforms is going to be. The required .NET framework consists of much that is, at least at the moment, Windows specific, and C# relies heavily on Microsoft's Component Object Model. All things considered, setting up a proper environment for C# on other platforms should prove to be a massive undertaking, that perhaps none other than Microsoft can afford.

Furthermore, while there is mention of a provided system library, it's not clear what services such a library would provide. C++ provides a standard library that allows basic OS operations, the immensely useful STL and a powerful stream I/O system with basic implementation for files and memory buffers. The Java core libraries go much further by providing classes for anything from data structures, to communications, to GUI. It is yet to be seen how C#'s system library would fare in comparison.

One thing that's sure to be missing from C#, and very sadly at that is any form of genericity. Genericity, such as it is implemented in C++, allows one to define "types with holes". Such types, when supplied with the missing information, are used to create new types on the spot, and are therefore considered to be "templates" for types. A good example of a useful type template is C++'s list, which can be used to create linked-lists for values of any type. Unlike a C linked-list that takes in pointers to void or a Java linked list that takes Object references, a list instantiated from the C++ list template is type-safe. That is to say, it would only be able to take in values of the type for which it was instantiated. While it is true that inheritance and genericity are often interchangeable, having both makes for a safer, possibly faster development platform.

The designers of C# have admitted the usefulness of genericity, but also confessed that C# is not going to support genericity on first release. More interestingly, they are unhappy with C++'s approach to genericity, which is based entirely on templates. It would be interesting to see what approach C# would take towards the concept, seeing as templates are pretty much synonymous with genericity at the moment.

To sum it up

Many now refer to C# as a Java-wannabe, and there is much evidence to support this notion. C# doesn't only borrow a number of ideas from Java. It seems to follow up on Java's sense of clean design. It's a somewhat sad observation then that C#, purely as a language, not only provides a fraction of the innovation and daring that Java did, it also falls just a little behind Java where cleanliness and simplicity are concerned. However, if you're someone like myself, who uses Windows as their primary development platform and needs to use C or C++ because he cannot afford the overhead that Java incurs, it's possible that C# would turn out to be a very beneficial compromise.

389 comments

  1. Re:C# = ? by DrQu+xum · · Score: 1

    Dammit - I've always hated hex math. :)

    --
    DrQu+xum: Proof that the lameness filter doesn't work.
  2. Wrong Direction by Slur · · Score: 3

    I'm sorry, kids, but any language that is tied to a single OS - as C# is destined to be - is nothing but a scripting extension. I don't care how many bells and whistles the language has.

    C was created specifically to emulate a "universal cpu" and to make it easier to write software across platforms. C++ extended that mission with the added benefit of reusable code (cross-application). C# is a step in the wrong direction if it pretends to be a language in the same class as others with 'C' in the name.

    As far as I can see it's main innovations are little more than invisible methods.



    --------
    Yeah, I'm a Mac programmer. You got a problem with that?

    --
    -- thinkyhead software and media
    1. Re:Wrong Direction by baka_boy · · Score: 2

      Why? OS-X already has a great shared runtime derived largely from NeXTStep, with support in the first release for Objective-C and Java. I'd rather have a nice, clean, UNIX-centric platform to develop my code on than some bastardized MicroSpawn.

  3. Re:Apple releases a new language called C#++ by Kobes · · Score: 3

    Interestingly enough, this new language, "C##", has already been dubbed "D" by various industry experts.

    (Note: Having to explain this joke means it is a great failure.)

    --
    Providing Thetan's(TM) safe-haven for over 18 years!
  4. Re:I don't understand this attitude at all. by nojomofo · · Score: 1

    IMHO, good coding practice negates all of these problems in C/Java/etc. For example:

    In your first example, you suggest that adding a second line of code in an "if" clause. I always use braces, even if it's just for one line, that way I can add a second and never forget the braces.

    As far as the whole wrong number of braces thing, that's why I use emacs. It indents for me, I can easily tell by how it indents my code whether I've forgotten anything.

    I've never used Python, but having non-significate whitespace (and therefore requiring braces and whatnot) really shouldn't bother somebody who is a careful coder.

  5. Delphi, Delphi, Delphi by Viking+Coder · · Score: 1

    Nir Arbel seems to think that Events are "new," which is amazing to me. Especially since C# was designed by the main architect of Delphi - which has had both Properties and Events since Day One. (What - 1995?) You'd think someone that says they love new languages would have read about Delphi before proclaiming how revolutionary C# was, since it sounds to me more like C# is based on Delphi than even on C++, in design if not in interface.

    --
    Education is the silver bullet.
  6. Re:This level of language... by LuckyLuke58 · · Score: 2

    "I mean, what would be the advantage??"

    There probably won't be a technical advantage, but MS seldom creates things because they'll have a technical advantage; MS creates things that give MS a strategical advantage. In this case, MS needed something of their own to tie into application development for their .NET "vision". .NET has the potential to make vast amounts of money for MS (that will make their current revenues look like small change) but they need as much lock-in as possible. If a whole generation of programmers learns C# instead of C++ and Java (just wait for the deals that MS makes with Universities, it'll happen soon enough: "we'll donate hardware to your university if you teach C# in the courses") then those developers are primed for .NET development.

    Sure, MS could use C++ or Java for .NET, but then developer skills are general enough for those developers to use anywhere.

    Of course, it could be I don't know what I'm talking about, because it's difficult to really tell what C# will be about, what with all the hype surrounding it.

  7. Microsoft DOES acknowledge Java influence by harshaw · · Score: 1

    "C# borrows much from Java, a debt which Microsoft has not acknowledged, and possibly never will."

    At the Microsoft PDC a bunch of the C# developers admitted quite openly that Java was a big influence in C# development and design. Of course, I am not saying that the MS Marketing engine will ever admit java's influence :)

  8. Real Java Gcs and other errors.... by catseye_95051 · · Score: 1

    >> (Warning: This could be considered a flame.)

    In fact, modern Java VMs use far more complex garbage collection schemes. Hotspot is a combination of a generational collector and a train-algorithm collector.

    Between this, the incorrect assertions about Java performance, and the questionable logic about pass by value (anyone consider the cost of COPYING all those objects?), frankly this author seems not to have the knowledge necessary to do his topic any justice.

    P.S. The fastest system in the world is the one thats only on paper....

  9. Re:C# vs C vs Java vs Stone Cold Steve Austin et a by pdrayton · · Score: 1
    Does C# have an "assembler subset"?

    Effectively, yes. The Sytem.Reflection.Emit.ILGenerator class can emit IL opcodes into the instruction stream.

  10. Sounds like Delphi by uradu · · Score: 1

    Most of the features could have been lifted straight out of Object Pascal as implemented in Delphi, including:

    -strong typing
    -interfaces & single inheritance
    -properties
    -method pointers

    Sounds like Delphi also provides much better RTTI. The only thing Delphi lacks is the garbage collection, and I'm not sure I like that anyway. It does reference counting on strings with copy-on-modify, so that's something I guess.

    Besides, Delphi is HERE, creates fast native code, and will soon be cross-platform between Windows and Unix. That alone makes it a winner over most other development systems out there as far as I'm concerned.

    Uwe Wolfgang Radu

    1. Re:Sounds like Delphi by Skim123 · · Score: 2

      It's no surprise that it sounds like Delphi! It was, after all, architected by the same guy who architected Delphi...

      --

      I could not justify my existence if I were a turkey farmer. Would I terminate myself? Undoubtably, yes.

  11. OK, so how's performance? by Gorimek · · Score: 1

    Cool!

    I realize it's an early version, but has anyone got a sense of how performance is, in terms of speed and memory use?

    1. Re:OK, so how's performance? by Skim123 · · Score: 2
      As with most things Microsoft, they are striving for easy development... performance is a secondary goal.

      Concerning the ASP+ stuff, though, there are a ton of things built in to increase performance. For example, current ASP pages are scripted... they are interpretted, an execution path stored in memory... when the cache maxes out, the plan for the least used script is dumped and if that page is visited again, it needs to be re-interpretted. ASP+, however, creates a "compiled" version and caches it to disk. (The compiled version is the bytecode in the .NET CLR.) For a good article on ASP+ be sure to check out this piece I wrote:
      ASP+: An Introduction and My Views on the Matter
      http://www.4guysfromrolla.com/ webtech/071500-1.shtml

      Happy Programming!

      --

      I could not justify my existence if I were a turkey farmer. Would I terminate myself? Undoubtably, yes.

  12. Re:Huh? (GC) by SlipJig · · Score: 1
    I think (correct me if I'm wrong) that he's referring to situations where he doesn't want to keep a reference to the object, but wants to intervene when the object gets gc'd. Java allows you to do this, if I remember correctly, by using soft references with a ReferenceQueue (see the Java 2 java.lang.ref package). You can set it up so that you can "rescue" your object from being gc'd.

    Likewise, this package allows you to keep references to objects but still let them be gc'd; in that case, you would need to check before you use it, and recreate it if necessary.

    --
    Read my keyboard review.
  13. Re:Where do functions fit in? by Nigel+Bree · · Score: 3
    First off, from the main article.
    > Now, Java uses mark-and-sweep in order to garbage collect.

    No, it doesn't specify any such thing. You're perfectly welcome to use any collection system for Java objects you like, including high-performance generational/copying collectors.

    As it happens, the bulk of Java implementations do use mark-sweep as part of a conservative collection approach, because of the need to interact with code that is not GC-aware. That's easiest to structure as a simple mark/sweep pre-pass to the real collection phase, which can do pretty much anything it wants that doesn't involve moving or freeing the conservatively blacklisted objects.

    I have a GC library for C++ I've written which works exactly like this - mark/sweep conservative phase, generational copy collector phase - and works just fine.

    As for the copy-by-value/copy-by-reference distinction, template library authors already make this distinction for performance (at least I do in mine) and provide simple ways to annotate classes so templates expand to by-reference versions. That said, the biggest problem with that is that even in MSVC++6.0, the template support is still so broken that you spent more time fighting internal compiler errors that coding :-(

    Back to the article being replied to:
    > Part of the uniqueness of C# is its conception of code reuse - for instance, instead of purchasing a commercial garbage-collector for your C++ code, you get one for free from C#.

    Huh? It's "unique" to do something that most every programming language outside the Algol/Pascal/C family has done from day one?

    > But where does this garbage collector reside?

    It's in the language run-time, which can be wherever the implementation gives you the option of putting it. Y'know, like malloc ().

    In case you've never seen one, a garbage collector is not a big piece of code - a simple but perfectly effective one is typically much smaller than the equivalent malloc () code. For high-performance allocator implementations (like the impressive Hoard from Paul Wilson's group at UTexas, where allocation performance of all kinds are studied), expect a GC and a manual allocator to be of roughly similar overall size and complexity.

  14. Microsoft has made a C# compiler available by jbork · · Score: 2
    Microsoft has just recently posted the same version of the .NET Framework SDK that they distributed at the PDC in July. The SDK is now freely available, and you can download the SDK preview from MSDN. (The download is about 86 MB, however.)

    The SDK preview includes a copy of the C# compiler with Win2k Professional. (Note that the SDK does not include the Visual Studio 7 preview, but it does include "ASP+, the Common Language Runtime, documentation, samples, tools, and command line compilers.")

    Microsoft also has some public newsgroups (hosted on "msnews.microsoft.com") for discussions about the .NET frameworks, C#, C++, VB, etc. And DevelopMentor is also hosting a .NET mailing list.

    The August 2000 issue of MSDN Magazine is also featuring an article about C#.

  15. Re:Copy By Value vs Copy By Reference by tylerh · · Score: 1
    You question can be regarded as deep, since we are talking about how information get passed between conceptually distinct parts of the program. For most C++ work, it boils down to how things are passed to functions:

    In pass by value, a complete copy is made of the thing being passed. The function being called the works on the copy, leaving the original untouched.

    In pass by reference, only enough information for the called rouitne to find the original thing is passed. The small smidgeon of information can be called the reference. There is only one (original) copy of the thing, and the called function uses it reference to find and operate on the original thing.

    hope this helps.

    --
    "one treats others with courtesy not because they are gentlemen or gentlewomen, but because you are" --G. Henrichs
  16. C# so far isn't non-portable... by iabervon · · Score: 1

    It seems to me that what we've seen so far of C# has been language features and syntax. What we haven't seen is the main library, which is presumably the part that ties to whole thing to Windows.

    We ought to be able to pretty simply modify a Java compiler to compile C# code that uses the standard Java libraries instead of MS ones and produces slightly stylized Java bytecode. Of the language features that seem important, none of them seem like anything a compiler couldn't handle and get the standard Java libraries to support. If we hacked a bytecode interpreter sufficiently, we could probably even get the efficiency gains that C# is supposed to give.

    It would be really amusing if there was a working C# for linux available before there was one for Windows. Ignoring, of course, all the Windows-specific parts that will probably take a while to implement anyway.

  17. Re:A look at C# by baka_boy · · Score: 2

    As I'm not an experienced VM or compiler programmer, I hope you'll al forgive me if this is a stupid question, but here goes: If the C# VM is basically a slightly tweaked version of the MS Java VM internally, then wouldn't it stand to reason that another VM could be adapted to handle C# code? How unique is the design of their Java virtual machine?

  18. Very good by mmmmbeer · · Score: 1

    This was a very good review. It's nice to see someone who can resist the temptation to let his own biases show through. Although I did see a little C++ bias, it's clear that he has a healthy respect of Java as well, and gave C# a fair shot. I wish I could say I would have been as fair were I to have written this. Well done!

  19. Closures... by Cedric+Adjih · · Score: 2
    Such event members can be defined to take any delegate type. Delegates are the C# version of function pointers. Whereas a C function pointer consists of nothing but a callable address, a delegate is an object reference as well as a method reference. Delegates are callable, and when called, operate the stored method upon the stored object reference. This design, which may seem less object-oriented than the Java approach of defining a handler interface and having subscribers subclass the interface and instantiate a subscriber, is considerably more straightforward and makes using events nearly as simple as invoking object methods.

    Events are one example of how C# takes a popular use of pre-existing object-oriented mechanisms and makes it explicit by giving it a name and logic of its own.

    Except that it already existed decades ago in Lisp under the explicit name of "closures", exists also in Python under the name "bound methods", and exists in general in dynamically typed languages under the idea of "protocol". The difference is, in C#, you have type checking, so you have to declare the signature.

    Delegate is rather an example of how "Those who don't use Lisp are doomed to reimplement it." :-)

  20. Re: Pronunciation: whatever... by Phroggy · · Score: 1
    I was expecting to pronounce it C-sharp, but the voices in my head keep saying C-pound. Not sure why. I'm a musician, too.

    --

    --
    $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
    $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
  21. Re:This level of language... by Junks+Jerzey · · Score: 2

    I think this whole "write in languages that are C, but easier" movement that's been going on for decades is a little weird.

    Decades? The first real language to fit this description is Java. Pascal came before C, if that's what you're thinking of. Modula-2 and Oberon were after C, but they descended from Pascal, not C. Ada? It wasn't nearly as low-level as C, and had more modern features (e.g. packages). Objective C? That was a merging of C and OOP that went down a different path than C++.

    Not sure what you're talking about here.

  22. Re:Go get C# at Microsoft! by baka_boy · · Score: 2

    And there's the secret we've all been looking for...namely, why MS would go to all this trouble to create a Java-alike. Windows 2000! They need a way to strongarm developers onto the new system, and away from NT or 98. If the development tools are only available for Win2k, then you're going to have to upgrade if you want to stay ahead of the curve.

  23. Re:Geeks of all flavors by maelstrom · · Score: 2
    "Is there going to be a sudden demand for C# coders in a few years? if there is, maybe I should start learning it"

    I don't know what your philosophy is, but I wouldn't want to tie my career to one company. Computer Science is not supposed to be learning the language of the day, but the fundamental paradigms and algorithms to allow you to pick up any language.

    Though my personal preference is obviously Linux, in a pinch I could become a Solaris or Irix guy. With my UNIX background I can transition to NT easier than an NT guy could to UNIX. The tech world changes so quickly it is best to be flexible and to keep an open mind.

    The way I feel right now though, I'd rather take a lesser paying job doing UNIX stuff and be happy than make more money doing MS and be miserable. Each to his own though. :)

    --
    The more you know, the less you understand.
  24. Objective-C, NeXTStep, OpenStep, Mac OS X, and C# by plsuh · · Score: 5
    It is useful to note that much of what C# provides actually originated in the context of NeXT, the Objective-C language, and the associated operating systems.

    Inheritance and Interfaces

    Another idea that was lifted directly off Java, and one which turned out to be very controversial is that of multiple inheritance. In what seemed like a step backwards, Java did not allow you to define classes that inherit from one than one class. Java did let you define "interfaces", which work like C++ abstract classes, but were semantically clearer: an interface is a functional contract that declares one or more methods.
    Objective-C in the OpenStep/Mac OS X environment has single inheritance from a base class (NSObject), and protocols, which are precise counterparts to Java's interfaces. I have run into situations, however, where multiple inheritance is exactly what is required, and using interfaces meant that I had re-write the exact same code more than once, as I was implementing a group of specialized collection classes in Java. There were two axes of differentiation: mutability = (immutable, mutable), and ordering (partially ordered, ordered, strictly ordered). There was a lot of code that had to be duplicated that I should have been able to inherit from two abstract superclasses, one for mutability, and one for ordering. (*grumble*)

    Garbage Collection and Memory Management

    One new feature that I mentioned already was that of copy-by-value objects. This seemingly small improvement is a potentially huge performance saver! With C++, one is regularly tempted to describe the simplest constructs as classes, and in so doing make it safer and simpler to use them. For example, a phone directory program might define a phone record as a class, and would maintain one PhoneRecord object per actual record. In Java, each and every one of those objects would be garbage collected! Now, Java uses mark-and-sweep in order to garbage collect. The way that this is done is this: the JVM starts with the program's main object, and starts recursively descending through references to other objects. Every object that is traversed is marked as referenced. When this is done, all of the objects that aren't marked are destroyed. In the phone book program, especially if there are thousands and thousands of phone records, this can drastically increase the time that it takes the JVM to go through the marking phase. In C#, you'd be able to avoid all this by defining PhoneRecord as a struct instead of a class.
    Objective-C provides a semi-automatic reference-counted garbage collection mechanism that is amenable to programmer intervention to increase efficiency, through a construct called an Autorelease Pool. Every object has a retain count, which can be incremented or decremented. The object's retain count starts at one, and when an object's retain count goes down to zero it is garbage collected. Note that this happens the instant that the retain count drops to zero, not during a mark/sweep. However, you may need to pass an object on to another part of your app, but your code does not need/want to retain it. What you do instead is tell the object to auto-release. It is then put into the autorelease pool, and later on during the system's garbage collection each object in the autorelease pool is sent a release message. Some objects that are entered in the autorelease pool still have a retain count (as they are being retained by other objects) and are simply removed from the autorelease pool; others have their retain counts drop to zero and are garbage collected.

    You can fine-tune this mechanism to a high degree, by putting your own autorelease pool in the stack ahead of the system's primary autorelease pool. For instance, suppose you know that you will be allocating a whole bunch of objects for use in a part of your program, and after you exit you will never need them again. Well, you can put your own autorelease pool in for the system's autorelease pool at the start of that section of your code, write normal code, then remove and release your private autorelease pool and put back the system autorelease pool, which release all of the objects you created in your little section of code. Conversely, if you want an object to stick around, just don't ever release or autorelease it.

    However, from a business standpoint, I find that the automated garbage collection and never having to worry about memory allocation issues is a strong point of Java. It allows me to code more complex applications and avoid memory debugging issues that invarable bedevil complex Objective-C and C++ programs. I can get a WebObjects application to a customer much more quickly using Java than using Objective-C, with quicker turnaround and more feedback cycles.

    Events, Notifications, and Delegation

    Personally, I found C# support of events to be a very exciting new feature! Whereas an object method operates the object in a certain way, object events let the object notify the outside world of particular changes in its state.. A Socket class, for instance, might define a ReadPossible event or a data object might release a DataChanged event. Other objects may then subscribe for such an event so that they'd be able to do some work when the event is released. Events may very well be considered to be "reverse- functions", in the sense that rather than operate the object, they allow the object to operate the outside world, and in my programming experience, events are almost as important as methods themselves.
    The OpenStep and Mac OS X operating systems (viewed separately from the Objective-C language, as these features are available from Java as well) have long had notifications and delegates. There is a system-wide notification center, objects can define notifications that they will post in response to certain events, and objects can register to receive particular events or classes of events. This mechanism has been in place for a long time.

    Delegation is a bit more tightly tied to Objective-C, as objects in Obj-C can pass messages (i.e. method calls) onto to other objects, and objects can "pose as" other objects. An object can register to be the delegate of another object (in Java, the delegator object needs to make special provision for this), and there are "informal protocols" or "informal interfaces" defined that indicate the possible messages a delegate might receive from its delegator. Again, this is not new, and its assembly into a single OS is not new.

    Primitive Types

    C# classes are also all eventual descendents of the object class, but unlike Java, primitives such as integers, booleans and floating-point types are considered to be regular classes.
    This is one feature that I like very much, and wish that Java had. Objective-C, of course, will always have to support native types such as char's and int's, as it is defined as a superset of C. However, Java had the opportunity to remove this artificial distinction, and has caused lots of cursing from yours truly over the past couple of years.

    Compiling to Native Code

    It's not yet clear whether C# programs would need the equivalent of a Java Virtual Machine or whether they could be compiled directly into standalone executables, which might positively affect C#'s performance and possibly even set it as a viable successor to C++, at the very least on Windows.
    I would point out here that compiling to native code may not result in the fastest execution. Review the HP Dynamo project, as written up on Ars Technica, for the reasons why JITC can actually exceed the speed of native code. The whole Transmeta Crusoe architecture is built around this theory of operation, and no one will claim that it's too slow.

    Genericity

    One thing that's sure to be missing from C#, and very sadly at that is any form of genericity.
    Amen to this. The fact that genericity is missing from Java is a serious gripe of mine, and the fact that it is missing from C# is a serious omission. This business of casting objects coming out of arrays is a pain the in neck, and it is often tough to find out where an object of the wrong type went into an array, although on the cast coming out you get a ClassCastException. Far better to catch the problem when the object goes in, which often gives you a better idea of where your design is broken. One of these days I am really going to have to start using the stuff coming out of the GJ project.


    Conclusions

    Overall, I find that the "new" stuff in C# is really old stuff. Furthermore, this is not the first time that all of this has been pulled together in one place. Almost all of this has been in the NeXTStep/OpenStep/Mac OS X family for a long time, and the implementations there are quite mature. I suspect that the implementations in C# will require several revisions before they reach the levels that programmers can really use.

    Just so everyone knows, I am a Consulting Engineer working for Apple iServices, a part of Apple Computer, specializing in WebObjects development. These opinions are my own, however, and not those of Apple.


    --Paul
  25. Re:Apple releases a new language called C#++ by efuseekay · · Score: 1

    Hmm.. the fact that you thought it was a joke meant that it was a bigger failure than it actually is.

    --
    Mode (3) smart-aleck mode. Press * to return to main menu.
  26. Re:java by Kailden · · Score: 1

    If your writing for convenience, stick with M$ ASP, cowboy.

    But if you want enterprise stability and the advantages of object oriented code reuse, consider servlets.

    --
    I need a TiVo for my car. Pause live traffic now.
  27. Re:C#: Answer to the DOJ? by jason_aw · · Score: 1

    > usually the GUI code made any application level program worth nothing

    Modularity? Huh? We don't need no steenking modularity!

    Clean design? Wassat den?

  28. Re:java's overhead by Anonymous Coward · · Score: 4

    I wrote a graphical editor in Java. On a 1024x768 display (modest for the times), the performance penalty of Swing made some parts of it barely usable on a dual P3-550 Xeon box with a TNT2.

    This was not sloppy code. I made extensive use of caching, pre-rendering and Java2d to make the most of the platform. Java simply has performance overhead -- the overhead of Swing (sloppy, sloppy -- it's not even well built, consider for instance that affinexforms were hacked on but don't apply heirarchically and thus can't zoom Swing UI elements) is huge, but there is overhead in JAva2d (JNI is slow, especially for copying chunks of data back and forth) and some additional overhead in the basic design.

    In Java, it is almost impossible to write cache-friendly code. If you build things in an OO fashion, you cannot force locality, since object refs force you to essenaitally chase pointers for every object. If you write degenerate code that isn't OO (sort of misses the point) then the array bounds checks hammer you anyway (and no, I have yet to see this eliminated by "smart compilers").

    Java has some inherent problems with performance. These are real, they exist, and they are fundamental to the platform.

    Consider that in JAva, you have to have a thread per socket connection. Yes, I'm serious. There is no select, there is no poll. This means that a messaging server on Java can maybe serve 3000 clients before it starts to fall apart, but something in C++? Trivial to serve 20,000. You don't even need to optimize it to get that level of scalability that even optimized JAva can't do.

    Consider the weirdness that Java can spawn a child process but not attach to a process that's already running (easy to do in C [C++, C, C#]). How do you write a watchdog process in JAva whan you can't kill a process that's hung?

    Java is great. I've used it extensively. But it is seriously warped in some ways.

    RSR

  29. Re:All Java's are not created equal by bgalehouse · · Score: 1
    Roughly speaking, the copying collector family (which includs the algorithms used hotspot) has overhead proportional to the amount of data (in both bytes and objects) saved - not the amount of data collected. This is very different than mark sweep.

    On the other hand, the box/unbox problem is still a good topic for debate. Boxing means wrapping into an indepedent object so that the garbage collectors and utility classes and remote references can be less type aware.

    Java provides a set of unboxed scalars (int, byte, etc), and the ability to manually box them. It sound like C# gives the ability to treat structs as scalars - effectively unboxing them.

    Some languages (ML in particular) defer boxing questions to the compiler. This makes the compiler author sweat more if he'd like to avoid the overhead associated with boxing. Problems like this explain why SML/NJ is such big program.

  30. Re:Back to C... by Zagadka · · Score: 1

    There's a C library that does garbage collection already. Actually, I think there are a few of them.

    Yes, there are a few conservative garbage collectors available for C. Conservative garbage collectors are an ugly hack though. They essentially scan through all allocted parts of the heap, and look at everything that might be a pointer. They then use this information to determine connectivity information, which is required for garbage collection. Because they have to assume that virtually any value is a pointer (because they have no run-time type information to work with), you end up with a lot of things not getting collected even if they should be. And the worst part is, the more memory you're using, the more "false positives" it's going to get.

    If you want garbage collection, use a language that supports it. Note that with mostforms of pointer arithmetic, it basically throws the possibility of proper garbage collection out the window, because everything is always reachable because you can theoretically always compute the address. (it is possible to make limited forms of pseudo-pointer arithmetic that don't defy GC)

  31. Re:And this differ's from Delphi how? by sugarman · · Score: 1
    You've never really _used_ the VCL, have you?

    Nope, busted. Right now, Delphi is little more than a learning tool on my workstation. I like a lot of what I see, and the VCL and other parts haven't given me any real problems. OF course, I haven't been in a position to stress them much either. Sorry to hear it doesn't cut the mustard at a other levels of use. That being said, the orginal question still stands. If C# is a tool to make COM or SOAP or AotD (Acronym of the Day) development easier, how is it different from the languages we're currently are using for that development? Wouldn't we be better served by making better tools for the languages we have than devising a new construction method?

    --
    --sugarman--
  32. java by KeyShark · · Score: 2

    Granted Java has an overhead, but it's getting better and better every release. 1.3 with the new VM, hotspot, is incredibly fast. I wish i still had the url of the benchmarking of it. It beat C++ in speed on a couple of tests, granted they were the recursion which C++ doesn't handle well, but Java is getting much better. C# is going to have to show me something besides the speed factor to get me to switch.

    1. Re:java by Zagadka · · Score: 1

      You will be surprised. Ever had any "finalize" hacks around? When you memory consumption is critical, knowing what gc is doing is rather important.

      Yes, I know some people have had trouble with the fact that things aren't cleaned up in a deterministic way, and that sometime fnalize isn't called.

      Java 2 (1.2 and 1.3) support Reference Objects, so you can get pretty fine control over when things are deallocated. If you need finer control than that, you probably want to use JNI.

      That still doesn't explain the author's original comment though:

      the solution depended on objects *not* being automatically destroyed, as they were supposed to exist separate from the main object hierarchy and would take care of their own destruction when the time was right.

      This implies that he wanted the GC to not destroy the objects, because they were supposed to "exist separate from the main object hierarchy" (whatever that means). The GC only cleans up things when they're unreachable, so why did he want it to not clean them up?

    2. Re:java by vsync64 · · Score: 2
      And then there's Lisp! I've seen benchmarks where good tail-recursive Lisp code beat FORTRAN at some numerical tasks.

      Okay, obligatory plug over... =)

      --
      TO BUY A NEW CAR WOULD MAKE YOU SEXUALLY ATTRACTIVE.
    3. Re:java by Zagadka · · Score: 1

      Maybe they were handling events? Why would you keep a hard reference to an event handler lying around?

      I'm not sure what you're talking about. Please elaborate if I'm misunderstanding what you're saying.

      If by "event handler" you mean something like a "listener" in Java, well the event generator (the thing you called "addFooListener" on) would hold the reference for you, so there's no nee for you to hold a reference. If you mean a separate thread that's intended to handle events... Java's garbage collector doesn't collect active threads.

    4. Re:java by Zagadka · · Score: 2

      I really have to wonder whether the author understands garbage collection. For example:

      there have been a few instances where I was faced with a programming problem where the solution depended on objects *not* being automatically destroyed, as they were supposed to exist separate from the main object hierarchy and would take care of their own destruction when the time was right.

      WTF? Objects will only be collected if they're unreachable, and if they're unreachable, what do you want them hanging around for?

      Also, the whole thing about C#'s "structs" seems a bit dubious to me:

      One new feature that I mentioned already was that of copy-by-value objects. This seemingly small improvement is a potentially huge performance saver

      It would only be a performance saver if these objects are really small, because you'll be copying these objects around all over the place). I also have to wonder how C# deals with the object slicing issue. Object slicing is when you pass a subclass instance to something that takes the base class using pass-by-value, and you implicitly "slice" thje object down to the base class. It doesn't happen in Java (or Modula-3, or Objective-C, or any other language that always passes objects by reference). It does happen in C++ if you're not careful though, and it's really hideous.

    5. Re:java by YoJ · · Score: 2

      I think his point still stands, though. If you can declare some objects as not needing to be considered for garbage collection, you can't help but make the garbage collection faster.

    6. Re:java by perfecto · · Score: 1
      Then, SubThreadStarter stops, and FooServer destroys it.

      But now the garbage collector will notice that all those ListenerServers's are unreachable from FooServer, and they all get destroyed, although they may be running and doing useful stuff.

      This might not be what you wanted to happen!

      if this only happens when you run threads as daemons. if not, they keep on ticking.



      --
      And Justice for None

    7. Re:java by perfecto · · Score: 1
      i fucked up on my last response. i wanted to say the threads get killed only if you're not running as daemons.



      --
      And Justice for None

    8. Re:java by stubob · · Score: 2

      and that's only on the application level. I have been hearing for over a year (1.2 release?) that servlets perform much better than cgi. Here's a couple links to evaluated benchmarks. Note the servlet link is from sun, so keep that in mind.
      java and servlets

      That must be one really fast vm!

      -----
      My karma is still less than my age.

      --
      Planning to be moderated ± 1: Bad Pun.
    9. Re:java by Axe · · Score: 1

      WTF? Objects will only be collected if they're unreachable, and if they're unreachable, what do you want them hanging around for?

      You will be surprised. Ever had any "finalize" hacks around? When you memory consumption is critical, knowing what gc is doing is rather important.
      --
      <^>_<(ô ô)>_<^>
    10. Re:java by Anonymous Coward · · Score: 1

      It is impossible for Java to be "faster" than C++. They are just languages. I think what you meant is that a particular implementation of Java produced faster code than that of a particular C++ implementation.

    11. Re:java by Axe · · Score: 1

      Soft references are cool indeed, and I use it, but for one my project it was incurring a bad performance hit. Did not bother to figure out and went for JNI. We needed Java only for GUI anyway then... GC is cool until it fucks you up bad...

      --
      <^>_<(ô ô)>_<^>
    12. Re:java by __aasmho4525 · · Score: 1

      hi all.

      i think one example that might be relevant is the concept of predictability in a real-time application. for example, the entire reason the folks working on the java real time specification decided to come up with the pool of memory that is never collectable to have predictable real-time threads that don't have their objects get garbage collected and therefore the thread doesn't get preempted by the g.c. (for example).

      this is probably the most important use of such a pool i can quickly come up with...

      Peter

    13. Re:java by Disco+Stu · · Score: 1

      So, the gc could be mark-and-sweep, copying, generational, or reference counted. Heck, it could even be an incremental collector, in which case overall application timing becomes a moot point.

      I haven't read the VM spec. Of course, I don't do much java programming. Anyway, that no gc collection algorithm is specified seems like a big deal. Isn't anyone else bothered by this? GC is a great idea, but when there people stupid enough to use stuff like reference counting (sorry Larry...you're still my hero), the programmer should know so that she can plan accordingly. If you're concerned about leaks, knowing which GC algorithm is used is a really big deal.

    14. Re:java by _Quinn · · Score: 1

      Maybe they were handling events? Why would you keep a hard reference to an event handler lying around?

      -_Quinn

      --
      Reality Maintenance Group, Silver City Construction Co., Ltd.
    15. Re:java by __aasmho4525 · · Score: 1

      out of curiousity.

      do you believe it is the java *language*, *toolkit*, or *platform* that is flawed?

      realistically, i believe the language is quite good. the toolkit does have some room for improvement, and the platform always can be improved...

      thoughts?

      Peter

    16. Re:java by Icculus · · Score: 1
      /. article:

      C Faces Java In Performance Tests


      and outlink to an article @ Ace's hardware.

    17. Re:java by jekk · · Score: 1
      Ok, here's your gentle correction

      A java garbage collecter may (not must) garbage collect any objects that are unreachable. But unreachable from where? The "starting point" for reachability is defined to be all executing non-daemon Threads.

      So in your example, the ListenerServer's would NOT be garbage collected, because they're Threads. Basically, this rule means that any memory which could possibly be reached by any code executing anywhere can NOT be garbage collected -- ie, nothing you could possibly care about can disapear.

      All of this, of course, leaves out the "new" (well... not so new anymore) soft, weak, and virtual references that were introduced to allow more flexible garbage collection behavior. These allow all kinds of fancier GC behavior if you want to develop for it.

      -- Michael Chermside

    18. Re:java by Azog · · Score: 2

      Actually, I think the author is correct. Here's an example. Remember a thread is an object in Java.

      Imagine that your program "FooServer" creates a thread "SubThreadStarter".

      SubThreadStarter runs for a while and creates a whole bunch of "ListenerThreads", which attach to a port and wait for input, kind of like a web server.

      Then, SubThreadStarter stops, and FooServer destroys it.

      But now the garbage collector will notice that all those ListenerServers's are unreachable from FooServer, and they all get destroyed, although they may be running and doing useful stuff.

      This might not be what you wanted to happen!

      This may sound a little contrived, but stuff like that happens. Fortunately it is easy to work around, just by keeping a master list of threads in the FooServer program (which you would probably want to do anyway, actually).

      Disclaimer: I am not a Java expert. Gentle corrections are welcome.

      Torrey Hoffman (Azog)

      --
      Torrey Hoffman (Azog)
      "HTML needs a rant tag" - Alan Cox
    19. Re:java by SomeOne2 · · Score: 1

      Not exactly, Java _requires_ exceptions when following null pointers or at illegal array access so the code _has_ to check this, regardles of the implementation.
      Trust me, I tried to write a realtime adaptive huffman compression in Java and even after a lot of fine-tuning the C++ implemenation was more than 2x faster. Of course the C++ implemenation was carefully fine-tuned, too :) Most benchmarks I see which compare Java to C++ just compare more or less tuned Java code to bad C++ code (they don't even use the keyword inline, much less register etc.) and then are happy to find that Java is faster... It should be possible to disable these checks for time-critical code.

    20. Re:java by odysseus_complex · · Score: 4
      I would also like to point out a fallacy in the article. The author states that, "Java uses mark-and-sweep in order to garbage collect," which is incorrect. The JVM spec does not specify which garbage collection algorithm is to be used, much that one must be used. So, the gc could be mark-and-sweep, copying, generational, or reference counted. Heck, it could even be an incremental collector, in which case overall application timing becomes a moot point.

      So, in this case, the analysis of time-to-collect is misplaced unless there is reference to a specfic VM.

      I recommend reading the VM spec. I've read it 5 or 6 times myself.

    21. Re:java by cybercuzco · · Score: 1
      not if i can write more code that produces more usable functions in Java than I can in C++ in a given amount of time. In that case Java, as a language, would be faster than C++

      --

    22. Re:java by Zagadka · · Score: 1

      Listener lists shouldn't (and typically don't) use weak references. When using "strong" references, if the event source is the only thing with a reference to the listener (via the listener list) then the listener will be collected at the same time (or after) the event source is collected. If listener lists used weak references instead, then code like this wouldn't work:
      foo.addActionListener(
      new ActionListener(){
      public void actionPerformed(ActionEvent e){
      /* do something */
      }
      }
      );


      If foo's listener list used weak references, the listener would be destroyed very soon, because the only reference to it will be that weak reference.

    23. Re:java by Azog · · Score: 1

      Ahhh.... Ok. I didn't realize the garbage collector started from more places than just the original program for determining reachability.

      I suppose I should have checked more carefully - I have a couple of Java references here - but I rarely do any significant Java hacking.

      Thanks for the info.

      Torrey Hoffman (Azog)

      --
      Torrey Hoffman (Azog)
      "HTML needs a rant tag" - Alan Cox
    24. Re:java by AMK · · Score: 2

      Benchmarking servlets against regular CGI is a bogus comparison. Are servlets faster than Python/Perl/whatever using FastCGI, Persistent CGI, or an embedded Apache module? Are they more convenient to write? Doubtful, on both those aspects...

    25. Re:java by rpk · · Score: 1

      I think the idea is that if you're implementing a listener list from an event source, you should use weak references to the listener so that the listening object can still go away if it forgets to remove itself from the event source.

    26. Re:java by Anonymous Coward · · Score: 2
      • Are servlets faster than Python/Perl/whatever using FastCGI, Persistent CGI, or an embedded Apache module?
      Unless someone has a developed a JIT for those, then yes, Java is faster.
      • Are they more convenient to write?
      That depends.

      My site uses PHP for a lot of the "dynamic content" type stuff. It's quick and easy and it works pretty fast. Complex "web-based applications" are written with Servlets. I don't know if I'd call them "convenient" to write, but they are easier to debug, faster to execute, easier to integrate securely with back-end systems, scalable and maintainable.

      Often, if there's a convenient way of doing something, you're eating somebody's dust. In a dog-eat-dog world, I want to eat dogs, not dust.

    27. Re:java by tomwa · · Score: 1
      In C#, I can write the C# portable runtime. Can you write a full Java VM in Java? Nope. What about one with JIT, etc.? No frigging way.
      Jalapeno? Surprise!
    28. Re:java by krafter · · Score: 2

      If you like doing servlet programming, but sometimes find it difficult to do with all the HTML coding mixed with the Java code you should look into JSP's.

      If you have servlets working you can get JSP's working and they make things much nicer.

      They still end up being compiled into servlets in the end. You can actually look at the .java files they generate. After they generate .java files those files are compiled. The server will continue to use the complied files until the .jsp file changes and then it will automatically recompile the .jsp files for you. This makes code updates very easy.

      I also found that my .jsp's tend to come up faster, once they are compiled, than the perl scripts we have running under mod_perl.

      Chris Kraft (krafter@zilla.net)

    29. Re:java by Photon+Ghoul · · Score: 1

      Why was this scored zero?

    30. Re:java by Anonymous Coward · · Score: 2

      Okay. In C#, I can write an operating system and get the same perforemance as C by restricting myself the the C subset. What about Java?

      In C#, I can write the C# portable runtime. Can you write a full Java VM in Java? Nope. What about one with JIT, etc.? No frigging way.

      C# gives me the power to drop down to the low level where I need it, but gives me the power to do so without having to jump through a thick, slow, clumsy layer like JNI.

      As someone who has done a lot of JNI programming, C#, instead of being the total turnoff I thought it would be, has me very interested. It's cleaner, safer and more powerful than C and C++ and has no features that are inherently more expensive from a performance point of view. If C# gets support outside of MS, then it will be a fantastic opportunity for C and C++ programmers since it lets us do things (like high performance graphics, etc.) that we can't do in the only other real alternative (Java).

      I've spent the last two years doing nothing but Java development. Real, tens-of-thousands-of-lines-of-code development. I like Java, but there are huge parts of it (all of java.io, all of Swing, etc.) that are seriously broken.

      The only thing I think C# doesn't do that I really wish it did was provide for Eiffel-like assertions and invariants. Aside from that, it's a really nice language.

      Now, the problem is that the .NET stuff may be tied to MS platforms..

  33. Clue time by Ars-Fartsica · · Score: 2
    How do you figure? C++ templates are a hack to deal with the lack of a base class; other OO languages (Java, Objective-C, C#,Smalltalk...) let you do generic things by operating on the base class, from which all objects inherit.

    Casting from Object is not comparable to C++ templates. Firstly, you lose any compile time type checking (which C++ templates give you). On the contrary, the Java approach is the hack. Don't take my word for it, read interviews with Gosling where he admits as much.

  34. Where do functions fit in? by freebe · · Score: 2

    Part of the uniqueness of C# is its conception of code reuse - for instance, instead of purchasing a commercial garbage-collector for your C++ code, you get one for free from C#. But where does this garbage collector reside? Is it in a shared library? If so, where and when does it get called? Is it a seperate process fork()ed off from the main process? Does the collector get compiled in to each and every program? Is it part of some system-level component that will be built in to the next Windows, that Linux will have to emulate? Inquiring minds want to know...

    --

    Free BeOS, runs from a Linux partition

    1. Re:Where do functions fit in? by EAG · · Score: 1

      In the .Net implementation of C#, the garbage collector is in the runtime, and is used by all the .Net languages.

  35. Instead of a Microscope... by Dr+Caleb · · Score: 3
    Perhaps it should be reviewed with a tuning fork?

    From all the reviews I've read, "See Sharp" doesn't.

    --
    "History doesn't repeat itself, but it does rhyme." Mark Twain
    1. Re:Instead of a Microscope... by austad · · Score: 2

      It could be pronounced "C-Hash", which, at a glance looks like C-Rash, which is most likely what it does best. Or maybe C-Hash is how Apu says "crash" as in:
      "Oh my golly gosh, the big truck has C-Hashed into the Qwikie Mart!"

      Or Hash is probably what the developers were smoking when they came up with this language.

      --
      Need Free Juniper/NetScreen Support? JuniperForum
  36. Re:Objective-C, NeXTStep, OpenStep, Mac OS X, and by bgalehouse · · Score: 1
    I'd like to point out that reference count garbage collection is faster to think about. In practice, the CS profs will generally tell you that it tends to be slwer than copying (or even mark sweep), unless you are running near your memmory limit. It and mark sweep both fail to address memmory fragmentation.

    Think about it. Every object gains a few bytes of size. Every time you change a pointer, you need to also add, subtract, and test for 0. And... loop shaped data structures never get collected.

    BTW great post. I just didn't want to let it be thought that reference counting ts a particularly clever form of gc.

  37. Not to Perl programmers. by Frizzle+Fry · · Score: 1
    This is a pound: £

    It is used as currency.

    This is a hash: #

    As in 'please enter your password and press the hash key'.

    No, here's a hash: %

    The concept of illegal plants and animals is obnoxious and ridiculous.
    --
    I'd rather be lucky than good.
  38. Re:Ack! Significant whitespace! by Happy+Monkey · · Score: 3
    I shudder when I think of programming with significant whitespace.

    You may not always be safe in C++. (Acrobat format ;)
    ___

    --
    __
    Do ya feel happy-go-lucky, punk?
  39. Re:For all the bashing C# gets here... by NaughtyEddie · · Score: 3
    I won't touch C# with a ten-foot barge pole for at least 2 years. That's just common sense. Nothing out of Redmond ever works until at least service pack 4.

    Other than that, you're just regurgitating the typical boring Slashdot opinion set in a highly overdramatic style. To call a language dangerous, a corporation evil and to literally identify a real manager with the PHB from Dilbert is at best inaccurate, and at worst displays a shocking seperation between you and reality. The world is not as black and white as you would like it to be.

    --

    --
    It's a .88 magnum -- it goes through schools.
    -- Danny Vermin
  40. Re:C# vs Java ? Gimme a compiler! by YoJ · · Score: 1

    Check out gcj, the Java frontend for gcc. It compiles Java to executable form. The problem is all the extra Java libraries and stuff.

  41. Re:For all the bashing C# gets here... by kb9vcr · · Score: 2

    It might have something to do with the fact that a lot of us might have to learn this language.

  42. Re:A look at C# by JasonOrrill · · Score: 1

    MS basically wanted to offer a VM based Java-like language, but was unable to add their own extensions to Java fit in with their new strategy (remember the lawsuit from Sun?)

    'scuse? That's not the way I recall it working. MS didn't get in trouble with Sun for adding extensions to the language. They got in trouble because they didn't do a full implementation of the Java standard, and started monkeying around with the language on top of it. This business of "not being allowed to add extensions" is just more MS weaseling.I believe (and somebody please correct me if I'm wrong) that Apple, for example, has added some extensions to Java specific to the Mac, but has not gotten in trouble for it because they've got a complete Java implementation, and are adding to it...not starting with 95% & then going from there.

    --
    -- "" - Harpo Marx
  43. Re:Here's The Deal by jason_aw · · Score: 1

    > Languages don't matter. Compilers do.

    Well, that's nearly true, if all you're worried about is running speed.

    > If you disagree, you're a moron.

    Oh noooo! *sigh* You caught me; I suppose you're just too clever for me.

  44. Re:For all the bashing C# gets here... by NaughtyEddie · · Score: 1
    --

    --
    It's a .88 magnum -- it goes through schools.
    -- Danny Vermin
  45. Re:Attributes by EAG · · Score: 1

    If you want to specify the information, you can. If you don't, you don't have to. But I thought that would be obvious in the design of the XML serializer; you set the name if you care, and if you don't, it uses the reasonable default. On your final statement, how do you propose to add attributes if you don't control the language, and can't forsee the future?

  46. Re:Not see sharp by jsmaby · · Score: 1

    I bet Micro$oft had See-Sharp in mind because it sounds classy (hey, you're looking sharp today). I, however, think that See-Pound makes much more sence because one is likely to pound at thier computer when the programs crash, or better yet, while waiting for the bloat to load/run. I know I absolutly despise java and don't like c++ because they are not as fast as strait c. I supose that c++ should really be See-Cross-Cross because one must pray to the computer gods that the programs don't crash, while c is just See, as in "See? That wasn't so bad now, was it?"

    --

    Sometimes I've believed as many as six impossible things before breakfast.

  47. Re:For all the bashing C# gets here... by NaughtyEddie · · Score: 2
    Hate to burst your bubble, but:

    • New programming languages are not dangerous
    • Microsoft are not evil
    • Dilbert doesn't exist
    • Real managers are not PHBs
    • And "mindshare" is a buzzword
    --

    --
    It's a .88 magnum -- it goes through schools.
    -- Danny Vermin
  48. Re:Programming languages: C++ still king? by waynetv · · Score: 1
    2. Templated classes. It was mentioned above, C# lacks these, as do many other languages it seems. While the use of them could be cleaned up quite a bit, the idea of template classes is very sound. It allows for the easy set up of a container class that holds basically any other class you put into it. For example, a matrix in C++ is little more than an array of arrays, all of which can also be templated to hold int, float, char, etc. As a simple side project, I once made a 3D matrix by simple templating arrays into a 2d matrix. In C#, it appears doing this would not be nearly as easy or straight forward.

    Java does not have template classes but it does have containers that can hold any other class you put in it. How do they do it? Simple, all objects derive from a single root object called Object. C# works the same way. This is by far cleaner than using templates.

    Each time you instanciate a template class with a different "type" you create a whole new class. If you just creating simple containers, than you are wasting a lot of space. In Java and C#, the class is created only once.

  49. Re:For all the bashing C# gets here... by Bob+McCown · · Score: 1

    Well, yes...

  50. jumping off point by Norge · · Score: 2

    http://cm.bell-labs.com/cm/cs/what/smlnj/

    Many people I know here at CMU found ML tough to wrap their heads around. I think it is a wonderful language, and I plan on using it for as many projects as I can in the future.

    Ben

  51. Not really a VM by Ececheira · · Score: 3

    From what I've seen in the C# Tech Preview SDK, C# does compile into an intermidiate language (IL), but it never actually runs as IL. Instead, the installation process compiles the IL into machine-specific code that is optimized for the specific platform its running on. Once the code is installed, the byte-code IL can be thrown away.

    What it seems like is a cross-platform distribution but with native compilation upon installation. Sorta a best of both worlds kinda thing...

  52. Generic Java by Anonymous Coward · · Score: 1

    Hence Generic Java. In my experience, GJ is clean and works well. The GJ page includes comments from Bill Joy and Guy Steele, as well as links to info on the incorporation of genericity into standard Java.

    1. Re:Generic Java by Y · · Score: 1

      Also, take a look at this paper on NextGen. NextGen is a superset of GJ and hopefully a release will be coming soon.

      A couple of examples of what NextGen adds to GJ:

      - ability to write expression "new T(...)" where T is a type variable.

      - ability to write expression "instanceof T" where T is a type variable

      GJ and NextGen's implementations of genericity are much better than C++ because they allow for sound typing and code reuse. I use GJ at work, and I am currently working on a tool to generate HTML documentation for GJ source code, a javadoc-like tool which we are calling, uh, gjdoc. It will fix some issues I had with pizzadoc's generated HTML. The first release (0.5, forthcoming) will not support cross-referencing other classes (e.g., via hyperlinks in method argument lists or return types), but it will document GJ source and support the important tags like @param, @return, and, of course, @author. I'm planning on developing linking in the second release. The issue with links is when documenters provided unqualified names: the search for a qualified name from a simple name is outlined in detail in the Java language spec, and it requires a good amount of code.

      Anyway, try GJ out. You might like it.

      > Mike

      --
      "There is no culture in computer science, only cults." - M. Felleisen
    2. Re:Generic Java by jetson123 · · Score: 2
      I think it's a mistake to assume that the preferred ML implementation of genericity is better (or worse) than C++ style genericity. Both have their areas of application.

      C++ style genericity is unmatched in its expressiveness and efficiency for scientific computations. If you are going to have value classes (also called "expanded classes"), you need C++ style genericity with it to use them for anything useful; without that, they become nearly meaningless. An ML-style implementation doesn't even come close in providing the necessary functionality.

      On the other hand, C++ style genericity is cumbersome and inefficient for general purpose "application programming". For that, the ML style implementation (and GenericJava) genericity is much better.

      I hope the GenericJava folks are not working under the assumption that the ML strategy is always preferable, because if they do, what they produce will likely be useless for high performance applications. Compiler-created specializations of generic classes, including type variable specific overloading, and value classes are the backbone of high level, high performance computing.

    3. Re:Generic Java by Hortensia+Patel · · Score: 1

      where C++ templates result in code bloat by producing a copy of the generic class for every concrete instance

      To be fair, you can often avoid this in C++, using the same technique that you describe for GJ. Basically, where you have a collection of typed pointers, you can implement all functionality in an instantiation for void* and then subclass it with a strongly-typed casting wrapper. Stroustrup mentions this technique in CPL as an effective way to reduce bloat.

  53. It should have been called. by Spankophile · · Score: 3

    It should have been called:

    C~1

  54. Re:C# = ? by NaughtyEddie · · Score: 1

    Er ... don't you mean 12 pounds?

    --

    --
    It's a .88 magnum -- it goes through schools.
    -- Danny Vermin
  55. The Be Sharps by Skim123 · · Score: 2

    Skinner: "We need a name that's witty at first, but that seems less funny each time you hear it.
    Apu: "How about "The Be Shaprs?"
    Skinner: "Perfect."
    Homer: "The Be Sharps."

    --

    I could not justify my existence if I were a turkey farmer. Would I terminate myself? Undoubtably, yes.

  56. Re:I don't understand this attitude at all. by Malc · · Score: 2

    How often do you hit Enter followed by Tab, only to realise that MSVC has already indented correctly for you? Yes! It drives me nuts. That's why I use the VisEmacs plugin for anything more than trivial editions. I keep the MSVC editor for when I'm debugging (which isn't really editing I suppose). This plugin is great. It's a god send.

  57. Re:C#: Answer to the DOJ? by ucblockhead · · Score: 1

    All Java objects may have vtables, but all C++ objects most certainly do not!

    It is easy (and useful) to write a small C++ object that is entirely inline, and does something useful. Here's a Windoze realworld example:

    class MyDC
    {
    public:
    inline MyDC(HWND hWnd) : m_hWnd(hWnd), m_dc(BeginPaint(hWnd, &m_ps) {}
    inline ~MyDC() {EndPaint(m_ps);}

    inline operator HDC const { return m_dc; }

    private:
    HDC m_dc;
    PAINTSTRUCT m_ps;
    HWND m_hWnd;
    }

    This allows me to code this:

    FooFunc()
    {
    MyDC hdc;

    TextOut(hdc, 0,0, "FooBar");
    }

    instead of

    FooFunc()
    {
    PAINTSTUCT ps;
    HDC hdc;

    BeginPaint(hdc, &ps);

    TextOut(hdc, 0,0, "FooBar");

    EndPaint(ps);
    }

    Now this isn't earthshattering, but it is nice to be able to do with other sorts of resources. And there are many other sorts of problems where small classes work well. The nice thing is that because the class above is all inlined, the first version of FooFunc essentially compiles to the second. Thus, there is absolutely no overhead for the small class. No indirection. No extra memory usage.

    --
    The cake is a pie
  58. Re:C# by Zico · · Score: 1

    But why would Microsoft care? I'm sure Microsoft would be thrilled if other people made C# compilers, to help popularize the language -- and anyway, the language will be an open ECMA standard. Sun won't do it, but you know Microsoft would be licking their chops if they did. After all, even though Sun created Java, Microsoft's VMs blew Sun's out of the water on a regular basis.

    Cheers,
    ZicoKnows@hotmail.com


    Cheers,

  59. Visual Age for Java has native executable support by brokeninside · · Score: 1

    IBM's Visual Age for Java Enterprise Edition supports native compilation for server side Java.

    From the above page:

    Enterprise Edition is ready to meet those requirements with a High Performance Compiler (HPC) for Java that maximizes the execution speed of your server code on OS/2, Windows NT, AIX, OS/400 and OS/390.
  60. Re:java's overhead by harmonica · · Score: 2

    There is Java Grande. These guys are working on making Java more suitable for number crunching and similar jobs. They've contributed to StrictMath and suggested the strictfp modifier (IIRC)... If they thought number crunching couldn't be done fast enough, they'd never started the project. It seems like the interpretation / just-in-time compilation part of Java doesn't have too much of an influence on performance with these kinds of applications.

  61. Marajuana explaining Windows Errors? by Lechter · · Score: 3

    Microsoft says it's supposed to be pronounced C (sharp). But I've almost always heard "#" called the hash mark. Regardless of what the PR folks say I believe that M$'s developers really meant it to be pronounced see-hash. Could this indication of an obsession with pot among Microsoft's developers be an explanation of the buggy history of Windows? I don't know but it does explain things...

    --
    credo quia absurdum
  62. Re:What _I_ Like about C#.. by lient · · Score: 1

    What? You did a Grep in Java through lots and lots of files? Did you do this just for the statistic or for some actual REAL work. If you did it for real work shame on you. This is perhaps one of the worst areas of performance with the JVM.

    I used to like Java, before I became a real honest to goodness coder. My school focused on it so thats what I learned. When I started delving into C++, it was pure joy. Now I have higher requirements for the languages I will use. Some of these are genericicity, operator overloading, multiple inheritance (or a GOOD alternative (not Interfaces)), atleast descent speed, and no memory hogging VM, amongst other things.

    Here are some arguments agains C# based on these precepts.

    If C# does not have genericicity it will not be clean or typesafe as we have seen with something as simple as a Vector that has to use casting *everywhere* in Java. Stroustrup says if you have a lot of casting in you code it is a sign of a design flaw, meaning that the Java language itself is ONE BIG DESIGN FLAW. Looks like C# is heading in the same direction.

    C# is created by Microsoft and Microsoft *standards* are even more of a joke than Sun Microsystems are (ie Visual Basic). Third party standards committees are essential for things as fundamental as a language, so that it can grow. If Microsoft is making all the decisions about their language, do you really want to trust them to alter/add to the language in a responsible way? How about hokey licensing restrictions like Sun's saying that you cannot use the JVM in a Nuclear power plant. What's up with that!? C# is destined for this same type of ludicrousy. The bottom line is that big companies rarely ever make software decisions that benefit the user. It's all about upgrading to the next version, and making the previous incompatible so you have to switch.

    I could go on but I don't want to waste my time any more on another crappy Microsoft "innovation".

  63. Re:C#: Answer to the DOJ? by Matthew+Smith · · Score: 1

    I'm not arguing that having ability to create classes with no vtables is useful. One simple case I have at work is our Vertex3f class. Because in large data visualisation you want a single vertex to take up as little memory as posssible vertices don't have vtables. It gives us good speed and minimal memory footprint. Having said that I don't forsee many sane developers trying to write seismic visualisation software in C# or Java. These languages serve a different purpose and hence they get away with the extra bloat. What I was trying to say earlier is that C# code should be no slower or bigger than Java code.

  64. C# (read as...) by corporate+zombie · · Score: 2

    Heh. With all the work I do with shells and perl when I first read the language name I thought it would be read as "See Comment".

  65. Re:Apple releases a new language called C#++ by kellin · · Score: 1

    I think you have to be a music geek, or a music theory geek to get the joke...

    (I almost didn't get it)

    --
    GWB to President of Brazil - "You have blacks, too?"
  66. Re:Somewhat related to both points... by RevAaron · · Score: 2

    I wonder this very same thing everytime I start up a Smalltalk image to get some work done. So many of the "innovations" of Java and C# are naught but features of Smalltalk with C's nasty syntax applied. Then you have abonomations like C++. I'll never understand the motivation behind that. I usually chalk it up to the fact that the average programmer's brain isn't flexible enough to look at non-BCPL/Algol syntax. Sounds elitist, but I'm at a loss for any other explanation.

    Thanks for the pointer to Cugar- I've not looked at it yet, but hopefully I can use it to escape the hell known as C++ this coming school year... Bloody professors won't let me use Objective-C or Smalltalk, but I'll show them! :)

    --

    Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
  67. Totally agree - when will OO die? by Ars-Fartsica · · Score: 3
    I agree completely that you can get by doing anything with C, perl, and maybe some shell scripting thrown in.

    I've done extensive Java programming since it was v0.9, and C++ programming for about six years, and my opinion is that most of the OO stuff is complete mumbo-jumbo that only serves to confuse the core programmer and others who try using their code.

    One rule that has served me well throughout the years is that one should never use a tool more complicated than the problem demands. Many OO programmers throw this rule out the window, and spend weeks playing with Factory patterns, polymorphism, huge inheritance hierarchies, and all sorts of other junk that creates bloated, useless code.

    At the very least, C++ allows me to limit the amount of OO I introduce into programs. Java seems to be as retarded as Smalltalk when it comes to this.

    Even for "internal" programs that don't require full-out performance, I can bang out a perl solution in half the code it takes a Java programmer do write. I have to wonder how Java programmers keep from going insane. The language and object hierarchy are so verbose that it takes at least twice as many lines of code to get anything done as any other language, and then the speed sucks. Rant off.

    1. Re:Totally agree - when will OO die? by Ars-Fartsica · · Score: 2
      Don't take this as a flame, because I am not trolling. I am just surprized that someone with 6 years of C++ and Java. Maybe there is a lack of OOA and OOD in your shop to benefit from OO implementations? Thoughts?

      Well, I admit C++ is less of an offender than Java, as it isn't prompting you to use OO whether you want to or not.

      As for a "lack of OOA and OOD" in my office, I'm sorry, but I've heard this one a thousand times. Typically, I find the worst offenders are the ones with the most books and training under their belt - they are even more likely to employ specious OO methods where they aren't needed. The problem is, most of the OO training and literature still isn't frank enough about the success rate of these methods, and what domains they handle adequately. The party line still seems to treat OO as a silver bullet that we could all use to save ourselves if we weren't so stupid.

      Obviously this is anecdotal evidence, but I still haven't heard of one shop who has gone totally OO and is better off for it.

    2. Re:Totally agree - when will OO die? by neutron42 · · Score: 1

      Lots of financial shops have gone OO (a la Smalltalk) and they're loving it. Obviously the OO philosophy has its limitations, but it can also create very elegant and appropriate designs.

    3. Re:Totally agree - when will OO die? by Johann · · Score: 2

      Well, I work in one of those shops that has gone totally OO and is better for it. We are a financial institution and our code involves rigorous manipulation of financial data. This system was implemented in C and C++. We hired a real OO architect, converted to java, completed team designs and the result is a much better system. Since then, I have worked on other projects that utilize OOA/OOD and implement in Java. The result is faster implementation, fewer bugs, and a better translation of the business logic into code.

      I was hoping you would provide some evidence for your bias against OO. What were the problems (not anecdotes) that led to your belief?

      As far as your comment on OO training and relevance to the real world, I agree. Much of our success is derived from the combination of well educated and experienced engineers (I am one of the most junior engineers with 5+ years as software engineer), an experienced chief architect (who has implemented dozens of OO systems), and old fashioned elbow grease! Let me recommend one OOA/OOD book that actually has real world problems and life cycles. Applying UML and Patterns by Larman. Check it out, you may find it more useful than much of the academic OO drivel on the market.

      Finally, I am not one of those folks who thinks OO is a silver bullet. I happen to model in the Relational Database arena often to know that OO and RDBMS are not a clean mix. I was as skeptical as you - until we designed and implemented a system with so few problems that it was shocking. These experiences taught me that OO is meritable and has too many positive ideas to throw out with the bath water.

      Later.

      --

      --
      "You're gonna need a bigger boat." - Chief Brody
    4. Re:Totally agree - when will OO die? by Johann · · Score: 2

      I broke most of your rules of thumb when I wrote a web server monitoring application (in Java). It was a single developer with a simple task -- Query web servers in the field, collect their current statistics text file, parse the file, and display it in a grid inside a window application.

      Thanks to the excellent Java libraries, I used sockets, threads, observer-observable to write this AWT application (they didn't want swing) in 2600 lines. IMHO, the OO patterns simplified the implementation so that it became trivial. BTW-The majority of the 2600 lines was from the chessy AWT event model. The core logic was in two classes at about 500 lines total.

      --

      --
      "You're gonna need a bigger boat." - Chief Brody
    5. Re:Totally agree - when will OO die? by __aasmho4525 · · Score: 3

      as one who has written about as much software as i've had to maintain other peoples' i can without a doubt say that the software that is well engineered in *either* paradigm is easily maintained (while the converse is clearly true).

      now, where it got interesting was when we actually examined the software engineered by novices. the o.o. paradigm forced more thought to be placed into the structure of the application's design, thus typically resulted in easier to maintain software.

      that software written in c, cobol, basic, pascal, you name it, that was easy to maintain was only that written by the really experienced. the novices in the crowd made our lives very painful. my experience seems to show me that o.o. languages are less lenient toward rush-jobs at design-time.

      just my 0.02

      Peter

    6. Re:Totally agree - when will OO die? by Johann · · Score: 2

      Based on your reported experience with OO in C++ and your apparent disdain that OO "creates bloated, useless code", I wonder what kinds of systems were you building that caused this opinion?

      My experience with OO is that depending on the lifespan of the code, OO will produce more stable and maintainable systems. Unfortunately, you have to add some up front time for analysis and design or the implementation will be poor. But, isn't this true of any system (procedural or OO)? Now, if you have a simple problem that you can solve with 50 lines of PERL, then I agree: why bother with OO implementation?

      Don't take this as a flame, because I am not trolling. I am just surprized that someone with 6 years of C++ and Java. Maybe there is a lack of OOA and OOD in your shop to benefit from OO implementations? Thoughts?

      --

      --
      "You're gonna need a bigger boat." - Chief Brody
    7. Re:Totally agree - when will OO die? by dynamitehack · · Score: 1

      My (a startup with about 15 people) company is completely switching gears from seat of the pants/ad-hoc/pseudo iterative-waterfall analysis and design to completely rigorous OOA and OOD using Rational Rose with Java as the main development tool. (The previous development tool was mostly VB6/COM+.)

      I was pushed in this new direction by management and new Gurus that they hired. From the begining I've had my doubts that this will result in better product that is more robust in a reasonable timeframe. I'm still on the learning curve but am starting to think this may work. All the "overhead" of the OOA and OOD process is causing us to understand the system in much deeper fashion that we would have otherwise. This will probably result in better implementation decisions on our part.

    8. Re:Totally agree - when will OO die? by Baki · · Score: 1

      As someone who has used C++ for 11 years, Java for 4 years, and has been involved in UML designes etc. in 5 different companies (one of them should be doing it right) amongst which Lucent/Bell Labs, I have to agree with Ars-Fartsica fully.

      Just now I'm involved again in a project with full-blown UML lifecycle, implementing the project in a very interesting self-developed framework (for handling applets-servlets-corba chain) with highly interesting MVC and what have you patterns and paradigms.

      It is a disaster.

      Everything is soooo very structured, but so complex and difficult. Only the framework developer (and myself) really know what is going on (and still we have to think hard to know). The rest are just developing according to a "cook-book" and have no clue on what's going on.

      Using non-OO (or maybe mixed, using some OOP handy things but no full-blown approach), perl, php or whatever with some RDBMS API, the project would for sure already have been finished (after 4 months now) but in reality we have implemented just some sketchy parts yet (design keeps changing, framework too) and it won't be before 2001 before it could be finished.

      From an academic point of view, I find it all very interesting and even beautiful, but for the project itself this is not good.

      As for maintainability: structured C code can be very well maintainable. But in this case, when the experts are gone and the project goes into maintenance mode, there won't be anyone left who has a clue on what's going on or who would even have the intellectual capabilities to do so.

    9. Re:Totally agree - when will OO die? by Ars-Fartsica · · Score: 2
      I was pushed in this new direction by management and new Gurus that they hired.

      I hope you have a list of projects that these "gurus" have completed in the past - my fear is that you'll end up with a gorgeous class hierarchy, with lovely UML diagrams, and then before your very eyes, the problem itself starts to move under your feet. All of a sudden your hierarchy may start to look very brittle. I've seen this before.

      Reuse in future projects may also be a bugbear. Class hierarchies tend to have more dependencies than anyone thinks, and you end up copying the entire hierarchy anywhere you want to reuse any of the classes.

      I hope it works out for you.

    10. Re:Totally agree - when will OO die? by Baki · · Score: 1

      OOP (object oriented programming) has little to do with OOD (design). What you have been doing is mainly OOP I guess.

      Java with it's framework is nice, since it contains a lot of useful functionality already, and the OOP helps structuring things.

      But: did you make your own framework? did you make use cases, sequence diagrams, analysis classes etc. for this project? Then it would be OOD but I hope and think you did not.

    11. Re:Totally agree - when will OO die? by MassacrE · · Score: 3

      OOD is incredibly useful, but there are several types of projects which it fails for:

      - projects which are one-shot, or which there is no interest in maintaining. For these, why do design at all? if it works enough for you to use, and you don't have to worry about adding features or fixing bugs other people have, just finish the damn thing and go home. Perl is great for this.

      - projects in which the customer has no clue what they want. I've been using design principles for a while, my current customer has no earthly clue what they want, but definately hope that I can completely change everything around at the last minute when I show them a working program based on my own ideas of how it should be designed. They literally won't pay me to do design specs. The code is rapidly approaching 100k lines, and I have no idea how the massive 1 ton block of spaghetti will be maintained in the future. There are parts of an old program with 25-page-long routines pasted in, and I have been told if I edit those routines I will be fired on the spot.

      - single-developer projects (or even two/three developer projects) don't really need OOD and documentation as much as team or multiple-team projects. It can still hit you hard right around 40-60k lines (depending just how good you are), when you realize that you don't remember how the whole thing works anymore. After about 80k lines, you will spend more time communicating how things work and bringing new developers up to speed than you will coding - basically you aren't done with the program and already you are maintaining it.

      If you are writing small,simple pieces of software, OOD is a joke. The reason isn't that OOD doesn't scale down, it is because the problem is so simple you designed it in your head. The end product is so simple that you can look at it for five minutes and understand what is going on. But as soon as you can't think about all the issues someone will face in the project by looking at the problem, as soon as you can't be sure what steps to take to get from A to B, you need OOD.

    12. Re:Totally agree - when will OO die? by SimonK · · Score: 2

      For once I agree with you. One of the things conventional approaches to Object Oriented Development tend to miss is that in the real world requirements change, and in cases where reuse is wanted, requirements often change drastically.

      Real companies - especially product companies -cannot afford to set solid requirements at the start of a project. Scope for change - and reuse - has to be allowed in the design.

      This, bluntly, is where *good* design and implementation come into play. Inevitably code must be changed, and inevitably the original design will have certain rigidities in it. To pick examples from different styles of programming, someone will have decided to use a 4 bit field for that thing that really has more than 16 different variants, or someone will have decided to use inheritance heavily to represent variation on some trivial dimension where you really need it for some unanticipated case that also includes all the same variation.

      The only true way to avoid these problems is good engineering. Precisely what that means is hard to say, but I guess two elements of OO design *help* (and here, no doubt, we differ).

      Firstly design patterns and abstraction should be used appropriatly in the design to abstract away the kind of variation between objects that might cause problems. As far as possible, public interfaces should be in places that you can be more certain of, and private ones in places that are more likely to vary.

      Secondly, as programs, requirements and functionality evolve around your code, it must be constantly redesigned - not merely modified - in order to accomodate the changes. The minuite you spot that the design is wrong, you must change it. Its never appropriate to create "working code" now, and decide to "do it right later", because no-one, ever, ever does.

      A lot of the discussion in this thread has focused on heavy, up-front, object-oriented design by "architects" who don't actually write any of the code, they just produce diagrams. Its my experience that this style of working is destructive. It deprives the actual developers of the power to go in an change the design which they will inevitably need, and it tends to produce designs which are, as you say, brittle, in that the factoring into classes is naive to the point where changes to the code will eventually totally destroy the abstraction.

    13. Re:Totally agree - when will OO die? by Hard_Code · · Score: 2

      Well I'm a Java "enterprise" programmer by day, which basically means I work on middleware implemented in Java (CORBA, RMI, messaging, database access, etc.). It is pretty heavily OO. While the gui libraries may be bloated, and you may think they are over-designed (well, what do you expect for a *completely* cross-platform gui), I think Java in general has pretty much fulfilled it's promise of being lightweight, robust, reliable, and cross-platform. Those benefits far outweigh any apocryphal "bloat" or abuse of OO. Of course OO is not a silver bullet, and I think only OO bigots would claim that. OO is a concept and a tool and like any other can be abused for the worse. Perhaps worse than that, since it is a complicated area with many subtleties, novices can easily munge things and come up with something much worse than what they could have with a non-OO language. OO requires understanding and discipline as with anything, and it should not be used as a panacea. It should be used for what it is good for: designing complex systems, on a high level, with robustness and reliability. OO is not for hello world.

      By the way, I don't know if you'd call us a "shop" (we're a "middleware"ish dept of the IT dept of a university), but we have gone pretty much entirely to CORBA and Java and other departments describe us as completing miracles weekly. All our new applications (both end-user, and "internal") are entirely Java, and communicate with CORBA/Java middleware which in turn hits the back end. It's scalable and robust.

      --

      It's 10 PM. Do you know if you're un-American?
  68. Re:What is wrong with hard tabs? by Tomun · · Score: 1

    I like them to be one half inch wide, but neither windows nor linux seem to care what size my monitor is. I still have to get a ruler up to the screen to measure my dpi.

    Surely an A4 page at 100% on your screen should be the same size as an A4 piece of paper ?

    Is it just me, or do others have this problem ?

  69. Re:C# by Zico · · Score: 1
    I don't belive that Microsoft would use the Sun Java vs. Microsoft Java case as a basis, [...]

    Hmm? As a basis for what?


    Cheers,

  70. Re:copying, assignment, garbage collection by jaoswald · · Score: 2

    I see a lot of interesting issues being partially raised here, and by the original article.

    There is indeed overhead involved in a reference, but the hope is that you only have to handle "large" objects by reference. Things like numbers are indeed "atomic" meaning that one use of the number 5, for example, cannot be distinguished usefully from another instance of the number 5. It doesn't make sense to say "change the value of 5 to be 6." Instead, we have a place that can hold numbers, and we change the value in that place to be the number 6 instead of 5. In that sense, a numeric variable is a "reference" to a location in memory, which can contain "values" although we never use those terms in C, as there is no pointer indirection or overhead involved.

    Now, the problem comes in when you talk about larger things, like, for instance, a 3-D rendered scene. Say I have a "scene" which contains a bat and a ball. If I "duplicate" the scene, so I have S1 and S2, and I move the ball in S1, does it move in S2? Hmmm. It depends on what you did/meant when you "duplicated" the scene. Is it the "same" scene, meaning you scratch one and the other bleeds? Or is it a new scene, which just happens to look the same? The same philosophical problem arises when you pass parameters to functions. Do you "duplicate" the argument, or not?

    The point is that a language implementation pushes bits and bytes around. However, a programmer is managing abstractions, and the handling of those abstractions CANNOT be specified as part of a language definition! It depends on the programmer's intent!

    This is another mess that C++ got into when it had to manage assignment and initialization of classes: "copy" constructors for all your classes. But what does it mean to copy? It depends! Not only does it depend on your class, but it also depends on how you want to use it, which can change!

    A side effect of this is that passing arguments around can involve a lot of excess "copying," if you insist on "copying" arguments before you pass them. C++ has to do this, because C did, except when you specifically ask for references. Now, if you have garbage collection, all these excess copies, most of which are soon discarded, need to be cleaned up.

    I guess this is why the author here worries about garbage collection in his phone number instance. In principle, once you have everyone's phone number, you don't need to allocate any more of them, and unless people go away, or change phone numbers, you don't really need to throw them away. Unless you are in C++, so you have to keep "copying" them onto scraps of memory to send to subroutines, and then discarding the scraps as soon as it returns.

    As a side note, mark-and-sweep is usually the worst possible garbage collection algorithm. You have to look at everything, even if most of it isn't garbage anymore. Much better is "generational" garbage collection, which mostly looks at recently allocated stuff. The idea is that if stuff has been held onto for a while already, it probably is still being held onto, while it is very common for things to be allocated, used only a little bit, then discarded. This can be very efficient GC.

    The problem with people's perception of GC is that it happens behind the scenes. "malloc()" and "free()" are right there in your face. In fact, they have so few characters in them, "they must be fast." Of course, as soon as you fragment your arena, malloc can get slower, and slower, and slower....In Windows, where programs typically don't live long, you don't see this. But in the world of serious applications, if you want your program to run for weeks or years, this can be a real problem. Garbage collection on references can then be MORE EFFICIENT than manual collection, not only because it doesn't "forget to free()", it can also, when dealing with references, rearrange memory to be more compact, and therefore localized for cache issues.

    Of course, I don't think C++ or C# garbage collection can actually do this, because when you move objects, you have to go back and change all the pointers that pointed to it, which in Lisp is easy, because the machine can tell a pointer from an integer, but in C-based languages is hard, because pointers and integers are both just piles of bits. But hey, that's what you get for programming in object-oriented portable assembler.

  71. Re:Ack! Significant whitespace! by Malc · · Score: 2

    You obviously don't use Emacs as your editor.

    Re-indent the whole file
    M-<
    C-space
    M->
    C-M-\

    Emacs was designed for using with Lisp... now that's a language with crazy matching of brackets. Everytime I close a brace, paren, etc, the cursor shows me where it matches, or outputs the line in the mini-buffer. If I felt like it I could also have it automatically highlight the whole region between brackets. Really, bracket matching is irrelevant.

    Personally I think that people who code in C/C++/Java/etc without using any braces for one line blocks are bad programmers. They're just asking for a bug to be introduced at a later date. Hence I don't do, and neither do a lot of the people I've worked with. It's just lazy.

    I kind of like the braces (opening brace on a new line please) as it helps space the code vertically and provides an easy way to search for the end of a block (I'll leave coding for a 25 line screen to Linux kernel people and their crazy coding standards - bunch 'o masochists that they are!) I don't know how you would do that if the block was specified by indentation.

  72. Re:For all the bashing C# gets here... by cwhicks · · Score: 1

    Jesus, relax. All he said was it gets a lot of press here. Seeing that there is not a lot new in the language (as described in this article), except that it is a Microsoft product, it may be that it is too much press.

    --
    - I like pudding.
  73. Re:Does C# exist yet?? by Skim123 · · Score: 2
    C# exists... I've created ASP+ pages using C#

    Go off and download the .NET SDK @ http://msdn.microsoft.com/net/...

    --

    I could not justify my existence if I were a turkey farmer. Would I terminate myself? Undoubtably, yes.

  74. Is C# a threat to UNIX or Delphi? by stikves · · Score: 1
    Well i thing GNU will have no diffucilty in making a C# compiler (if there is no licensing issue).

    Bu what i am afraid is this will hit Delphi bad. Well, a talented programmer on Windows uses either pure C or Delphi. Pure C is not for me because interface design is not easy, same thing for MFC.

    Delphi has all the bells & whistles, lile properties, a very good Class hierarchy (VCL) and a very good exception handling mechanism.

    I will be very sad if Borland (or Inprise) cannot catch up. BP7 was may favouritte in dos and Kylix may change things in Linux development, but what can we do about this C# thingy?

  75. It's a mesh, says INTERCAL by ToastyKen · · Score: 2

    Well, according to INTERCAL notation, which I'm sure we're all familiar with, it's a "mesh". :)

    1. Re:It's a mesh, says INTERCAL by damaged · · Score: 1

      Clear it's C-Hash, pronounced "Cash."

  76. Re:jsp by stubob · · Score: 1

    I prefer to work with embedded servlets using the servlet tag rather than jsps, if only for the size of the servlets I'm making at work. Yeah, I agree that writing a whole page with a servlet sucks. Try writing javascript with a servlet. out.println("document.write('hello')"); yuck.

    To answer the perl/servlet question browse this. Again, I have no idea of any credibility of the author, but the times are comparable or atleast close. I'm really starting to like yahoo/google...


    -----
    My karma is still less than my age.

    --
    Planning to be moderated ± 1: Bad Pun.
  77. How is it better? by gtaluvit · · Score: 2

    I work with C, Java, and Perl all the time. I shy away from Java for most major apps though because its a HUGE memory hog and incredibly slow. However, I use it over C++ (when I can't use C easily) because of the elegant design and garbage collection sacrificing speed. This Napster guy makes a point about a speed increase because of the use of copy-by-value and also talks about how cool it is that an "int" is an object. How is this good? If every object is unique, then copy-by-value is good, but the second you have a duplicate, you start eating up memory. An int may only take up one or two bytes of memory in C, how much is an Integer class going to take up in C#? For something as large as the phone database he mentions, thats a lot of wasted space. To me, it looks simply like a fully compiled, less elegant, single platform version of Java. If Microsoft wants to do something, improve the Java VM, don't waste time on languages that are going to be used regularly by five people in the world. ( See ADA, Eiffel, Lisp ) -gtaluvit (prnc. GOT-ta-LUV-it)

    --
    - gtaluvit (prnc. GOT-tuh-LUV-it)
  78. Re:Huh? (GC) by NaughtyEddie · · Score: 2
    I spotted that one. It's garbage. If anything has a reference to an object, it won't be collected, and if nothing has a reference to an object, it can't be used. Garbage collecting is 100% robust in this aspect.

    Mind you, this is one of Napster's programmers - the company famous for "taking existing filesharing software and making it work with MP3s" - about on a par with Baby's First JavaScript.

    --

    --
    It's a .88 magnum -- it goes through schools.
    -- Danny Vermin
  79. Re: Significant whitespace by Tomun · · Score: 1

    Yeah Visual Basic, you can't forget an 'End If', it doesnt understand your indenting and its less powerful than C.

    As a result of these problems I've learned to indent properly for easier reading. I use the Allman(?) style of C indenting whereby the braces go on a line of their own:

    if (thing)
    {
    do some things;
    }

    and I use a similar style in VB. I like Python's enforced whitespace because it make it easier to pick up another programmers code. I just dont like the rest of the language...

    I will definitely have a look at TheDullBlade's Cugar because it will save on vertical space in C programs and hopefully give me the best of both worlds.

    Preprocessors like these should be available for all languages so that a project team can enforce an indenting style across the project.
    Of course there are many other reasons why debugging others source code can be difficult, but I find it easier to read my own code from 7 years ago (when my ability and technique were different) tha anyone elses code because I was indenting in the same way.

    On the other hand, these syntax highlighing glorified text editors which appear to know what my code means and put indents in for me in almost the right place, could't they reformat a text file into my preferred style and save it back out into a compiler compatible format, with or without braces, ?

  80. Re:IL is the key... by baka_boy · · Score: 3
    Having had some experience with (shudder) VJ++ development, I would guess that the answer to your question about native code would most likely be: "If you include native code, then your IL will be completely tied to the platform(s) you compile for." Such is the way of "unsafe," low-level code, right? You can't guarantee it'll port, so a given VM can only allow it if it's been compiled for that specific architecture/OS combination. Just look at WFC in J++ -- if you use them, your Java code might as well be VB, because it sure as hell ain't gonna run on anything besides 32-bit Windows systems.

    Of course, Microsoft isn't exactly the only group doing this. As much as I may like the looks of OS X, the development environment is, once again, highly dependent on a number of proprietary, platform-specific libraries and services. Linux and the rest of the UNIX-esque system benefit from the basic POSIX standard, but I think what we're seeing more and more lately is that that's not quite far enough these days. If the UNIXes of the world can't come up with a system that's as brainless to use as Visual Basic, Microsoft will continue to lure developers who can't, don't want to, or don't need to learn the intricacies of OO, and just want to quickly build applications with the benefits of pluggable components.

  81. Re:For good "template" support: try ML by bgalehouse · · Score: 1
    Mostly the searning curve is because the syntax is optimized for functional (as opposed to prcedural). Nested function declarations and recursion are your friend.

    fun rev (nil) = nil
    | (h::t) = rev(t) @ [h]

    is probably the shortest function to reverse any list. Type is `a list -> `a list. Which indicates that it takes any list and returns a list of identical type.

    fun rev l1 =
    let
    fun rec (nil,l2) = l2
    | rec (h::t,l2) = rec(t,h::l2)
    in
    rec(l1,nil)
    end

    On the other hand uses an inner tail recursive function for performance. Does the same thing. rec (both lines of it does the work, the rest just wraps it to change the interface.

    Compare to the amount of code required to reverse a list in any other language. This second version doesn't rely built in libraries for linked lists - you could create an equivalent custom list type in about 3 lines.

  82. Re:New languages have potential, but C# doesn't by Bozovision · · Score: 2

    I don't know enough about C# to judge yet, but it's clear that you aren't taking a thinking-persons stance here.

    Let's deal with your points 1 by 1.

    1: It's been shown a few times that incremental languages are successful and revolutionary ones aren't. C++ was incremental on C. Eiffel was revolutionary. Which is in greater use. Leave the revolutionary stuff to experimental languages but be clear that ideas extracted from those languages and implemented in a incremental way are ideas that are successful.

    2: Schizo Gerbil. Jeeze - get a grip. Does C++ keep all semantics the same as C? Nope. Does Java?

    3. Non-open runtime. Really you don't know because the language is not ready for use yet. However Anders has said that the lnguage and all the other MS languages will compile down to run on top of the .Net runtime engine. He has also said that the language will be submittes to ECMA, so you can reasonably expect runtimes to exist for other platforms.

    4. No real standard. They have said they will submit to ECMA.

    Get some balance dude.

  83. Why program in flat text files?? by Ricdude · · Score: 2

    As programmers, I think our next big challenge is to remove the inherent religious problems with "whitespace" in programs entirely, by presenting a programming system where the programming is truly done at a conceptual level, and not at a textual level. Pick UML, or (relatively) standard flowcharts for procedural decompositions, and work graphically. Initially, you could "render" your program in a variety of back end languages (c, c++, java, perl, tcl, python, etc.) for execution. Eventually, you could generate machine code directly, libraries for "packages" and binaries for executable programs. Then all we can complain about is the expressivity of the graphical programming environment, and not meaningless trivia like syntax, whitespace, and so on.

    --
    How's my programming? Call 1-800-DEV-NULL
    1. Re:Why program in flat text files?? by Zurk · · Score: 2

      ugh. please dont. you have no idea how frigging ANNOYING it is to code visually. i used to work on objectime on irix boxes (basically a drag and drop UML tool with RPL for coding inside the boxes) which generated C++ code at the end. Since all our boxes were on NFS, it used to take 10 minutes to save the bloody picture (if the objectime application didnt crash and corrupt the files - the VM was bloody unstable). if it crashed, the entire application would be destroyed. backups were a nightmare with source files running into dozens of megabytes (each block of source is a visual image thingy - try and read that with anything other than objectime). each. ever tried to backup gigabytes of *new* data every DAY ? ever tried to get IRIX stable with HUGE FREAKING NFS TRANSFERS every few SECONDS ?? gimme a vt100 with a green glowing text screen, pico/vi/emacs and java or gcc. i'll take that over visual coding any day.

    2. Re:Why program in flat text files?? by T_Wit · · Score: 1

      Amen. And, if we ever do go to pic-oriented programming, it'll be ten years before colleges actually start teaching it (my age-old recurring theme of slamming our educational system cropping up again, sorry). Besides, on the code end of it, it seems like the whole thing would be slower. There's just too many steps between you & the binary data. After all, didn't we all learn in progging 101 that the fastest executables are generated when you code in pure assembly? Pictures, in my opinion, are inherently generic. Thus, our programs might start resembling our first C++ prog where we said "cout "Hi Everyone!";" without knowing what "cout", " " or " ; " actually meant - we just knew that was what we typed to get it. I know it's paranoia and an unwilligness to give up text, but that's my two cents, for what market depreciation they're worth.

  84. Generic Java by mouseman · · Score: 3
    The designers of C# have admitted the usefulness of genericity, but also confessed that C# is not going to support genericity on first release. More interestingly, they are unhappy with C++'s approach to genericity, which is based entirely on templates. It would be interesting to see what approach C# would take towards the concept, seeing as templates are pretty much synonymous with genericity at the moment.
    As others have pointed out, parametric polymorphism / generic classes are supported elegantly in other languages, such as ML and its variants, without resorting to the hack of templates. But I've only found one post, by an AC, score zero, buried deep in one of the threads (alas, no moderator points) that mentions Generic Java (GJ). GJ provides an elegant solution to adding generics to Java, and may find its way into future Java specs. It essentially works by having the compiler do type checking based on the generic types, but then translate to standard Java by "deleting" the generic parameters and inserting type casts where appropriate. The compiler guarantees that none of those type casts will ever raise an exception. The result is that where C++ templates result in code bloat by producing a copy of the generic class for every concrete instance, the GJ approach yields a single class, but type errors are still caught at compile time as they should be. The rewriting approach also ensures compatability with the JVM, since it compiles down to pure Java (with the addition of a little glue code). The catch is that there is no run-time information about the parameters of generic classes, so explicit runtime type checks (instanceof, etc.) can't be used for parameterized types. There was a nice article about GJ in the Feb 2000 Dr. Dobbs's

    I've used GJ quite a bit, and I'm quite happy with it. Furthermore, there's reason to hope that code written in GJ (the syntax of which is similar to C++ templates) will be compatable with future versions of Java, since Sun is looking into adding genericity to Java, and looking at GJ in particular.

  85. Re:I don't understand this attitude at all. by LLatson · · Score: 2

    Personally, I avoid all of this by using the C indentation mode in Emacs, where "tab" means correctly indent the line, not insert five spaces, so I can quickly check for errors like those by hitting tab on each line.

    (Right now I am teaching myself Visual C++, and the hardest thing about it for me is getting used to MS's editor, not the syntax!)

    LL

    --
    "If you are falling, dive." -Joseph Campbell
  86. C# support of events sounds alot like how Qt does by thufir · · Score: 1

    > Personally, I found C# support of events to
    > be a very exciting new feature! Whereas an
    > object method operates the object in a
    > certain way, object events let the object
    > notify the outside world of particular
    > changes in its state.. A Socket class, for
    > instance, might define a ReadPossible event
    > or a data object might release a
    > DataChanged event. Other objects may then
    > subscribe for such an event so that they'd
    > be able to do some work when the event is
    > released. Events may very well be
    > considered to be "reverse- functions", in
    > the sense that rather than operate the
    > object, they allow the object to operate
    > the outside world, and in my programming
    > experience, events are almost as important
    > as methods themselves.

    Sounds an awful lot like the Trolls Qt Lib way of doing events. Slots and Signals, where a signal is simply a defined like a method, but in the signals: part of the class .h file. and you simply connect(class, signal, slot); in your code. Definatly not much of an innovation on MSs part.

  87. Multiple Inheritance by SecretAsianMan · · Score: 1

    I think all the worry about protecting programmers from the dangers of multiple inheritance is about as stupid as protecting airline passengers from theor peanut bags ("Warning: May Contain Peanuts").

    --

    Washington, DC: It's like Hollywood for ugly people.

  88. Re:I don't understand this attitude at all. by MalcolmT · · Score: 2

    The parent post was making lots of sense until I read this bit:

    Since it does things like treat "=" as comparison in conditionals and assignment in statements, as well as the whole whitespace formatting thing, it totally spoils you for writing in things like C and Perl.

    I'm sorry, but that is just not true. In Python, '=' is assignment and '==' is comparison, just like in C, C++, etc. What you cannot do is do an assignment and simultaneously treat the rvalue as a boolean in a conditional. In other words, if you mean to do this:

    if a== 6:

    print 'a was 6'

    If you had you accidently typed this:

    if a = 6:

    print 'a was 6'

    Python stops with a 'Syntax Error' exception. If you make the same mistake in C, if would happily overwrite the previous value of a and print a was 6. Lots of fun to debug .. not!

  89. Re:C#: Answer to the DOJ? by ucblockhead · · Score: 1

    Ok, I'd buy that. I'm mostly a C++ coder, so I'm obviously biased in that direction.

    --
    The cake is a pie
  90. Re: Significant whitespace by rsfinn · · Score: 1

    I've recently picked up Python, and while I have little experience with it I generally like what I see.

    I have trouble understanding how people can use words like "inexcusable", "abomination", and "disturbing" when speaking of Python's significant indentation feature. (I'm especially surprised to find this on Slashdot, which is known throughout the galaxy as a paragon of moderation and considered reflection; but anyway.)

    To such people I simply ask: "Don't you indent your code to demonstrate your intentions?" If you do, then what's the big deal? Python honors your intentions directly, so you don't have to type braces. If you don't, then Python's probably not the language for you. (I'll resist the urge to suggest Visual Basic, and will simply avoid taking a job where I have to maintain your code.)

  91. Re:For all the bashing C# gets here... by Golias · · Score: 1
    Actually, I think Microsoft is evil, but I'm not going to get into a religious debate with you.

    Otherwise you are right on... except if "mindshare" is still a buzzword, then so are "cyber", "information superhighway", "e-commerce", "girl power", "whippersnapper", "hootinanny", and "corporatism". :)

    --

    Information wants to be anthropomorphized.

  92. The VM is called NGWS? by Wesley+Felter · · Score: 1

    NGWS (Next Gen Windows Services) was the codename for .NET; I thought the VM was part of the Common Language Runtime (CLR), which itself is part of the Common Language Infrastructure (CLI).

    By maybe someone from MS should straigten this whole naming thing out.

    1. Re:The VM is called NGWS? by _prime · · Score: 1

      I admit that as a non-MS centered person it is quite conceivable that I was overwhelmed with new 3 and 4 letter acronyms. I think you're probably right.

  93. Re:A look at C# by spectecjr · · Score: 3

    They had a look "under the hood" of the Virtual Machine only to discover that it looked *strangely* just like MS's Java VM. Apparently they changed the variable/function names but the programmer who was taking a look said the code itself looked the same. They commented that they could actually run Java code on the system without problems, providing it didn't refer to any of the special Java class libraries.

    Uhuh... right...

    The runtime for .net is NOT the same as the Java VM; it's not even the same codebase. It was a completely different team who didn't use any of the JVM code.

    Simon

    --
    Coming soon - pyrogyra
  94. Re:Ack! Significant whitespace! by RevAaron · · Score: 2

    Perhaps the more fatal flaw is that you refuse to touch it because of that attribute (significant whitespace). While Python isn't my favorite language (for other reasons), the whitespace-as-syntax has never been a problem for me or the other Python programmers out there. In fact, I've yet to talk to someone that hates the whitespace-as-syntax whose actually done more than go through the tutorial and a couple trivial scripts. Try it out for a while before you write it off as a design flaw.

    --

    Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
  95. Re:A look at C# by Rares+Marian · · Score: 1

    Hearsay

    --
    The message on the other side of this sig is false.
  96. Re:How do you pronounce C# ? by skwog · · Score: 1

    #include is not pronounced 'sharp-include', that's for damn sure, and the # on your phone isn't a 'sharp' key. C# should be pronounced 'C-pound'. Unless you're an idot && you work at M$.

    --


    You can laugh without eating a sandwhich, but you can do both if bring one.
  97. Re:Programming languages: Understanding Templates by bored · · Score: 1

    Wow, it constantly amazes me that people still don't get templates. Duh, you can create containers without them. Duh, the Java or C++ (ever looked at MFC? ick...) non template containers only need a single code instance independent of the data type being manipulated. The point of templates is FAST containers. The compiler can make all kinds of cool optimizations if it knows that in the line if (T1>T2) dosomethingwith(T); T1 and T2 are a particular type at compile time and it can optimize the code for that particular type rather than calling some virtual method to do a simple comparison.

    The point of templates is two fold, to provide a type independent method for coding algorithms, and to allow the compiler to generate OPTIMUM code from that generic algorithms for a particular data type.

    This is sort of like the point of C++ wasn't to create the perfect OO language. It was to provide a natural evolution for C with all the advantages of an OO language without compromising any runtime speed.

  98. That's OK, he's confused, too... by alispguru · · Score: 2
    For someone who clearly knows a bunch about a bunch of different languages, Mr. Arbel doesn't seem to know much about garbage collection in general, and Java/JVM GC in particular.

    The JVM is not required to do mark-sweep GC. The JVM spec ifically leaves the implementation of storage management unspecified.

    This is good because it means that Java can use modern, higher-performance GC strategies like stop-and-copy or generational GC, both of which have been in use in Lisp and Scheme systems since the 1980's. I strongly suspect that C# will have to use mark-sweep or some other non-relocating GC, since you're allowed to go down below it to assembler, exposing pointers that might need relocation.

    Do most JVM implementations really still use mark-sweep GC? Despite James Gosling and Guy Steele both being ur-Lisp hackers?

    --

    To a Lisp hacker, XML is S-expressions in drag.
    1. Re:That's OK, he's confused, too... by scrytch · · Score: 2

      I kind of started to wonder about the guy's programming background when he started referring to "classes with holes". Every whitepaper on whatever language I've seen that implements this feature refers to it as "parametric polymorphism". Something java still greviously lacks -- safe downcasts work but are still annoying to do by hand. If I wanted to do everything by hand, I would still be using the switches on the console.

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
  99. Re:For all the bashing C# gets here... by NaughtyEddie · · Score: 1
    No, it's not worth the debate.

    Is "corporatism" a buzzword? Most buzzwords are invented and employed in order to sell you stuff; this is quite the opposite!

    --

    --
    It's a .88 magnum -- it goes through schools.
    -- Danny Vermin
  100. Borland already did C# in C++Builder by DragonHawk · · Score: 3

    It is interesting to note that two of the "new" things that make the article author so excited have already been done ny Borland, in C++Builder, while retaining C++ compatibility. (Well, okay, they added a couple keywords, but marked them as implementation-dependent using the ANSI standard double-underscore prefix.)

    Personally, I found C# support of events to be a very exciting new feature ... an object reference as well as a method reference.

    C++Builder has been doing this since day one, with what Borland calls a "closure". You use a new keyword, __closure, to declare a pointer which points to a member function of a specific object instance. Not surprisingly, Borland uses this to drive the entire event system in their GUI framework. It rocks.

    Properties are another example, even though they're not as much of a labor-saver as events are.

    Again, Borland has been doing this since day one. The keyword __property can be used to declare object members which appear to be simple variables to "outsiders", but do magic when read or set.

    Once again, Microsoft fails to innovate, but instead steals from elsewhere.

    --

    dragonhawk@iname.microsoft.com
    I do not like Microsoft. Remove them from my email address.
  101. Re:Objective-C, NeXTStep, OpenStep, Mac OS X, and by LarryTheCucumber · · Score: 1

    Apple could probably wrap the runtime services it's built into WebObjects and have one the best freaking Java server platforms on the market.

    That's exactly what Apple plans to do.

    -jimbo

    --
    "Hold me Bob!" "I would if I could man!" -Larry and Bob in VeggieTales
  102. Re:C# directory listings on the web. by humpmonkey · · Score: 1

    They use .cs
    with humpy love,

    --
    with humpy love,
    humpmonkey
  103. Java vs. C++ speed by jonabbey · · Score: 2

    HotSpot is *extremely* good.. probably a fair distance along the way to optimal, given its ability to do things like deep inlining across several layers when the runtime history indicates that path is very hot. The reason Java code still runs slower than C++ is partially due to the HotSpot overhead and partially due to the fact that the way you write code in Java is often much less CPU efficient than if you were to write code with similar intent in C++.

    In C/C++, you would parse a file line by line by constantly re-using a single memory buffer for each line of the file that you read (sizing it up if it overflows, of course). In Java, since Strings are immutable (for thread safety), you wind up creating a new String for each line, plus a new String for just about every subelement that you pull out for further processing. This sort of style is mandated by the fact that so much of the Java class library API's demand real live immutable Strings, and you don't have a choice but to create a bazillion of them in many cases.

    With HotSpot, creating new objects off of the heap can be very nearly as fast as stack-based allocation of auto variables in C/C++, but it's just not going to ever be as fast as intelligently re-using a memory buffer. There are many things in Java programming that force that kind of trade-off. The benefit is that you get a lot of aid and encouragement to make your code thread-safe and that it is actually possible to guarantee that an object's private state can't be trashed by anything external to it, never no way no how. A completely reasonable trade, in my opinion, especially in light of the massive portability support provided by Java, but it's not The Answer To Everything, of course.

    But HotSpot itself is some impressive shit.

  104. Re:yet another moronic USian by jcr · · Score: 1

    >The whole *reason* the currency is called 'pound' is because it is worth a pound of gold.

    No, it's worth a whole lot less than that.

    There was a time when it was tied to a weight of silver (in fact, the currency is called the "pound Sterling"), but that was a long time ago.

    -jcr

    --
    The only title of honor that a tyrant can grant is "Enemy of the State."
  105. Events used to drive Garbage Collection? by torpor · · Score: 3

    So is it feasible that I could define an object in C# that fires a ReleaseMe event when it's finished with itself, at which point it gets garbage collected?

    --
    ; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
  106. Re:Objective-C, NeXTStep, OpenStep, Mac OS X, and by Ars-Fartsica · · Score: 2
    Nice post. Its unfortunate that even with Apple's backing, Objective C is probably off the radar for good. I can't see it regaining much mindshare with all the hype Java is getting, and with the vigorous interest in scripting. This isn't the first language tragedy.

    As for JITC, prospective apostles of this technology should try it out with real programs and do extensive benchmarking - indications are that HotSpot is still two to four times slower than C++. Most claims I have seen for JIT code is based on in-memory operations with very little IO and/or user-interaction.

  107. This *vaugely* sounds like a mashing of VB and VC by SuiteSisterMary · · Score: 1

    Ya know, this sounds kinda like they took VB and VC and mashed them together. Based merely on the above article. I haven't read any of the C# docs or anything.

    --
    Vintage computer games and RPG books available. Email me if you're interested.
  108. Re:power languages by ckaminski · · Score: 1

    >The good thing about C is that nothing goes on ?>behind your back. It's a portable, highlevel asm >that allows you to see *exactly* what >instructions the code will compile to. (compare >this to c++ and most other "advanced" languages >where a var[i]++ can involve millions of >instructions that are never seen.)

    Don't confuse instructions with code-reuse. A var[i]++ could easily turn out to be only a few more instructions that a comparable C statement or it could the exact same, but instead be comprised of much more code which insulates the programmer from stupid errors.

    One of the best things about C++, is that it let's me dictate the amount of overhead I want in my programs, as opposed to having extra overhead dictated upon me.

    How many instructions is a var[i]++ in Java? Not java ops either, but real machine instructions?

    C++ however, requires damn good compilers for performance.

    -cfk

  109. C# by VAXGeek · · Score: 1

    As with any new programming language, I suspect hype is going to factor in. I think this is more of a move by Microsoft to "innovate" a language. This way, there is no competitor at first. For instance, Borland/Inprise is NOT going to come out with a compiler for this right away, if at all, so Microsoft will have the 'best' C# implementation. The only use I can possibly see for it is if it's faster than Java, it'll make a nice language to program Win32 applications (instead of VB). It won't take all platforms by storm, but to Microsoft, all that matters is Win32 anyway.
    ------------
    a funny comment: 1 karma
    an insightful comment: 1 karma
    a good old-fashioned flame: priceless

    --
    this sig limit is too small to put anything good h
    1. Re:C# by sandalle · · Score: 1

      Oh, the irony! It hurts! =) And to make matters even funnier, I don't belive that Microsoft would use the Sun Java vs. Microsoft Java case as a basis, since that would mean that they were wrong that time, they would just 'floss' over that one.

      --
      "To many, a tux is something you wear for formal events, to those of substance, Tux is a symbol of freedom." --sandalle
    2. Re:C# by Anonymous Coward · · Score: 3

      speaking of compilers, wouldn't it be funny if Sun released a compiler for C# that didn't follow the language specifications exactly as Micrsoft has detailed them?

      I wonder who would win that court battle...

  110. Re:A look at C# by spectecjr · · Score: 2

    What's hearsay? My comment or the other guy's?

    Which of the two of us worked on the .net team? (Clue: Not him).

    Simon

    --
    Coming soon - pyrogyra
  111. Re:Copy By Value vs Copy By Reference by Sir+Joseph+KCB · · Score: 2

    That's right except for a few things:

    the output would be "21" and "10" if it is passed by reference, not "10.5" (integer division)

    C and C++ pass by value by default, and Java passes primitive types (int, double, char) by value, but Objects by reference

  112. Back to C... by pb · · Score: 4

    There's a C library that does garbage collection already. Actually, I think there are a few of them.

    And it's a shame to not see good template (genericity?) support in C#. Or any language, for that matter.

    I think choosing a good type system is where a lot of languages fall flat, and I'm not a big fan of the huge C++/Java Object/Type/Library approach, although I haven't seen a truly good solution to this problem yet. C, Pascal, Java, Perl, Scheme... They all have different ideas and solutions, and I haven't seen a "Right Way" yet. Although I think Scheme has the right idea with its first class data types, it still all needs some work.
    ---
    pb Reply or e-mail; don't vaguely moderate.

    --
    pb Reply or e-mail; don't vaguely moderate.
    1. Re:Back to C... by HeghmoH · · Score: 3

      With Objective-C, you can have pointers to objects and not have even the faintest clue what kind they are, yet you can still call their methods. I'm sure many proper OO languages support what you're looking for as well.

      --
      Mod down posts with a "Free Mac Mini/iPod" sig, they're spam!
    2. Re:Back to C... by Anonymous Coward · · Score: 1

      Ya, I don't know why people seem to be flocking to the Simula school instead of the Smalltalk school. Objective C is a good argument for how Smalltalk can be compiled and be fast. If you make heavy use of protocols (which admittedly uglies up your code), the difference in performance between ObjC and C is negligible.

    3. Re:Back to C... by pb · · Score: 1

      That's cool; is there some sort of method naming convention?

      What I like about Scheme is that you can query the datatype to see what it is, and it will be an atom or a list; atoms are like scalars, and lists just need to be parsed recursively.

      Perl doesn't really support that well for its scalars, and arrays and hashes sort of have their own namespaces, and look like they came from BASIC. But at least you can get types from references.

      And C is downright horrible on this because a pointer could be anything! You'd have to make a struct with a field that identifies it, always in the same place, or something similar. But you have the power to do whatever you want... sort of...

      On the other side of the fence, Java has a type for everything, and is correspondingly complex, too.

      Those are the issues I see, anyhow.
      ---
      pb Reply or e-mail; don't vaguely moderate.

      --
      pb Reply or e-mail; don't vaguely moderate.
    4. Re:Back to C... by ameoba · · Score: 1

      One of the advantages of Java's singly rooted object heirarchy is that all objects are subclasses of Object (for clarification object is just a thing, Object is the class to which all classes are subclasses of), so (with the exception of the primitive types) any object can be referenced as an Object.

      --
      my sig's at the bottom of the page.
    5. Re:Back to C... by Keith+Russell · · Score: 2
      Actually, in O'Reilly's interview with Anders Hejlsberg, Anders mentions that they have generic classes running in the lab:
      Hejlsberg: Yes. Microsoft Research in Cambridge has created a generics version of the common language runtime and the C# compiler. We're looking at how to move that forward right now. It's not going to happen in the first release, that much we know, but we are working on making sure that we do things right for the first release so that generics fit into the picture.
      He also mentions that generics would be implemented in the Common Language Runtime, which would allow C#, Managed C++, and Visual Basic to all share generic classes.

      Every day we're standing in a wind tunnel/Facing down the future coming fast - Rush
      --
      This sig intentionally left blank.
    6. Re:Back to C... by Anonymous Coward · · Score: 1
      Yes some of the nice things about Smalltalk languages (ObjC) over Simula languages (C++) are:
      1. Classes are objects
      2. Methods are objects

      I'm sure you've read David Stes on comp.lang.objective-c go on and on about blocks (which is the idea that blocks of code are objects, too). It doesn't seem very practical in a compiled language, but you never know.

      But to answer the question about how messaging works in ObjC, basically (assuming there isn't an appropriate protocol), the function objc_msg_lookup() will be called. It will then return an IMP (pointer to a method), most likely _i_MyClass__methodName, but possibly _i_MySuperClass__methodName, etc.

    7. Re:Back to C... by HeghmoH · · Score: 2

      Ok, I haven't been doing Obj-C for too long, so this may be innacurate or incomplete yada yada.

      I've only done work using my own code within a free set of libraries called Swarm, so I don't really know if there are method naming conventions between sets of code and the like. I think many common operations would be named the same. Basic things like object creation/destruction are certainly named the same.

      Objective-C is more-or-less straight C with smalltalk classes grafted on top. Things like int, float, and C-style arrays aren't classes of any kind. However, most Obj-C compiler libraries have classes for arrays and other types of object collections. If you have an object of type id (literally, just a pointer to some object), there are some standard methods to see whether it's a particular class, whether it responds to a particular method or protocol set. There's been mention in comp.lang.objective-c about a higher-order-messaging scheme that one of the people is putting together to help handle things like performing actions over entire arrays, and it's done entirely within the language (no compiler changes). I haven't looked into it too much, but it looks pretty neat.

      --
      Mod down posts with a "Free Mac Mini/iPod" sig, they're spam!
    8. Re:Back to C... by Matthew+Weigel · · Score: 1
      And it's a shame to not see good template (genericity?) support in C#. Or any language, for that matter.

      How do you figure? C++ templates are a hack to deal with the lack of a base class; other OO languages (Java, Objective-C, C#,Smalltalk...) let you do generic things by operating on the base class, from which all objects inherit. Also, with interfaces, you can define an operation that only affects classes that know about the operation, without worrying about where in the class hierarchy the class is.

      I think choosing a good type system is where a lot of languages fall flat, and I'm not a big fan of the huge C++/Java Object/Type/Library approach, although I haven't seen a truly good solution to this problem yet.

      Would you mind explaining this a bit? What do you mean by 'Object/Type/Library' approach to typing?

      --
      --Matthew
    9. Re:Back to C... by VP · · Score: 1

      I think choosing a good type system is where a lot of languages fall flat, and I'm not a big fan of the huge C++/Java Object/Type/Library approach, although I haven't seen a truly good solution to this problem yet.

      You may want to check out Standard ML (SML). It is a functional OO language, it is interactive, and compiled. Here is a good starting point.

    10. Re:Back to C... by Snocone · · Score: 3

      That's cool; is there some sort of method naming convention?

      That problem is addressed through the use of protocols. Some are formal, like the reference counting protocol for instance (implementing them is known as "adopting" that protocol), informal protocols can be defined at will. Note that this also gives you basically all the design capabilities of C++'s multiple inheritance with none of the associated problems.

      "Protocols free method declarations from dependency on the class hierarchy, so they can be used in ways that classes and categories cannot. Protocols list methods that are (or may be) implemented somewhere, but the identity of the class that implements them is not of interest. What is of interest is whether or not a particular class conforms to the protocol--whether it has implementations of the methods the protocol declares. Thus objects can be grouped into types not just on the basis of similarities due to the fact that they inherit from the same class, but also on the basis of their similarity in conforming to the same protocol. Classes in unrelated branches of the inheritance hierarchy might be typed alike because they conform to the same protocol."

      -- Object-Oriented Programming and the Objective-C Language, p.99.

      What I like about Scheme is that you can query the datatype to see what it is,

      In Obj-C you can ask an object what it is, if what it is is a kind of some of other thing, if it responds to a given message (note that through the use of categories, this capability may be added at runtime), conforms to a given protocol, yadayadayada.

      On the other side of the fence, Java has a type for everything, and is correspondingly complex, too.

      Obj-C is, well, C. You add just as much or little complexity as you wish.

  113. Is it just me, or does this like VB++ by Bigboote66 · · Score: 2

    Events? Attributes? Garbage collection based on copy-by-value?

    The similarities to Visual Basic are eerie. It sounds a lot like they looked at the way people were using VB and incorporated those ideas plus improvements people have been asking for into a package that is more 'programmerly'. Anyone want to place any bets that this is the heir apparent to VB?

  114. .NET probably no better by Wesley+Felter · · Score: 1

    If you write an app that uses any .NET features, it will require the .NET runtime, which is probably at least as big and complex as the JRE.

  115. Re:power languages by Ars-Fartsica · · Score: 2
    I think it's an unfortunate misconception that C is the ultimate "power language" because it gives you so much "control".

    I would argue that efficiency and performance are more likely arguments for C.

    (Eiffel, Haskell, ML come to mind)

    Haskell in particular is cool, but I think you do these languages a disserive by mentioning them in the same post as Java - while they all require a new way of thinking, none of them has nearly as much mumbo-jumbo associated with them as Java. In fact, I see the simplicity of Haskell as its key advantage.

  116. Generic Programming by knepley · · Score: 2

    I found the comments made about this language feature in the article somewhat naive. It is well known that C++ templates, being pure textual substitution, do not guarantee type safety. For examples, see "Object Oriented Type Systems" by Shwartzbach and Palsberg. In that book, you can also find a viable alternative (and a nice proof that inheritance and genericity are orthogonal mechanisms which commute). Matt

    1. Re:Generic Programming by Anonymous Coward · · Score: 2

      Ada generics are completely type safe. Indeed, type safe generics are possible, if done right. Check out GNU Ada. By the way, GNU Ada can compile to Java byte code. It is also worth looking at GNU Eiffel which also provides type safe generics and the ability to compile to Java byte code.

    2. Re:Generic Programming by dav1d_s · · Score: 1

      Of course the use of templates by itself can't guarantee type safety, since a template is only as good as its author. C++ doesn't guarantee you much of anything, but it allows you to build systems that guarantee whatever you want, if you're good enough to design them properly. That's one of the main reasons why the language is so popular.

      If you want guaranteed type-safe collection classes, but you don't know how to build a type-safe collection class template yourself, try the STL. In fact, even if you do know how to build them yourself, you're almost certainly better off using the STL rather than reinventing the wheel.

  117. CORBA, not JNI by Malc · · Score: 2

    "For serious number-crunching, using JNI to hook into some optimised native libraries, which can be built with a minimum of platform-dependant code if you don't count Makefiles, all-but-negates any speed loss that going with a purely Java solution would give you."

    I've always been partial to CORBA as a solution to using native components. It doesn't matter where and how your components are implemented. We were doing stuff using the TAO ORB for our C++ servers (and Visibroker in Java). For what we were doing, CORBA is so fast that it wasn't really noticeable if my CORBA servers were at the other end of a dial up connection!

  118. I don't understand this attitude at all. by TheDullBlade · · Score: 2

    that one design flaw (making whitespace significant) has kept me from wanting to touch it. It would be okay for the compiler to generate a warning for incorrectly-indented code, but to generate incorrect code instead is simply inexcusable.

    I think this is a common poor analysis that reads the situation backwards. In reality, code is almost always indented "correctly" according to what the programmer intended, errors arising from incorrect indentation are generally due to the programmer failing to insert the braces in the correct positions, and thus don't exist in a language like Python. So "to generate incorrect code" due to a formatting error is simply an impossibility, unlike in C.

    Whitespace formatting is instantly visible, that's why people indent their code even when it's insignificant. Braces, OTOH, are very hard to keep track of. When the whitespace isn't used by the compiler, that means you're using one technique to give this information to a human reader (including yourself), and another to give the information to the compiler: a sure recipe for errors.

    How often have you seen C bugs due to missed semicolons and braces? Part of this

    if(x==y)
    doxeqy();

    Then you realize you had to do more for that condition:

    if(x==y)
    doxeqy();
    doyeqx();

    Whoops! It looks okay, but of course it's not.

    Or how about this classic mistake?

    if(x==y)
    if(t==u){
    doxyandtu();
    doxyandtu2();
    doxyandtu3();
    }
    else{
    donotxy(); /*d'oh!*/
    }

    Hmm... looks okay, compiles fine...

    Sure, they're goofy mistakes, people make them all the time! Human minds are terrible at diligence tasks (when they have to remember to do something and nobody is reminding them to do it). Of course you're going to forget to put in braces sometimes! Why not design the language so your first impression is always right?

    In practice nobody ever fobs up a Python script with something like:

    if a=b:
    if c=d: do_aeqb_and_ceqd1()
    do_aeqb_and_ceqd2()

    It's immediately apparent from the indentation that the second function call is in the "if a=b" block, not the "if c=d" block.

    However, I do think that pushing Python as a teaching language is a terrible mistake. Since it does things like treat "=" as comparison in conditionals and assignment in statements, as well as the whole whitespace formatting thing, it totally spoils you for writing in things like C and Perl. Even experienced C programmers often forget things like semicolons and mix up comparison and assignment, people moving from Python to C just have a terrible time.

    ---
    Despite rumors to the contrary, I am not a turnip.

    --
    /.
    1. Re:I don't understand this attitude at all. by aphrael · · Score: 1

      code is almost always indented "correctly" according to what the programmer intended

      In practice, I find that most incorrect indentation (on a multiple-person project with significant quantities of legacy code) is the result of different people using different editors that have different default indentations.

    2. Re:I don't understand this attitude at all. by battjt · · Score: 1

      Depends who you work with.

      I see lost of Java that is not indented, or is incorrectly indented, so I never trust the indentation and always have emacs reformat all the code before I even get started.

      Joe

      --
      Joe Batt Solid Design
  119. Unoriginal and boring by eric.t.f.bat · · Score: 1
    I can't see Mr Nir Arbel as anything worth crowing about. He claims to be worthy of our attention, but he's just boring. Consider:

    Body shape: Mr Arbel has two arms, two legs, a torso and a head. BORING!!! That design has been kicking around at least since the 1920s, possibly earlier. If he wants us to pay attention to him, why doesn't he try something new, like tentacles, which work well for squid but which haven't been used in any land-based mammals that I know of, despite their obvious utility for important stuff like swimming and catching fish.

    Writing style: Mr Arbel uses vowels all the time. How can he claim any kind of innovation? Linus Torvalds himself pioneered the use of vowels in software when he invented a variable type called "int" in the early nineties. This is just copyright infringement on the part of Mr Arbel.

    Clear, rational argument: For g*d's s*ke, why must we keep listening to people who read widely and carefully and then write articles that are clear and well-written? It's blatant, unforgiveable discrimination against the visually impaired, the illiterate and the grumpy, three minorities that deserve equal time in all areas. This sort of thing is not acceptable in the modern world.

    Shame, shame, shame, Mr Arbel!

    : Fruitbat :

    --
    I have discovered a truly remarkable .sig block which this margin is too small to conta
  120. Re:Americans are *so* fucking stupid by Bryan+K.+Feir · · Score: 1

    This is a pound: £

    It is used as currency.

    This is a hash: #

    As in 'please enter your password and press the hash key'.


    And this is also a pound: #

    It is used to refer to a pound as in the weight, and I have seen it used as such in a couple of old recipe books instead of the more common abbreviation lb (which is actually from the Latin/French librum, or balance, I believe).

    -- Bryan Feir

  121. This level of language... by Chiasmus_ · · Score: 5

    I think this whole "write in languages that are C, but easier" movement that's been going on for decades is a little weird.

    If I want to use a medium-level language because I want absolute control and optimized speed, I'll use C. I don't want an "almost-medium-level-but-a-little-higher-than-that -level language". If I was looking for ease of use and didn't care about optimizing, I'd go with PERL, or, hell, even Quickbasic.

    Granted, there's a need for these "weird-level" languages, and some people love them - but I think that C++ and Java nicely fill the niche. So, my first thought, which is even more valid, I think, in the face of this review, is "Why does Microsoft feel almost obligated to make an M$ version of *everything*??"

    For GUIs and money managers and anything else aimed at "my mom", Microsoft is guaranteed to reign supreme, because "my mom" doesn't really care about performance issues or security or any of that. But my hunch is that, in light of some of the bugs and general ickiness covered in this review, few people are going to want to switch over to C#. I mean, what would be the advantage?? If you already write C++ and/or Java, why would you want to start writing stuff in C#? I just don't understand.

    --
    "Beware he who would deny you access to information, for in his heart he deems himself your master."
    1. Re:This level of language... by matsh · · Score: 1

      The real reason why Microsoft invented this new language is that writing COM components in C++ sucks really bad, and VB isn't really powerful enough for writing COM. Java would have been perfect, but it turned out to be a too good language, so they did this instead.

    2. Re:This level of language... by sjames · · Score: 2

      By doing this you'd have the benefit of having all your C# code instantly portable to every platform with a conforming C implementation (i.e. 99.99% of all platforms, and I think that's being conservative).

      That's exactly what Miocro$oft DOESN'T want! Otherwise, they would have played nice with Java amd made C# compile into Java bytecode.

      They used to feel safe enough with C since C code for windows isn't very portable. Now that compiling against winelib can get you 90% of the way there on Linux, they need something more locked in.

    3. Re:This level of language... by Anonymous Coward · · Score: 2

      Yes, that's my sentiment, too. It would have been a lot more logical (IMHO) to make the back-end of C# be C instead of compiled code (which I assume it does now). I've never understood why C++ implementations stopped doing this, since C++ itself doesn't offer anything over C. By doing this you'd have the benefit of having all your C# code instantly portable to every platform with a conforming C implementation (i.e. 99.99% of all platforms, and I think that's being conservative).

    4. Re:This level of language... by LuckyLuke58 · · Score: 1

      "But in the interview with the Microsoft C# guys, one of the guys said that Microsoft will be submitting the C# language definition to a standards body"

      Sure they are, on the surface. But lets be honest about this: how cross-platform do you realistically expect C# to be? Do you expect that there will always (for example) be a C# for Linux, Mac and BeOS? Do you expect that that version will be the latest, or will it always trail months or years behind Microsoft's version?

      This is a well-worn path by MS, don't be fooled by what you see on the surface. They're old hands at doing this. You can expect that they will aggressively push out new versions of C# and it's libs as often as possible, regardless of whether or not those new versions are actually stable. You can also expect that MS's version will have a number of "subtle differences" between the published standard and their version, which will give software developers a hard time when they discover that they can't just copy their source files over to Linux and recompile (remember the differences MS pushed into their Java? Expect the same sort of thing, but now that the language is theirs, they don't have to worry about litigation. And MS has never claimed that their implementation is going to stick exactly with the open version.)

      It sounds like you actually somewhat trust what MS says about C#. This is strange, considering their track record, particularly when it comes to compatibility and interopability. "Maybe this time it'll be different" .. "maybe this time they really do care about standards" .. "maybe this time it'll be stable" .. yeah right, every single time MS releases something new we all say the same things, hoping it "will be different this time". But it never is. And we'll be saying that when Windows 2005 comes out. And we'll be saying it when Windows 2010 comes out, and so on. Strange what short memory spans we have .. the moment MS starts promising us their next new and wonderful thing, we've all forgotten all about the last time they screwed us over. Like the wife who won't leave her cheating husband because each time he gets caught he promises that he won't cheat on her again, and she believes him.

    5. Re:This level of language... by steveha · · Score: 1
      they need as much lock-in as possible.

      But in the interview with the Microsoft C# guys, one of the guys said that Microsoft will be submitting the C# language definition to a standards body. Why would they even be talking about that if they want as much lock-in as possible?

      --
      lf(1): it's like ls(1) but sorts filenames by extension, tersely
    6. Re:This level of language... by J.Random+Hacker · · Score: 3

      As to why compilers abandoned generating C, I can answer that readily. Two things come immediately to mind.

      (1) The ability to do source level debugging is nearly completely lost in translation from C++ to C.

      (2) It is much easier to optimize code when you are going from a symbolic representation to RTL or some other near-machine-level representation than it is when going from symbolic code to some other symbolic code with uncertain semantics. While the translation is *possible* the results are not elegant, efficient, or readable.

    7. Re:This level of language... by Malc · · Score: 1

      Oops, I tried to moderate the parent comment and screwed it up trying to scroll down the page with my mouse wheel. So, to undo my "Flamebait" moderation, here's a useless comment.

    8. Re:This level of language... by SimonK · · Score: 2

      I think this whole "write in languages that are C, but easier" movement that's been going on for decades is a little weird.

      There are only four languages, C++, Java, Objective-C and C# that even come close to meeting this description. In the case of C++, its a mixed level language - parts are very low level, like C, and parts are fairly high leve. In this it is like many older, larger languages, like Pascal, Modula, Ada, PL/1, etc. Objective-C is similar in nature, but its high level parts are higher level - its a kind of wierd hybrid of Smalltalk and C. These two languages are as they are because they want to retain *compatibility* with C, which is widely used, whilst getting some or all of the percieved advantages of OO.

      Java and C# are as they are because people are familiar with C-like syntax. The underlying mechanism of the languages relate more closely to Smalltalk - for instance they are dynamically linked, and can support reflection. Thus they are not really "like C" except in their syntax.

  122. What's the point? by HeghmoH · · Score: 3

    Why do we need yet another object-oriented C? We already have C++ (fast but crappy) and Objective-C (slightly slower but way better), what does this C# thing add? I saw no compelling features in it that Obj-C doesn't already provide.

    --
    Mod down posts with a "Free Mac Mini/iPod" sig, they're spam!
    1. Re:What's the point? by Anonymous Coward · · Score: 1
      The one thing that C# does offer is garbage collection. To my knowledge, only POC and Stepstone offer GC, which means that you can't assume that it's there if you're coding in Objective C. Perhaps if NeXT had kept their grubby little hands out of ObjC, implementations would have long ago added garbage collection instead of relying on release pools.

      Besides that, though, I agree that C# does seem pretty useless.

    2. Re:What's the point? by Black+Parrot · · Score: 4

      > what does this C# thing add? I saw no compelling features in it that Obj-C doesn't already provide.

      It provides a Java-proof firewall around Microsoft's market share.

      --

      --
      Sheesh, evil *and* a jerk. -- Jade
  123. Re:Ack! Significant whitespace! by PD · · Score: 1

    >at least until I write a conversion program that turns braces into the whitespace that python likes (in Perl :-).

    You've given me an idea...

    I think I could write that program in Tcl!

  124. C#: Answer to the DOJ? by KFury · · Score: 5

    (I know I'll get thrashed for this, but my karma can take it)

    It seems to me that creating a new 'standard' language, which neverltheless relies heavily on COM and .NET ties which only exist on Windows, is in part a tactical method to inhibit migration of Windows products to other platforms.

    Let's say that C# is simply a better language to program for Windows than C++ is. Let's also suppose the hypothetical case where new Windows functionality comes along in future Win versions, and that this functionality is more easily taken advantage of using this new C# language. This gives developers the incentive to code new Windows products in C#. Note that C# has substantially different enough structures that porting from C# to C++ would not be trivial.

    Now suppose that Linux (or another OS) starts gaining prominence in the next 2-8 years. As with any new OS, its main barrier to entry is lack of software. (The only reason Linux is viable is because of all the UNIX software it inherits.) In this time, Microsoft's pushing of C# has created a new software base for Windows that is relatively locked into place, unable to be ported to other platforms without significant effort.

    Now I'm not saying this is evil. I'm not saying it's a conspiracy. Often languages built for specific environments are superior tools in those environments specifically because they're specialized.

    It's just something to be aware of.

    Kevin Fox

    1. Re:C#: Answer to the DOJ? by ucblockhead · · Score: 1

      Ever try actually doing that under Windows?

      Usually you end up with 20k of portable code and 200k of hideous Windows GUI crap.

      Microsoft does not do much to help you write modular programs...

      --
      The cake is a pie
    2. Re:C#: Answer to the DOJ? by baka_boy · · Score: 3
      With the similarities between C# and Java, I worry less about language lock-in than reliance on a set of system libraries and object models. In this case, the C# focus on COM objects would prove to be a greater barrier to porting a lot of code to another platform, not the basic language syntax. Add the new shared .NET libraries to the mix, and suddenly, you have mission-critical applications being developed in a completely platform, vendor, and version-dependent environment.

      Java may not be the ultra-portable platform it originally claimed to be, but at least companies who develop with it are not signing their eternal soul (and support contracts) away to a single vendor. If you start down the road of .NET, you are now committing not just your desktop applications and documents, but all your business logic and data, to the benevolent guidance of Microsoft.

      The silver lining to all this is the fact that there will be those business analyst-types who will realize the same thing, and say so.

    3. Re:C#: Answer to the DOJ? by Matthew+Smith · · Score: 2
      COM doesn't increase the size of an object if that object already has a vtable. All classes in Java have vtables by default so each object in Java has the extra four bytes of size penalty. Since all Java functions are virtual they incur a speed penalty of one indirection. I suspect that C# will be the same in this way although I haven't read the spec so I can't be sure. But it's a fairly educated guess.

      COM is not slow nor is it big. calling a COM object within the same address space is no more expensive that a single virtual function call. All COM objects must have vtables but this is the sad reality and in most cases the extra four bytes per object isn't critical. You're saying COM object but I guess what you have in mind is OLE controls. OCXes are big and slow. But don't confuse them with COM objects.

      I buy your argument about not wanting to export all your object to the outside world. It doesn't make sense to say that everything is a COM object. It serves no purpose and could have been achieved with an extra keyword, something like exportable or something. It would be much more elegant.

    4. Re:C#: Answer to the DOJ? by ucblockhead · · Score: 4

      I find the concept of "every object is a COM object" worrisome because COM objects are anything but lightweight. Often, as a C++ programmer, I find a problem best attacked with small, lightweight classes, often entirely inline. They help keep the code simple while essentially compiling down to nothing. If every object is a COM object, that ability goes away. That small, lightweight class all of a sudden has all of this overhead to do things that I don't really care about for this particulr problem.

      Which gets to a more theoretical problem. The purpose of COM, and models like it, is fairly specific. It is interoperability between seperate running programs, either locally or across a network. But who says I want to share every single object in my program with the outside world? What's the point in having a string class that could potentially be shared between programs if I've got no need to share it between programs?

      It seems to me that people are going to find that to get C# programs to perform acceptably, they are going to have to design with big, heavy kitchen sink classes. And that worries me because that sort of design is, in my opinion, one of the biggest downfalls of most Windows software. (Especially Microsoft APIs.) I'm sick of having to instiatiate five classes and code a hundred lines of code just to find out if the damn CD player is in the "playing" state.

      It seems to me that this is a case of having a hammer (COM) and seeing every problem as a nail.

      If I were designing C#, I wouldn't make every object a COM object. Instead, I'd have some kind of "COMmable" attribute that could make some objects COM objects with little fuss. Put the control in the hands of the programmer.

      --
      The cake is a pie
    5. Re:C#: Answer to the DOJ? by Evangelion · · Score: 1


      You're acting like current application-level C++ code on Windows can easily ported to Linux.


      --

    6. Re:C#: Answer to the DOJ? by KFury · · Score: 1

      s/easily/more easily than C# be/

      Kevin Fox

    7. Re:C#: Answer to the DOJ? by Saint+Stephen · · Score: 1

      I must correct some things you have gotten factually incorrect. While .NET is AKA "Com+ 2.0", all of COM is gone from it.

      No IUnknown, no GUIDs, no stuff in the registry, no IDispatch, no VARIANTs, no DCOM, no RPC (replaced with Soap), and you have implementation inheritance.

      It's not COM. It's component based programming but it has completely thrown out all of what was in the "COM" section of MSDN.

    8. Re:C#: Answer to the DOJ? by plumby · · Score: 1

      You're acting like current application-level C++ code on Windows can easily ported to Linux.

      The last few projects that I worked on in C++ on Windows compiled and ran (almost) first time on Unix. The trick is not to be tempted to the dark side by putting any MFC in your business code. The (very thin) front ends were all written in VB, to make sure that we were not tempted to slip any UI code into the business logic.

      I suspect that doing the same thing in C# would not be as easy.

    9. Re:C#: Answer to the DOJ? by ucblockhead · · Score: 1

      I'm not so sure even that is true, unless you worked very, very hard to make your code portable from the outset.

      I've been involved in ports between OS/2 and Windows, and usually the GUI code made any application level program worth nothing on the new system. Better to just treat it like a spec. and recode. And OS/2 and Windows are a lot closer together than either is to Linux.

      --
      The cake is a pie
  125. Re:For all the bashing C# gets here... by Golias · · Score: 1

    It's a new language form a major vendor. Would you rather we poke our heads in the sand and pretend that the Redmond Empire does not exist?

    --

    Information wants to be anthropomorphized.

  126. Ignorance is bliss by tylerh · · Score: 1

    One can always gain performance by throwing throwing away features.

    Late Binding may be feature bloat to you, but it abosultely essential for me.

    This one fact alone is probably enough to keep me away from Sea Harp, or whatever M$ calls this.

    --
    "one treats others with courtesy not because they are gentlemen or gentlewomen, but because you are" --G. Henrichs
  127. Re:New languages have potential, but C# doesn't by jilles · · Score: 2

    I agree, C# does not provide much new. The only nice thing I could discover in it was the delegate function. The syntactic sugar in the rest of the language may also be convenient but won't save much time since it does not fundamentally change the way you model a program.

    Right now there are two things that I would like to see in a new OO language:
    - templates (not the crappy C++ version)
    - aspects (as in AspectJ)

    Both make it significantly easier to model certain problems. Especially aspects are really cool. Unfortunately C# provides neither which dooms it as obsolete even before it is finished.

    I don't think C# is a bad thing, I just think it is not a very big step forward (to small to be interesting).

    --

    Jilles
  128. Just a matter of time... by micromuncher · · Score: 1

    Soon C# and SOAP will be Microsoft firsts. After all, Microsoft never re-writes history, they innovate. Anyone who doubts it should read the "Comparing MTS to EJB".

    --
    /\/\icro/\/\uncher
    1. Re:Just a matter of time... by __aasmho4525 · · Score: 1

      as much as i generally dislike microsoft's tactics, i believe you're off-base here.

      microsoft ABSOLUTELY DID build the basis for the EJB specification first.

      HOWEVER, it is NOT fair to say that microsoft innovated here too terribly much, either.

      the order of operations is more plausibly:

      Tux/CICS/Various TPM's + Services Begat MTS Begat EJB

      Microsoft was building on the work of the TPM engines + lots of best-practices designs for the services built around/within them. They built MTS, Sun lifts the design for the EJB spec.

      i *love* java (not necessarily sun), but this was plainly obvious as the honker on my face the day the EJB 0.8 (or whichever the first i touched was) spec shipped :)

      just my 0.02

      cheers.

      Peter

  129. Re:For all the bashing C# gets here... by Golias · · Score: 2

    True... "corporatism" was invented and employed to pad out Jon Katz articles (which generate web hits to sell ads); totally different.

    --

    Information wants to be anthropomorphized.

  130. JIT != compiler by jabber · · Score: 2

    I agree, the JIT does a great job for performance, but the gcj is more along the lines of what I'm looking for in a Win32 environment.

    Providing a self-contained executable, or a set of compiled files (a'la DLL and EXE) is much easier than making sure that a customer has a servicable JRE on his/her box. As it stands, dealing with distribution of Java programs is just as bad, if not worse, than handling VB programs. With VB all I had to worry about was providing the correct VBRUNxxx.dll, but with the recent (relatively, you must admit) switch to Java2 and the more recent addition of HotSpot in JDK1.3, things got complex.

    Distributing the complete JRE each time, Just In Case, isn't going to cut it. Yes, the support stuff is in JARs, and these can all be conditionally installed - but that's a bit more to worry about than with an old fashioned EXE. Also, the fact that invoking a Java program involves not only starting the interpreter/JIT, but also setting a CLASSPATH, makes things icky - at least until Java makes adequate inroads that a CLASSPATH can be presumed. Sure, setting up a batch to do this is fine, but we're just compounding assumptions at that point. A binary executable is a lot more workable when doling out software to non-programmers.


    --

    -- What you do today will cost you a day of your life.
    1. Re:JIT != compiler by barracg8 · · Score: 1
      On the whole JIT vs static compiling issue, I'd like to point out HP's Dynamo (I own credit for this link to toh, from a recent post on askslashdot). Anyway, what HP are doing, is a VM like Sun's hotspot, initially interpreting code, then JIT compiling it. The interesting thing, is it compiles from HP-PA to HP-PA. :-) The idea is to optomize the most commonly used bits of code, while the program is running.

      The JIT gives a 10%-15% speed increase over running the code without the VM.

      You make a very valid point, that running Java on Windows can be a pain (or rather, getting it installed in the first place).

      But this may improve, due to the DOJ / Microsoft trial. The appeals may delay the split for years, but as I understand it, some of the controls kick in within the the next two months. I think, MS will be stopped from restricting what software (read: Netscape) may be installed on PCs when they are shipped. This may mean companies start selling PCs supporting Java out the box. MacOS X supporting Java2 out the box may help encourage PC manufacturers in the right direction :-)

  131. Not all Java objects have to have vtables by jonabbey · · Score: 2

    After all, Java does support the final attribute on both methods and classes, and JVM's like HotSpot are perfectly capable of doing extremely aggressive inlining as necessary.

    Since Java is a late binding language, you do have to have some intelligence in the JVM to optimize the method resolution when new classes are loaded and compiled, so you still have to pay the link penalty for both virtual and non-virtual Java methods at the time that a class is loaded, but Sun's JVM on Solaris, Windows, and Linux will do the code rewriting during execution to translate final method calls to direct calls without any vtable. I believe it may even be able to optimize virtual methods to direct calls in circumstances where the execution history forces the object pointer to be of a specific type, as in the case where you have a line of code that creates an object of a given type and the next line you call a method on it.. since HotSpot could reasonably tell that at that point in the code that object reference will always be of the specific subtype that was just created, it would be able to just do a direct jump to the method.

    I'm speculating here somewhat.. HotSpot may not be quite that smart, but Sun's comments strongly suggest that it does do that sort of path analysis for heavily used code segments.

  132. Re:And this differ's from Delphi how? by fitsy · · Score: 1

    the short answer is : "not by much"; Syntatic sugar like properties referencing functions/procs/private data and "events" (aka method pointers) have been in delphi since version 1.
    We all know who devised Delphi & C#, I am just suprised C# is getting this much attention when its all been done before, and now its an MS innovation, there is a big song and dance about it...

    Well one thing is for sure, MS Marketing deserve their dollars.

  133. Try O'Caml by mattwb2 · · Score: 2

    It has almost the speed of C, a good Unix library, bindings for all sorts of graphical environments, etc. It isn't SML, but it's great!

    1. Re:Try O'Caml by thallgren · · Score: 1
      I have to agree with that. Objective CAML is one of the few functional programming languages that you can do "real" programs in. It's not a toy, it's powerful and very very fast. It's also easy to implement new libraries in C/C++ if you want.

      Some useful links:

      o OCaml's main web page: http://caml.inria.fr/ocaml/

      o an Emacs-like texteditor written in OCaml: http://pauillac.inria.fr/para/cdrom/prog/unix/efun s/eng.htm

      o a DOOM-like game written in OCaml: http://pauillac.inria.fr/~pessaux/ocamldoom.tgz

      o a window manager for X written in OCaml: http://pauillac.inria.fr/para/cdrom/prog/unix/gwml /eng.htm

      Also, check out these links: http://pauillac.inria.fr/caml/hump.html

      Regards, Tommy - user of OCaml

  134. Microsoft's product nomenclature by afflatus_com · · Score: 1

    Lets see, they are unrolling .NET which runs their COM objects. I wonder how long before the ORG product line hits shelves. Gotta love the Microsoft marketing machine to try to subliminally link Microsoft to the creators of the Internet. Suppose thats what you gotta do when all you can do for innovation is make some cosmetic changes to java, and herald it as the dawn of a new era...

    ---
    "And the beast shall be made legion. Its numbers shall be increased a thousand thousand fold."

    --

    -----
    Cast a Cold Eye
    On Life, on Death
    Horseman, pass by
    --W.B. Yeats' gravestone
  135. Re:For all the bashing C# gets here... by SuperCujo · · Score: 1

    I always go by the rule: Don't touch anything MS with an even numbered service pack...

    It seems all the odd packs improve the product, the even ones add shit you don't need and don't fix any bugs.

    PHB's do exist, if only in spirit. I used to have three when i worked at *beeeep*.

    --
    --- Can i borrow your Clue-Stick(tm)? I need to go beat a few people with it...
  136. Re:Ack! Significant whitespace! by PD · · Score: 1

    Hate to say it, but some people enjoy using Hungarian notation in C++ programs to. There's no accounting for taste I guess.

  137. C# is VB? by davekor · · Score: 1

    I've been working with VB in my day job for the past year and one thing that I noticed was how similiar C# is to VB.

    I mean, both languages
    - compile into byte-code
    - require a VM to execute
    - garbage collection
    - support and essentially need COM to do anything useful
    - have strong typing + safety
    - have versioning support
    - have early binding
    - have interfaces
    - have built-in events
    - have built-in properties

    The only difference I see is full OO support that VB lacks. C# is VB + OO extensions! Yay, MS has reinvented VB and renamed it C#.

    1. Re:C# is VB? by jglynn · · Score: 1

      Well, let's see, assuming your talking about current VB (5 or 6) -compile to byte code - wrong answer VB currently compiles to P-code or native, C# will use IL. -reuire VM - wrong again Runtime is the answer you were looking for, big difference -garbage collected - wrong again Current versions of VB are not "garbage collected" Objects are supposed to fall out of scope and get cleaned up, but if any competent VB coder relies on this, theyare fighting memory leak bugs. -need COM to do anything - wrong again Current VB is definately COM based. C# doesn't use COM at all. It is NOT COM++ or COM2 etc etc etc. It can use COM, but is not dependent in any way. I'll give you the rest, although a couple could be argued on technicalities, but I believe we've seen enough here. Next time get the facts.

  138. The big picture by SilentWarrior · · Score: 1

    C# is just one of languages in NGWS (Next Generation Windows Service). The other 3 languages to target NGWS in VisualStudio.NET 1.0 are VB, JScript, and Managed C++. C# will take java's place only because of Sun's lawsuit. That's why its design to mimic java.

    IL is the intermediate language that is converted to machine code by the NGWS runtime's JIT compilers just prior to exceution. System services offered by the runtime are structured similarly to java packages. For example, there are packages like System.Data.XML, System.IO, System.Net etc. There are also packages specific to Windows, like Microsoft.Win32.

    Microsoft has been quietly working on NGWS for quite a while now. You can download the preview SDK at http://msdn.microsoft.com/downloads/. It's quite functional and stable.

    --
    #include "disclaimer.h"
  139. IL is the key... by SuperKendall · · Score: 3

    In all talks about C#, IL is really the key - it's the intermediate language that all languages going to the .Net platform (including C#) get compiled into, before they are JITted on the target machine and run alongside the CRL (a support library).

    Why is IL the key? Consider:

    They are going to submit C# the language as a standard - but I don't think that includes IL. That means that even if you make a C# compiler based on the standard, they could change how IL is structured to shut you down.

    They have stated IL will be compiled to native code in one pass. That can happen before it's deployed, or on the target platform. But by doing that, they loose the possibiliy of dynamic optmization (one of the things that makes HotSpot fast, and better than just a straight JIT). By allowing the compilation to happen before deployment, you also risk a bad choice for target platforms and possibly reduced performance of distributed components.

    It effects all other languages. Using Visual Studio, pretty much all languages will compile into IL. That means the workings of IL affect your code to some degree, really regardless of language.

    C# is an interesting language, and I like some of the features - but for all that, would it be impossible to compile C# to Java bytecode? I don't know the answer to that myself for certain, but really the development and capabilites of IL as a platform are really more interesting to watch than whatever language is on top.

    Another interesting question to consider - C# allows you to have native (unprotected) code blocks. How does that work in relation to IL? Does the code get bundled with the IL, to be compiled when the IL is compiled? Or are the native parts compiled to native code when the other code is compiled to IL, and transported as a mix of IL and native code? The answer has some implications for optmization of native code blocks.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  140. Copy By Value vs Copy By Reference by Anonymous Coward · · Score: 2

    What is the difference?

    P.S. I'm only 12, so take it easy on me.

    1. Re:Copy By Value vs Copy By Reference by gibara · · Score: 1

      > Java passes primitive types (int, double, char) by value, but Objects by reference

      No. I have to set the record straight on this one - I see this confusion frequently. Java passes ALL primitives by value. References are a primitive and are passed by value. This uniformity of method invocation which is not seen in most other C derivatives. This subtlety seems to be lost on most Java programmers.

      On the wider topic of passing values vs. references, Java's equivalent of pass by value for objects (since objects are never actually passed as arguments) is to call a clone method on the object to be passed thus:

      Dog rover = new Dog(); //make a dog
      Dog rex = rover.clone(); //twin dogs
      rex.sit(); //rex sits, rover stands
      Crufts.judge(rover); //rover enters crufts, rex does not

      Note how the clone method actually produces a distinct reference value (from that stored in rover) to an identical dog. IFAIK Java rarely duplicates any object by bytewise copy, instead, when an object is cloned a fresh object is constructed and populated (however the implementor sees fit) with corresponding values. This provides flexibility but makes cloning very expensive.

      To avoid this overhead I think there is a distinct move towards designs which make more use of immutable objects. Combined with a specialist factory pattern this can provide very fast and robust code. Java programs written largely in this mode start to heavily resemble functional programs (with all their benefits).

      --
      Programmers of the world unite, you have nothing to lose but your strings.
    2. Re:Copy By Value vs Copy By Reference by __aasmho4525 · · Score: 1

      lol.

      this is my life story too! :)

      funny, that.

      Peter

    3. Re:Copy By Value vs Copy By Reference by jpowers · · Score: 1

      I too wish that I hadn't wasted my time with BASIC.

      Me too, but at 7 what choice did I have? "Here's a C64, kid, if you do well enough in spelling Monday Wednesday and Friday, you can use the computer lab Tuesday and Thursday." BASIC and LOGO were all we had. The only thing I learned was not to fear the machines. We need a simple C64-type machine that's just C, so kids can learn something that'll grow with them.

      -jpowers

      --

      -jpowers
    4. Re:Copy By Value vs Copy By Reference by PsychoKiller · · Score: 2

      I don't know who was the moron who modded this as flamebait.

      Anyway, good question. I think what he was referring to here is the habit of C++ to copy objects by copying the address of the variables. This is silly because if you are making a copy of something, you usually want to duplicate it, not just have pointers going back to the original object. I guess what C# does when it is copying is it always does a copy by value, making it easier on the programmer.

      I'm not sure how much programming experience you have, so this might be way over your head. When I was twelve I was programming in BASIC, but kids these days are getting smarter.

      PS. If you don't know C or C++ yet, learn them! I wish I had learned them when I was young. Instead I wasted my time with BASIC.

    5. Re:Copy By Value vs Copy By Reference by Rumble · · Score: 1

      not sure why this was modded as flamebait... I'll bite on this seemingly innocuous piece nonetheless.

      (this description has a C bias) Copy by value and copy by reference are two ways that data can be transfered about in a program (i.e. passed as a parameter to a function). If the copy by value method is used, the destination function, call it bar(), will get it's own copy of the data that it can modify (the data will be physically copied to another location in memory that bar() can use). Any changes that bar() makes on the data won't affect what the data was before the function call was made.

      The copy by value method is useful in certain situations and might be seen to be desirable since the original data won't get affected, however it has the additional overhead of utilizing more memory and taking longer to "set up" since all of the original data must be copied.

      Copy by reference means you pass a reference to the original data to the function foo(). foo() now has access to all the original data. Any modifications that foo() makes will be reflected outside foo() as well. This has the advantage of speed since the original data doesn't need to be copied, as well as the fact that less memory is used up on the stack.

      When programming in C++, for example, except for primitive data types, you will almost always want to pass objects by reference.

    6. Re:Copy By Value vs Copy By Reference by Peter+Putzer · · Score: 1

      Sorry, but C (and C++) pass parameters strictly by value. Passing args "by pointer" is not the same as pass-by-reference, as the pointer itself is a distinct datatype that is passed by value.

      C++ adds pass-by-reference (with the postfix "&"), and a reference type seperate from the pointer type, but that's not the "default".

      --
      -- KDE programmer and computer science student in Klagenfurt, Austria.
    7. Re:Copy By Value vs Copy By Reference by Mongoose · · Score: 1

      Aw, that's cute... =)

      Copy by value - ( aka deep copy )
      You allocate new space for an object and copy it
      from the orignal. Kind of like making Xeroxs -
      you have an exact copy of the orignal but it's
      a new copy.

      Copy by ref - ( aka shallow copy )
      You point to the old copy. It's like only having
      one copy of a paper and when someone wants a'copy'
      they have to reall barrow it from bob.

      - Mongoose

      wolf wolf, I like Kittie
      http://gooseegg.sourceforge.net
      http://www.quakeforge.net

    8. Re:Copy By Value vs Copy By Reference by Just+Some+Guy · · Score: 2

      In my experience, I rarely want to make an actual bitwise copy of something. If I already have one copy in memory, chances are that I don't want another one.

      According to the review, C# copies by reference by default, just like C++ and Java. It can be coerced into copy-by-value, though, on the rare occasions that you can't work around it.

      I do agree with your other points, though. The kid wasn't baiting, and I too wish that I hadn't wasted my time with BASIC.

      --
      Dewey, what part of this looks like authorities should be involved?
    9. Re:Copy By Value vs Copy By Reference by Rumble · · Score: 1

      What's wrong with BASIC? I spent years programming in BASIC in elementary/middle school. Up in Canada, all we had were Apple 2's in the schools anyways, and my old man had an apple2 at home as well. You can do a lot of cool stuff with BASIC with very little knowledge of underlying computer hardware and it is reletively simple to understand the procedural programming methods required (at least, last time I used BASIC, then again, it was almost 11 years ago!). C would have been the absolute WRONG choice back in those days. I have no regrets about my BASIC heritage, he he :)

    10. Re:Copy By Value vs Copy By Reference by Sajma · · Score: 1

      I think there's also another problem with your example: "int" is a primitive type (not an object), so it is always passed by value. These examples should explain the differences between the three languages C, C++, and Java:

      C always passes by value; you get pass-by-reference by passing a pointer to the desired object:

      void halve(int va) {
      va = va/2;
      /* pass by value; call this using halve(a).
      'a' does not change outside the function */
      }

      void halve(int *pa) {
      *pa = (*pa)/2;
      /* pass by reference; call this using halve(&a).
      'a' is halved outside this function */
      }

      C++ is like C, but also adds language support for pass-by-reference:

      void halve(int &ra) {
      ra = ra/2;
      /* pass by reference; call this using halve(a).
      'a' is halved outside this fuction */
      }

      Java is always pass-by-value: primitive types like 'int' are treated just like the C case. However, you cannot pass a pointer to an 'int' like in C. Instead, you have to use an object reference. The reference to an object argument is copied pass-by-value, so the object is effectively passed-by-reference:

      class IntHolder {
      public int a;
      }

      void halve(IntHolder h) {
      h.a = h.a/2;
      /* 'h' is the reference to the object passed
      to this method. We can follow this
      reference and change the original object */
      h = null;
      /* note that the reference itself is passed
      by value, so this assignment does NOT
      affect the object outside this method. */
      }

      Hope this helps.
      --S

    11. Re:Copy By Value vs Copy By Reference by Phroggy · · Score: 2
      That's right except for a few things:

      Whoops, my bad. Thanks.

      Can you tell I haven't touched C++ in a year and a half? ;-)

      --

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    12. Re:Copy By Value vs Copy By Reference by pergamon · · Score: 1

      Automatic copy by value is a sticky language concept. Where does the copying by value stop?

      In other words: What if I have an object with an array filled with a billion other objects. Then I've got another object with a reference to the first object. What if I want to make a copy of this object? Does it then make a copy of the billion objects in the first object?

    13. Re:Copy By Value vs Copy By Reference by Phroggy · · Score: 2
      Let me try explaining this a different way:

      int main() {
      int a=42;
      halve(a);
      halve(a);
      return 0;
      }
      void halve(int a) {
      a=a/2;
      cout<<"a/2="<<a<<"\n";
      }


      If you're passing by reference, the variable "a" itself would be passed back and forth between the two sections of the program, and "21" and "10.5" would be printed.

      If you're passing by value, however, only the value "42" is passed to the "halve" function; it will be halved and printed, but the new value won't be passed back to main, so "21" will be printed twice.

      C, C++ and Java pass by reference by default (I think), but you can choose to pass by value when you want. BASIC and HyperTalk always pass by value.

      By the way, I'm really not a programmer, so don't listen to me.

      --

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    14. Re:Copy By Value vs Copy By Reference by MadHobbit · · Score: 1

      It's pretty simple...

      (Note that the exact mechanics of this vary from language to language, but the idea is the same)

      Say you have an object in memory, 100 bytes big. Your program uses a reference to find the object in memory and do useful things to it, like change it. Now, if you copy it by reference, you make a new reference to the same object -- You have one object and two references. However, if you copy it by value, you make a new copy of the object, and a new reference pointing to the new object.

      If you copied by reference, then the two references affect each other; make a change using reference A, and the change is reflected in reference B. It uses less memory (since there's only one copy of the data) and is a faster operation (there's less data to duplicate). However, garbage collection is difficult, because the object can only be safely deleted once ALL references are gone.

      During a copy by value, the data is replicated, so making changes with reference A doesn't affect reference B. You need more memory (200 bytes -- there's now two copies of the original object) and copying the data takes time. However, garbage collection is very simple, because there's no possibility of two references to one object. Once you remove the reference, the object can be deleted.

      This type of discussion is appropriate to a language like Java, where there are no pointers, only references to objects. In C or C++, you have variables (like "int num") and pointers ("int *numptr"). Pointers act as references and are used to copy objects by reference. It's a bit more complex, since pointers are often used to generate references to variables, so the same object is sometimes copied by value and sometimes by reference....

      Hope this helps...I think I made sense :-) And everyone feel free to jump in if I messed anything up -- I despise Java from the pit of my being, so I don't know it that well. C is more my thing.

  141. You forgot the biggest advantage of C++... by Ars-Fartsica · · Score: 2
    ...the quite useful fact that it is a multi-paradigm language.

    Java is cute, but what do you do with it once OO becomes passe? (don't be shocked by this - there is actually a vocal constituent of clued in folks who are actively protesting the usefulness of OO).

    I refuse to latch onto any language that forces me into one paradigm.

    Its interesting - if you look at these languages in a detailed and discerning manner, you really get to see the genius of Stroustrup.

    Read some of his papers on C++, perticularly his assumptions for the language, and you really see how far ahead his thinking was.

  142. All Java's are not created equal by Anonymous Coward · · Score: 2
    • Java uses mark-and-sweep in order to garbage collect.
    Not always. There are other approaches used, depending on the implementation.

    This begs the question: since C# is tied to an implementation (COM), what's the likelihood that there will be competing implementations? On Windows, you have Java implementations from Symantec, IBM, Microsoft, Sun and even an open source one, Kaffe.

    How many C# vendors do we expect? GNU C#? When you can't run it on a GNU operating system? Yeah, right.

  143. I stand corrected. by TheDullBlade · · Score: 1

    True enough. I haven't used Python in a while.

    Still, I do believe that Python spoils its users with the world's friendliest syntax.

    I wish I'd taken another look at Python before writing Cugar. I just realized that, working from memory, I used "sub" for function definition instead of "def". Sloppy. I'll probably change that to match Python (I doubt there are more than a dozen people using Cugar right now, so it shouldn't cause problems).

    ---
    Despite rumors to the contrary, I am not a turnip.

    --
    /.
  144. COM and C# by wilkinsm · · Score: 3

    ...and C# relies heavily on Microsoft's Component Object Model...

    Which is probably how most of this functionality (encapulation, events and call-backs) will be implemented. I'm getting the sense this is going to turn out to be something of a quazi-language, which was in the end what Microsoft's Java implementation became (Just try and do something meaningful in it without invoking a COM object.)

    In the end, C# really does not seem to offer anything meaningful that VB does (or will) not, and for the same reasons will not be any less portable.

  145. Using C# over C++ just for Windows?!? by 1alpha7 · · Score: 2

    someone like myself, who uses Windows as their primary development platform and needs to use C or C++ because he cannot afford the overhead that Java incurs, it's possible that C# would turn out to be a very beneficial compromise.

    If I'm already coding for a Winblows enviro, I already have C++. I damn sure am not switching to some new, barely supported language just for the "new toy coolness" factor.

    --
    Live to be Moderated
    1. Re:Using C# over C++ just for Windows?!? by ucblockhead · · Score: 2

      Well, as another Winblows programmer, I suspect that the gain would be if you are doing anything in COM. As we both know, doing anything concerning COM in C++ is like banging yourself in the head with a pointy rock. C# seems to make this transparent.

      Which also adds a concern in my mind, as I suspect that Microsoft will have lots of incentive to make COM even harder to deal with in C++.

      --
      The cake is a pie
    2. Re:Using C# over C++ just for Windows?!? by SpryGuy · · Score: 1

      Well, the advantages are allegedly many...

      Writing in C# (or using 'Managed C++' which also buys you garbage collection) allows you to write COM objects and to interoperate with other languages (C#, Managed C++, VB, ??) transparently. The whole .Net thing is about a common runtime platform, where the language itself doesn't matter. Got an object written in VB? You can inheret from it and extend it in C#. And vice-versa. You can pass data transparently back and forth (though gawd knows what is going on underneat the covers as far as a performance hit). I think all strings are Unicode underneath... as long as you never have to fiddle with BSTRs again, I'll be very happy.

      - Spryguy

      --

      - Spryguy
      There are three kinds of people in this world: those that can count and those that can't
  146. What _I_ Like about C#.. by JackDangers · · Score: 4

    Some friends at work recently got back from a MS Developers Conference where they handed out CD's with Visual Studio 7.0 beta and a full version of Windows 2000 Professional (since Visual Studio 7.0 will only run on Windows 2000 Pro.) I loaded it up, read throught the C# book that was included, and was impressed.

    C# is highly typed, so you don't spend hours looking through code trying to find a type mismatch.

    It is early binding instead of late binding, meaning it is quicker! With Java (late binding), a file search and enumeration of 8000 files on our servers here at work took an hour and a half, and 50000 files with a C(early binding) app took 4 minutes, so C# takes the best of both. Also, because it is early binding, you don't have to worry about references to non-existant objects, when you are using DLL's for instance. C# automatically loads and reviews the routines contained in a DLL automatically, before compile, so a reference to myDLL. will bringup a popup list of the routines availible in that DLL.

    Very cool stuff! It will be interesting to see if it takes over as the new, trendy programming language of 2000/2001, as Java has been for a few years.

    1. Re:What _I_ Like about C#.. by Pfhreakaz0id · · Score: 2

      Wow! Early binding and all the advantages that brings... just like VB.
      ---

    2. Re:What _I_ Like about C#.. by __aasmho4525 · · Score: 1

      i'm still not sure i agree with Bjarne on this topic.

      it is, afterall, *just typing* when it comes down to it... the implementation of the last 3 software projects i worked on took less than 25% of the total clock-time for those projects. those couple thousand characters really didn't matter.

      if it makes it extraordinarily clear to:

      1) the humans reading the code, and
      2) the computers parsing the code

      how can it be considered that horrible for those cosmetic reasons only? now, i'm not referring to you here, but i rarely hear anyone actually provide any substantial evidence that it is *really* a problem.

      i've tried to read lots of arguments on the topic, but most come down to subjective / stylistic human choice, not real substantive flaws.

      just my 0.02.

      Peter

    3. Re:What _I_ Like about C#.. by vyesue · · Score: 4

      > C# is highly typed, so you don't spend hours
      > looking through code trying to find a type
      > mismatch.

      Client.java:43: Incompatible type for declaration. Can't convert Context to Community.
      Community context = (Context)contextE.nextElement();

      yeah, that took a couple hours to track down. phew!

    4. Re:What _I_ Like about C#.. by lordpixel · · Score: 3

      C++ uses a mixture of early and late binding. So does Java. I'd be stunned if the same wasn't true of C#. Late binding is the only way to do some things. Perhaps C# does more early binding than Java.

      Then there's the question of Java's Hotspot, which can remove the late binding overhead in Java at runtime once its optimised a piece of code. It can even de-optimise and switch back to late binding then re-optimise if you starty doing dynamic class loading. This is a big and complex subject, and I'm not sure I could explain it here even if I had the time...

      I submit the most likely reason for the performance of your Java program is that it wasn't as well written as the C++ one. Binding is a tiny tiny part of the difference between the 2 languages. There any many other factors which are more likely to account for the difference.

      As for the DLL thing - that sounds great - except whe nyou come to deploy your application the user doesn't have the same version of the myDLL that you did on you super dev box. Hence the user gets a reference to a non existant object. Early binding really has nothing to do with this. It sounds like its being used to implement a nice feature in the IDE, not a solution to the age old library versioning problem that people are discussing in the Lets Make Unix not suck thread
      Lord Pixel - The cat who walks through walls

      --

      Lord Pixel - The cat who walks through walls
      A little bigger on the inside than out

    5. Re:What _I_ Like about C#.. by rmull · · Score: 1

      1) C# may be strongly (highly?) typed, but it seems to me that that is rather negated by the absence of anything resembling templates - how do you handle basic collections? Unless a reference has a type implicitly associated with it, you throw away alot of your advantages when you start to use these untyped data structures.

      2) I've not the slightest idea what early binding and late binding mean, but there must be SOME advantage to late binding if it's used at all...

      --
      See you, space cowboy...
    6. Re:What _I_ Like about C#.. by lordpixel · · Score: 1

      The single biggest advantage is Size. If you build everything static, you include the code you link to. A large app that exercises a fair sized chunk of the operating system (e.g. a web browser) could end up including a fair sized chunk of the operating system in its executable. With shared libraries (dll's on Windows, Code Fragments on Mac OS, .so files on Linux) you only have to install the common code once, no matter how many apps use it.

      The trouble is you need a decent versioning system, otherwise apps will use the wrong version of a shared library :-( This means you often end up shipping exact versions of libraries bundled with an app. Each app then installs these somewhere where only it can see them, and you're back to square one.

      This seems to be worst on windows, where different versions of dlls are more frequently incompatible than on Unix (or even on Mac OS).

      Apple have an interesting new scheme that addresses this problem on Mac OS X. Its kinda neat. developer.apple.com has a PDF called System Overview (in the OS X section). This explains it.
      Lord Pixel - The cat who walks through walls

      --

      Lord Pixel - The cat who walks through walls
      A little bigger on the inside than out

  147. Re:java's overhead by __aasmho4525 · · Score: 1

    just wanted to suggest you go check on the adjustments made in the jdk 1.3 implementation of threading (and specifically how they pseudo-pool automatically for you).

    i have definitely created thread pools that get dispatched into when incoming socket connections arrive, so while i do understand your criticisms, i believe they are surmountable in most cases.

    when the pseudo-pooling of jdk1.3's threading implementation becomes understood, i think it drastically changes the way we think about threading in java..

    just my 0.02.

    Peter

  148. Re:A story about ML by Disco+Stu · · Score: 1

    Dude, that guy's totally a troll. Ullman's a genius...everybody knows that, and ML's a perfect language.

  149. New languages have potential, but C# doesn't by stuyman · · Score: 2
    There are going to be a number of things holding back C# that could've been solved if Microsoft had been designing a real language instead of trying to create a market for their visual studio line:

    1. True innovation: As this article makes clear, C#'s changes are purely incremental, nothing revolutionary is there that justifies the learning curve that a language will always include
    2. Clear, consistent design: C# is like a schizophrenic gerbil. It is stuck half way between Java and C#, and instead of extending them in a reasonable way they change the use of features such as structs.
    3. Non-open runtime librarys: Part of the reason C++ has taken off is because of the libstdc++, and java has taken off because sun has a JVM available for pretty much all platforms. C# doesn't, and the lack of a clear and free standard will relegate it to MSdom the same way VB was. (see my next point)
    4. No Real Standard: If Microsoft treats this like most of their products, each version will make frivolous and yet code-breaking changes to the standard. This means not only can you not keep emulation up to speed easily, but old C# code wont even work in say MSVisualC#3.666

    And that's why I'm sticking with C, C++, perl, PHP, sh, and learning Java.

    --
    Q:Doctor, how many autopsies have you performed on dead people?
    A:All my autopsies have been performed on dead peop
  150. Coupling to Microsoft's object model by Animats · · Score: 2
    The key thing to realize about "C#" is that it's not so much a programming language as an integration tool for DCOM/Active-X objects. It's tightly coupled to Microsoft's object model, like Visual Basic. That, more than the language features, makes it immediately useful.

    UNIX people tend not to pay enough attention to Microsoft's middleware layer because the UNIX world doesn't have that layer. (de Icaza is trying to fix that, but it hasn't happened yet.) Much of the success of Windows is due to that middleware layer. Note how strongly Microsoft reacts to threats to that layer, such as Java and Netscape, while Linux is regarded more as an annoyance.

    1. Re:Coupling to Microsoft's object model by jglynn · · Score: 1

      Isn't anyone paying attention. C# and the .NET platform is "NOT" related to DCOM, activex etc. It does "NOT" implement COM. It can use it, but believe it or not, it's not native.

  151. But that would confuse the Brits (OT) by l-ascorbic · · Score: 1

    I would spell 'see-pound' C£ . Aaargh! Have you ever seen a confused brit using a US voicemail system? 'Press the pound key" WTF!! Why would I have a currency symbol on my phone? In the UK its normally 'hash', but BT has started saying 'square'. I guess they'd have echelon recording all the talk of drugs in the voicemail system otherwise.

  152. Re:Ack! Significant whitespace! by rafial · · Score: 1

    You obviously don't use Emacs as your editor.

    You are right. I much prefer Xemacs :-) ... And I like all those helpful indentation and expression balancing features in the various language modes.

    As for finding the end of a block, well python-mode has handy commands to mark and move by class, method definition or block, so those clever elisp hackers obviously have some way to do it.

    I still think Python's WYSIWYG style of formatting makes sense. If nothing else, it finally ends all those arguments about where to put your opening brace, so we can have more time to fight about variable naming conventions!

  153. Re:Ack! Significant whitespace! by ZenShadow · · Score: 1

    We recently had a discussion at work related to code indentation. The question at hand is this: how many time have you picked up someone else's code and it seems terribly poorly indented, until you realize that they had their tabstops set for 4 characters?

    Non-ANSI, to be sure, but it happens. Programming with significant whitespace will continue to be impractical, at least for me, until computers force tabs to be N characters accross the board (which will never happen).

    Besides, having blank space mean something is just evil. But that's neither here nor there.

    --ZS

    --
    -- sigs cause cancer.
  154. Does anyone have some performance numbers? by Rombuu · · Score: 2

    Does anyone who got a beta of the Visual Studio.net from the MS PDC have any idea on how this performs? I mean, its taken Sun several years to come up with a decent performing VM for Java, and the CRL for C# sounds like it may have similar issues (despite the fact they claim everything runs as native code). If there are substatial performance imporovements from Java, that would definitely be another reason to move toward C# development (the Everything is a COM object is pretty slick too).

    I think its interesting that the author of the article says C# has garbage collection like Java. I mean, wasn't LISP the first major language to have garbage collection?

    --

    DrLunch.com The site that tells you what's for lunch!
    1. Re:Does anyone have some performance numbers? by Anonymous Coward · · Score: 1

      I don't have any raw numbers but I can tell you that it is blazingly fast, faster than any comparable code in Java that I've tested. Because of the way their GC works- sweeping all used memeory into the local cache - it has even beaten similar Visual C++ code. Love them or hate them, this is one of the coolest things I've ever seen from Microsoft. It makes building components and web sites a pleasure. What they've done with Web Services is awesome too.

  155. Not Marajuana, Music by intmainvoid · · Score: 1

    The # symbol is used in music notation as the "sharp" symbol which denotes that a note is a semi-tone higher.

    i.e. C# is a semitone higher than C - I'm sure that's the meaning they were intending, since C+++ would have looked pretty stupid!

    1. Re:Not Marajuana, Music by bigchris · · Score: 1

      Then wouldn't they have made it C+=2 ?

  156. I always pronounce "#" as... by TheDullBlade · · Score: 1

    "Microsoft write a stupid Java clone"

    So "C#" should be pronounced, "See Microsoft write a stupid Java clone"

    ---
    Despite rumors to the contrary, I am not a turnip.

    --
    /.
  157. Re:Somewhat related to both points... by William+Tanksley · · Score: 2

    May I suggest Oberon? It meets all of what you're asking for -- and is a good language.

    Its (optional) portable binary format is sheer genius.

    Of course, I use and like Python, so my judgement is suspect at best ;-).

    -Billy

  158. What is wrong with hard tabs? by TheDullBlade · · Score: 2

    I always use hard tabs. In fact, I require them in cugar. Indenting one space further than the previous line means a continuation of a previous line. Indenting more than one space is an error, because it could be misinterpreted as a tab. This forces consistent indentation on all cugar users.

    Different people prefer indentations between 2 and 6 spaces (I like 3), why not let them choose? You can always change the tab stops in your editor.

    ---
    Despite rumors to the contrary, I am not a turnip.

    --
    /.
    1. Re:What is wrong with hard tabs? by Deven · · Score: 2

      I always use hard tabs. In fact, I require them in cugar. Indenting one space further than the previous line means a continuation of a previous line. Indenting more than one space is an error, because it could be misinterpreted as a tab. This forces consistent indentation on all cugar users.

      Indenting styles vary widely, and there will probably never be consensus on the best way to indent programs. That's why tools like indent exist in the first place.

      As for the use of hard tabs in general, you might want to think twice about it. The only tool I'm aware of that's in widespread use that relies on hard tabs is "make". Supposedly, the author decided very early on that using hard tabs was a mistake, and wanted to correct it, but left it instead because he had over a hundred people using the code already and he didn't want to break backward compatibility on all those people. How many thousands upon thousands of people now suffer the inconveniences of that mistake? How many beginners stumble on the arbitrary requirement of a hard tab? It seemed like a good idea when he started, but it wasn't.

      Also, keep in mind that some text editors will interfere with hard tabs, automatically expanding them into spaces. In this case, you may or may not be able to quote the hard tab, and it may be difficult to work with, if you can. (It might display as a symbolic code, for example.) Some editors will even expand hard tabs simply from loading a file with hard tabs and saving it again.

      Are you sure you really want to use hard tabs?

      Different people prefer indentations between 2 and 6 spaces (I like 3), why not let them choose? You can always change the tab stops in your editor.

      Some people even prefer the default of 8, but I don't think I've ever met anyone who wanted tabstops of 7...

      Changing the display size of hard tabs is a poor idea. It leads to inconsistencies (especially some (but not all) tabs are replaced with what appears to be the proper number of spaces), and depends on everyone to use the same settings to see the same thing. Sticking with 8 spaces for a hard tab is the safest thing to do. (True, if you only allow hard tabs, it's less likely to be a problem, but the folly of requiring hard tabs is already discussed above.) A better choice is to use soft tabs in the editor, and having it saved as spaces. Everyone then sees the exact same thing, and it prints consistently. (Printouts usually assume 8, or even fail to process hard tabs entirely!)

      Obviously, this makes consistency between coders with a different style harder to maintain. This can be addressed with coding standards and/or use of the "indent" tool.

      --

      Deven

      "Simple things should be simple, and complex things should be possible." - Alan Kay

    2. Re:What is wrong with hard tabs? by Deven · · Score: 2
      Or
      -*- c-basic-offset: 4; tab-width: 4 -*-
      (and whatever the vi equivalent is) and disuse of "text editors" that mangle files. I wouldn't use an editor that omitted vowels while saving, even if it would make writing Unix utilities a lttl smplr.

      If you insist on tolerating broken tools, you can always fix it by running a C++ grinder (can indent do the job yet) in cvswrappers.
      There isn't an equivalent in vi or even vim, as far as I know -- I believe you'd have to set the parameters in your .virc or .vimrc file, which would apply to the user, not the file. You couldn't have different files using different tab widths, and others users editing the same file would get their settings instead. With emacs, you can tag the file with such information using -*-, but that still depends on all users to edit the file with emacs only.

      As an individual developer, it's quite reasonable for you to say that you won't tolerate broken tools. As a language designer, it's hard to make assumptions about what tools people will be using. Even if your implementation of the language includes the proper tools, another implementation might not. That's why it's preferable to stick with the least common denominator whenever possible for language design. Imagine if a language required 16-bit Unicode characters for a basic purpose, such as braces in C. Now imagine how difficult (or impossible) it would be for users who only have an ASCII text editor that doesn't understand Unicode. Sure, you might be able to make the language more concise if you can incorporate some extra symbols that aren't available in the standard ASCII set, but it constrains the users. You can do it, but you should really consider the cost first. (Do you know anyone who programs in APL with all its nonstandard characters?)
      --

      Deven

      "Simple things should be simple, and complex things should be possible." - Alan Kay

  159. And this differ's from Delphi how? by sugarman · · Score: 2
    Aside from the basic C-language syntax that is the basis for C#. (Serious question, no sarcasm intended. Implied, maybe, but not intentional 8)

    With Kylix bringing many of these features to Linux soon, as well as the strength of the VCL and a powerful rad tool that will provide an easy migration path, why is C# a big deal?

    --
    --sugarman--
    1. Re:And this differ's from Delphi how? by Anonymous Coward · · Score: 1

      You've never really _used_ the VCL, have you? From my experience, it's buggy and inconsistent. The IDE also has a habit of occasionally crashing without warning. I like Delphi the language, but the flaws in the VCL, and the fact that you're in most cases tied to it, really hurt. Really, what the people on my dev team wanted was to be able to replace Delphi with J++. We didn't care about the license issues with Sun, we just wanted to do our work, dammit! So, C# may allow us to get away from Delphi. Don't get me wrong, I love Java. But COM pays the bills (very well).

  160. Re:C# vs Java ? Java JIT of the JVM vs .net design by bored · · Score: 1

    Seems to me that improving the performance of an existing language (albeit at the cost of platform independence, obviously) would be much simpler than developing a whole new language to include the piece that Java is missing - a native compiler.

    Actually, the problem is the JVM which makes to many assumptions about the fact that its running in an interpreted state. This doesn't mean that you can't JIT java its just means that its inefficient. This is sort of evidenced by the fact that the java JIT setups don't get as massive performance improvements as you would expect.

    Apparently according to Hejlsberg the C# and the associated .net platform is designed with JIT compilation in mind so it makes me think that the result should be a lot closer to native code execution speed than java can hope to get. Although M$ doesn't want people to think that C# is a java extension it makes sense that M$ saw the opportunity to improve on javas many flaws and the marketing / Business people saw the chance to solve there problems with Sun/Java, VB's bad image, etc in one big package.

    BTW: I suspect that if Sun hadn't gotten in the way with VJ++ then M$ probably would have eventually added an 'Ultra Fast native' mode which completely bypassed the JVM and locked the user into the M$ JVM (more than they already did) or a .net type layer. The end result being java loosing its attempt at cross platform in exchange for a order of magnitude speed improvement on M$ platforms.

  161. Re:Ack! Significant whitespace! by Deven · · Score: 2

    Hate to say it, but some people enjoy using Hungarian notation in C++ programs to. There's no accounting for taste I guess.

    I'm not a fan of Hungarian notation, personally, although I can see some value in it. For me, the impact on readability makes it not worth using. This is one of those classic debates, like vi vs. emacs, which will probably never be resolved.

    If anyone is looking for a free software project to write, it just occurred to me that a missing tool that could be useful would be a program like indent that would add or remove Hungarian-notation prefixes instead of adjusting whitespace. I'd probably write this myself, if I were a fan of Hungarian notation. Since I'm not, I'm tossing the idea out there; maybe someone else out there wants to run with it?

    --

    Deven

    "Simple things should be simple, and complex things should be possible." - Alan Kay

  162. Re:A look at C# by jonathanclark · · Score: 2

    I think C# is closer to Amiga/Elate than Java. Java was designed with security as a top priority. i.e. being able to run in a sandbox. This imposed a number of limitations that effect java's speed performance. C# allows you to write "unsafe" code if you like, whereas Java requires you to load some external C library. By unsafe, I mean doing unsafe typecast and accessing memory you probably shouldn't.

    Also C# never runs under emulation or interpretation - it is always compiled to native code before it is run. This is similar to how Elate works.

    For comparisons based on my limited knowledge see here:

    Elate versus .NET

    I discuss the IL assembly that c# generates more than the language c# itself.

    --

  163. Re:Now who's trolling? by tomwa · · Score: 1
    there's not a benchmark to be seen

    Uh? I assume we have different definitions of 'benchmark'. Running Conways's 'life' (an intensively computational program), a fibonacci calculator and a fast Fourier transform program, with C and Java implementations, and measuring their performance is what i call a benchmark. Could you perhaps enlighten me as to why it isn't?

    FWIW, the fibonacci test (not a very real-world test, i admit) shows that the IBM and HotSpot JVMs are both faster than optimised C. I'm a Java zealot, and even i don't believe that!

  164. more on ML by Tom7 · · Score: 2

    ML efficiency is always a concern, but most modern compilers will turn simple recursive functions into loops (in fact, tail recursive functions running in constant space is part of the definition). The speed of compiled programs is getting much better, almost to the point where it's not worth worrying about (unless you're writing Quake 4).

    You can declare variables in ML (or other functional languages), just not change them (they're math "variables" not programming variables). Most programs are (surprisingly) much more clearly written this way, once you get used to it. If you want updatable values, though, that's there too.

    Parametric polymorphism is in C++ (templates), but it's done badly. Generic Java (and probably the next iteration of Sun's Java) will have parametric polymorphism that's a little more sensible.

    Other features I find myself pining for when I'm not allowed to use ML: higher-order functions and proper closures; type inference; call with currrent continuation ("callcc" or "first class continuations"); lightweight threads and typed channels; roll-your-own infix operators; pattern matching; value-carrying exceptions that actually work; and garbage collection.

  165. Templates/genericity/polymorphism and Haskell by hoggy · · Score: 1

    Or for excellent parametric polymorphism, garbage collection, loads of useful API bindings, native compilation and lazy evaluation, try
    Haskell. For the length example:

    length [] = 0
    length (x:xs) = 1 + length xs


    More interesting examples use the lazy evaluation in Haskell to allow clean specification of algorithms without worry about trying to write the most efficient code. For instance if I wanted to sum the first ten numbers in the fibonacci sequence I might write:

    fibonacci = (fib 0 1) where fib x y = x : fib y (x + y)

    sum [] = 0
    sum (x:xs) = x + sum xs

    take 0 _ = []
    take n (x:xs) = x : take (n-1) xs

    sum_of_first_five = sum (take 10 fibonacci)


    This program uses seemingly infinite recursion. However, thanks to lazy evaluation only the actual instructions that are required to evaluation the sum of the first five members will ever be run.

    I'd recommend language hackers take a look at this elegant language. A Linux/Windows compiler is available as well as an interpreter for those who just want to tinker around with it. It even uses syntactic white space :-)

    (Apologies to any Haskell hackers who spot mistakes in my code - it's been a while since I wrote any Haskell)

  166. Re:java's overhead by tomwa · · Score: 2

    Firstly: yes, Swing is a bit slow (i haven't used 1.3, so i can't comment on that); this seems to be mostly due to rather dim implementations (using the win32 GDI rather than DirectDraw, not using hardware acceleration, etc), which will get fixed in the not-too-distant future. I have to admit that Swing is an embarrassment to Java: by far the most slow and buggy package.

    Secondly: cache locality? I'm sorry to see that you know nothing whatsoever about modern OO compiler research - it's fascinating 8). There were some lovely papers in an ACM SIGPLAN bulletin a while back on just this; you can build a VM that tunes memory layout to improve locality, eg by clustering objects which are accessed together (only possible if you have a sophisticated GCish memory model, like Java) and splitting up objects so that the hot parts are clustered together (where they can get cached) and the cold parts are somewhere else (only possible if the VM has control over the code, as object splitting requires code rewriting). I don't think any of this research has made it into production VMs yet (we're also waiting for funky new GC strategies), which is a shame.

    Thirdly: sockets; guilty as charged! The lack of asynchronous IO in Java is a crime. JSR-51 is sorting out bringing it in, but i don't know when it will make it into the releases. Saying "use a real operating system!" is not an answer, by the way - passing the buck doesn't help Java and doesn't help Java programmers (except that maybe Sun will sell more boxen, make more money and invest more in Java ...).

  167. Re:For good "template" support: try ML by Weezul · · Score: 2

    Actually, If your interested in type system stuff you should really check out Haskell. Haskell is a lazy functional langauge (ML is strict), so things do not evaluate unless they are needed. This means no lisp/ML style cheating with side effects to do IO. Instead Haskell uses a type system construct called monads to allow for IO, variables, side effects, and OOP. Actually, monads are really the best resolution to the apperent conflict between object oriented and functional programming. the monads have evolved far enough to allow you to simulate an imperitive object oriented langauge within Haskell.

    Anywho, Haskell's type system pretty much blows most langauge (including most functional langauges) out of thge water. The types for essentially every variable are derived from the contex where the variable is used, but there are still really nice systems for overloading / signatures / interfaces, type parameters, and type derivation.

    It's possible that ML has caught up with Haskell's type features, but there are some interpreted varients of Haskell (maybe Gofer) which have crazy type parameterization by parameterizable type features (or something like that.. I forget). I think they have a type system for types (called kinds) to allow recursive type definitions or something insane like that.

    Really, Haskell is one of the most fun langauges when you enjoy this sort of shit. I hear rummors you can use it for practical stuff too, but I wouldn't know anyhting about that. :)

    --
    The Christian religion has been and still is the principal enemy of moral progress in the world. -- Bertrand Russell
  168. Re:Not see sharp by Karellen · · Score: 1

    see _pound_????? Where the hell does that come from?

    £ is a pound sign.

    # is not. It's a hash mark. Or an octothorpe. Or something else. But certainly not a pound sign.

    --
    Why doesn't the gene pool have a life guard?
  169. Huh? (GC) by Anonymous Coward · · Score: 1
    Can anyone make sense of this?

    "there have been a few instances where I was faced with a programming problem where the solution depended on objects *not* being automatically destroyed, as they were supposed to exist separate from the main object hierarchy and would take care of their own destruction when the time was right."

    Presumably, the objects would have to have their own threads to do this - but if so, then the thread has a reference to the object so it can't be GC'd. What's his problem?

  170. C# directory listings on the web. by mtippett · · Score: 1

    One thing that hasn't been looked at is how we are going view these files online. Has any mention of how the naming convention of these files is going to be discussed?

    Logically foo.c# would be the logical extension from the name of the language. Now let's see what happens if we have foo.c and foo.c# in the same directory? Click the link and unless we *escape* the # into the appropraite % number, we have broken browsing.

    *sigh*.

    Interestingly, MS looks like they have already run into this problem. http://msdn.mi crosoft.com/vstudio/nextgen/technology/csharpintro .asp should ideally have the c#intro.asp as the name.

    Snigger

    Hmm... Default score of 5. I guess I won't be seeing my own posting.

  171. Re:Ack! Significant whitespace! by Mister+Slippery · · Score: 1
    If you've got the same information in two places, eventually they'll get out of sync, and you'll lose...

    I admit the risk of this, that's why I prefer emacs, with its context-sensitive indentation. By the way, if anyone knows of a vi extension that is equivalent to emacs' context-sensitive indentation, please mail me: sbetten at (spam-me-not) yahoo.com.

  172. For good "template" support: try ML by Tom7 · · Score: 5

    ML has an excellent implementation of parametric polymorphism (sometimes thought of as "templates"). You can define a function that counts the elements in a list of anythings:

    fun length nil = 0
    | length (h::t) = 1 + (length t)

    which has type: 'a list -> int
    (meaning the function takes a list of anything, and returns an integer).

    Through the mechanism called "functors", you can specialize a generic structure (say "sets", or "mappings", or "arrays") with some types and operations to create a new type. Signatures let you make these types truly abstract (paired with type safety, a very powerful notion).

    All of this is type safe (with proofs). Most of it is accomplished statically too, so there's little run-time overhead. It is indeed scheme with "some work".

    1. Re:For good "template" support: try ML by pb · · Score: 1

      That actually sounds really interesting; I'll have to check it out.

      I take it there's a bit of a learning curve, though? :)

      Thanks!
      ---
      pb Reply or e-mail; don't vaguely moderate.

      --
      pb Reply or e-mail; don't vaguely moderate.
    2. Re:For good "template" support: try ML by Lechter · · Score: 1

      I certainly agree that ML's implementation of parametric polymorphism (which should be said three times fast) is really useful. However, in the little ML coding that I did for a class I found that it used an awful lot of recursion, and while that made for neat thought exercises in a CS class I wonder what affect it had on performance.

      For example, in the limited implemntation of OcamL we were using, we couldn't declare varriables. So data structures, non-homogeneous lists, values, etc had to be passed from function to function, with recursion all over the place (even iteration was done recursively) Ironicly the compiler attempted to detect this iterative recursion and change it to normal iteration in the binary.

      Nonetheless, the parametric polymorphism was extremely useful and I found my self sorely missing it when I switch back to C++/Java.

      --
      credo quia absurdum
  173. Re:Somewhat related to both points... by UnknownSoldier · · Score: 1

    > What do people cling to C's hideous syntax when they write a new language? I'll take braces over begin/end any day. What _specifically_ do you hate about the C / C++ syntax ?

  174. I'm a bit confused. by Shadowlion · · Score: 2

    One interesting way in which C# deals with the performance issues involved with automatic garbage collection is that of allowing you to define classes whose objects always copy by value, instead of the default copy by reference, which means there is no need to garbage- collect such objects. This is done, confusingly enough, by defining classes instead as structs. This is very different from C++ structs, which are defined in exactly the same way; C++ structs are just classes where members are public by default, instead of privately.

    One new feature that I mentioned already was that of copy-by-value objects. This seemingly small improvement is a potentially huge performance saver! With C++, one is regularly tempted to describe the simplest constructs as classes, and in so doing make it safer and simpler to use them. For example, a phone directory program might define a phone record as a class, and would maintain one PhoneRecord object per actual record. In Java, each and every one of those objects would be garbage collected! [snip] In C#, you'd be able to avoid all this by defining PhoneRecord as a struct instead of a class.


    I'm a bit confused.

    If I follow this correctly, it's implying that C# is faster (in this instance) because you don't have to mark/sweep through all of the objects allocated in order to garbage collect all of the objects. They've been copied by value, not by reference, so you don't need to hunt down all of the references.

    Doesn't this only work, however, if you're actually copying the objects? If I allocate several thousand PhoneRecord objects, but don't assign one to another, wouldn't C# and Java be equivalent in the speed of garbage collection?

    It seems like this particular benefit of C# is only useful in a limited number of situations. I can't honestly say that I've ever really needed to create many thousands of objects in Java or C++ by allocating/cloning an existing object each and every time.

    Can somebody confirm that this is, indeed, the correct understanding, and perhaps provide a situation where this would be genuinely useful?

    Thanks.

    1. Re:I'm a bit confused. by EAG · · Score: 1

      Value types are allocated inline, which means either on the stack or contained within an object.

      If, for example, you allocate an array of 1000 value types, you're allocating 1 chunk of memory that's big enough to hold all 1000 objects.

      If you do that with a reference type, you get an array of 1000 references to 1000 independently-allocated objects.

    2. Re:I'm a bit confused. by Acy+James+Stapp · · Score: 1

      This is especially useful for numeric programming. A programmer's mental model of numbers is such that assignment = copying. Say you have a complex number class, 'complex'
      Which is more error-prone:
      (good c++ code, bad java code)
      complex a;
      complex b;
      a=b;
      b.imaginary = 1.0;
      (a is not changed if you have copy by value, but is changed if you have copy by reference (as in java))

      or

      (good java code)
      complex a;
      complex b;
      a=new complex(b);
      b->imaginary = 1.0;
      (a is not changed, but this is nasty looking)

      (pardon my probably incorrect java syntax, but the idea should be clear)

      The other issue is memory usage. An object with an embedded complex number will use sizeof(complex) (probably 16 bytes). But an object with a reference to a complex numbers will take (sizeof(complex)+allocation overhead+reference size), typically 28 bytes, or almost twice as much memory! Not to mention cache coherency issues.

      In summary, value objects are good.

      --
      -- Too lazy to get a lower UID.
  175. Not see sharp by cybercuzco · · Score: 2
    I always prononce it "see pound" which makes more sense since most people are farmilliar with the pound key but not the musical notation for sharp. (please enter your voice mail password and press the pound key)

    --

    1. Re:Not see sharp by Karellen · · Score: 1

      It's a unit of weight still used in the UK as well. Only we already have an abbreviation for it - 'lb' (short for libra - latin unit of weight same as a pound).

      What's wrong with that?

      --
      Why doesn't the gene pool have a life guard?
    2. Re:Not see sharp by tomblackwell · · Score: 1

      See Octothorpe.

    3. Re:Not see sharp by J.Random+Hacker · · Score: 1

      na -- it should be pronounced see-hash, since it makes a hash of lots of good design ideas... ;-)

    4. Re:Not see sharp by cybercuzco · · Score: 3
      and youd have to be smoking hash to code in it.

      --

    5. Re:Not see sharp by angst_ridden_hipster · · Score: 2

      Cocktothorpe (C-Octothorpe).

      With apologies to Don Macpherson at Bell Labs, originator of the word "octothorpe."
      -
      bukra fil mish mish
      -
      Monitor the Web, or Track your site!

      --
      Eloi, Eloi, lema sabachtani?
      www.fogbound.net
  176. Re:Objective-C, NeXTStep, OpenStep, Mac OS X, and by baka_boy · · Score: 2
    Regardless of the future of Objective-C, OS-X has the nice advantage of offering an almost identical runtime environment for Java. Hell, even if Apple's hardware business tanks (which I think unlikely any time soon), or no one upgrades to OS-X (even less likely, given the response it seems to be generating), Apple could probably wrap the runtime services it's built into WebObjects and have one the best freaking Java server platforms on the market.

    Really, the use of Objective-C in OS-X is probably more about leveraging the NeXT codebase than any strong desire on Apple's part to reintroduce the language. Rather than try to struggle through morphing all the NeXTStep code to a different OO language and its less-elegant model, I'm sure it was easier for Apple to just hire a bunch of old NeXTStep/GNUStep coders, and port the whole package to the Mac.

    Buying NeXT wasn't just a way for Apple to get Jobs back on baord; they really did (still do?) have some cutting-edge code, and it'll put them light-years ahead of where they would be if they tried to incrementially adapt the old Mac OS -- just look at how long it took MS to get rid of DOS, and imagine an equally daunting task being completed by the relatively tiny MacOS development crew.

  177. Re:power languages by abelsson · · Score: 1

    The good thing about C is that nothing goes on behind your back. It's a portable, highlevel asm that allows you to see *exactly* what instructions the code will compile to. (compare this to c++ and most other "advanced" languages where a var[i]++ can involve millions of instructions that are never seen.)

    C gives you more power over your computer than most other languages. It may not be as "powerful" (read: productive) as Eiffel or Haskell but you can't beat it for coming close to the iron.

    -henrik

  178. Attributes by EAG · · Score: 5

    Attributes aren't really the C# version of reflection; reflection lets you look at the normal things you'd expect it to, and it also lets you look for attributes.

    Why should you care?

    Well, attributes are really useful in cases where you want to pass some information about the class somewhere else but you don't want to make it part of the code.

    With attributes, for example, you can specify how a class should be persisted to XML.

    [XmlRoot("Order", Namespace="urn:acme.b2b-schema.v1")]
    public class PurchaseOrder
    {
    [XmlElement("shipTo")] public Address ShipTo;
    [XmlElement("billTo")] public Address BillTo;
    [XmlElement("comment")] public string Comment;
    [XmlElement("items")] public Item[] Items;
    [XmlAttribute("date")] public DateTime OrderDate;
    }

    At runtime, the XML serializer looks for those attributes on the object it's trying to serialize, and uses them to control how it works.

    You can also use attributes to communicate marshalling information, security information, etc.

    The nice thing about attributes is that it's a common mechanism, and it's extensible, so you don't have to invent some new mechanism to do something similar.

    Or, to look at it another way, attributes are just a general mechanism for getting information into the metadata.

    1. Re:Attributes by jetson123 · · Score: 2
      Static member variables or static enquiry methods, are entirely adequate for that. The JavaBeans framework uses them, for example. If the language has reflection, they become even more powerful.

      C# attributes seem like a lot of messy mechanism for very little functionality. They should redirect that effort to add a decent reflection facility.

    2. Re:Attributes by NaughtyEddie · · Score: 1
      So they let you add massive redundancy to your codebase?

      [XmlElement("shipTo")]public Address ShipTo;

      That'll be changed incorrectly by a developer within a week.

      If a language needs specific attributes, they should be built into the language in such a manner as to eliminate this sort of pointless redundancy.

      --

      --
      It's a .88 magnum -- it goes through schools.
      -- Danny Vermin
  179. Garbage Collection by Tom7 · · Score: 1

    Huh?

    Defining garbage collection as part of a language doesn't really require you to specify how the compiler should implement it. But most of the time, the garbage collector is part of the runtime system and is triggered on a timer interrupt (or when running out of memory on an allocation). This is all up to the compiler writers to determine.

  180. Re:Ack! Significant whitespace! by Mister+Slippery · · Score: 1

    Correction to my earlier reply, my email address is sgbetten >>>at yahoo.com.

  181. Re:Ack! Significant whitespace! by Deven · · Score: 2
    Ack! Multilayered quoting! :-)

    It would be okay for the compiler to generate a warning for incorrectly-indented code, but to generate incorrect code instead is simply inexcusable.

    Depends on your definition of correctness. ;) If you wrote:
    if( myCondition) {
    doThingOne();
    doThingTwo();
    }
    On a quick visual inspection of the code, I'd assume that doThingTwo() was outside of the if clause, and if you wrote:
    if( myCondition)
    doThingOne();
    doThingTwo();
    I'd definately assume doThingTwo() was inside the if until I looked closer to notice the braces were missing. In this case, the "correct" code would be very suprising.
    That's why a compiler warning is entirely appropriate in either case above. It may be syntactically valid code, but it may not agree with the programmer's intuitions, so it's worth pointing out to possibly save the programmer time looking for the non-obvious. However, if the programmer meant to violate the indentation rules, or simply didn't care (for a quick-and-dirty program perhaps), generating different code based solely on indentation is an attempt to second-guess the programmer, and a really bad idea.

    To give you an idea on a case where the programmer might deliberately violate the indentation, consider debugging code... I will usually put temporary debugging statements flush with the left edge when I'm planning to remove them immediately after tracking down a particular problem. Because it looks wrong, it stands out, which is exactly why I do it. And I don't want a compiler second-guessing me and generating incorrect code because the compiler doesn't agree with my use of indentation. Indentation is for human readibility, and humans are more complex than programs. Syntax rules like this are an unnecessary constraint on the programmer.

    As for your second example, that sort of problem is why I always use braces on single-line blocks like that, in case another line is added later. (Hours wasted debugging someone else's code that moved key code out of a loop convinced me to change my personal coding standard, 10 years ago.) I'll drop the braces only if the statement starts on the same line with the "if", "while" or whatever. (Perl goes a step further and always requires braces; I consider this perfectly reasonable, and a much better solution than Python's.)
    In python, you don't have these sorts of suprises, your block structure is immediately obvious from indentation, and if it looks wrong, it is wrong. I'd call that correct code generation...
    Instead, Python opens you up to brand new potential surprises. Suppose you're trying to debug a program by reading through the code on a printout, and there's an indentation shift that happens to coincide with a page break? You might not notice the difference visually when moving from one page to the next, but the compiler may not do what you expect from looking at the printout, if there's a mistake in the indentation. Braces, at least, are visible and matchable.

    Also, many programs take a cavalier attitude toward whitespace, especially leading and trailing whitespace. If you were to display a python program in HTML and not disable the normal HTML formatting, the entire program will be re-wrapped. This won't hurt a C or Perl program much, but it would cripple the meaning of a Python program. If you send a program through email, a mail system could strip leading whitespace (stranger things have been known to happen). A text editor might expand tabs to spaces, not necessarily at 8 spaces per tab.

    Because whitespace typically has minimal significance, there's a lot of potential for it to get mangled in one way or another. That is one of the biggest dangers I see in Python's approach, and it just seems to be begging for trouble.
    And applying the pragmatic programming principle of DRY (Don't Repeat Yourself), what is the point of having the same semantic information encoded in the formatting (where it is visible to the programmer) and brace structure (where it is visible to the compiler). If you've got the same information in two places, eventually they'll get out of sync, and you'll lose...
    On the contrary, you should want that kind of redundancy, because it improves your chances of catching errors, especially when the compiler help automate the validation of those redundancies. Consider C function prototypes. K&R didn't feel it was necessary to declare parameter types before calling a function. After all, that information is already there in the function call (types of expressions) and definition (types of parameters). Why bother repeating information you already have? Because it catches mistakes. ANSI C catches (at compile time) many mistakes that programmers make, which K&R C missed, because of stronger typing. This redundant semantic information is a good thing.

    I stand by my opinion that Python's significant whitespace is an abomination. It second-guesses the programmer and invites trouble with whitespace-mangling. Dropping the braces removes the redundancy that could catch the problems that are likely to be caused by significant whitespace. (Had Python kept the usual braces, it would have mitigated most of the damage of making whitespace significant, and I would have much less objection to it.)

    Yes, it's a good goal to want to improve code quality and reduce mistakes. Perl's solution is much cleaner, safer, and so unobtrusive that people barely notice it and nobody particularly minds it. Python's approach, on the other hand, was ill-conceived from the start.
    --

    Deven

    "Simple things should be simple, and complex things should be possible." - Alan Kay

  182. Java Performance by photon317 · · Score: 1
    Just a note on his comment ( ~ "Java is perhaps a better language but performance sucks due to JVM")

    I distinctly remember that GCC has a front end now for compiling Java source and object files into native machine code. I don't know the status of this at this time (how well it works, how much perf gain, how stable, etc...), but for people who like Java as a language, and want fast native code, this might make Java a viable language for building traditional executables that perform well.

    --
    11*43+456^2
  183. Big waste of time ! by kazzuya · · Score: 1

    'C' rules !!
    Stop wasting time with all those fancy languages with all those problems. Programmers should work on algorithms not languages.
    C# is just another bullshit like C++ and Java.
    ..in my not so humble opinion.

  184. COM not lightweight? by Zigurd · · Score: 1
    COM is not "heavy." Distributed COM is arguably "heavy" because you must marshall the data in network-order, and SOAP does not make this lighter, only more inter-operable. But local COM objects are not appreciably "heavier" than DLLs without COM conventions for finding entry points, which is, at heart, what COM does.

    In the case of a C# module, COM (or must we call it .NET now?) provides uniform conventions for describing the classes in the module. Some other convention would be unlikely to be substantially more efficient. If the scope of a class does not extend outside a module, I doubt COM enters the picture at all.

  185. Well, C++ sucks, Java does too, so why not? by costas · · Score: 2

    I've seen plenty of comments mentioning Java's shortcomings but none mentioning C++'s: name-mangling and the lack of an industry standard.

    Case in point: I work for a company that deploys a large C++ application on 5 platforms: Solaris, AIX, HPUX, NT and Dynix. For part of the functionality we rely on licensed, commercial, dynamically linked C++ binaries. The vendor of those binaries builds them with the native compiler on each platform. However, our code is heavily templated and performance-dependent and can only be compiled with 1-2 compilers, Kai's being the only one that works on all platforms... since Kai uses a different name-mangling structure than each native compiler, we've had to write C wrappers for everything.

    Now, it seems that an ECMA-compliant, standardized language (if C# becomes that) will fix a lot of this nonsense...

    engineers never lie; we just approximate the truth.

  186. Geeks of all flavors by cheezus · · Score: 1
    I have to disclaim this post with the following statement. Please do not take it as a troll

    I do not like C or C++

    ouch. I can feel people's flames already. But here's why: I started programming in basic on an Apple II when I was about 8 years old. Later moved on to Pascal, and then Ada as my college into CSCI courses (yes, Ada and pascal suck dirty balls). Then i learned java. Java and I have a love affair now. Not only did I have an excellent instructor who made me think of the entire world as a bunch of objects, but the language also fits the way I think. Automatic garbage collection is a godsend, and object references make more sense to me than pointers (although some of the pointer arthimetic stuff in C is really cool). I also like strongly typed languages. Strangely enough, I love perl too, mostly for the reason that there are no data types (per se). In perl it makes sense, because of what i use it for... scripting and CGI. But when I am writing a program that i need to function correctly I like to have somebody watching my back. When I was learning C and C++, and to this day when I program in those languages they always manage to compile my code and do stuff they aren't supposed to.

    So C# looks pretty cool. Mostly because it looks like it will protect me like Java, and let me program on windoze (I'm not a big fan of windows, but let's face it... I don't get paid for writing free software). I'm wonding how adoped C# will be. Will it be incorporated into DevStudio with VB and VC++? And being an up and comming language, will there be lucritive jobs for the people who know it? I graduate from the University in a couple of years, but i've been looking at jobs and dice and monster to see what's out there, and it seems like aren't a whole lot of java coders comparted to C/C++ coders, thus they get paid more. Is there going to be a sudden demand for C# coders in a few years? if there is, maybe I should start learning it

    ---

    --
    /bin/fortune | slashdotsig.sh
    1. Re:Geeks of all flavors by NaughtyEddie · · Score: 2
      C# will be integrated with DevStudio.

      No-one knows the future; C# may succeed on the Windows platforms and be a vital line on your resume, or it may flop totally and be rejected by developers, and M$ may drop it in 2 years.

      As for C and C++, I find it amusing that the one part of C which you like (pointers) is the one aspect which has taken the most criticism over the past few decades!

      You don't really explain why you dislike C/C++ - apart from having someone "watching your back". Well, the solution is to learn to write robust code. Run-time errors are useful, but if you're shipping software it shouldn't have any, so run-time error checking is a waste of the end-user's time.

      I mean, I could understand it if you hated the C syntax, or C pointers, or C++ backasswards compatibility with C, or the appalling non-portability of C. But if you dislike C because it reveals your subtle bugs to you, then you should really learn how to write bug-free code. It's a much better thing to have on your resume than knowing ANY specific language. And C/C++ are going to be around for a while.

      --

      --
      It's a .88 magnum -- it goes through schools.
      -- Danny Vermin
  187. Re: Pronunciation: whatever... by Dawn+Keyhotie · · Score: 4
    Well, I'm glad I'm not the only person getting tired of having the (preferred) pronunciation given with every single mention of the languages name: C# (pronounced see sharp). Ugh. How about Java (pronounced Java), C (pronounced see), Eiffel (eye full), Pascal (pascal), perl (perl). No explanation needed there!

    Anytime you come up with a name where you have to explain the pronunciation every time you use it, you know that its a real lamer. Its a dead give-away that you worked too hard, stayed up too late, and got too cute.

    Of course, there _are_ lots of ways to say C#. I always think 'hash' everytime I see '#', and if you use the hard sound for the letter C, you get K-hash, or simple Cash. Which I think fits, considering the orifice from which it issued.

    Cheers!

    --
    "The only good windmill is a tilted windmill."
  188. And interestingly, MS trounces linux WRT java by Ars-Fartsica · · Score: 1
    In the latest Linux Journal their is a performance evaluation of various JDKs for linux. It isn't pretty. Even Cygnus's gcj comes up well short of the stock windows JDK in terms of performance.

    Unfortunately, it doesn't look like anyone is spending serious time tuning Java for linux.

  189. Re:Objective-C, NeXTStep, OpenStep, Mac OS X, and by jetson123 · · Score: 2
    NeXTStep and Objective-C ought to have caught on in the 1980's: they were a good compromise between practicality and powerful language features. It would have been great if that had been widely used. Looking back, it's not too hard to see where NeXT and Jobs went wrong.

    In 2000, Objective-C is still nice in many ways but it's dated. Java receives all the "hype" because it is at the sweet spot of backwards compatibility and new features right now. Most importantly, Java is runtime safe and it has well-defined reflection, something Objective-C always lacked, and something that is essential for a modern component market. I think Apple is making the right decision in going strongly after Java in MacOS X.

  190. Re:jsp by Zurk · · Score: 1

    i use servlets. i dont have a single line of HTML in my servlets. i generate lots of dynamic content. you just need to rethink your paradigm. JSP is not the answer.

  191. Re:garbage collection not as good as precise colle by Wesley+Felter · · Score: 1

    Some recent Java VMs can stack-allocate objects in cases where it's safe to do so.

  192. Re:Ack! Significant whitespace! by Kidbro · · Score: 1

    I once spent two hours tracking down a bug in python which finally turned out to be a space at the beginning of a line where the indention used was 4-char tabs...

  193. VB proved that microsoft... by Ukab+the+Great · · Score: 1

    can't create a language worth a damn. They are incompetant in all areas, and language creation is really no different. Anyone who creates a language that delimits blocks of codes via new lines and has parameter passing by reference as the default cannot be taken seriously.

  194. power languages by Tom7 · · Score: 3


    I think it's an unfortunate misconception that C is the ultimate "power language" because it gives you so much "control". There are lots of advanced languages around (Eiffel, Haskell, ML come to mind) which are more powerful than C precisely because of their restrictions. (You can reason about your programs more precisely since you know certain behavior is impossible). Java has some of this (safety, at least) and I think that makes it better for most applications than C++.

    I'll agree with you here, though: aside from a few cosmetic improvements, C# is not really any better than Java.

  195. Re:Ack! Significant whitespace! by scrytch · · Score: 2


    Depends on your definition of correctness. ;) If you wrote:

    if( myCondition) {
    doThingOne();
    doThingTwo();
    }


    1) It would at least run. Can't say that for python.

    2) Who writes code like that anyway?

    3) By pressing exactly one key (actually a vulgar combination of three bucky bits and a key) in emacs, i can reformat the entire source so it is indented properly (this function does marvelously with C and C++ except for multiline macros, has some problems with perl). Since indent determines scope in python, this trick is impossible with python.

    Maybe when I have less worries about being able to pay rent and grocery expenses in the near term (translation: i get a job) I'll resume my work on ni, which stands for "no indent", and will be my attempt at writing a new grammar for python that will still produce compatible bytecode. Just for kicks, I'll probably merge stackless in with ni as well, and will probably start diverging from the language once the grammar is established. I had the basics of the grammar working, but thanks to the coziness of python's lexer and parser, it still has some problems.

    --
    I've finally had it: until slashdot gets article moderation, I am not coming back.
  196. Weird-level language? by deacent · · Score: 1

    Granted, there's a need for these "weird-level" languages, and some people love them - but I think that C++ and Java nicely fill the niche.

    You seem to imply OO language where you say weird-level language. I thought that it was just a different design paradigm. Sometimes a project makes more sense if you think of it in objects than in terms of operation.

    So, my first thought, which is even more valid, I think, in the face of this review, is "Why does Microsoft feel almost obligated to make an M$ version of *everything*??"

    MS has NIH syndrome, plus they have an overwhelming need to be in contol. Not so much for the sake of power. I think it's more that they've become accustomed to making the rules instead of following them. I think that, if they could, they'd create their own variety of oxygen (not backwards compatible, of course).

    -Jennifer

  197. Copy By Value vs Copy By Reference - Simple exampl by balor · · Score: 1

    Hey, nice to see someone into programmig so young. I'll take a java example. I you create an Object (which is a container to hold data in a format you define) it is referenced by a memory address.
    String MyString = new String("Hello World")
    This string is held in a variable called MyString, the string is "Hello World". If I want to use it I have to (have to in Java) pass it into a function as a reference (memory address) thus copy-by-reference.
    In Java all simple types int,char etc.. are automatically copied by value.
    static void foo(int i)
    {
    System.out.println(i); //java way of printing to screen
    }
    this means that if I call a the function foo
    int MyInt = 10;
    foo(MyInt);
    MyInt dosn't get passed as a memory reference to the function. The actual number 10 is passed to foo. Thus its value is copied or copy-by-value.
    Copy by value is much faster as when you copy-by-reference the function has to find the memory address and all the data.
    These are difficult concepts when first starting programming. In my Computer Science degree class people had problems with them.
    If you want to contact me my email is aidan.delaney@NOSPAM.eei.ericsson.se remove the NOSPAM. I'm always happy to help people get started in somthing cool
    balor

  198. Get the language reference here by bandolero · · Score: 1

    Get the language reference and an introduction from Microsoft itself here

  199. You want something like JOVE by brokeninside · · Score: 1
    A company named Instantiations bought what was (AFAIK) the first commercially available java compiler, SuperCede, that spit out native executables.

    Apparently the technology behind SuperCede was folded into Instantians' JOVE product.

    Anyway, native compilers are out there...

  200. don't get your hopes up on performance by jetson123 · · Score: 4
    I see nothing in C# that would make it perform any better than Java. The introduction of objects with value semantics perhaps comes closest, but similar efforts are underway for Java (and can be implemented without any significant changes to the Java language and none to the Java byte codes).

    Java has an enormous number of man-years poured into its design, library, bug fixes, and various implementations. Issues like safety, sandboxing, security, and reflection aren't even addressed by C#. A complete set of cross-platform libraries is also not a goal of C#, while Java actually delivers, and delivers pretty well. And people are working hard at adding genericity and features for high performance computing (JavaGrande) to Java.

    If Windows programmers switch in droves from C++ to C# that would be great: as far as it's defined, C# is almost indistiguishable from Java, and it would elevate the quality of software on Windows platforms. But, at this point, C# looks like a dud to me: it's late, it's non-standard, has no user community, and it doesn't even promise to offer any compelling advantages over Java.

  201. Somewhat related to both points... by TheDullBlade · · Score: 1

    What do people cling to C's hideous syntax when they write a new language? Not only is it, IMHO, a bad syntax choice, but it messes you up when you go to learn it and you expect things to work like they did in C.

    I wrote a C/C++ preprocessor that lets you use Python-style whitespace-significant code, called Cugar to escape the ugliness of C. I just don't understand why people keep pushing back toward it.

    ---
    Despite rumors to the contrary, I am not a turnip.

    --
    /.
    1. Re:Somewhat related to both points... by Dimitri-san · · Score: 2
      What do people cling to C's hideous syntax when they write a new language? Not only is it, IMHO, a bad syntax choice...

      Amen, brother! I have yet to fathom why anyone would want to use the hard-to-type curly braces for block notation where you can just use an "end" keyword at the end of blocks instead. An if-then-else-end construct saves 3 keystrokes (7 if using implict "THEN"s) over a readably-formatted if () {} else {}. Not to mention that typing the curly braces is more difficult and error-prone than typing "THEN", "ELSE", or "END." (Note: I'm including shift keys as keystrokes for the calculation.)

      Now, one might say that 3 keystrokes are no big deal, but when this kind of construct is the most common in the hand-coded parts of a program, it adds up (your fingers notice the difference).

      When I first read about C#, I thought "Great! A new language with new ideas!" But, upon reading the specs, it's the same old C-syntax garbage we've been fed for years. I'm surprised there hasn't been a good cross-platform compiled language yet that does away with the dreaded curly braces.

      I, for one, would welcome it.

  202. It's a sink, says nethack by scrytch · · Score: 1

    :)

    --
    I've finally had it: until slashdot gets article moderation, I am not coming back.
  203. Good, but inconsistent, review by srussell · · Score: 1
    It is nice to see someone attempting to give a reasonably objective review of C#. What with the hype flying in both directions, it has been difficult to glean some useful third party opinions on the topic.

    A problem I have with the review is duplicity. In one paragraph, the author applauds C# for reducing the "basic" types -- integers, floats, and such -- to pure objects, while criticizing Java for having impure OO by having non-object base types. In another paragraph, C# is again praised for creating a new, non-OO event mechanism, while Java (and C++) is criticized for using objects for events. I don't criticize people for using different standards than the ones I hold when evaluating something, but I do expect them to be consistent within their own reviews.

    Overall a good review. Personally, I never intend to use C# if I can at all avoid it, and I've managed to never hold a job that requires me to use M$ products, so I figure I have a pretty good chance. There just isn't any compelling reason to use C#, unless you're a Sith.

  204. Events by Lozzer · · Score: 1

    I've never seen a better implementation than in Forté where they are build in to the language. It to allows you define events on a class and has constructs such as event loop, when, register and deregister for responding to the the events. (Its a while since I've used Forté but I think that events can also be used for thread to thread communication, as well as distributed - cross partition communication)

    --
    Special Relativity: The person in the other queue thinks yours is moving faster.
  205. Actually, it looks pretty nifty to me by Julian+Morrison · · Score: 1

    Am I the only one that likes this? It seems like the perfect language to implement what Miguel de icaza is talking about in another article today: the re-componentization of modern unix. As to all the fuss about COM - just make the GNU clone use Bonobo instead :-)

  206. Re:Disappointed about boxing/unboxing by scrytch · · Score: 2

    > Really elegant boxing would allow you to treat primitives as full, first class objects. Then you could, for instance, have a synchronized block use an integer as its lock object.

    Bad form. First of all, nothing about an int says "lock", specialized lock classes like Mutex or Semaphore and whatnot are far more descriptive. Secondly, that lock probably requires a unique value now, where otherwise it could be reused by other unboxing operations using the same value. (i.e. one lock on a "5" object now requires a different object than a different lock on a "5" object)

    Smalltalk has been doing automatic [un]boxing for eons now, I'm disappointed to see other languages still don't do this.

    --
    I've finally had it: until slashdot gets article moderation, I am not coming back.
  207. You wanna live in that hell? by redhog · · Score: 2

    Edit those routines at the spot! You can not survive in such an environment for long. So, for your own health, make certain you quit/get fired soon!

    I have been working in an environment where there where no clear specs from the customer and where there where more or less no docs on the libs the customer wanted me to use. And I honestly don't want others to have the same nightmare (By the way, my coworkers where the best team you can ever get on this planet, so the job wasn't all that bad).
    --The knowledge that you are an idiot, is what distinguishes you from one.

    --
    --The knowledge that you are an idiot, is what distinguishes you from one.
  208. Honest Microsoft! by Godwin+O'Hitler · · Score: 1

    I'm surprised that Mr. Invoice Portcullises has called this "C#". Normally the bad boys from Redmond try to hide clapped out ideas behind nice new names.
    It's also a relief to see that Mirfoscot can't come up with anything better. If they'd used a modern OOP structure, we'd all have had to worry about Mifcroost imposing yet another set of painful Redmond standards.

    --
    No, your children are not the special ones. Nor are your pets.
  209. Early/Late binding by Acy+James+Stapp · · Score: 3

    I think you are a bit confused about early/late binding. Early binding is the process of determining the address of the function to call (given it's name) at compile, link, or load time. This happens once, so it is fast. Late binding is the process of determining the address of the function to call each time it is called. In C++, late binding is used for virtual functions, and early binding for non-virtual functions.
    There are optimizations that enable late-binding to be more efficient (such as a vtable). Java implementations should be able to determine (via the final attribute) that a function can be early-bound instead of late-bound. There are also C++ compilers that can eliminate virtual function calls by doing link-time program analysis.

    --
    -- Too lazy to get a lower UID.
  210. Attributes, Generics and COM by tyse · · Score: 2
    With respect to attributes, these are mainly used for interoperation with other programming languages. If you want to interoperate well with C++, for example, you can put an attribute on a parameter that says that C++ should consider this "int" to be a "long". The C++ compiler/tool can then read the attribute from the metadata in the compiler C# program, and generate the appropriate code or header file. In this way you can provide "extra information" about language features. There are two sorts of attribute -- a sort you can ignore (this is a "long", but if you don't know what a long is, don't worry about it, just treat it as an "int"), and the sort you can't ignore (this parameter is really int[4..8] -- if you don't know what that means, don't even think about calling this method). C# is used for writing a lot of class libraries so it needs good support for attributes. I dare say it was also Microsoft's testbed for the .NET architecture, so of course almost everything that is in the architecture is in C#.

    You can also use attributes to embed documentation, contracts, etc. People who compile from a high-level language to C# (already happening) will no doubt have many uses for attributes. Attributes are more of a tool feature than a language feature -- as a programmer you probably won't use many of them, but if you are systems programmer you might use them (or generate them) a lot.

    Generics are not the same as templates. There are literally hundreds of languages out there that don't use templates for generics. In the .NET runtime it looks like the approach will be to use a sort of dynamic template expansion technique (you expand the templates as you JIT -- although this is a gross simplification). There are several languages that already have generics on the .NET platform -- Eiffel, Mercury, Haskell, ML (although I think ML uses whole-program compilation to eliminate real genericity).

    Finally, AFAIK nothing in .NET relies on COM. There is certainly full COM interoperability built into the system libraries and tools -- basically there is a tool that takes a COM type library and turns it into a .NET component by creating forwarding stubs. There is an interop library that does marshalling and so on. But if your code doesn't rely on a COM component, you don't need this stuff.

    Of course as a platform at the moment, most of the interesting components you would want to use are COM components. But if people write 100% .NET code, you can run it anywhere. Obviously some people will not do this -- it makes a lot more sense to just script COM components in .NET, at least until there are enough .NET components to replace them. But given that deployment of .NET components is a lot more controlled that COM, there is certainly some incentive to replace them. Of course there are still platform specific APIs to contend with, but they are always going to be an issue.

    So AFAIK there's no reason why you couldn't write a .NET framework, and a C# compiler that works under Linux (or whatever your favourite platform is). This will be really quite possible if Microsoft does what they say they will and standardizes them. You could also hook in support for CORBA interoperability. You could put in support for SOAP. You could allow it to run under Apache and do something like ASP+ and web methods.

  211. C# and COM by bburcham · · Score: 1

    Visual J++ was arguably the easiest environment in which to do COM programming (including MTS and later COM(+) (managed) components). It wasn't perfect though. Seems to me that the biggest opportunity for C# is to have a language that _really_ fits (embodies) the COM object model. From my reading of the C# docs though it is unclear to what extent C# really achieves that. For example there is no mention of how some sophisticated/obscure/INTERESTING COM features such as "tearoff" interfaces will map to C#. Sigh.

  212. Re: Pronunciation: whatever... by Anonymous Coward · · Score: 1

    Perhaps MS is trying to pull a Prince here--giving C# an unpronouncable name, it becomes the language formerly known as Java.

  213. Better gc performance? by greysky · · Score: 1

    Ok, he tries to make the argument that garbage collection would be faster than in java because you can declare data structures that aren't objects so they won't have to be gc'd, giving the example of a phone number class in java. Then he says that all the primitives are now objects. Doesn't this nullify the performance benefit? Granted the phone number struct is not an object but the number(s) it contains is(are).

  214. I'm so lame... by burris · · Score: 2
    In the look & feel department, C# feels very much like C++. More so than even Java. While Java syntax borrows much of the C++ syntax, some of the corresponding language constructs have a slightly different form of use. While this is hardly a complaint, it's interesting to note that the designers of C# went a little further in making it look like C++. This is good for the same reason it was good with Java. Being a professional C++ programmer, I use C++ way more than any other language. Eiffel, for instance, has a much cleaner syntax than either C++, C# or Java, and at face value it does seem as though one should bear with new syntax if this is going to lead to cleaner, more easily understandable code, but for an old dog like myself, not having to remember so much new syntax when switching to another language is nothing short of a blessing
    *sarcasm*
    I'm so lame that I am unable to learn a new programming language syntax. Even though it's been thirty years since computers have become powerful enough to support parsers that can figure out the end of a statement without an explicit delimiter, it makes me feel all warm and fuzzy inside when I put that semicolon at the end of every line. Even though named arguments might be preferable to sequences of anonymous types, a new messaging syntax would more than my fossilized brain can tolerate. Asking mere computer programmers to learn something new is asking a little too much, after all, programmers tend to be slow learning. Instead, we should perpetuate outdated and inconvenient syntax. We wouldn't want to frighten the poor wittle programmers with something as radical and hard to grasp as a different syntax.
    *sarcasm*

    Burris

  215. Programming languages: C++ still king? by AstynaxX · · Score: 1

    So far from the various articles and discussions on C#, C++ still seems to come out ahead. How so? here's the short list:

    1. C++ allows for you to import and/or write code blocks in C. 2 languages for the price of one in a sense, which is very useful if, say, the C implementation is easier to code up then the corresponding C++ implementation, but you don't want to lose C++'s other strong points[such as simplified I/O, at least as compared to C]

    2. Templated classes. It was mentioned above, C# lacks these, as do many other languages it seems. While the use of them could be cleaned up quite a bit, the idea of template classes is very sound. It allows for the easy set up of a container class that holds basically any other class you put into it. For example, a matrix in C++ is little more than an array of arrays, all of which can also be templated to hold int, float, char, etc. As a simple side project, I once made a 3D matrix by simple templating arrays into a 2d matrix. In C#, it appears doing this would not be nearly as easy or straight forward.

    -={(Astynax)}=-

    --
    -={(Astynax)}=-
    "Darkness beyond Twilight"
    1. Re:Programming languages: C++ still king? by rickjenn · · Score: 1

      Deriving everything from one base class is not cleaner! It means that you have horrible container classes like Java's vector, which is about as type-unsafe as you can get and requires vast amounts of icky casting whenever you use it.

    2. Re:Programming languages: C++ still king? by SpryGuy · · Score: 1

      Not *really*. I mean, you could say "COM" is language neutral too, but what MS is doing goes way beyond that from what little I understand.

      And in particular, they hide all the 'plumbing' that is COM or CORBA (via attributed programming) so that, regardless of the language, you don't need to worry about the boilerplate stuff.

      My main worry, of course, is performance. We'll just have to wait and see on that one.

      - Spryguy

      --

      - Spryguy
      There are three kinds of people in this world: those that can count and those that can't
    3. Re:Programming languages: C++ still king? by bigchris · · Score: 1

      In that case, why not just use CORBA? Isn't this language neutral?

      If I'm wrong, please correct me (but try to do it gently!)

    4. Re:Programming languages: C++ still king? by SpryGuy · · Score: 1

      Um... C# lets you import and use objects written in C++ or VB as well as those in C#. In fact, that's part of the whole point of the .Net thing. It's "language neutral". You write in the language you're most comfortable with. Others can then use your objects in the language THEY are most comfortable with. (as long as there's a language wrapper that uses the common runtime... so far, I'm only aware of "Managed C++", C#, and VB ... though they talked about COBOL, Fortran, Perl, Pascal, etc. being ported to use the runtime)

      Just FYI.

      - Spryguy

      --

      - Spryguy
      There are three kinds of people in this world: those that can count and those that can't
  216. Issues with C# by Anonymous Coward · · Score: 1

    While everyone beats on Microsoft for doing things with its Windows platform and "innovating" software which further ties it to Windows, I think that there is some merit in Microsoft.

    Microsoft writes software. Software has a purpose. The extent to which that software can fulfill its purpose is the way to judge that software. Slashdot readers tend to judge software by how accessible (i.e. open source) it is to them as programmers.

    Microsoft products (nowadays) tend to have the ability to be programmed. Sometimes this takes the form of Macros, sometimes VBA, sometimes scripting or batch files. The beauty is that people who aren't computer geeks use this stuff, and they get things done.

    C# will fill a lot of holes. It will be used to create stand-alone applications with COM objects, COM .DLLs, server side interpreted p-code, and anything else you want with it. Lay to rest your fears that you need to port to C#. COM is the MS answer to language porting.

    "News for Nerds. Stuff that matters." is an appropriate title for this site because it is quite aparrent (via the feedback), that most users of this site are nerds that do things in the nerdiest fashion possible. I happen to be a nerd who has to support MS at school...

    Anyway, my beef with free software (in particular Linux), is that it is NOT free. Free software takes time to learn and use. How much do you get paid per hour to learn and use Linux? The fact that I do means that Linux is free for me. Is it free for my mom? No. Is it free for my sister? No. The free software movement needs to come to terms with the fact that unless you make software usable to people who don't have the time to pick up the manual, your software won't be used.

    I am personally a big fan of the GIMP. I wish that the latest win32 release could load a JPEG on a 2-processor NT machine... I haven't updated my older version (I have 2 computers at my desk) for fear that it won't work on a 1 processor machine, too.... Playing with free code vs playing with commercial code, I can say that the free code needs to mature in usability for the rest of the world before it makes a dent in the software industry. I welcome the market share to open source software, but sarcastically say, "yeah, that'll happen soon...".
    -Mike

  217. Re:For all the bashing C# gets here... by Tet · · Score: 2
    Real managers are not PHBs

    Sorry, but I have too much real world proof to let this stand. PHBs really do exist. Not all managers are PHBs, but go to any reasonably sized company, and you'll find them...

    --
    "The invisible and the non-existent look very much alike." -- Delos B. McKown
  218. Re:java's overhead by jeti+ · · Score: 1
    I wrote a graphical editor in Java. On a 1024x768 display (modest for the times), the performance penalty of Swing made some parts of it barely usable on a dual P3-550 Xeon box with a TNT2.

    Actually, in terms of swing speed, there are drastic differerences between different JVMs.

    When I was working on a simple graph editor (bitmap background, boxes with text on foreground) I noticed that Sun JDK 1.2.2 run on NT was clearly slower than IBM JDK 1.1.8 run in Linux but used through X server on the same NT! (The network between NT and Linux was 10MB ethernet.)

    After investigating a little it seems that Sun JVM rendered the image in core memory and just dumped everything to graphics card when needed. OTOH IBM JVM drew the picture 'right' so the graphics card accelerator was used. (Sun JVM on Linux/X was unusably slow, IBM JVM on NT was the fastes combination.)

    Please note these observations probably won't reflect performance of current 1.3 JVMs.

    // /

    --

    // /

  219. A look at C# by _prime · · Score: 5

    I recently went to a brief presentation on C#, done by some Comp Sci folks just back from the MS developer conference.

    A few points I recall:

    • It does require a virtual machine. It forms a layer of abstraction called the "Common Language Runtime." The name of the VM itself is "NGWS". Performance questions led to answers along the lines of it being comparible to Java; there were indications that MS engineers believed it would eventually run faster than a compiled language due to the virtual machine's ability to optimize code execution for individual processors and systems.
    • They had a look "under the hood" of the Virtual Machine only to discover that it looked *strangely* just like MS's Java VM. Apparently they changed the variable/function names but the programmer who was taking a look said the code itself looked the same. They commented that they could actually run Java code on the system without problems, providing it didn't refer to any of the special Java class libraries.
    • Visual Studio 7 (?) would be known as Visual Studio .NET and would feature C# and the VM. They remarked that the beta release they received was quite stable.
    • The VM would run on everything from Win98 up (not sure about 95).
    • They went into some detail on MS's new strategy. Basically they are hoping to capture the Middle Tier market with C# services running on the VM (NGWS), accessible remotely via SOAP. On top would be ASP+ (internet) and Win Forms (enterprise).

    Someone asked why we need another language, especially one so close to Java. The presenter(s) explained that MS basically wanted to offer a VM based Java-like language, but was unable to add their own extensions to Java fit in with their new strategy (remember the lawsuit from Sun?). They remarked that perhaps Sun made a mistake in their desire to keep MS from making non-standard alterations to the MS implementation of the Java VM. MS, as usual, just went ahead and created their own new standard. Now we have another language to pull developers away from Java.

  220. Re: Pronunciation: whatever... by horza · · Score: 1

    I would have thought that if it was pronounced "see hash" it would perk up programmers interest no end.

    Phillip.

  221. Gripes and rebuttals by Edward+Kmett · · Score: 3
    I dislike the syntax used for C#'s structs. Since it is identical to the syntax used to access a class, you cannot identify without digging up the location of the source definition of the object whether or not you are passing by value or reference into the function.

    my_int bar(my_int x) {
    x+=1;
    return x;
    }
    my_int foo() {
    my_int y = 2;
    bar(y);
    return bar(y);
    }
    foo returns different results depending on whether or not my_int is a struct or a class. You cannot tell if modifying the object will modify the original or not without looking for the original class definition which can be buried pretty much anywhere in c#, because it has abandoned the rigid formalism that Java used of one public class per file and the name of the file matching the class.

    Mind you, Microsoft will probably sell a nice Visual Studio plugin which looks up the source definition and shows you if its a class or struct, and which allows you to hyperlink to the definition (witness MSVC and VB), but I'm examining the language, not Microsoft's tools.

    I disagree with the author of this article about the presence of Attributes. Attributes (as ugly as they are) create an avenue to extend the metainformation provided by the language. Since the attributes reside at the class rather than instance level, the glut of their presence is not intolerable. Their presence is necessary to fully specify COM parameters, they can act as a reflection tie to documentation, provide editor bindings to source code, etc.. in one place, rather than java's comparatively hackish javadoc approach of differentiating /* and /**. Its new, its different, but I can accept it and already see uses for it.

    However, I do not see the need for Events to be a language level construct. With the introduction of generics/templates they could be implemented as a generator/listener template with a common superclass and subscribers tracked in a static list per event template used. No extra nomenclature need be added to the language to describe what is just another pattern afterall. In the absence of generics I suppose they did the best they could, but its another case of pandering to their present programming paradigm (pardon the alliteration).

    I do miss the presence of java's inner classes and either c++'s templates or some other form of constrained generics (can anyone say Eiffel?).

    In fact the lack of any form of generic will probably keep me from using the language as I am a pattern junky, and templates/generics are key to avoiding a lot of cut&paste code when using similar patterns heavily.

    --
    Sanity is a sandbox. I prefer the swings.
    1. Re:Gripes and rebuttals by Edward+Kmett · · Score: 1

      Re-read the post. I did say public class per file. ;)

      --
      Sanity is a sandbox. I prefer the swings.
  222. Apple releases a new language called C#++ by efuseekay · · Score: 4

    Despite the success of C#, programmers began to complained that though C# provides much of the functionality of Java with the flexibility of C++, there exists a middle ground between C++ and C#.

    C#++ is desiged to fill that middle ground.

    CaptChalupa, a MicroSlash programmer, said, "I love C++, and always programmed in C++. But the lure of the C#, which my colleagues have raved all over, is tugging me. The reason I don't want to abandon C++ is because I still like to keep the flexibility of collecting my own garbage. C#++ is the answer that may just finally pull me away from C++."

    Meanwhile, in another development, Microsoft Applications Inc. has announced the development of a new language called "C##".....

    --
    Mode (3) smart-aleck mode. Press * to return to main menu.
  223. I'm so excited, I can hardly contain myself by askheaves · · Score: 4

    Since the first day I heard about this language, I have been excited about it. The more that I read about it, the more I can't wait to see that pretty little brown MSDN box come in the mail with my copy of Vis Studio 7.

    As a Microsoft-whore, the ability to develop with the new tools of VS7 (which, BTW, features C#, VC++, Managed VC++, and VB all running in the same IDE with concurrent, multilanguage debugging... baby!) has taken over. I am working on a project that requires two WinCE portions and a data management system. The things I've read have made me make the conscious decision to do no code development on the data management portion until VS7 is in my hand and on my machine.

    This month's Visual C++ Developers Journal has a cover to cover exposé on VS7. This is a link to the online article.

    http://www.devx.com/upload/free/features/vcdj/2000 /08aug00/bn0008/bn0008-1.asp



    "Blue Elf has destroyed the food!"

    --

    Because you can't, you won't, and you don't stop...
  224. Does C# exist yet?? by Gorimek · · Score: 1

    Is there a working C# implementation?

    Correct me if I'm wrong, but I get the impression C# is just vaporware so far.

  225. Re:Ack! Significant whitespace! by Deven · · Score: 2

    I shudder when I think of programming with significant whitespace. It's what has kept me from picking up Python in earnest--at least until I write a conversion program that turns braces into the whitespace that python likes (in Perl :-).

    To think that C would be made *better* by the addition of significant whitespace gives me the chills.


    Agreed! I've been told a number of times that Python is a good language, but that one design flaw (making whitespace significant) has kept me from wanting to touch it. It would be okay for the compiler to generate a warning for incorrectly-indented code, but to generate incorrect code instead is simply inexcusable. Grafting this abomination onto C is a disturbing prospect indeed.

    --

    Deven

    "Simple things should be simple, and complex things should be possible." - Alan Kay

  226. C# = ? by DrQu+xum · · Score: 1

    C# = 13 pounds (base 10).
    Coincidentally, that's how much the documentation weighs. Problem is, it's on 13 pounds of CD-ROMs.

    --
    DrQu+xum: Proof that the lameness filter doesn't work.
  227. Moving target? by jaoswald · · Score: 2

    Does this mean that C# will be as much of a moving target as C++ was for the first 10 years of its existence?

    (I don't mean to sound surprised, as this is a Microsoft language, which needs continuous "innovation" to maintain market-share.)

    To me, one of the huge reasons not to use C++ was that, even though I had learned an earlier version years ago, when I came back a few years later, Bjarne had added a few new features that were now "essential" to implement some "crucial" paradigm. E.g., suddenly templates are crucial to programming in the true C++ religion. Never mind that compilers took years to get them properly and consistently implemented, while hackers seemed to keep pushing templates harder and harder for compile-time code generation, in ways that were bound to activate any subtle, lurking bugs in a compiler. Same with exceptions, RTTI, et al.

    My main gripe is that it is hard enough to deal with languages where people keep coming up with half-solutions to new problems by changing the language definition. How much worse will it be when Microsoft, with its commercial interests, gets in the game?

  228. Disappointed about boxing/unboxing by JohnZed · · Score: 2

    Microsoft played up the fact that their approach to boxing/unboxing would be fairly innovative in C#, and this got me pretty psyched. Basically, boxing is a way to convert primitive objects (ints, etc.) to instances of the generic C# 'object' class. That way, you can treat primitives like objects, but without the performance loss in cases where you just want them to be plain old primitives (I imagine something similar happens with structs?).
    Sadly, I took a skim through the "Introducing C#" book, and noticed that boxed primitives are completely distinct objects from their unboxed versions. So, if I do "int x = 10; Object xobj = x;", the new xobj is completely unrelated to x from now on. I can later do "(int)xobj += 100; print(x)", and x will still be 10.
    In other words, this is (as far as I can tell, please correct me otherwise!) exactly identical to doing "xobj = new Integer(x);" in Java, just 'syntactic sugar' as they say. You could add this pretty trivially to Java with few little tweaks to the front-end (and maybe somebody should).
    Really elegant boxing would allow you to treat primitives as full, first class objects. Then you could, for instance, have a synchronized block use an integer as its lock object. Or you could store an integer in a collection (say, a hashtable) and have the hashtable entry properly updated as the original int is changed (as if it were any other mutable object). These aren't huge deals in the grand world of language design, but their efficient implementation would actually be kind of interesting.
    --JRZ

  229. How I hate MS Types (Re:C#: Answer to the DOJ?) by chris_7d0h · · Score: 1
    (off topic warning)

    I think I'll never be able to not get sick seeing windows (tm) C code.

    MS wasn't satisfied with ordinary types, but had to go inventing their own MYNEWCOOLTYPE == long (C type) code. Or their completely illogical ways of accessing functions with their API, with 10 arguments, of which 5 are NULL or at least undefined and some requiring preallocated memory space, having names like bzskrpf or similar. Remembering all that crap is like learning Russian, stripping out all grammar and anything that could let you get a grip on things.

    (I admit, I have done very little WinAPI coding, and usually wrap whatever feature I need into classes, so I'll never have to deal with the pesky syntax ever again). Perhaps I'm the only one not liking this gibberish, as the MS platform seems to have quite a few programmer followers?

    (I'm not writing this to *piss off* all the Win coders, just posting an opinion which I hope I am not totally alone of having + yes, some of the above might be a little over exaggerated)

    --
    In a society that believes in nothing, fear becomes the only agenda ~ Bill Durodié
  230. Re:jsp by Zurk · · Score: 1

    you do it in the HTML. :) .as i said, i do list boxes, select boxes etc dynamically..any element can be dynamic. you just need to think about your fundamental assumptions. i'd say more but im under an NDA.

  231. Sharp Move? by Anonymous Coward · · Score: 2

    I've been thinking about this one for a couple of days and all actually fits in. Assume the following events:

    C# will be ignored by SUN/IBM etc. for the next 2-3 years since they heavily back Java and are reluctant to invest in competing technologies.

    While being ignored by their competitors Microsoft does some heavy promoting of C# to windows developers and succeeds into making it the primary windows development environment. Ofcourse using Visual Studio. (I think this will be easy due to the current gap between Visual Basic, which is too simplistic to do any serious component development in, and Visual C++, too hard, ever used ATL? C# fills the gap nicely where Java fills the same gap on other platforms.)

    Higher level Windows API's are wrapped in C#-accessible classes or components and a lot of the code implementing this is ported to C#/IL. Using the same strategy as with Windows, there are 2 APIs: one public and one internal.

    C# is accepted by ECMA into the standarization process. The language and associated libraries are standarized. The standard process progresses fast backed by Microsoft and it's partners. Except for Microsoft itself, no-one tries to keep up.

    Microsoft looses its appeal is split up into an OS and an Apps company. The Apps company keeps Visual Studio.

    The IL and libraries (.NET framework?) are ported to a different operating system (e.g. Linux) and most code that would run only on windows now runs on that other platform with minimal effort. Ofcourse only when the Microsoft implemented libraries are installed and paid for.

    Effect: Microsoft Apps company doesn't need the Windows OS anymore and controls the API used in most commercial applications on several platforms and also has a secret internal API that they can use for pushing too powerfull players out of the market.

    Thoughts?

  232. Re:java's overhead by Spud+the+Ninja · · Score: 2

    Even if speed is a big issue, you can still used Java. The least platform-independant stuff to program is the user-interface. This is were Java shines, I think. I don't care how slowly it runs, Java can keep up with my mouse clicks!

    For serious number-crunching, using JNI to hook into some optimised native libraries, which can be built with a minimum of platform-dependant code if you don't count Makefiles, all-but-negates any speed loss that going with a purely Java solution would give you.

    My understanding is that C# can also call libraries like this, and that it's way easier for other languages to call C# methods than Java methods. But with it's heavy dependance on COM, I'm not sure how widespread C# could be outside of the Win32 system. Does it even provide it's own windowing toolkit, or does it jack into the exiisting OS calls?


    Love, Spud.

    --
    You can never put too much water in a nuclear reactor.
  233. Will there be a Linux/UNIX compiler? by peter303 · · Score: 2

    Just asking.

  234. Genericity by vanicat · · Score: 1

    When i read this, one thing make me realy react : no, template aren't the only way to do genericity, the ML way of doing it, or better the OCaml way are fare better : they are type safe, whith no duplication of code. More precisly, it's easier when programing object in ocaml to make generic function than to make non generic one, and all this whith out any lost of efficacity in size or speed.

  235. Doesn't make sense to me either. by Tom7 · · Score: 1

    If structs can contain object references, then they must be observed by the garbage collector as well, even if they are allocated on the stack.

    I'm pretty comfortable with garbage collection but I don't get what he's trying to say here. Can the poster elucidate us a little?

  236. C# vs Java ? Gimme a compiler! by jabber · · Score: 2

    The one argument for C#, and against Java, seems to be performance. If C# delivers better performance than Java, than C# will be better. I'd argue that, but I left my asbestos undies at home.

    Well... Where are the Java bytecode-to-native compilers to make this a non-issue?

    Seems to me that improving the performance of an existing language (albeit at the cost of platform independence, obviously) would be much simpler than developing a whole new language to include the piece that Java is missing - a native compiler.

    --

    -- What you do today will cost you a day of your life.
    1. Re:C# vs Java ? Gimme a compiler! by catseye_95051 · · Score: 1

      You ask:

      "Where are the Java bytecode-to-native compilers to make this a non-issue? "

      The answer is, in Java. It's called a JIT and in fact does a better job compiling in many cases then a static compiler can due to the richness of information available to it at run-time.

      This mistake is what's wrong with the article too- it's built on false prmise. Yo uand the article author both need to go read Chris Rijk's benchamrking report (Binareis v. Bytecodes) at www.aceshardware.com.

  237. Ack! Significant whitespace! by stevens · · Score: 3
    Quoth the poster:
    ...C's hideous syntax...
    ...and...
    I wrote a C/C++ preprocessor that lets you use Python-style whitespace-significant code, called Cugar to escape the ugliness of C.

    I shudder when I think of programming with significant whitespace. It's what has kept me from picking up Python in earnest--at least until I write a conversion program that turns braces into the whitespace that python likes (in Perl :-).

    To think that C would be made *better* by the addition of significant whitespace gives me the chills.

    Steve
  238. Re:For all the bashing C# gets here... by jglynn · · Score: 1

    Yeah, but who cares...

  239. C# is only half the story by ToughRat · · Score: 1

    Check out this interview on C# and the language engine underlying it with Anders Hejlsberg on O'Reilly.

    Python, among other languages, is being ported to run on the .NET language engine (reported on comp.lang.python by Mark Hammond). As the article makes clear, any language using the common language engine can compile down to machine code. Also, interoperability with all interprocess methods is open and equal.

    As I told my friends, I take back almost everything bad I've said about MS. &lt&ltg&gt&gt

    Hank Fay

  240. Enforcing indenting styles across a project... by Deven · · Score: 1

    Preprocessors like these should be available for all languages so that a project team can enforce an indenting style across the project. Of course there are many other reasons why debugging others source code can be difficult, but I find it easier to read my own code from 7 years ago (when my ability and technique were different) tha anyone elses code because I was indenting in the same way.

    Ever heard of indent? It can be used to enforce a consistent indenting style. Much better than making whitespace significant in the language.

    --

    Deven

    "Simple things should be simple, and complex things should be possible." - Alan Kay

  241. Re:Ack! Significant whitespace! by rafial · · Score: 4

    It would be okay for the compiler to generate a warning for incorrectly-indented code, but to generate incorrect code instead is simply inexcusable.

    Depends on your definition of correctness. ;) If you wrote:

    if( myCondition) {
    doThingOne();
    doThingTwo();
    }

    On a quick visual inspection of the code, I'd assume that doThingTwo() was outside of the if clause, and if you wrote:

    if( myCondition)
    doThingOne();
    doThingTwo();

    I'd definately assume doThingTwo() was inside the if until I looked closer to notice the braces were missing. In this case, the "correct" code would be very suprising.

    In python, you don't have these sorts of suprises, your block structure is immediately obvious from indentation, and if it looks wrong, it is wrong. I'd call that correct code generation...

    I'll admit I was a little put off by this feature of python at first, but as soon as I started working with it for awhile, it just seemed natural. Now in my Java programming I always get annoyed when I have to spend time balancing my braces!

    Also, I used to do alot of work in perl with a guy who never bothered to indent his code consistently (after all, its the braces that define the block structure) and at least once a week, he would call me over to look at some bug that became obvious as soon as I reformatted the code. And applying the pragmatic programming principle of DRY (Don't Repeat Yourself), what is the point of having the same semantic information encoded in the formatting (where it is visible to the programmer) and brace structure (where it is visible to the compiler). If you've got the same information in two places, eventually they'll get out of sync, and you'll lose...

  242. Re:Ack! Significant whitespace! by jovlinger · · Score: 2

    White space schmight place.

    Python is truly a wonderful prototyping language, but as soon as any project I use it for (tend to be home-sys admin things) I always get bitten by the global/local scoping rules (*).

    I would cry tears of happiness if it only had lexical scoping. My "I'll just fix it" threshold is pretty high, but I've just about to reached it.

    Johan

    (*) variables in methods are global if you only read from them in the body, but if you assign to them in the body, they become global. Scoping is dynamicish, allowing you to declare the global afterr you have declared it in the method, as long as it occurs first in the runtime. The semantics are way to ad-hoc, no?

  243. Re:Ack! Significant whitespace! by jovlinger · · Score: 2

    they become global

    local.

    preview, what's that?

  244. Go get C# at Microsoft! by RevAaron · · Score: 2

    A lot of people seem to be under the impression that C# is only available to those who went to the PDC. Nope. For a couple days, it's been available at Microsoft's site, and according to them, it's the same "sample bits" distributed at PDC.

    Get it here. It does require Windows 2000 though.

    --

    Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
  245. Re:Ack! Significant whitespace! by Deven · · Score: 2

    Perhaps the more fatal flaw is that you refuse to touch it because of that attribute (significant whitespace).

    Actually, I've heard enough good things about the design of the language as a whole that I've decided I should overlook the whitespace thing and learn it sometime anyhow. However, it took a lot of praise from other sources to convince me that it might have sufficient redeeming qualities to outweigh this abomination.

    Try it out for a while before you write it off as a design flaw.

    Whether or not it's a technical design flaw, which is debatable, I'd suggest it's a social design flaw if it makes many programmers reluctant to seriously consider using the language (which it does). Some programmers may like it, others may manage to set aside their distaste for it, but many simply won't touch it at all. That's a flaw, if it makes an otherwise-good language worthless because it gets rejected out of hand.

    --

    Deven

    "Simple things should be simple, and complex things should be possible." - Alan Kay

  246. Re:interface rant by AndrewHowe · · Score: 1

    Urrrm... Turn it off if you don't like it?

  247. Makes some sense to me. by Len · · Score: 1
    Well, clearly, if you create a bunch of structs and then fill them with refs to other heap-allocated objects, you've defeated the purpose of reducing garbage collection.

    But if your structs contain only "simple" data that can be contained directly in the structs (like ints or something, I don't know the details of C#), then you can avoid garbage collection on the bunch of structs.

    I'm sure this would be a useful optimization in some situations, but I don't think it will be all that common. The garbage collector is still going to bear the brunt most of the time. Fortunately, garbage collectors are more efficient these days than back when I was using Interlisp.
    --