Summary
Motley: Native C++ code development is obsolete. Everyone should be using a language like C# or Java.
Maven: Managed code is a great platform, but there are still reasons to use native C++, such as enhancing legacy code and developing an operating system (e.g. Windows Mobile). Understanding C++ makes you a better managed code developer.
______________________________
[Context: Maven and Motley are in the middle of discussing programming languages and, in particular, C#. Motley is pondering other languages and their usefulness]
Maven: I agree with you Mot - C# is a killer language. There are constant strides to move it forward and it is very intuitive for a new developer to learn.
Motley: I wouldn't want to develop in any other language, thank you very much. In fact, I am surprised other languages still exist. Well, Java has a place for the non-Windows developers, but other than that, why maintain them?
Maven: C# is great, but there are other languages out there that are still widely used. C++, for example, is still used in many different companies and serves a real need.
Motley: Hah! Name one. There are so many advantages to developing with managed code that you don't get in C++. C# is much more intuitive and easier to learn than C++. It is harder to make nasty mistakes considering you have garbage collection. Exception handling is a built-in construct. Your code is optimized by the Just-In-Time (JIT) compiler dynamically according to the platform you are executing on. I could go on and on.
Maven: Here's where you may want to have a chat with James. Before joining Cynthesis he worked for Microsoft in the Entertainment and Devices division group developing components for the Windows Mobile operating system that runs on tens of millions of so-called "smart phones". His work on that team was all native code.
Motley: Sucks to be him. I am willing to bet he is the victim of code complexity, a legacy code base, extremely long build times, nasty dangling pointer problems, and a host of other issues that are an order of magnitude more complicated than developing for .NET.
Maven: Yes, he told me that there were some nasty problems. But the point is that there are real reasons why the group chose to develop on a native C++ platform.
Motley: I'm waiting.
Maven: When you think about it, developing for mobile and embedded devices is almost like taking a step back in time a few years. Consider the type of hardware you are developing for:
When you consider all these constraints, you want to develop applications to be as lean and mean as possible. The Common Language Runtime (CLR) has significant overhead in the system and is a negative drain on efficiency.
Motley: Those concerns are less prominent in most other types of development, however.
Maven: You might think, but ignoring these constraints even on desktop workstations leads to much more bloated software and applications that do not play nice with one another. Although not necessarily high profile, the skills that a mobile developer possesses make her a better developer overall, regardless of application domain, platform or language. You started out on C++, didn't you?
Motley: Yeah, and I never want to go back. As far as I'm concerned, native C++ code development is obsolete.
Maven: C++ is far from obsolete. In fact, standardization of the new version of the language, C++ 0x, should be completed by end of 2009.
Motley: Great. I'll just take a job where developers use managed code and be happy.
Maven: That's fine, although there are many more reasons to join a team than just technology and programming language. We discussed that previously. Anyway, I would argue that you are a better developer now because you had a C++ background. You understand what a pointer is don't you?
Motley: Don't insult me.
Maven: Do you ignore the concept of a pointer in managed code?
Motley: Absolutely not. There are times to pass objects by reference. There are times when using COM Interop that I have to worry about AddRef and Release. There are times when I do server-side development that I have to explore heap fragmentation issues (and in rare circumstances heap corruptions). Understanding a pointer is a necessity.
Maven: I agree! In addition, and when writing an operating system like Windows Mobile, you may need finer control at many different levels of the architecture. You cannot take the hit in performance for garbage collection. You may need your own memory manager given hardware constraints. You need finer control over the creation and destruction of objects to ensure resources are freed as soon as possible.
Motley: Understood. It's just not for me. I did my time.
Maven: I prefer the .NET platform as well. James, however, just found such a fantastic team at Microsoft that he gave up his technology preference to build a cool application with super strong developers. Although COM and C++ have been around for years, they are here to stay for a while yet. There is lot of legacy code written in C++ that still must be maintained. Although we may wish that the entire development population wrote managed code, that day is still far off in the future.
Maven's Pointer: Is Maven's "pointer" a bit of a misnomer if we talk mostly about managed code? Well, yes and no, as Motley indicated. Taking some time to understand the underlying technology behind managed code will improve you as a developer. This may include starting at the level of C++ but also delving down into intermediate language (what C# compiles into) and assembly language. By the way, if you understand how a Reverse Polish Notation (RPN) calculator works and its stack-based number manipulation, you already understand much of what you need to grasp intermediate language (IL).
Maven's Double Pointer Indirection: Microsoft made a big bet on .NET with Windows Vista a few years ago exposing the majority of the APIs as managed code. The best didn't really pan out and contributed to forcing a development reset partway through the cycle. Managed code has a great future for many different types of applications, but for developing operating systems, more improvements are in order.
Maven's Triple Pointer Indirection: This is a bit of a controversial topic. I'd love to hear the opinions of others out there. How long will native languages like C++ be around?
Maven's Resources:
How much of the Longhorn reset was due to managed code? I was under the impression it was just a different team since the "real" Windows team was out fixing all their security holes. And a dose of mismanagement for good measure as well...?
It could be long discussion if we start talking about the Longhorn reset. Since I was not directly involved with Vista, I'll refrain from commenting further on it as you would be getting the information second hand. If someone directly involved wants to comment, well, have at it :-).
Yea, I wouldn't mind reading about it, just don't really want to open it up. My point was that there was probably more than "oh they used C#" to the reset. There are plenty of counterpoints: Lookout was written in C#, then sometime it got turned into C++ and now it's slow as heck :) (although, again, I doubt it was just the translation into C++ alone).
Oh, there were definitely other reasons than just the managed code bet that lead to the reset, but I don't feel I'm qualified to provide the details. Managed code was a contributing factor. I don't mean to imply it was the *only* factor.
Don't get me wrong - I am a HUGE advocate of managed code and my default platform of choice is .NET and I'll argue myself out of it only if necessary. There are even server applications at MS written in managed code, which may surprise some people.
Personally I prefer to use unmanaged code. Managed code has its place, but there is simplicity in sticking with unmanaged code. For example, I don't need to pull up MSDN or the Sun online documentation for J2EE every time I need to do something complex. I KNOW what is available because things are kept small. If I need to reinvent the wheel for a specific case to make things incredibly faster, I can do that. If I need to use inline assembly code, I can do that too. I don't like the overhead that comes with garbage collectors, though I admit that they're getting better.
In any case, I can't wait to see what comes of C++0x (C++09?). I am also anxious to see what becomes of C programming in the next decade. ^_^
If I use anything, I'll use Python. At least there I know that I can use something without worrying about syntax and such.
Thanks for the comment rpgfan3233. I have found throughout the past few years that managed code makes me much more efficient as a developer (I include Java in that). The programming model is much more intuitive and the reusable classes out there that help you do your job are phenomenal, not to mention a much better toolset. I can do most of my programming using Intellisense and often do not even need the docs.
Even with unmanaged native code, there can still be lots of complication. Have you used STL or ATL, for example? It's a tough learning curve.
Python is not something I have used. I'll check that out one day.
If your brain has already been damaged by repeated exposure to C++, then C# will seem a panacea. Both of them seem absolutely horrible to me. Give me Delphi or Python, or Java, or anything other than C++ or C#, and that monster called .NET.
Warren