August 19, 2005
If you were about to throw out your C++ compilers because of my post on the productivity benefits of managed code and scripting languages, hold your horses. Although managed code is pretty darn fast, sometimes performance still comes first. As Ole Eichorn points out in the comments:
[You said] "given the abandonment of C/C++ for mainstream programming".
Name any OS which isn't coded in C/C++. I mean, a real one.
Name any Office package which isn't coded in C/C++. I mean, one with measurable market share.
Name any database which isn't coded in C/C++.
Name any X which isn't coded in C/C++. Where X = webserver, application server, financial application, image analysis package, etc.
I think your definition of "mainstream" must be different from mine, because from my point of view EVERY mainstream program is written in C/C++, and nothing is even close.
What I actually said was mainstream programming, not mainstream programs. Consider the total volume of code written in a given year for the PC platform. What percentage of that code will end up in commercial, shipping applications-- much less an operating system? And in which of those applications will performance be the primary consideration? It's an incredibly tiny fraction!
But Ole's comment is still valid, insofar as it goes. I'm not proposing a world where all applications are written in managed code, or Python, or Ruby, or whatever the cool scripting language of the moment happens to be. It just doesn't make sense. To prove that point, here's an amazing quote from a first look at the ill-fated Corel Office for Java beta from way back in 1997:
The pre-beta version of WordPerfect on display is very basic, a few fonts, a few formatting commands -- not like the full-featured Word Processing apps we're used to. Still, it's enough to play around with.
As I mentioned before, it's very slow. All us fast typists will be frustrated, as there seems to be a two second delay between typing each letter and seeing it displayed.
Despite the incredible slowness and the sparseness of features, this is really, really cool and I hope Corel can pull this off quickly. If they can, it should open up the software market -- no longer would software companies be developing for platforms, they would be developing for one big market. Then it would be up to the Operating Systems themselves to attract users by their merits, not by what they can run.
So, er, good luck with that.
This is a stretch even on today's hardware, so I can't even begin to imagine what they were thinking back in 1997 when a 300 mhz CPU was top of the line. Where is Corel Office for Java now? Seriously, where is it? I can't find any mention of it.
And that's why C, C++, and even assembler are still part of a developer's toolkit. I argue that they are of increasingly diminished importance, but I would never propose that every application should be written in .NET.
At least not with a straight face.
Posted by Jeff Atwood
Apart from legacy code, unmanaged code is a thing of the past, and for good reason.
"EVERY mainstream program is written in C/C++"
Which missed the point. Exactly how many NEW OS/database/Office packages/whatever mainstream programs, HAVE been written in the last 10 or 5 years since the introduction of Java and .NET languages respectively?
If Microsoft had to start all over again and write a brand new OS completely from scratch (with no eye toward compatibility with previous OS's), how much of it would be written in C++? How much of it would be written in C#? And how much of it would be written in some sort of scripting language?
C++ = 25%
C# = 75%
Scripting language "X" = 0%
This of course proves nothing as the numbers would be completely different for some in-house line of business application.
Name any X which isn't coded in C/C++. Where
X = webserver, application server, financial
application, image analysis package, etc
I live in the New York area where there are many financial institutions and financial service providers. I've spoken with many people associated with those fields and can tell you that there currently exists several systems that were developed with managed code (java/C#), and that many new trading systems are being developed entirely in managed code.
Most of the applications listed are legacy applications written years ago, before Java even (the dark ages). The same arguments made against managed code today were made by the assembly programmers back when C++ came out. Heck, Excel is still a mish-mosh of C/C++/assembly because there are some parts they are either too scared to touch or they really need the performance. Is the web server embedded in VS2K5 written in C++ or is it just the C# demo web server?...gah, can't think of it's name...Canolli?
You could look at the WEBRick server, Tomcat has a web server embedded in it. I think JBoss and Gemstone do as well. for the Ruby on Rails applications as a "mainstream" application... if you squint real hard and spend a lot of time reading weblogs.
I *think* Corel Office for Java ended up as StarOffice, which is also Open Office, and NeoOffice J for Mac. I'm not entirely sure about it's lineage and I'm too lazy to Google. ;)
yeah, but StarOffice is straight C++, as far as I know. So I don't think it shares any code with the Office for Java project. Here's a review of the latest version (StarOffice 7) from pcmag:
From the review:
But StarOffice tends to be more intuitive than Microsoft Office
"yeah, but StarOffice is straight C++,"
duh, as are OpenOffice and NeoOffice/J. I don't know what I was thinking. The "/J" threw me off. hehehe
I'm really amazed at the statement:
"Apart from legacy code, unmanaged code is a thing of the past, and for good reason."
What do you think all the .NET managed code is written in? Native C/C++ duh! I suppose if you don't know how to write safe code then managed code would be a safe place to start. I've been coding for 25 years and have written in more languages than I care to count(C# included). C/C++ is hands down the best coding language out there. Using Managed Code is just unacceptable in my opinion. There is just way too much stuff going on in these managed extensions to justify their use. The performance and control just isn't their. Not to mention all of the deployment and maintenance problems of someone else changing the way your app behaves. To make matters worse, whenever there is a security hole in the managed code every hacker in the world hears about it and your app becomes a security risk whenever it's running! Yikes!
I agree with u.. When talking about performance, C++ wins C#,java or any programming language used these days.. so @Matt, I don't agree with ur theory cause simply if Microsoft will do its OS from Scratch these days, They will use C++ too :) (thinking about performance not easiness to its developers!!)
@Sam: whenever there is a security hole in the managed code every hacker in the world hears about it and your app becomes a security risk whenever it's running
That's also true for security holes in operating systems, servers, database engines, third-party libraries, and whatever else your application depends on to run.