Fog Creek Software
Discussion Board




C and C++ - are these languages dying?

Are C#/.net and java/J2EE taking over the need for C and C++.

On the hardware/OS side of things C++ may not go away - i.e. being close to the operating system.

But are these languages basically doomed?

Jeff Reubin
Thursday, July 31, 2003

For the sake of new programmers and the future of the industry, I hope not.  If anyone only learns and uses C# and Java, there will be a whole generation of programmers that know nothing about memory and how to manage it.

Elephant
Thursday, July 31, 2003

What do you mean by doomed? Are less programmers destined to use them, proportionally, as time goes on? Yes. Competitive advantage dictates that programmer productivity wins out over precision control of expression any day of the week. Will development in them stop? No. Will development *of* them stop? No. They're still filling an ecological niche that is valuable. As software development matures, and hardware improves, that niche becomes smaller by virtue of all the other niches becoming much better defined.
Is that your question?

Israel Orange
Thursday, July 31, 2003

Elephant:  Just to play devil's advocate and usher down upon me a rain of criticism, what would be so bad about that?  I mean, if we can all easily list at least 4 languages that manage memory for us, and if they perform well enough to get the job done, what would be the point in doing it the hard way?  Once a problem is solved, put it aside and work on the next one!

Patrick Lioi
Thursday, July 31, 2003

Should I advice a new student in CS not to learn C or C++?

What would be the alternatives to memory management in a C#/.net and java/j2ee environment?

Would C# be able to management memory as well?

Thanks,

Jeff

Jeff Reubin
Thursday, July 31, 2003

I would advise the student to learn C++.  I believe after you really master C++ switching to most other language is a breeze, although you may become frustrated at the loss of fine grained memory control. 

Java nor C# really bring anything to the table that could't be learned in C++.  Maybe introspection...

This really isn't meant as a troll, but I really don't trust Java programmers that don't have a strong background in C++.

christopher baus
Thursday, July 31, 2003

Furious activity is no substitute for understanding.

"what would be so bad about that?"

What I observed (many times over) is that the "new generation" of programmers, who don't know C (nor assembly), start spinning their wheels when faced with a low level problem (e.g. "Java program core-dumps for no apparent reason, but only on machine X").

When things work, they are productive and life is good.

When (low level) things break, they have no clue how to even begin to isolate the problem; so they try this and that, and, if they are lucky, stumble across a workaround (which may well be accidental).

If they are unlucky, they come to me ;-)

Employed Russian
Thursday, July 31, 2003

"... I really don't trust Java programmers that don't have a strong background in C++."

And I really don't trust C++ programmers who don't have a strong background in C.

I'm not kidding ... all that OO stuff is not free.

Grizzled Old C Guy
Thursday, July 31, 2003

These languages still definitely have their place.  The "new" languages don't have the performance, and there are times when you need that. 

C and C++ are certainly hard on students.  When I was teaching intro C++ we had a 50% failure rate, regardless of who the instructor was. That's good; programmers who get confused by the topics in a first year C++ class aren't the sort of people you want programming the computers at your bank.

The only drawback that I find to these languages is the learning curve. Once a programmer has a little bit of experience, development is just as quick, and sometime a lot easier.

Clay Dowling
Thursday, July 31, 2003

My biggest concern is that if no one knows anything about memory management, who will write the memory management of tomorrow's languages?  I know there will always be people around that know how to do those things, but a generation of programmers that don't know the first thing about a call stack scares me.  I look at people that just graduated, and the concept of binary data and manipulating bits scares them to death.  This scares me, especially when the graduates come from top tier schools (UMCP is my fodder school).  I know not all graduates suffer from this, but the numbers are growing.

Elephant
Thursday, July 31, 2003

I know only the basics of C++, I have never been paid to program it, but what magic understanding of memory management am I missing?  I *do* understand references, pointers, objects.... Is there something ultra-complicated about pointers I'm not getting?  Sure, You C++ gurus could probably do pointer arithmitic much quicker then I could.  I'm also sure you could optimize C++ better, but to say that just because I program in java and C# all day that i'm ignorant about memory is just silly.  On the other hand, i've met an awful lot of good C programmers who really just don't get object oriented programming, design, architecture, and heaven forbid they attempt enterprise stuff.  It goes both ways.

vince
Thursday, July 31, 2003

The ecological niche where knowing memory management was important has shrunk. This is not to be lamented-it is simply the lay of the land. That is why fewer and fewer grads know how to do it-there are uses for these people that do not necessitate their knowing such things. Most software projects these days do not require such knowledge.
There will always be people who do know it, just like there will always be people who know Latin. (Not a totally apt analogy, I know, so don't jump all over me!)

Israel Orange
Thursday, July 31, 2003

>"... I really don't trust Java programmers that don't have a strong background in C++."

> And I really don't trust C++ programmers who don't have a strong background in C.

> I'm not kidding ... all that OO stuff is not free.

I agree with that.  I learned C in 1988.  I've never been the same since. ; )

christopher baus
Thursday, July 31, 2003

I really don't trust C programmers who don't have a strong background in computer science.  I'm not kidding.  Security, correctness, and maintainability are not free.

Rob Mayoff
Thursday, July 31, 2003

Hmmm..

They still start pilots out on a single-engined aircraft, with only your eyes to navigate with, and the instructor's selection of gauges to be "broken" and work the way up before they let you fly a 767, where the gauges are all electronic and are a tad more reliable, the autopilot can fly the entire flight, including landing, etc.  Before you are ready for a higher level of abstraction, they make you understand how to handle things when everything isn't automated, so you know how not to crash the aircraft.  I sleep very well on a cross-country flight knowing that the flight deck crew are required to be able to land an aircraft with no engines and no gauges.

They still make people know how to actually do mathematical calculations before they let you use a calculator in math class.  Anybody can feed an equation into a CAS and derive, integrate, and rearange it.  But being able to do that by hand is what differentiates between people who are capable of higher maths and who need more work.

I see nothing wrong with torturing new CS students in the first few programming classes by making them manage memory and get intimate with the machine.

No form of engineering, no form of science, and no form of artistry allows it's practicioners to ignore the basics of how things fit together.

Flamebait Sr.
Thursday, July 31, 2003

> I really don't trust C programmers who don't have a strong background in computer science.  I'm not kidding.  Security, correctness, and maintainability are not free

I agree with that as well.  I think a programmer who doesn't understand the basics of computer science really isn't a developer.  It certainly isn't one I would want mucking around in our code base.  I don't care what language you are talking about.  This reminds me of the hash table thread regarding VB programmers. 

I would not allow a programmer that doesn't know what a hash table is anywhere near a production code base that is less than trivial.

I still think C++ is a good language  to learn early on, as is it allows multiple paradigms, doesn't depend on run time mechanisms, and uses a syntax that is similar to java and C#.  Yea its a hard language, because it is flexible.  That flexibility comes at a cost, yes. 

I feel that a really intelligent C++ programmer could easily migrate to Java or C#, but not visa versa.

christopher baus
Thursday, July 31, 2003

BTW, I'm not sure if maintainability is the realm of Computer Science.  More like Software Engineering.

http://www.baus.net

christopher baus
Thursday, July 31, 2003

christopher,
it's *vice versa*
/spellnazi

Israel Orange
Thursday, July 31, 2003

Well then joel should implement a speling cheker for us geeks that skipped class. ; )

christopher baus
Thursday, July 31, 2003

C and C++ will outlive most of the recent stuff such as Java, C#, whatever.net, etc.
Don't listen to code monkeys chanting - they can't see father than their noses ...



Mr Curiousity
Thursday, July 31, 2003

I forgot to substantiate my claim :-)

There is a huge number of software packages (OSes, databases, various applications) written in C/C++. Nobody in his/her right mind will through out all that investment in order to start using whatever is fasion du jour.
Plus, C/C++ already have everything one needs  to get the job done. Thus there is no real reason to switch as long as you add to some huge codebase.

Mr Curiousity
Thursday, July 31, 2003

Jeff if the point of your original question is "Should I advise a new student in CS not to learn C or C++?", my thought is no.

While in a university setting, or even afterwards, learn as many as possible.  Learn what makes them tick and learn the plus and minus of using them.  What I found in this approach is:
1. You get to hear everyone bashing each other over how a language is better than another.  Then figure out if they are right or merely speaking on what they  know.
2. I better understand when a specific tool may get me into trouble given my current application
3. I can actually learn new languages faster.  Much like people who speak multiple languages will attest to, you get to a point where picking up the next language is fairly easy.

That being said, beware the person who believes that understanding syntax and semantics is the same as being a good developer in a language.  I do not know what the magic number is, as it varies by language, but you must use a language to know the shortcomings, and corrections.

Mike Gamerland
Thursday, July 31, 2003

I completely agree with Mr. Curiosity.  However, I would also say this: 

My first _huge_ project was written in PL/I on a VAX, and both of those particular tools (PL/I and VAX) were thought to be lasting forever, at that time.  At that time (early 80's) C wasn't a player, PL/I had IBM's blessing, and the mighty VAX ruled in such a way that no one could imagine a world without VAX.

I hope C will be around forever ... there is an elegance to it that I have never found in any other compiled high level langauge.

But, you never know ....

Grizzled Old C Guy
Thursday, July 31, 2003

Yeah I hope C will be around for a long time too, and I don't doubt it will outlast Java and C#.  After all, those languages will probably live only as long as Microsoft and Sun do.  If you think Microsoft will live forever, just think about when Bill Gates passes on.

And what do you think the CLR was written in?  Without even looking it up, I would bet my salary this year that it was written in C++/C.  What about the JVM?  Likewise.

I believe that most developers will move on to higher level languages, for productivity reasons.  But C and C++ will always be there to build the foundation that those developers rely on.

Now, if there is some fundamental change in computer architecture -- like when Moore's law runs out and quantum effects start to interfere in CPUs, I could see them going away, but then Java and C# will be dead as well, and so will all the assembly langugages that exist today.

Andy
Friday, August 01, 2003

Yes Jeff, I'm off to write my new flashly o/s in C#/.net. No? Yeh, that's why c won't die.

FW
Friday, August 01, 2003

I think the relationship between C/C++ and C#/Java will eventually become similar to what the relationship between C++ and assembler is now.

Most of the time, the higher level language works fine, but just occasionally you run into problems that need to be fixed at the lower level. Also if you have a basic knowledge of assembler, then it's easier to understand pointers, buffer overruns and stack overflows.

I'm sure assembler and C will carry on being used in device drivers and embedded software on small boxes for years to come.

I would recommend anybody learning something to do it the "hard way" first, then use the tools to save time. When I first started programming in COM, I did an inproc server by hand without using any wizards. It took three days, but at least I knew what was going on under the hood. Nowadays I just use the ATL wizards, but at least I've got some idea what all the templates and macros are doing so if they screw up I can fix them.

It's the same with programming Windows. Learn how to do it by hand first - how to register a window class, create it, handle the WNDPROC and how to optimise WM_PAINT  ... then use MFC or ATL to save time.

Better Than Being Unemployed...
Friday, August 01, 2003

Now it's been about 2 years since I talked fluently on this topic, but from what I remember the .Net CLR was written in C#.  The original linker/compiler was written in C++, but the CLR itself was written in C#.  It's quite possible I've gotten this mixed up and turned around in my head since I haven't been "preaching" on the subject for quite some time now.  It is possible that the CLR was written in C++ and that C# was written in C#, but I think I had it correct the first time.  Then again, it's also possible I was passed some bad info from coorporate.

Any statements/links to the actual fact would be much appreciated.

Elephant
Friday, August 01, 2003

Recall that C originated around 1971, and C++ around 1983... so are they dying?

If we are still discussing it after all this time, then we can safely answer no.

Look at the Rolling Stones for another example...

Punk's not dead, it just smells funny...

"I'm not dead yet!" (Monty Python)

anony125
Friday, August 01, 2003

"Any statements/links to the actual fact would be much appreciated. "

The _fundamental_ underlying functions of the CLR -- the security system, the JIT compiler, etc -- are implemented in C++. 

The class libraries are mostly written in C#, though obviously a lot of that is managed wrappers around calls to the underlying framework or Win32 APIs.

The VB.NET runtime classes are written almost entirely in VB.NET.

The VB.NET and C# compilers are entirely written in C++. 

The JScript.NET compiler is entirely written in C#.

Eric

Eric Lippert
Friday, August 01, 2003

"...feel that a really intelligent C++ programmer could easily migrate to Java or C#, but not visa versa."

"it's *vice versa*"

It can be visa versa if migration issues arise.

Obfuscated Clown
Friday, August 01, 2003

C and C++ are here to stay.  Hell, take a look at assembler, it is still around (and if you REALLy want to know what's under the hood of a JVM or the CLR, you need to understand an assembler-like language). 

I have concerns that more and more CS programs are teaching Java and are dropping the C++ classes.  I never took a C++ class, but I learned it at work, and getting a handle around pointers and bit operations took some learning, but it helped me understand how the underlying OS worked in addition to giving me a valuable skill.

As far as hiring developers, I prefer someone with C++ over Java/C# over VB/VB.NET. 

Phil
Friday, August 01, 2003

And I dont' trust C++ nor C geeks that have nothing else to do, but complain about their lot and put down others, while the best they can do is go and teach a c or c++ class, rather than getting the real job done.
I know c and c++ , but i don't mentally masterbate with it,
and put the rest of the java or c# or others down for it.

get a life boys, or a real job for that matter.

C++ programs are just like cobol programmers
Wednesday, March 10, 2004

*  Recent Topics

*  Fog Creek Home