Hey sjelkjd,
I think you make some valid points in defense of C#, and there are certainly some hideous things you can do in C++ (I know cause I've done some hideous things myself), but at the same time, there are some amazing things you can do in C++ that you simply can't do in C# (at least as of yet).
You mentioned the lack of an enforced type system. This generally applies only to the primitive types, and most C++ programmers use them simply as building tools for advanced types. This is certainly a disadvantage, but I don't think they cause many problems for experienced developers.
>> Lack of garbage collection which makes certain idioms problematic, and causes developers to have to waste time dealing with memory allocation and ownership issues, rather than focusing on the actual problem they are trying to solve.
This is true, but I would argue that C# can still require you to focus on a whole new set of issues as well, as davepermen pointed out. The inability to explicitly control the allocation and deallocation of an object requires you to track down every single reference if you want to avoid internal memory leaks, which I imagine can be quite challenging in a large scale system.
>> Note that this problem also creates unneeded confusion regarding pass-by-value and pass-by-reference, since now arguments will be passed by ref for performance reasons.
I don't think this creates any more confusion than in C#. The behavior is simply reversed. C#, by default, passes things by reference while C++ passes objects by value. A programmer should still think about whether he/she wishes to deep copy or shallow copy an object. In fact, if he/she doesn't know well enough to decide, I would think that it would be less confusing and potentially less problematic to pass and return copies around. It's worth mentioning that a problem with many C++ programs is that many programmers do a lot of unnecessary copying. However, I would still bet that many of them outperform similar C# programs. It's when a programmer shallow copies an object and hopes to be working with a copy when the bigger, more difficult problems arise.
Additionally, I think some of your points are really IDE-specific (though you're probably perfectly aware of it). While C++ IDEs at the present may have synchronization issues between headers and implementations (I avoid most fancy IDEs in C++ so I wouldn't know), that's still a feature of the IDEs and not C++. It doesn't mean it would be impossible for an IDE to be created that would keep the things in sync. The form designer is not part of the C# language. A person could just as well write a C# program in notepad and do all the code for the assemblies and the form-generating code themselves. Furthermore, I've discovered some synchronization issues myself while using the .NET form designer, such as events persisting even after I delete a control or form designer code persisting for events even after I delete the definitions of those events.
Also, you mentioned C++'s longer build times. This is certainly a disadvantage, but it's due to the fact that C++'s power comes mainly from its static, compile-time capabilities. This is why applications using templates as a means of generic design can greatly outperform C# applications which use object boxing. Templates slow down compile time but have no effect on the application's performance at runtime.
On a similar note, most of the commonly used C++ libraries are statically compiled and linked, including the STL (and for good reason). This contributes to a great portion of the build time. If you wanted, you could certainly take the functionality from these libraries and compile your own dynamic linked libraries and avoid the lengthy build times that way, as C# does. However, you would have to sacrifice the use of templates and use other techniques for generic programming which would inevitably lead to a reduction in efficiency. If C# had to statically compile and link the full .NET framework, the build times would be horrific and the executables would be huge.
From my standpoint, I can always make a C++ program compile faster at the cost of runtime performance or by writing a bunch of DLLs. There are also a lot of techniques such as pimpls to reduce compile-time dependencies. However, in C#, I have no choice but to do a lot of things dynamically which I could have done statically to get a more efficient program.
In terms of importance, however, I usually find that greater efficiency at runtime generally outweights the speed at which a program can be compiled and linked. A lot of people say that computers these days have so much memory and so much speed that programmers need not worry about such things, but there are still a number of applications where performance is crucial. Server-side applications, for instance, often need optimal performance to serve as many people as possible with a given set of hardware.
I think one of the greatest advantages of C#(aside from better type checking, ease of creating DLLs, etc.) that people haven't mentioned too much is in uniformity. The language restrictions can lead to a greater uniformity in design, which allows for programmers to work with other people's code more easily. Further, the fact that the whole .net framework library is designed by Microsoft provides a level of uniformity. You generally don't have to worry about standardization issues and compatibility problems when software is being developed completely by a single company. People who want to do threading, sockets, graphics, sound, etc. in a C++ application generally turn to an assortment of libraries which can vary greatly in their design and workflow.
However, just taking out features from a language because a lot of people misuse them is not always the best solution, in my opinion. This is the big problem I see in C# and Java's approach to 'better design'. It might make the general population design better, but it restricts the more advanced people from doing a lot of good stuff.
I was formerly a visual arts major, and I've seen a lot of artists have a hard time getting used to oil paints and watercolor. With oil paints they end up over-blending and getting muddy results. With watercolor they try to layer too much or use too much water and end up with muddy results that bleed all over the place. This doesn't mean that the ideal solution is to just take oil paints and watercolors away permanently and let all artists paint with gouache or digital paints instead. While a lot of beginning artists may do some really ugly stuff with those paints, there are some really gorgeous oil paintings and watercolors out there.
- David Ikeda
[edited by - nyugfu on February 19, 2004 1:45:34 AM]