January 12, 2007
MIT's Technology Review recently interviewed Bjarne Stroustrup in a two-part article (part one, part two). You may know Bjarne as the inventor of the C++ programming language. Indeed, he even maintains a comprehensive C++ FAQ that answers every imaginable C++ question.
Here are a few select quotes from the interview that I found notable:
C++ has indeed become too "expert friendly" at a time where the degree of effective formal education of the average software developer has declined. However, the solution is not to dumb down the programming languages but to use a variety of programming languages and educate more experts. There has to be languages for those experts to use-- and C++ is one of those languages.
What I did do was to design C++ as first of all a systems programming language: I wanted to be able to write device drivers, embedded systems, and other code that needed to use hardware directly. Next, I wanted C++ to be a good language for designing tools. That required flexibility and performance, but also the ability to express elegant interfaces. My view was that to do higher-level stuff, to build complete applications, you first needed to buy, build, or borrow libraries providing appropriate abstractions. Often, when people have trouble with C++, the real problem is that they don't have appropriate libraries--or that they can't find the libraries that are available.
Other languages have tried to more directly support high-level applications. That works, but often that support comes at the cost of specialization. Personally, I wouldn't design a tool that could do only what I wanted--I aim for generality.
I think [making computer languages easier for average people] would be misguided. The idea of programming as a semiskilled task, practiced by people with a few months' training, is dangerous. We wouldn't tolerate plumbers or accountants that poorly educated. We don't have as an aim that architecture (of buildings) and engineering (of bridges and trains) should become more accessible to people with progressively less training. Indeed, one serious problem is that currently, too many software developers are undereducated and undertrained.
In the FAQ and the interview, Bjarne comes off as a little defensive about C++ and its role in the history of computer languages. Maybe that's because the importance of C++ has diminished over time, principally for two reasons:
- C++ is fast but unforgiving. It was an appropriate solution for an era of limited computing resources. But we've long since left that behind; we live in an era of abundance. We have more computer power than we possibly know what to do with on the desktop. Even the naive solutions for most computing problems are "fast enough" these days. Computers get faster every day, but programmers' brains, sadly, do not. It'd be a waste not to trade some of that abundant raw power to make things easier on us. It's time to evolve up the one trillion dollar programming pyramid.
- C++ is designed for any possible programming task, from the lowest level to the highest. It makes sense to use C++ to write operating system kernels and device drivers. But when was the last time you used C++ to write a line of business app or website? C++ is perhaps the ultimate generalist language. Because it can do all these things, it's complicated and dangerous. Other languages don't try to span the entire range of low-level to high-level programming tasks; they simplify to attack a specific high-level problem domain.
C++ is a key historic milestone in the evolution of computer languages. There will always be a place in a programmer's toolbox for C++, but I'd argue that it's an increasingly a niche language for a very specific subset of programming tasks. The most important question to ask about any language these days isn't how fast it is, or how general it is, but how well does it protect you from yourself? Stroustrup has a great quote that says it all:
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.
Posted by Jeff Atwood
I would agree with Tragomaskalos, where "modern C++" doesn't have C arrays or fully-explicit memory management (it is still somewhat explicit, as you can discern between a single-owner or shared ownership strong reference, or a weak reference, for example). You don't go anywhere near a "delete" statement, and buffer overflows are a rare occurrence with vectors and such.
The much hated C++-style casts are at least greppable (and I find their ugliness to be a *feature*, you know something's awful when you see one!) as well as more accurate (static_cast does notmagically and silently turning into a reinterpret_cast, which would most likely introduce a bug, for example).
You still have the lower-level C-style constructs available, for those times you really need them (which is just about never, if you're not doing system programming). One could say that not having them at all is probably best, but I find idiots somehow manage to write crap code no matter what language you give them, so it might as well be a more capable language.
This way, you can also notice the people with blown off legs and fire them. ;-)
C++ is just C with object structures, I'm guessing all C++ compilers actually still at some point output C code.
Personally I love C and C++. Yes its complex, probably more complex than is really good.
Also pretty much no one uses it, but its not really the languages fault. Blame it on Microsoft, no one wanted to write MFC applications, and Microsoft openly ignored the standard, and implemented a lot of crap that people didnt/couldnt/wouldnt/shouldnt use.
Who's got time to figure out how to write code in a language that doesnt have a standard implementation that can be used to build real applications. MFC was just too hard, weird, too Microsoft -- it killed the language.
C# is just Java with the names changed to protect the lawyers, I dont consider it a derivative. But I like it, even though I dont use it.
Mostly, I find PERL, AWK, Python, and other scripting languages get it done for me these days. Its just easier, and most stuff i want to do I want to automate and a GUI is in the way.
I still love you C++, but your time has passed.
"But when was the last time you used C++ to write a [...] website?"
I've written several websites using C++. For example an SMB search engine. It is very good at integrating things - an HTML template library, SQL library, CGI library.
"Because it can do all these things, it's complicated and dangerous."
Dangerous links to buffer_overflow. That's really only a valid criticism for C and for stupid programmers. C++ has std::string and std::vector.
I guess another way to look at things these days is that with so many RAD desktop/web software being developed, a modern language targeted for that end point is needed.
Low level work requires C/C++, but these days more work is done at a high level (i.e. Writing an AJAX web application, rather than writing a web browser in C++)
Really this topic shows more about human psychology!
* Defending their choice of language
* Taking digs at other language
* Attacking each other
When deep down we all know the basic truth, with is:
* There are different programming languages
* There are different types of software to be written with those languages
There is no right or wrong, only different choices with different outcomes.
You are a fucking idiot, c++ is supposed to be for expert programmers only because noobs like you dont need to use it. Youre the stupidest person i've ever seen, or read.
There sure is a lot of defensiveness around C++, but that's already been pointed out.
I agree that C++ has very few uses nowadays where C# (or another common language) would be a better choice. But Stroustrup's point about uneducated programmers is valid. As far as I'm concerned, language is irrelevant compared to skill with programming, and we have too little skill going into increasingly complex problems.
This whole topic is laughable. About every month or so the VB and Java camp spit out propaganda against C/C++. This time because Ruby has Java on the run.
Let's take this article's argument even further. Why use Java? It's harder than some other languages. The simple fact, which Stroustrup made clear, is it encourages specialization.
Look at Java, for example. As long as a Java application is idle 99% of the time it's ok to use Java. Otherwise use C/C++. That's the reputation that specialization awards.
Stroustrup is clearly frustrated with the state of Computer Science in academia. Most universities switched to Java in the classroom about 7 to 8 years ago. Not because Java is a better language but because the professors got lazy and didn't want to spend anytime teaching the C++ language. This narrow minded philosophy has lead us straight to where we are now. A small army of Java disciples suffering from something akin to C++ envy. Now we have to suffer with things like slow phone systems 'proudly' written in Java.
Give me a language that is better for real time 3d graphics programming, and I will gladly use it. Not everyone has moved on to the web.
A number of people seem to be saying the same thing and that is, C++ isn't the problem, the programmer is the problem. The argument seems to be if you can't solve your problem in C++ then you aren't good enough to use it.
I think this line of thinking is generally one that stunts progression. The problems we are trying to solve today are, arguably, many orders of magnitude more difficult than those we were solving 10 or 20 years ago. When C++ was created did anyone think of desktops with multiple cores? Probably not. Given this increased complexity, perhaps C++'s expressiveness is not enough anymore. C++ is not going anywhere due to legacy code, however when making a new project one should think hard and long about what benefits the various languages will give them. To put it in an analogy, construction has come a long way from slave labor, now we have giant machines to do our work. They can move in a single shovelful as much as a hundred men can. They move a bulk and of the problem and then we use smaller and more refined tools for the other parts.
I don't think making languages 'easier' is meant to make less skilled people able to program, no, I think it is meant to let experts solve more complex and interesting problems. Writing an IRC client in C++ is one thing, however building a large, fault tolerant application that needs to have defined state throughout its lifetime is different, and I would not like to do that in C++.
One thing to also remember with all of these languages, is marketing.
When .NET, which I am using to encompass C#, et.al., has Microsoft's marketing team behind it, how many "new" programmers are going to head to SmallTalk or Java? At lot less.
When Java has Sun behind it, plus their other Sun Studio product which includes C/C++ for free, how many of the left over "new" programmers are going to head there? Not quite as many.
When a business needs to have an B2B web service and web protal created in 2 months, who are they going to want to work with AND add supportability for any other programmer to step in at anytime? A C# ASP.NET programmer who can turn out that app in possibly 1/2 the time or a C or C++ programmer who can maybe get it out on time?
What if a cell phone manufacturer needed a new GreenNose driver that is going to blow away the competition and make it to market before their biggest competitor? The C# programmer who might be able to fit the app on the cell phone's limited storage space or the C programmer who can make it fit and leave room for that spreadsheet app the other department is working on PLUS crank it out in half the time?
I've said it before, yes the tool may do the job, but is it the right tool for the job?
I totally agree that knowledge of other languages is important, but I also agree that it isn't necessary. I can read C, C++, Java, or any number of other languages, and with time, could even code in them. Anything can happen with practice AND documentation.
One of the other things that makes MS technologies "better" is the fact of support. They have excellent documentation, support forums, training, and a user base that rivals any other language produced by another company or by the open source world. This a cannot be denied.
It seems to me, there are two types of "languages": a) of the Turing camp (the FULLY ORACLE-SQL-Persisted-SWI-Prolog and ASSEMBLERs), and b) the fast, straight, bladed procedural (compiled) languages ala C/C++/Haskell/Ruby/Most_LISPs/Mercury..u name it. The basic end-to-end-runtime system, buddy, that's the very idea behind every language philosophy. And C++? Well.. SEX. Yeah, sex, sex, sex, sex, sex. The easiest way to overcome a problem is to make it a bit more.. bisexual. Add libraries. Mix it, blend it with stuff like LLVM, rt_ctiny()...even Factor..
No, bytecode seems to be so...i dont know...rude. I mean, something like a C# parser, or a Java one or VB over a bytesomething....yeah whatever
i gotta go, oh happy new year ! :-)
For modelling and simulation, if you have something processor heavy it's likely to be mathematical. A good programmer can write Fortran in any language - well thought out algorithms operating mostly on primitive arrays. For that kind of code, with Java 1.4 you got better performance than MSVC++6 C; now VS2005 C is better than 1.6. C++ using stl fares worse than Java for tests such as SciMark. This is for modelling, not real-time simulation.
One of the modelling systems I've been called to work on cost 500,000 UKP per year in processor hours (the company was renting a legacy mainframe), so unless you're a multi-millionaire we're not in an era of abundance. On the other extreme, OLPC is a 100 dollar platform so again requires tight code.
Once you stop writing Fortran (and most sane people want to), the performance hits you get with Java or C++ seem to come from exploiting OO's information hiding, so the compiler is not able to optimise across objects. Sometimes trading hot-spot optimisation for whole program optimisation pays, sometimes it doesn't - for example inlining the most common case at runtime. The Fortress language, which runs on the JVM and is targetted at MS, is addressing this by flattening the program; I've also had success using model-driven development pipelines for generating flat code from high level maths models.
One weakness in C++ is that its templating system is not a very good model for meta-programming; Java and C# don't even try, so there's more external code generation options. Object oriented languages also have introspection and reflection, which C++ lacks, so I've ended up having to add them to every large C++ system I've worked on.
WRT RAII and garbage collector scheduling destruction, C# provides the 'using' statement that gives similar scope-delimited resource life-cycle semantics. It's not a hard problem.
I don't see C++ moving from realtime simulation yet (and that includes many video games, though there is use of scripting languages for AI and overall gameplay etc.) - it does most of what you want well enough, and lets you optimise for a traditional machine - until it's pushed off by a language that can handle multi-core processors better.
Sorry Jeff; While I usually agree with everything you say, you've totally missed the boat here.
I like C# a lot too, but it by no means replaces C++. There are a number of things that you can't do in C# that requires you to do a p/invoke to C++ code. This is especially true when programming for when programming in C# using the .NET Compact Framework on a Windows CE device.
Jeff, are you just writing these pieces just to sit back and laugh at so many whacked-out responses and get your page rankings up?
You are incorrect. That is not garbage collection but a simple parent-child relationship in the Delphi VCL. It is present in nearly every GUI library I have used, including Motif (C), VCL (Delphi)and Qt (C++).
The parent-child pattern is a paradigm common in many GUI toolkits and has nothing to do with garbage collection.
The largest problem with C++ is that it is too easy to make mistakes. People say "You must be a competent programmer, then that won't happen", suggesting that they are such a competent programmer. NO ONE can just write bug free code, particularly in C/C++. The OOP system gives a facade of high levelness (leading to misconceptions such as a GC and safety), but really its just a macro system. The odd bit about this macro system is that it didn't really do stuff that had been repetitious in C code before.
The other problem with it is that the 'proper' expression of solutions tend to be much longer than the dumb ones, and tend to have bad interfaces to boot. Worse yet is the tendancy towards preoptimization - because you can, you do. In the end you get longwinded, improper, preoptimized code.
Except for the preoptimization point, the previous paragraph may also be applied to such languages as C# and Java, which force upon you the OOP model as well as longwinded expression of simple concepts.
PS - that thing on fortress above, It does look like a very interesting language, but it doesn't necessarily target just JVM. That's just the initial impl. They are going to target machine code, and ramp up performance.
How can I resist adding my own comment to this burgeoning list when everybody else and their mother has already chipped in with their two cents? I have been writing embedded code for years. I do as much as I can in C, occasionally I have to deal with assembly language. C++ never appealed to me, I never found any advantage. Of course, most of the stuff I write is pretty simple minded.
The C++ programmer comments are quite interesting. None seem to remember why programming languages exist.
They exist to do useful things for PEOPLE.
PEOPLE. Remember those things?
Sometimes I need a power screwdriver with 12 specialty tips plus a dremel tool with a set of plans to do a job. Other times, a hammer and some intuition will do. You could put the dremel, drill and plan holder and pencil holder into one tool much like C++ tries to put everything into one tool. Anyone out there own anything like that?
As for complexity, they discuss it like it's a *good* thing, rather than simply an occasionally unavoidable thing. I chalk this up to machismo rather than intelligence. In humans, intelligence expresses itself as using the easiest, most appropriate tool for the job.
So I'll stick with generic freely downloadable C# or VB (which at this point are more or less the same) which run on that much hated, and ubiquitous Windows OS for most work and save c++ for those ever fewer occasions when it provides cost-effective utility.
Klingon programmers incoming!
"C++ is difficult and for experienced programmers, experience at least with C. You can do whatever you want fast. But it is not for everyone."
"a programming language isn't dangerous. an uneducated programmer is dangerous. if you can't program well in something, either better your skills or stick to something you know."
"If you can't handle the power, just steer away from it. Don't badmouth C++ because of your inability to use it correctly."
All programmers make mistakes, Klingon programmers just don't admit it. If you use a great language, you'll make fewer mistakes whether you are a great programmer or not. Proper type safety (no memory corruption or segfaults) is something we want for 99.9% of everything - and for the rest you want assembly! We don't even have to sacrifice very much efficiency, for instance Eiffel and Ada can be written to be as fast as C if it's really that important.
It's all about Ye Olde Fortran.
Well, with 110+ comments, this will likely be lost in the haystack, but here goes...
What a bunch of arrogant, puffed up assholes most of you are. Nothing like stroking the old ego, huh? Or the classic, "In my day, we had to...". All the talk about being threatened by C++, and yet, the mighty are freaking out that C++ is not the be all, end all. Give me a break.
Now, of course rigor and hard science disciplines should also exist. And they should set a very high bar. As stated before, Doctors, Engineers, and Scientists should not be rolling out of weekend course. I don't think this was being proposed by the original post.
But, I would put forth the example of the Web. Here, through HTML and other easy means, a wealth of wonders has been drawn out from the average person because the technology that was for so long only available in the hallowed halls of academia became liberated. In case you couldn't see it from your Ivory Towers, this is a good thing!
Imagine, a bunch of pompous cocks bitching about Gutenburg's press. "Oh, look! Now every half-wit with an opinion will be publishing books! It's outrageous! You should have to spend years and years in a monastery, learning to painstakingly illuminate by hand!".
Here's some advice: Step away from the keyboard and go do something you've never done before, and enjoy the wonder of being a novice, discovering new and interesting things. It'll do you some good.
I'm surprised that no one has brought up the side by side comparison done with Raymond Chen's Chinese/English dictionary reader. Jeff even blogged about it:
Yeah, C++ will perform better than C#, but productivity-wise, it sucks. When performance is a primary concern and you've got some intensive tasks that the application will be doing(games, drafting software, etc), then of course C++ will be the way to go. However, that enterprise web application will be better off written in C# due to the huge boost in productivity and negligible performance penalty.
Daniel: You can code cross platform with C#, Mono has come on leaps and bounds. You do have to put the extra effort of making sure your code is fully compatible with Mono and that you don’t use anything windows specific. You don't get anything for free ;)
I know I know...I just doubt it works properly as C# / .Net have been designed for Windows (and possible Windows Mobile). Java has strong support for Linux with Free Application Servers, Web Servers, Database Backends etc...is C# / Mono really on par with that??
Nice post and few daring conclusions :). I agree with some observations but not all, few points which I totally disagree..
First commenting about website development using C++ is inappropriate as there are alternate language for it. C++ is a computer programming language and has nothing to do with how to render an webpage. Although backend HTML render engine in most probability is C++.
Secondly, C++ is not dead. Most of the gaming engine, computational apps, libraries or simulation code is in C++ (most of it).
Thirdly, I am not sure we are in the era of abundance, philosophy that you have presented - being in era of abundance allows us to design lazily is not an appropriate argument. Why don't I see my machine being booted under 5 sec and OS running blazingly fast?? Our task are still the same - documenting, emailing, browsing and some business app. Still we are slowing down everyday.
I don't deny the need for C# or similar language but whenever you have to build any business app - most of the time is C++/C, just to ensure you can do what you want but not limited by some other constrains :)
" "But when was the last time you used C++ to write a line of business app or website?"
Hmmm. I guess that would have been last Friday, January 12 2007, when I was writing code for flight software application at a major aerospace corporation."
Not sure what the definition of "line of business" is, but I don't think flight software qualifies. You're doing the exact kind of program most posters recommend for C++. It ain't like no web site.
There is nothing like C++ to start a flame war.
Why does everyone forget about people who write programs that make heavy use of numeric computation? Many of these people are still writing in Fortran. Though, C++ is great for this too.
Good static analysis can really help C++. Every criticism of C++ is true and almost all of the time that's how it was designed. It's kind of like calling a dog a dog... You should already know what it is.
The optional garbage collection in C++09 looks interesting.
Imho, it is usually poor design and coding practice that leads to unnecessary complexity, not a programming language. You can make a mess in Java just as quick as you can in C++.
Using more than one language in a project is good [tm].
I have 7 .NET applications idling, including Sharpreader (ugh) and a couple of instances of Paint.NET. No percievable slowdown in any of my applications, .NET or otherwise. Even when I start loading files (with Paint.NET does the fastest I've seen btw) or doing process intensive task there is no slowdown relative to a native application.
My conclusion? I would have no problem running managed applications if people wrote more that I wanted.
Games will remain in the domain of C++ for a long time. Microsoft may have it's agenda trying to push C#, but there's still Sony and Nintendo out there. The one common denomator is C++. Game companies want to be able to get their game on as many consoles as possible, which means portability. If a game developer was geared towards C#, then they'd cut themselves off from the Sony and Nintendo markets.
However, scripting using Java/Python/Lua will become more and more important. They won't replace the C++ code, but will augment it. And there's some techniques you can adopt to reduce the garbage collection boogeyman when the language is used for this specific purpose.
I've worked with C#, Java, Python, Lua, Visual Basic, etc. At the end of the day, I come home to C++ because it does what I want and need it to, without sacrificing performance or any overhead to garbage collection. Even if that means taking a bit more time, it will get me to the goal.
And, well i really like the whole Plan9/Alef thing. It's open, small, you can understand it and you can modify it at any given time. Very, very easy to use...That's the real power of C and C++. The environment.. . And the possibility to make that conversation between you, the compiler... and the OS. I mean it’s so transparent ... C/C++ is not a bad thing but you need the right environment, the compiler and the OS must be 1 really. That’s the “problem” with commercial systems like Windows... They're interfaces, politics, philosophies and a million other things.....but they can't really make the subjective connection between the programmer, the language, and the OS. I don't know, maybe the first step should be to make the end users - programmers...
Cement? Why use cement? I find that chewed gum and masking tape take care of most problems just long enough for it to become someone else's problem.
Confucious say: If it's not my problem it doesn't exist.
And remember - Ideas are dangerous. The more usefule the idea, the more dangerous. Especially in the incompetent hands, you twiddle-fingers.
Maybe the first step should be to show programmers how to post responses only once.
If you code like you post, we're all in trouble.
Thanks ^2 Patrick, you code-mumbler.
Actually, Plan 9 from Outer Space is my FAV! And if it wasn't for my dashing digits you wouldn't have software gems like MS BOB. MS BOB rocks the muthafu@#ing house, y'all! Yeah!
Oh, my party bong is empty, be back in a flash.
Hey, I just realized that I can stop writing, and go about my business and you'd never know! Wow, this is pretty neat! Nothing like that IM crud. It's like so needy! Always ringing when people write stuff, it's like so instant, you know? maybe the first step should be to make those people that write the IM apps - programmers...
The problem isn't that C++ is difficult, because I've started programming in Pascal, then C/C++, then Visual Basic, then Java, and now I'm loving C#.
The actual problem is educating developers. Everybody is taught the same basic things at college when it comes to programming. We need to refine programming degrees, and take the novice developer further than the text book.
I think Java has the right idea when it comes to education -- look at the Java tutorial on the Sun Microsystems website. We need a C++ encyclopedia.
I see a lot of comments of the form "C++ can't do this as well as language X". C++ is available for all platforms. That throws out anything from Microsoft. C++ is a fast compiled language. That throws out all scripting languages. C++ can do basically everything you want, including numerical computing and writing operating systems. That throws out Java. C++ does everything, and does it fast. Does that matter in *all* cases? Obviously not. But we'd be hurting if we didn't have C++.
I can still remember programming the 65802 chipset in assembly language in the early 1990's and thinking "hmmm... that C++ looks a bit too much of a high level language for me."
Since then I have been dumbed down so much, that .net's intelli-type programming rubbish, where in a lobotomised state the GUI autofills my thought process for me. "Imports Microsoft.Thoughtprocess.Global.Domination" doesn't even register on the "is that the best way to do this?" anymore.
After 25 years and seen a lot of different stuff and people, and the only thing I don't like is language snobbery. The one thing I've learnt is that it's the right tool for the job.
Long live C++ (for device drivers..)
p.s. Some dude wrote that C# would blow your whole body away if you got it wrong... I have two words to say to about that :managed code
IMHO, For a very low level, c and c++ (not including OOP) is efficient, examples, controls of some hardware signals, communication devices etc.
Logical application, c++(OOP) is the best approach such as middle wares programs.
For Front-end GUI, I think most of the people uses windows platform,which what i think that C# comes in. From c#, as long as you can communicate with those middle ware system and have a good GUI, you are done.
RE the argument that systems are super fast and ultra powerful, so we can compromise speed for flexibility.
Sure, that works in some very limited cases (basically the web). But if you seriously think that your computer is fast enough, and you're ok with slower apps, then you're showing your age. My system is brand new, with high end components overclocked to the maximum. This system is WAY too slow. A little piece of me dies inside every time java starts loading...(pet peeve, sorry)
As I said, there's a time and place for C#/Java/VB/etc. When you need a quick app, those can't be beaten. But for any serious coding, performance is as important as development difficulty. After all, you write a program once, you execute it many times.
Bjarne Stroustrup is generous to defend C++. I don't know what's supposed to be wrong with rationally defending your own creation when it is being attacked. We only use "being defensive" with criticism when there is nothing to defended against.
I recommend that everyone visit his personal website and read his publications. Everything in C++ is rigorously and logically justified. The few problems that persist are openly admitted and will be fixed in C++ 09. C++ will be the norm for a very long time because there will always be good programmers to defend it.
"Programming languages should protect you from yourself."
What are you talking about?
Programming languages are tools to force a brain-dead machine (i.e. computer) to do repetitive tasks over and over again. Dude, you READ "Code Complete".
All you are asking is for some feature made by some really bright programmer (probably in a low-level language such as C++), for instance -- your wish for "case-insensitivity", to teach the computer catch your errors by assuming it knows what you REALLY mean.
Look, the computer will NEVER replace smart people - EVER! (If it does, people are in a world of hurt.) You have to be smarter than the thing you are working with. It is not any programming languages fault for "sloppy thinking" or "programming errors" IT WILL ALWAYS BE THE PROGRAMMER'S FAULT.
"Programming languages should protect you from yourself."
All that is will be the smart programmer carrying the load for the average programmer (i.e. dumbing down the job). This will create a hierarchy of the real smart guys (who WILL be paid the big bucks) so the not-so-smart ones can do relatively simple tasks (and not get paid the big bucks)
Don't believe me -- I have one word: LabVIEW.
This graphical language was supposed to take over the world -- because it made "everything SO much easier" than those "complicated text-based languages"
"The idea of programming as a semiskilled task, practiced by people with a few months' training, is dangerous."- Bjarne Stroustrup
I agree 100% with that statement. I see a lot of guys hurrying to develop applications without actually having obtained any good programming skills, and they come up with some really crappy and non-portable codes (especially in the geographic location where I live in). Here is an FAQ of C++ Programming forum that I maintain:
Just quit you whining an use Ada.
It will protect you from YOU.
I read an article titled "Problem with C++" by Jeff Atwood here: http://www.codinghorror.com/blog/archives/000768.html
I agree with some of his ideas and not with some of others. The point is I agree that C++ is complex and too cumbersome but i say that from a totally different point of view. This is what I have commented on his article:
==== Indeed, one serious problem is that currently, too many software
==== developers are undereducated and undertrained.
Well, Bjarne is 100% right about it. I am simple Science Graduate and when I meet programmers
carrying degrees like Master's of Computer Applications, they still don't know about the difference between a Pointer and a Reference in C++, they just don't have much understanding on Pointers and Arrays. They just create some softwares in VB and .NET and they call themselves Sr. Software Developers. some of them say VC++ is a better language than C++ and in their C programs, most of them use #include conio.h and they say it is from ANSI C Standard Library :-\ WTF ... they just move buttons here and there in VB and call themselves programmers... All of them say Hackers means Criminals, utter nonsense and nearly all of them use Windows. see the connection ?
Not only Bjarne, even Joel Spolskey is serious about the under-trained programmers: http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html
and even I think he is right. This is simple, plain common-sense that a person who never ever understood C or C++, is simply not a programmer, He can never be. C is hard, C++ is harder and complex. Dumbing down the education is just stupidity and that shows Government has not employed talented people to revise the education system of your country. Remember the "Segmentation Fault" that does not even tell you where the error is ? and then you set aside the program and keep on thinking where the error could be and at the same time you also think about the way you wrote the program .. thinking at 2 different levels, making work harder and most Post Graduate kiddies break under such circumstances, they run and cry and say C and C++ are bad. Understanding C or C++ is definitely going to make you the real programmer, I am into this field from last 2 years and I never met anyone, in person, who can call himself a programmer (because nobody of them knows the C or C++ well). You can keep on wandering into Java, .NET , Ruby or all the easy fun things and keep on believing that "I am into Applications Programming, Managing Memory is a poor idea, Processors are fast RAM is cheap" and miss on all the knowledge we call "Programming" or "Computer Science". There is even a connection between all these high-level programmers and poor algorithmic knowledge, they just don't possess enough idea about algorithms, the key concept in programming and as Niklaus Wirth said:
Algorithms + Data-Structures = Programs
and he is right. you the high-level programmer is just a kid, you are wrong, If you can not do C or C++, do not enter into Software Development. It will never be enjoyable to you and even after 10 years into it, you will still be a kid because you will never try to understand the essence of programming. You are poor programmer then and you know about that every single moment you think but you hide behind the self-made lies and cry over C and C++. Bjarne calls you an undereducated and under-trained programmer but I call you an under-minded programmer, the programmer who intentionally does not want to learn, who intentionally stays away from pain and hardness, who fears and then cries over for nothing .... you are damn stupid waste on human-life and on Nature. You better go and do something other than programming. Programming is about diversity, about hardness and playfulness and it has to do with the ability to solve problems and you under-minded are not the ones who can cal themselves programmers. shame on you...
(NOTE: I am not saying C++ is not complex, it is complex and monstrous and saying C++ is plain bad and Ruby/Java are good is a complete non-sense. The Programmer who agrees with this idea just don't have clue on what Programming is all about. It also means, he needs to learn more , He needs to put more time into Programming and he also needs UNIX way, IMVHO)
Common C++ still has tremendous server side applications, imagine a firm processing a millions of trades a day?? u can't expect a bloody garbage collector to kick in..
I really try to learn and use Ada time to time, but my head aches from reading Ada code, so I stick with C++.
C++ is incredibly unproductive. It's crushing stones. With copper hammers.
I'm doing it for a living, 8 hours a day. It never ceases to amaze me that some more complex algorithm that takes perhaps an hour in a highly expressive language like Lisp takes 3 f*cking weeks(!) in C++. Stroustrup talks about efficiency in every second sentence of his horrible book but completely fails to understand that the first way to make (large) programs faster is to give the programmer more expressive tools. Micro-optimize my arse. All large C++ programs I've seen have performance problems, which stem from the fact that large C++ programs become much larger (in LOC) than necessary, terribly convoluted, bureaucratic and hard to refactor. No thanks.
"it's dangerous"? a programming language isn't dangerous. An uneducated programmer is dangerous. If you can't program well in something, either better your skills or stick to something you know.
Maybe it's because I've just been reading Don Norman, but this screams "It's not the designer's job to make the right thing easy and the wrong thing hard."
In a sense he's right, of course. Programming languages don't melt servers, programmers melt servers.
But if there's no reason to use a server melting language, using it because it's the "language of choice" is like using a battleaxe to cut through a plank; impressive, and normally memorable, but there was probably an easier way to do it better.
Oh, and I'm not word perfect with C++. According to arnuld, I should therefore quit my job and become a taxi-cab driver. At 23, this seems like a drastic step.
Of course, as I've just noticed arnuld appeared to use IMVHO without humour, so he can be safely ignored.
fiblist = 0 : 1 : (zipWith (+) fiblist (tail fiblist))
Heh. Try that with your objects and callstacks and manual memory handling.
anyone gets the english to C++ translation?
If not, I can teach them what it really means since they're too dumb to understand that c++ is a language just like English.
How could they miss that? We are talking about computer LANGUAGE. Do you understand the meaning behind that word? To communicate with. Like how we code to the computer and it reacts to our code. Code = our aid in language translation to computer language. Machine language = all binary data the computer naturally reads and understands. Without researching this, I would geuss that machine language is telling the system to give power to certian area based on 1 being on 0 being off
as far as i can tell the times of java being 20 times slower than c++ are gone. 8 years ago when java 1.1 was around and interpreters weren't coded so well that was true. nowadays java is really fast. also numbercrunching apps were really fast in java. the problem of those benchmarks are, as i have seen a lot when at university is that a java program outperforms a c++ program when the coder is very skilled in java but only has some c++ knowledge. you can make far less mistakes coding java and you really don't have to worry if someone overloaded your operator, multiple inheritance or other messy stuff in c++.
still c and c++ are very powerful languages but in the time i code applications using c++ i nearly have coded the same application twice in java. it's a valid point if you argue with companies because manpower is very expensive in smaller and medium sized companies. imagine you have to tell your business partner "well you can have it in c++ and it't cost 30k developing costs +5k server hardware" or "15k developing costs in java +7k server hardware".
well, just my 1.2 eurocents (2 us cents)
many of you i think have that Joel Spolsky mentality that there is nothing but web applications out there when in fact there is the same if not more desktop applications being either written or maintained.
what about medical imaging software thats just starting to take off? what about 3-D graphics programming and virtual reality? if you can think of anything that does any number crunching whatsoever C++ is your best choice.
currently things written in C++ includes but is not limited to the following:(and this is just things that i have gotten off the web)
* Acronis TrueImage
* Age of Empires
* C# Bytecode Compiler
* Final Fantasy
* Flash Player
* Gnome Desktop
* Google Search Engine
* Internet Explorer
* Java Compiler
* Java Virtual Machine
* KDE Desktop
* Mac OS X
* McAfee AV
* Partition Magic
* Perl Interpreter (original)
* PHP Interpreter
* Python Interpreter (original)
* Ruby Interpreter (original)
* SQL Server
* Symbian OS
* Visual Studio
* Windows Media Player
emst.cpp:141: error: no matching function for call to ‘boost::filtered_graphCGAL::Delaunay_triangulation_2CGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tds2CGAL::TvbCGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tdsvbvoid , CGAL::Tdsfbvoid , Is_finite_and_mstCGAL::Delaunay_triangulation_2CGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tds2CGAL::TvbCGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tdsvbvoid , CGAL::Tdsfbvoid , std::setCGAL::detail::EdgeCGAL::Delaunay_triangulation_2CGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tds2CGAL::TvbCGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tdsvbvoid , CGAL::Tdsfbvoid , std::pairCGAL::CGALi::CC_iteratorCGAL::Compact_containerCGAL::TdsfbCGAL::Tds2CGAL::TvbCGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tdsvbvoid , CGAL::Tdsfbvoid , CGAL::Default_allocator, false, int , std::lessCGAL::detail::EdgeCGAL::Delaunay_triangulation_2CGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tds2CGAL::TvbCGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tdsvbvoid , CGAL::Tdsfbvoid , std::pairCGAL::CGALi::CC_iteratorCGAL::Compact_containerCGAL::TdsfbCGAL::Tds2CGAL::TvbCGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tdsvbvoid , CGAL::Tdsfbvoid , CGAL::Default_allocator, false, int , std::allocatorCGAL::detail::EdgeCGAL::Delaunay_triangulation_2CGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tds2CGAL::TvbCGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tdsvbvoid , CGAL::Tdsfbvoid , std::pairCGAL::CGALi::CC_iteratorCGAL::Compact_containerCGAL::TdsfbCGAL::Tds2CGAL::TvbCGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tdsvbvoid , CGAL::Tdsfbvoid , CGAL::Default_allocator, false, int , Is_finiteCGAL::Delaunay_triangulation_2CGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tds2CGAL::TvbCGAL::Filtered_kernelCGAL::Simple_cartesiandouble , CGAL::Tdsvbvoid , CGAL::Tdsfbvoid ::filtered_graph(Triangulation, IsFiniteFilter, MSTFilter)’
It is clear what he is saying; business managers need to give C++ programmers more time to fiddle around with code without producing results.
Flon's Dictum: There is not now, nor will there ever be, a language in which it is the least bit difficult to write bad code.
i have an problem in programming(C++).
i think u can solve it. i want to print a file whose name is aa.prn with the help of programming .
(by using laser printer).It means that sir if run the program then automatic output is printed using laser printer
i think u can under stand above.
OMG - Jeff wrote about C++ - but I thought he admitted he doesn't know C or C++. how the hell do you write a blog entry about something you have never used? This is just amazing.
Go, Jeff, go.
c++ is so hard to understand>>>>>
I think some people still use C++ for commercial development as its harder to reverse engineer than the newer languages (Java, C#, Python) which really matters to some people.
I recently benchmarked some protocol decoding (proprietary protocol) in Python, Java and C++. C++ was 13x faster than Java (based on the implementation, C would be similar). And C++ was 150x faster than Pure python. Considering how much time my server applications spends decoding 'messages', these performance numbers cannot be ignore.
Note: I'm not an expert Java developer, I had experts tune the Java test case.
When a programming language don't help you to solve a problem, then it isn't appropiate to solve it.
When a programming language confuses you in solving a problem, then it is not the best choice.
Now, when the programming language is just a tool, and you don't need to worry about the language itself, and only with the problem that you are trying to solve, then this programming language is the best choice that you can do.
For example, in high level applications, how many times I forgot to put an "" in ATL WIN32 API variables, and it give me a lot of problems that made me wast a lot of time and money. Now, it's normal to forgot this, we are humans, and humans forget things. Then, C++ doesn't help me with any warnings (W4) or anything to solve this problem.
C++, in my opnion, isn't the best human friendly language to solve high level problems. There is languages that do this in a better way.
I have found very little need for C++, however, I have found the need for low level languages like C or assembler from time to time as well as higher level languages like Ruby or Java. C++ just seems to fall in the middle when I personally have not needed to develop anything. Perhaps we need to look at this a little differently:
1) There will be programmers who need to know the inner workings of the machine and be proficient with bit-twiddling. These programmers will write the core of the OS, applications, and back end processing and data storage as well as complex, speed optimized routines.
2) There will be programmers who need to understand more of the business and functional processes then express these as code to implement them.
Very rarely will these two cross. Who would want them to? Do you really think that the programmers designing the internal workings of an RDBMS would really do well talking to the accountants about the char of accounts? Would you really expect someone with 90% of the knowledge of an accountant to be able to use binary math or read hex?
Perhaps the message here is to use the right tool for the job, not only the right language, but also the right programmer.
The truly great programmers will understand how all of the logic gates work and how various methods of memory allocation will affect performance. These people are very important.
However, others will fully understand the business domain, and often they will be best served by a language that insulates them from the reality of how it all happens. Luckily, they will speak enough tech to communicate with the low level programmers to handle things when they need to.
Looking at this from the game perspective: There are those who write the 3d rendering engine, but there are also others that write story lines, do artwork, and record audio. The jobs are all important, but different.
It is not just that one should select the right tool for the job, one must also choose from tools that one knows how to use effectively and eschew jobs that require tools for which he eschews training.
It is an absolute truth that C and C++ require the programmer to handle his own memory management. A well trained programmer not only is capable of this, but uses this to his advantage.
The poster's comment regarding the "age of abundance" is only a partial truth at best. There are plenty of programs which continue to be resource hogs. The ability to micro-manage those resources can be the difference between a usable interface/program and a nuisance application. Bill Gates once said something along the lines of "640KB is more memory than anyone will ever need," so apparently this is not the first age of abundance.
In fact for the last 20 years we have been in an age of abundance with processors, memory and cost improving by factors of around two annually. Yet, most do not have a computer ready for the newest MS operating system, Vista. In fact many computers purchased just in the last year are not Vista capable and those that are, are so minimally ready that I expect kernel thrashing (sic)*.
And what programmar that has written a Java routine that ran for 13 minutes crunching a solution wouldn't be excited to have the same functionality in C++ with a 1 minute running time. Java is often useful for a rapid prototype but then a C++ solution can provide optimized results.
We have projects that run for days, even months in the programming industry. Speed is important. Will always be important. No matter how much memory we have we seem to be able to fill it. I remember when 20MB drives were considered large. In 10 years I expect most of us to have 2TB or more at our disposal. We will use it all.
There can be no age of abundance until we prove P==NP. And this can't happen until we have quantum computers. Even then we will have even larger problems to solve.
C++ is a great tool. I like it better than C. I often use it and interface with existing C programs. At times I prefer it to Java but when I want platform freedom and a GUI, I trust Java. Even with Java it's important to understand memory concepts. GC is no assurance that memory will be used optimally. Occassionaly one must let go of the object and sometimes one has to call gc() directly.
* Kernel thrashing is, of course, literally impossible (by definition kernels remain in memory). My point is that the Vista OS requires enormous amounts of RAM by today's "abundant" standards.
I write code as a hobby, really. Simulations. Started with VB in Excel and then as my models got larger, moved (back) to FORTRAN and compiled basic. About 5 years ago, a colleague shamed me into learning C++. Took a while for it to become the first tool I turned to, but now that I'm reasonably comfortable (and less unproductive than I used to be), I enjoy the flexibility it offers and the neat things it lets you do. It's just a really neat language.
I think C++, being such a general-purpose language and one which makes very few assumptions at the language level, is a language which has great appeal to those who take it seriously. It is riddled with problems, but there's a tremendous difference which is probably one of the reasons it has die-hard enthusiasts like myself.
When we run into a language barrier in many other languages which causes systemic problems in the code your team produces, there's little we can do about it but work around it. As an example, there is no really elegant solution to deal with resource cleanup in Java and people often neglect to cleanup resources properly in the finally block. In C++, there are plenty of solutions available that people have built on top of the language (ways to implement RAII) since these kinds of things are not language-level problems in C++: while the language doesn't always provide solutions, it doesn't restrict solutions either.
This kind of freedom is probably one of the greatest appeals of C++ just from a pure language standpoint without considering other factors like efficiency. It has also lead to a lot of exploration and experimentation which has caused truly elegant and superior solutions to bubble up, yet those solutions are often awkward when it comes to implementation because they are built on top of such a general-purpose language with no specific accommodations for such solutions.
This kind of freedom is also the language's downfall. Too many self-proclaimed gurus tend to get creative and devise solutions to problems which have already been solved, and their solutions are often inferior to those which have been accepted and reviewed. Consider how many people have implemented their own reference-counted smart pointer in C++ without considering polymorphism, capturing on-site deletion, and the need for weak references. If C++ is going to move forward, more developers need to focus on the solutions that have worked and why they have worked rather than abusing the freedom that the language provides to roll their own solutions when superior solutions already exist. When it comes to C++, there's much more to learn than just the language itself; the freedom requires that we carefully study how it can be used effectively since there are too many ways to use it ineffectively. The language also needs to evolve with these new discoveries and trends which it fortunately appears to be doing with C++0x.
C++ was created to manage increasing complexity. We're in the millions of lines of code these days. I haven't reached that point in my own software. Use it as needed.
It's refreshing to see Jeff get the crap kicked out of him in the comments.
Though it is interesting for me, someone who likes C and Python, to see people defending C++ with the same things that make C great, and yet nobody seems to really be mentioning C itself. Hmm...
For all you C++ fanatics, by the way, Google for "C++ FQA".