25

When I first started to learn how to program, real programmers could write assembly in their sleep. Any serious schooling in computer science would include a hefty bit of training and practice in programming using assembly. That has since changed, to the point where I see Computer Science degrees with assembly, if included at all, is relegated to one assignment, and one chapter, for a total of two weeks' work out of 4 years' schooling.

C/C++ programming seems to have followed a similar path. I'm no longer surprised to interview university graduates who have not spent more than two weeks programming in C++, and have only read of C in a book somewhere. While the most serious CS degrees still seem to include significant time learning and using one or both of the languages, the trend is clearly towards less enforced C/C++ in school.

It's clearly possible to make a career producing good work without ever reading or writing a single line of C or C++ code.

Given all of that, is learning the two languages worth the effort? Are they at all required to excel? (beyond the obvious, non-language specific advice, such as "a good selection of languages is probably important for a comprehensive education", and "it's probably a good idea to keep trying out and learning new languages throughout a programmers' career, just to stretch the gray cells")

5
  • 8
    C is ubiquitous in today's software infrastructure. Learning it will definitely give you a deeper understanding of what's actually going on in the software you write. (See programmers.stackexchange.com/questions/14744/… ). Feb 1, 2011 at 4:45
  • I also found the answers here relevant: programmers.stackexchange.com/questions/29109/… Feb 1, 2011 at 5:41
  • Tangential: a good programmer is comfortable with various programming paradigms, this means having learned (and used) several languages. Feb 1, 2011 at 14:38
  • Learning more languages can't hurt.
    – Maxpm
    Feb 2, 2011 at 6:15
  • 4
    There is no C/C++. There are only C and C++. They're very different languages, and the answer is likely to be quite different depending on which you're talking about.
    – Caleb
    May 30, 2012 at 14:26

22 Answers 22

64

Joel Spolsky (yeah, that Joel) argued a while back that real tough programmers know how to use harder languages (like C, C++ and Lisp) and their constructs (like pointers and functional features), and that higher-level languages were usually not 'hard' enough to demonstrate your competency.

I can understand his point that people knowing C and C++ and that are actually good at it know a lot more about what goes on under the hood than people who, say, program in Ruby (and only in Ruby). I'd say it goes like this: if you know a "hard" language, it's probably a good proof that you're able to program while respecting severe constraints or that you master complex ways of thinking. If you're good at a high level language, you might as well be able to program while respecting severe constraints, but there's no proof of it.

I don't think learning C or C++ will damage your brain (some people seem to believe this though). Actually, learning it just to appreciate better higher-level languages might be a good idea.

35

Yes, knowing C (or C++) is required in order to be an excellent programmer (in our current times).

It's not the language itself, it's the environment.

Programs do not run in vacuum. Excellent programmer knows his/her environment, like great sculptor knows his/her material. Our current programming environment (operating systems, compilers, networking, etc) is built on C/C++.

Excellent programmer writes efficient programs and debugs them in real life situations. He must know the environment -- and nowadays it requires knowing C/C++.

Edit: Can't resist adding Matrix reference. Morpheus might ask: do you want to take the Java pill and continue living in comfortable world provided by the virtual machine? Or do you take the C pill and see how deep the rabbit hole goes?

1
  • 9
    +1 for the Matrix reference, I'll keep it for possible future use :-)
    – Konamiman
    Dec 2, 2011 at 12:32
20

I must refer to another Joel article. In The Law of Leaky Abstractions, learning languages like C, Lisp, C++, and languages that involve memory management also involve learning a way of thinking that defines us for the rest of our careers.

My professor in my Data Structures and Algorithms class, William Spears, told a roomful of skeptical Computer Science students why we weren't learning the latest tools. The students complained that they felt like they weren't being prepared for the "real world" because we weren't learning Java. We weren't learning JavaScript. There were no classes on HTML. We weren't learning [[INSERT TECHNOLOGY HERE]].

Why weren't we learning the latest tools? According to our professor, technology changes so fast that in 4 years, the tools we learn may very well be obsolete. Well, after a few years in the industry, I would have to say I agree with his assessment.

The purpose of a Computer Science education is to learn how to learn. Figuring out solutions to many problems in development oftentimes require an ability to think outside of the box that can only come from learning basic, fundamental, under the hood, raw Computer Science that comes from working with C, C++, and Lisp.

When those abstractions in the real world leak, and they will, an understanding of the basics is what separates the average from the best.

8
  • 3
    I must be missing something. What does Lisp have to do with learning fundamentals? It's the biggest abstraction inversion ever invented. One of its original, fundamental design goals was "let's pretend we're not really on a Turing machine and see how much we can simplify things by doing that." Feb 1, 2011 at 15:35
  • 6
    @Mason: Learning Lisp will teach you approximately nothing about real world computers. It will teach you a lot about the theory of computation. Raw computer science is about more than raw computers. Feb 1, 2011 at 16:04
  • 2
    @Mason Wheeler Learning lisp introduces several advanced concepts, including: data/code are interchangeable, reflection/self-modifying code, and the importance of considering your compiler/vm a part of your end product Feb 4, 2011 at 19:44
  • @blueberryfields: ...all of which are considered harmful and or security vulnerabilities to one degree or another by more experienced coders. Very bad things to teach to newbies. Feb 4, 2011 at 19:51
  • 2
    @Mason I don't understand the context of your comment - we're talking about excellent programmers here, not newbies. I would not consider a programmer, which doesn't have a thorough understanding of these concepts, and applies them appropriately (and regularly) in his work, to be an expert. Feb 4, 2011 at 20:05
18

Let me put it this way. Let's say you needed to hire someone to do some C++ work, and someone applies who did one C++ project in college but has only programmed in Java since graduation. Conversely, say you needed to hire someone for some Java work, and someone applies who did a Java project in college but has only programmed in C++ since graduation.

Who are you going to be more comfortable hiring? I would argue the C++ guy, since moving to using a garbage collecting language is a lot easier than moving away from one. Likewise for other concepts and other languages, like moving from compiled to interpreted, or from static to dynamic typing. In almost every feature by feature comparison you can make between languages, C++ comes out on the difficult end, which makes it a pain to program in, but also an excellent baseline for judging a programmer.

Can you thrive in a career without ever touching C or C++ code? Sure, but I still wouldn't want to hire someone who was unable or afraid to do so.

1
  • 3
    Unimpressive argument. If I needed Java work done, I'd hire someone with Java experience. If I needed C++ work done, I'd hire someone with C++ experience. If I had to hire a Java guy for a C++ position then I might spend some extra interview time quizzing him on pointers and memory management and RAII; similarly, if I had to hire a C++ guy for a Java position then I'd spend more time in the interview asking about jitters, design patterns, reflection, etc. Neither skill set seems to require more intelligence, just experience. Most of the learning curve is in the libraries anyway.
    – Aaronaught
    Aug 12, 2011 at 21:52
13

No, its is not required to learn C or C++ to be a good programmer but understanding it would help to clear some basic concepts like Memory Management.

7

is learning the two languages worth the effort?

It's clearly possible to make a career producing good work without ever reading or writing a single line of C or C++ code.

6

In short, no they're not. They're useful languages to learn, but you can easily be an excellent programmer without touching a line of C or C++. Most excellent programmers will probably have touched them but that's besides the point - in a lot of applications these days they're not used nearly as much as .NET and Java, and as such their necessity has dropped somewhat.

Note that I'm not saying they're not worth learning, I think they're both important languages to learn, especially if you're planning to make a career out of programming. But can you be decent programmer without ever having touched either? Sure.

5

It Depends on your Interests.
If you want to be in system programming yes you will have to learn C/C++ as they are default languages of CS. In order to get familiar with OS concepts, Compilers, data Structures, Memory management etc you must know C/C++. Additionally tons of good texts, books and articles are available on C/C++ which will optimize your programming skills. Few days ago in /* Programmers */ i read an excellent answer for Why C - Because Its Close to Metal.
On the other way around if you want to limit yourself to application programming there is no need to go for C/C++, Directly start with C# (.Net) / Java and you will get a good developer's job. But if you really love hardcore programming i am sure one day you will start learning C/C++.

1
  • Close to metal! Love that comment.
    – Wajih
    Aug 12, 2011 at 21:49
3

It totally depends on what application domain you want to work in. If you want to play in the embedded landscape then you pretty much need to know C or C++. C++ is also probably the most commonly used language in game development. If want to work on web applications then C or C++ may not be as important. There is no language that holds the prestige of being required to know as a precedence for defining a good software engineer.

3

C has been named "portably assembly" which is very true. It was designed to make Unix portable across processors, and describe code very close to the instruction set of the underlying processor.

If you find that you would like to work close to the actual hardware, being in embedded software or device drivers etc, there is no way around C. If you want to work in the more mainstream, high-level languages is a better idea since many of the features that make C powerfull is also making C dangerous so they have been lessened down or simply removed.

Personally I would consider it very important to understand what eventually will need to run your programs, as many design decisions depend on this, so you should at least be familiar with how to map code onto the assembly instruction set and how it works in the actual hardware. That things that you take for granted actually take time to do and why.

Therefore I would at least suggest you have a look at C and some advanced pointer arithmetic code, so you know what you don't have to deal with on a daily basis.

1

C is useful to learn because it is close to the silicon. C or assembly language will give you a good feel as to what computers can do and how they do it, and this is likely to be useful in understanding what's possible and what's practical. Moreover, there's a whole lot of C code out there that you might be interested in, and a great many more modern language use much of its syntax and semantics.

C++ is a higher level language that has some very interesting features in it. It has many good uses, and is a powerful language. On the other hand, there's lots of other powerful and useful languages out there.

So, I'd strongly recommend learning about what happens at the lower levels, and C is an excellent way to learn them, so I'd strongly recommend learning C. C++ is optional; learning it will teach you things, but there's other ways to learn most of them, and if you're already working in a mainstream language there's better languages to learn to pick up new concepts.

0

It depends on the type of software you think you'll be making. Games are often written in C/C++ as it's classically a more optimisable language when it comes to the executable code. What you code is just about what you get, in a way.

That being said, C# has also been used to program games. C# is probably one of the best languages for desktop application development, at least on the Windows platform.

Along with Visual Studio, C# has become almost the only software development language I use (excusing languages like SQL and PHP etc) as it's for all intents and purposes, bloody fantastic in my opinion.

If you develop on Windows, I would strongly recommend learning C# .NET alongside anything else.

I don't believe C++ is a requirement per se though, but it's nice to have that lower level knowledge of pointers, memory management and other concepts.

2
  • 1
    @ Nick : The Computer world is beyond the windows and C#.
    – Ranger
    Feb 1, 2011 at 5:05
  • 2
    Hence why I said, "If you develop on Windows". Feb 1, 2011 at 5:43
0

@Nick Bedford is right about the domain you are working in. My software counterparts write device drivers and embedded software. C is the way to go there. And don't think of C++ as a second language, they have huge overlap.

2
  • 3
    If you don't think of C++ as a different language from C, you really don't know C++ well. Working only in the overlap is possible but not advisable. Feb 1, 2011 at 16:05
  • Perhaps I overstate the similarity. But they are more the same that, for example, C and Perl. Feb 1, 2011 at 16:23
0

Many have said that C is good to learn for memory management and I agree. For my opinion on learning C is that it is very good to learn for the sake of learning how to debug a program. A lot can go wrong in writing for C that requires you to think about how you should be debugging your programs. I rarely use a debugging tool in any of my programming (in C or other languages) simply because C taught me how to add built-in debugging utilities into programs.

Is learning C/C++ required for a career? No, but I've also seen a lot of Java developers who don't know a lot of programming basics because they only learned Java. Same with Perl programmers. Learning more than one language should be a requirement for a career, whether C/C++ is one of those languages or not.

1
  • +1 - Seeing similar concepts presented in a different way in different languages helped me better understand those concepts and see them in a whole new light.
    – jmort253
    Feb 1, 2011 at 5:50
0

In the beginning, I used to think my university is in the generation of Dennis M. Ritchie for including C for 2 semesters when there are lot of relatively new languages such as Java, Visual Basic et cetera. But the fact is, or at least now I believe, C is one of the best languages that help you understand the fundamental concepts of programming.

And about the career without learning C (or C++) - Yes, it is possible, but learning C will showcase your knowledge in programming.

0

The answer for me was yes. Both C and C++ were required courses in my CS degree program, and I hold the belief that having a CS or related degree is a minimum requirement to being a "good programmer". Furthermore, being a "good programmer" means being able to rationalize the problems that occur and understand why something doesn't work as one might expect. Too many times in my career I've witnessed individuals being stumped by problems and thinking there were supernatural forces working against them... it's ridiculous.

IMO, knowing C demonstrates the ability to understand any of the imperative languages and solve problems using one of the most powerful tools ever invented by mankind.

0

A well rounded programmer has several bags of tricks up his sleeve, and these include:

1) Low-level programming... C at a minimum. Some assembly wouldn't hurt.

2) Functional programming... A pure functional language, not a hybrid -- Scheme works here.

3) OOP... Normally I'd say smalltalk, but I guess we could go with Java now.

0

C is the mother of all programming language....expert knowlesdge in C make you go a long way in knowing any other language like Java in a short duration.

C++ is a whole different ball game and is the most complex among all.

0

It is not necessary to learn C or C++ to be a good (excellent) programmer however it is necessary to learn Assembly in order to be a good (excellent) programmer. Excellent programming means optimizing across memory, Mhz, bandwidth, power constraints and then choosing the best design and/or implementation to accomplish the task at hand. Among computer scientists the primary weakness is still, after decades of evolving technologies, with managing data optimally. This is a set of skills taught by writing Assembly (any assembly; it could be ARM, or MIPS, or x86, or a microcontroller, or a DSP, or even lower than that, via verilog/VHDL).

0

Having proficiently used c,c++,assembly, and Lisp I would say it doesn't make sense to have to learn any particular language at all to be a good programmer. My experiences with what makes a good programmer is being able to think in a way that solve problems. Languages just allow you to express your problem solving skills. For example the simplicity of C allows you to easily express algorithms, while Lisp allows you to solve problems recursively. So a language doesn't make you a programmer. You have to be a problem solver first before you become a good programmer. Languages are just tools you use to solve problems. For example I almost applied for a patent on a logical programming implementation I thought of where the only way to express that implementation was through the use of assembly language since no compilers existed that could implement it.

-1

It is worth learning C well simply to gain a solid understanding of memory management. Ditto for C++ except with the goal of learning data structures.

2
  • It doesn't matter what language one uses to learn data structures. Feb 2, 2011 at 17:55
  • I believe it does because in a lot of other languages data structures are used without knowing how they're handled in memory. C++ (without use of STL) forces the programmer to learn how the data structures are handled at the low level.
    – aqua
    Feb 3, 2011 at 1:21
-1

No. There are plenty of lousy programmers that write C/C++ code. What will make you a good programmer is understanding when and why you would need to write something in C/C++

Not the answer you're looking for? Browse other questions tagged or ask your own question.