I am going to make the bold claim that everyone should know C. Even in a world where we can do 90%+ of our coding in a higher level language we still aren't at the place were we can get past writing out performance loops in C. Case in point my company recently needed to speed up a 128bit AND on two MySQL binary fields. While this can be done in pure SQL implementing the function in C saved an order of magnitude of time. Everyone is going to run into these performance problems and until we have run times that can match hand coded C it will in my option still be a required skill to have.
( Yes I know you can s/C/ASM , however this is a time issue eventually we may get past needing C , but we are not there yet )
It's funny, I tend to assume (because it mirrors my own experience, and my peers when I entered the industry) that everyone starts off as a C-on-Unix programmer, and specializes from there, into databases, or Windows programming, or whatever. But this isn't actually true, and makes people go cross-eyed when I say things like "just strace it" or "attach gdb and get me a backtrace". I grew up doing 6502 assembly language. Kids these days do HTML and JavaScript. They don't even know how far away from the machine they are, and when the "magic box" doesn't work, they're stumped.
A good programmer has the mentality "it's all turtles, all the way down", where a turtle means a thing that ultimately is just a piece of code, written by someone much like yourself, than you can understand inside out if only you take the time to do so. Even the CPU is just code (e.g. VHDL).
My programming started on windows trying to learn java (classpath? wth is a directory??), then to dos prompts and rexx scripts, but I didn't really hit my stride until a neighbor helped me install TurboLinux.
I spent the next few months at the console (configure X, what am I a god?), with emacs, and gcc and it was glorious.
I still remember the day when I figured out I could declare a function in one place, and then define it in a different .c file, compile things individually and link them and it would work!
So yes, I agree I think everyone should learn C, since it's still the best, thinnest model for the Von Neumann architecture a typical computer provides you. And those early painful steps with C have really served me well when it comes to visualizing the mechanics of a problem
> I am going to make the bold claim that everyone should know C.
I agree. Anyone who's going to be working at a non-entry-level job in the computer industry should know what the foundations are built on. C still dominates in the kernel space and other low-level facilities everyone uses. If you don't know it, you are at a disadvantage compared to those who do.
> I am going to make the bold claim that everyone should know C.
I agree.
The world of software is built on layers of abstractions. Both the skill of effortlessly layering abstractions and also the skill of peeling them away are fundamental to deep programming and modelling skills. Languages like LISP open the door to effortless modelling, whilst a language like C strips implementation all bare.
Its nice and widely available, fairly neutral on programming style (in the imperative space - few "political" (eg objects) abstractions rammed down your throat that don't actually exist in the CPU).
It can be used in a semi-portable manner, and inter-operates easily with assembler as required.
Boxing, GC, forced classes, and so forth still are not free. They are close to free in many problem domains - but you cant make them go away in other languages when they get in the way.
Pah, 99.9% of programmers will never, ever, ever need to drop down to that level.
Where do these delusions even come from? I think a lot of people here would benefit from 6 months in a 'normal' company, the kind that employs the vast majority of programmers. Just for a bit of perspective.
These delusions come from experience with watching programmers flop around like fish out of water whenever some layer of abstraction they took for granted starts "leaking".
I honestly don't get this attitude in our industry. Nobody tells a general practitioner, "Nah, you don't really need to know what comprises a living cell. You most likely won't even need to drop down to that level."
Just because you don't need to do any low level work, doesn't mean you shouldn't learn anything about it.
This is exactly the sort of nonsense I'm talking about. When, you fool? Do you think most business apps need to do some crazy algos or something that would benefit from C?
If you think most programmers who know Java, C#, Ruby or, Python have ever dropped down to C you're deluding yourself. And they never need to and not only that the majority of their performance problems come from poorly written SQL queries. And the rest come from poorly conceived loops.
As I said, go get a job in a normal company, open your eyes. Most job applications will not give you an advantage if you put the ability to drop down to C on your CV. Because they will never, ever, ever need it.
Probably from those of us who have found a working knowledge of C fairly useful in their careers?
I've been working for 24 years in software and I'd say that during most years I've written or read C sources. Some years it would be a lot, some years relatively little, but it's been a very useful skill for me.
I agree that relatively few people need to write C these days - but knowledge of it does, in my opinion, help quite a lot.
> I think a lot of people here would benefit from 6 months in a 'normal' company
I've worked several years at a normal company. My group of dozens of software engineers codes overwhelmingly in C, with Python, Perl, Lua, and the occasional ML in support roles.
I think a lot of people here would benefit from 6 months in a 'normal' company, that employs the vast majority of programmers. There's so more to the universe than Rails, Django, and JQuery...
Pretty much any extra skill will make you a better programmer if you disregard the time put into learn it, so that's hardly a high bar. What about comparing the marginal return of an hour spent learning C with an hour learning best practices in their own particular field, whatever that might be?
> Most programmers will not need to write code in C. But they'll still be better and more versatile programmers if they know the language.
I agree, although I'm not sure C should be the top priority for someone that will never need to actually use it. There are lots of other things to learn and nowhere near enough time to learn them all.
Although learning C when you already know other languages is not particularly difficult.
When I needed to fix a bug in the mono vm, guess what language I was using. Or apache. Or SQLite. You'll notice I'm not talking about the language my app was programmed in. I won't even start on the abomination that is the typical ruby gem ext directory.
If you had said 99.9% of programmers should not write C, I'd agree. But the reality is there's a lot of numb nuts out there, and you're going to need to fix their code. If you can't beat em, join em.
Completely this. On a similar note someone I follow on twitter posted that they thought it was important that every programmer knows the response times from L1, L2 and L3 cache...
I think programmers should know the basics of C even though most of them will never work at that low a level. If you don't understand C, you probably don't understand any modern imperative languages, practices, or patterns. If you don't understand imperative programming (what it is, where it is good, where it is bad) then you don't understand high-level or functional programming.
Also, C isn't a complicated language. Like any, it has faults and warts, but it's pretty damn elegant on the whole.
If you ever have to deal with a program that crashes (e.g. segmentation fault, etc) then the guy with the knowledge of C and the tools (gdb etc) will run rings around the guy who only knows a scripting language.
That's not a bold claim, that's a very safe claim. Learning C won't hurt anyone, except for the missed opportunities, which are invisible. But if you take all the "everybody should learn X" claims literally, you'll spend all your time learning.
So here's my counter-claim. Most Java and .NET developers will do just fine without knowledge of C.
Until you need to do something novel or unique. how useful would .NET be without pinvoke ? how many Java extensions exists out there ?
Above and beyond the practicality of being able to extend your language or debug it when it brakes in new and interesting ways, you also just have the general knowledge of how computers work that much more. This isn't to say you aren't any good, but if you want to be that much better you should learn C.
Server-side and in command-line tools there is tons of software that need not explicitly call into the lower level stuff. The code you call will eventually do that, but as far as the programmer is concerned, that is of no importance.
GUIs may still be a different matter, but I haven't programmed them in .NET/Java in years.
That claim doesn't really tell me anything without a measure. How much C should everyone know? I passed an introductory course in C, but that far from qualifies me to write any production-ready C. Every day I see some thread on C pitfalls here, many of which I would probably fall into once. What do you think someone should be able to do in C?
Yes, and one of the reasons that this is a good idea is that the opportunity cost is so low. C is a pretty simple language. Mastering it is hard, but the number of rules you have to learn just isn't that big.
( Yes I know you can s/C/ASM , however this is a time issue eventually we may get past needing C , but we are not there yet )