Interesting article this morning on CNet. It discusses language usage. Bjarne Stroustrup (the creator of C++) claims that C++ is not being overtaken by languages like C# and Java. He claims it is a matter of marketing. Java has marketing, C# has marketing, C++ does not. He's probably right about that. There is no hype machine for C++. Sometimes though, hype influences reality. If I'm an aspiring programmer, I'll hear all this cool stuff about .Net, Java, or C#. I will then be more likely to gravitate toward them. Surveys show that, as a percentage of all programming, C++ has dropped from 76% in 1998 to 46% in 2004. That may say more about the size of the programming pool though than about the number of C++ programmers. Stroustrup maintains that there are 3 million C++ programmers.
One aspect the article touches on is teaching languages. When I went to school, pascal was the language of teaching. In a lot of places, it is currently Java. Why do universities instist on "teaching" languages? Why not teach what people really use? You can't argue that C++ is too complicated. It is more complicated than C# or Java, sure. But then again, a lot of your graduates are going to be programming in C++. By the above survey, about half of them will. If they can't handle it in school, how are they going to handle it in the real world? I am all for taking some classes to expose people to different programming paradigms (C++, Lisp, Smalltalk, C#/Java, Python, C, etc.) but the core of the curriculum should be based around one language. That should be a language that is useful everywhere. It makes no sense teaching an OS class using Java. No one but Sun uses it for OS's and we know how successful JavaOS was.
My final thought on the subject is that it shouldn't suprise anyone that Java, VB, and C# and even "languages" like PHP or Perl are gaining so much momentum. They are more accessible than C/C++. They are easier to learn and easier to use. It's harder to shoot yourself in the foot with VB than with C++. It's also harder to do many kinds of work. Why not start students with the more complex languages and work down from there. To learn C# from C++ is easy. To learn VB after you know C++ is easy. The other direction, not so much.
So, if you happen to be reading this and just starting out, consider learning C++ early. You'll be doing yourself a favor.
Man! I totally agree. My friends and I used to talk about this issue when we were undergrads. I find that profs teach what they like. Most computer science departments are made up of math profs. So you see scheme, prolog, etc... Some profs only know pascal, modula, and Ada so that's what they teach. I found that profs that work in "the real world" outside the university tend to teach C++, C# and Java. Because they know that most students will be exposed to these after they graduate.
ReplyDeleteOn a realated subject, most profs don't teach good software design, or software processes. I think processes like Agile are just now beginning to make it into ''experimental'' computer science courses. A few years ago, I took a graduate course and the prof was teaching Rumbaugh! Eventhough, other profs in the same department were teaching UML, I think some profs just teach what they prefer.
On my CS course the emphasis was on teaching people the principles of programming (general concepts - data types/structures and algorithms) rather than teaching us how to program in a specific language. The idea was that if we could write programs in pseudo-code/Ada/Prolog/Lisp then these skills are easily transferable to any language. (The department did provide a fortnight long crash course in C for anyone who wanted though, but it wasn't part of the syllabus.)
ReplyDeleteHaving said that, I'm glad that I've never had cause to program in Ada since I graduated!
Yeah, we were taught Pascal, Scheme and Ada...but were required to teach ourselves C for assignments. I ended up taking an undergrad elective that covered Java.
ReplyDeleteHaving gone through the pain, I'm so glad they did things that way. Those four languages cover just about every different paradigm there is out there.
Now I do a lot of stuff in Python and it's my new favorite language. :)
The truth is that your survey is skewed. C++ is not going to be the primary language of choice at most companies. If it is, we are in trouble. I can write something in C#, Java, Python, etc in half the time that it would take anyone write something in C++. And truthfully most companies understand that database access is mainly as slow as the database and not the language getting the data.
ReplyDeleteA VB database app can be developed in a day, the same app can take weeks in C++.
I taught C++ to college students for a few years and we used MS C++ 6. I cannot tell you how many times a student could generate an error message that was completely useless and frustrating for them. All because of the complexity that lurks in the simple ">>" overloads for streams.
I think that everyone should learn C++ but most people in business are not using it. If they are, it is no wonder every software project is over budget and not on time.
I learned Pascal to start with but the truth is that the language did not matter. I constantly told my students that. For one reason or another they would always say I only want to program in language "X" because it is "fast" or "COM compliant" or "understands XML" or "insert your own buzzword."
You just need to get the job done and you should choose the language or tool that does it. For teaching it helps to start out with the hard stuff so that when you make it to the real world, you do not strain you brain to make a living.
Some people above commented that C++ is being used less and less in business applications.
ReplyDeleteBut who is more valuable, a programmer who only knows C#/Java/VB or someone who is a C++ wiz but can also develop in these other languages?
C#/Java may be the better choice for the bulk of the code of many applications, but when you need to interface with foreign libraries or just need lots of raw power, knowing C++ can save the day. Also, for smaller apps that should run on any computer, pure C++ apps are much more deployable since no .NET framework or Java VM is required.
I'd say C++ is definitely still worth learning.
I completely agree with you on the issue of using Java for OS related courses. I graduated when Java was the hype and naturally gravitated towards it. However if I were to start all over again, I would pursue the C++ route. That said the productivity of programmers has increased a lot after the advent of Java. Productivity has increased further with the popularity of Python, Ruby and Perl. You cannot dispute that. Couple of my gripes about C++ are that it doesnt come with a rich library set as do Java/.NET and the differences of the C++ compilers on different platforms (IBM's C++ compiler until 2000 didnt have a proper STL library!)
ReplyDeleteDisagree. I'll let Jon Galloway cover it since he does it so much better than I do:
ReplyDeleteJoel got it wrong - Why learning C is a waste of your college time and money
http://weblogs.asp.net/jgalloway/archive/2005/02/16/374212.aspx
I have to disagree with Jon Galloway. Sort of. I actually agree that C is not what you should learn but C++ is definitely something I would recommend over one of the "framework" languages. C++ has the low-level advantages of C but also allows you to practice good technique with OO.
ReplyDeleteI have nothing against the frameworks. Theya are fun to program. However, if you are aiming for a programming career, the more you learn in college, they better off you'll be later. C++ allows you to learn how the machine is working below you. Is this harder than Java? Yes. Is that good? In school, yes. As I said above, learning C# is easy after learning C++. Learning C++ after C# isn't.
As for jobs, the higher-paying, more interesting jobs are often at the systems level. Applications can be written in a framework language. Systems can't. H.264 decoders aren't written in Java. Operating systems aren't written in C#. Game engines aren't written in Python. If you want to work on compilers or operating systems or multimedia, it is best to know C++. If all you want to do is write web applications or juggle databases, start with the framework languages.
I think part of the disagreement comes from answering an ambiguous question. We're trying to decide "What's the best tool" without first describing the job the tool will be used to complete.
ReplyDeleteSo the question is, what will the tool be used for?
C++ is great if you want control and execution speed, but you have to trade some productivity for it. In modern business applications, C++ is rarely the best tool for the job. When you've got performant frameworks (like DirectX) and fast CPU's to ride on, the execution speed card is even less of a factor. So then it comes down to control, right?
I agree with your previous post (
http://blogs.msdn.com/steverowe/archive/2005/01/06/347845.aspx) in which you stated that learning a language is just the beginning of learning to program.
Now, I'll agree with you that learning the mechanics of C# or Java is trivial once you've learned C++. However, I think that the paradigm shift from C++ to managed languages is not so easy, especially when your education is totally focused on C++. I've worked with several programmers in the corporate sector who made the first leap but not the second, and the systems they went on to build were magnificent beasts, terrifying to behold.
So, that comes back to the question - what is the job that we're training for? There's no one answer - some will work on operating systems, some will work on embedded systems, some will write video games, but I believe the vast majority will work on business systems.
I think it's odd that a minority of programmers will need to know how to shoot themselves in the foot, but we make sure that all of them know how to do it.
It's an interesting discussion, and I very much appreciate your take on this. Good stuff.