I'm a coder and have experience with both native and managed code.
I started out with Pascal and C, then moved into C++ and eventually into C#.
Over the last year or so, I've been coding almost exclusively in C# and have lost a lot of what used to come naturally when I was a C++ coder.
A few weeks ago when I sat down to write some native C++ code, I found myself fumbling around as I slowly got re-acquainted with the complexities, quirks, and idiosyncrasies of it all. I'm almost embarrassed to say that I had completely forgotten that passing a dynamically allocated array to a function without also passing its size would mean that the receiving function would have no way of knowing how long the array is.
There are countless articles and documents which compare and contrast managed vs unmanaged code. We all know that native code, if well optimised, can run significantly faster and lighter than managed code. On the other hand, managed code has garbage collectors and run-time CPU-specific and OS-specific optimisation which can give native code a run for its money.
Purely from a technical perspective, there is no clear winner.
There is no doubt that managed code is orders of magnitude simpler to code and understand.
Just look at difference in the number of lines necessary to construct a simple GUI in Win32 C++ vs C#.
Back in my native-coding days, I mostly wrote mathematical simulations that ran on supercomputers. They had ugly CLIs and were mostly algorithm-focussed.
Nowadays I write in C# and produce beautiful GUI applications, but would be lost if I had to make something of a similar calibre on a native language. Even with a framework such as QT, it would still take twice as long to produce something in C++/QT than it would in C#.
Whenever I see someone who has written a large-scale, full-featured GUI application in C/C++, I can't help but feel a sense of awe and a hint of jealousy.
I'm curious how other experienced coders see managed and unmanaged languages.
Do you see managed code as amateur-ish? Do you see native coders as more hardcore?
Best Answer
My day job is currently in C++, but I've programmed in several languages long enough that I barely notice a difference anymore. Here are my observations:
delete
, but I'm still aware in my mind of the point at which the garbage collector considers it eligible for deletion. I had more difficult to solve low memory issues starting out in Java than I ever did in C++, probably because in C++ they are much harder to ignore for very long.With the combination of all those factors, my mental model stays fairly consistent between when I program in C++ and other languages, and the differences feel mostly merely syntactic. Granted, a lot of that is a result of training, habit, coding standards, and modern design patterns rather than features intrinsic to the C++ language itself, but the comparison still stands.
I guess what I'm trying to say is that in my experience the programmer's training makes a lot more difference than the language he is using.