tags:

views:

2186

answers:

24

I love the the stack overflow podcast, and I understand Jeff has no desire to learn C. However, in one of the conversation, Joel said something along the line that "While C is not being used much anymore, it's important to learn it to understand pointers".

In my particular domain (embedded systems), C is still king and C++ is commonly used. Is that specific to my domain. Has C really disappeared from common use in other places, to be supplanted by JavaScript/C#/Ruby/Python... ?

According to Lang Pop, C is still the dominant language. Would it be that Joel is simply a victim of his own "anecdote extrapolated has universal truth" syndrome? (Ok, I'm sure it's not what he called it, but y'all know what I'm talking about).

Edit: For those wondering about the Joel anecdote reference, see his Joel on Software post titled Anecdote.

+28  A: 

It all leads back to C in one way or another. Many interpreters for the more hip languages like Python are written in C, and the only way to afford them additional functionality (to link with other APIs) is to write a wrapper in C. In other words, even though people may prefer to use a more dynamic language, it's more or less a thin wrapper on an all-C stack.

Even when it comes to web apps huge components like the operating system (Linux definitely, Windows probably) are written in C. Apache's written in C, so is PHP, Python, Ruby, etc. In fact, the only thing not in C is the web app itself.

Kyle Cronin
New languages are always going to be developed, and in my opinion C is the best language to implement them in. It allows the implementers to make the most efficient memory management system they can while still having the language be as fast and as portable as possible.
Chris Lutz
Definitely - which is also why C isn't going away. The best way to communicate between languages at an API level is to use C as the lingua franca.
Kyle Cronin
Personally, I think this answer misses the point. This argument can be extrapolated one step further to prove that, in the end, everyone's programming in assembler, scratch that, machine code.
Software Monkey
@Software Monkey: Not really. His point is that C is still widely used, even to implement the compilers/interpreters of the new, "hip", languages. They actually are implemented in C, not in Assembler or machine code.
sebnow
@Sebnow: Yes, a relatively few programmers write compilers in C, so hundreds of thousands can write code in Java, C#, F#, Haskell, Python, Groovy, Scala, etc. C's not dead by a long shot, but this answer misses the point.
Software Monkey
+1 because Software Monkey is wrong
Judge Maygarden
Im with Software Monkey! Why don't you express your point as an answer? I'd vote it up without a doubt.
Pablo Fernandez
+43  A: 

NO. To me is just about using the right tool for the right project .... I would not write a embedded system on PHP for example, nor a webapp in C

As always there are likely special cases and or exceptions

webclimber
When it comes to web applications, C/C++ aren't used much any longer. And most developers these days start in or stay in web applications.
@unwesen, I don't understand your point. Are you arguing that this is a reason that C is dead?
senfo
@senfo - he's saying that web developers think C is dead, and there are a lot of web developers - hence the pervasive "C is dying" myth ;)
Jay
+8  A: 

Just look at *nix systems. C is still very alive. It's one of the most popular languages, and I don't think that will change any time soon.

Andrew
Kde utilizes C++ for Qt and Kde is gaining much more support than Gnome especially with the new release of version 4.x.
Suroot
@Suroot, that doesn't make much of a difference. C is still the primary language used for applications written for the Unix platform.
senfo
+18  A: 

It depends what circles you are in whether C is still important. At one point in time C was essentially the only language in town and so was used for most things. More recently new languages have appeared and they are taking away some of the territory people once used C in. For example, early web programming was often in C. Today almost none are. If you work on web applications, you won't run across C much. Even in the domain of desktop applications, C/C++ is waning and other technologies like C# are making headway.

Still, there are domains that benefit a lot from the low overhead nature of C/C++ and don't benefit from the higher level languages like C#/Java or Ruby/Python. In these places, C/C++ still reigns. If you watch Stack Overflow for long, you'll see that media processing, operating systems, embedded work, etc. are still very much the domain of the c-family of languages. And for good reason.

Steve Rowe
Funnily enough I have a buddy that got a job in BC a few years ago doing web programming using C. He loves it, I have to admit I'm a little jealous of him as I absolutely love working in C.
CalvinR
+2  A: 

I agree with webclimber. There is a right tool for every project. C and even C++ are great for applications that need to "count cycles" where as C++/C#/Java are great for user interfaces that might read that information. Granted I'm not going to write an application in assembly even though that would be the correct way to go about counting cycles.

Suroot
+6  A: 

C will always be.

In 30+ years there will still be people writing C. There is no other language that gives you more bang for your intellectual buck. If you are competent in C there is nothing that you cannot do with a computer.

I don't think that's true. You'll get more done per brain cycle in something like Lisp or even Ruby than you ever will in C. Just not having to deal with pointers gives you a lot more cycles for algorithms. C trades off intellectual bucks for computing speed.
Steve Rowe
There are libraries that it's difficult to call from C.
ChrisW
"There is no other language that gives you more bang for your intellectual buck" - anything with higher level constructs will allow you to do more with the same or less effort. So that's almost all other languages!
Daniel Earwicker
@ChrisW: I would say the exact opposite. Most high-level languages integrate with C and often when you have a mix of high-level languages (e.g. Ruby + Haskell) it's the only common glue language available.
finnw
@Everyone, I mean the effort spent learning C pays off more than any other language. C is the lingua franca of CS. You people do realize most of those languages you're talking about are written in C? If you want to extend them you must know C.
@finnw is that a fact? higher level languages call call C libraries, but can C code call libraries implemented in a HLL? For example, using C, how do you invoke a library that's written in Java or C#, or a COM component?
ChrisW
@ChrisW, Yes they can. For example, from C you can make direct calls into the JVM if you so desire using the JNI. COM is also no problem. Most languages that run in a VM or interpreter (Ruby,Python,et al.) have their VM implemented in C meaning you can call any code in that language from C.
Dealing with pointers is not that difficult. This is such a sophomoric argument against C. It's just silly.
BobbyShaftoe
+1  A: 

I personally wouldn't say that C is a dying language. Every language has it's advantages and disadvantages. There are times when a framework such as .NET or java is too cumbersome for the needs in a project. On the other side of the spectrum, with the level of abstraction involved with frameworks, development time is typically shorter and as a result costs are lower. This is the main reason that frameworks are typically used in business environments. Time is money.

Another advantage to C is that it compiles to machine code. Many of the underlying libraries in a OS are built in C-like languages due to the granularity of the language. A framework application requires an OS with the framework running in for it to work. As a result, I don't ever see C "dying".

regex
+1  A: 

"Is the C language really outdated?"

No, it is simply that there are newer,more productive languages around to do certain tasks, but there will always be tasks that C is better suited to.

"Has C really disappeared from common use in other places, to be supplanted by JavaScript/C#/Ruby/Python... ?"

Yes. Many other newer languages are more domain specific and so allow you to spend mental effort on solving the actual/business problem, rather then on lower level details.

"Would it be that Joel is simply a victim of his own "anecdote extrapolated has universal truth" syndrome?"

I have no idea what you're talking about.

Ash
+5  A: 

Outdated? mmmhh parhaps, but that's part of the beauty of the language, doesn't need any other features that those it already has.

I mean, you could say it is outdated because hasn't changed too much since its inception, but, it doesn't need to.

C will always be king, and the rest of the languages, will be based on it ( some way or another )

As for the domain, yeap, being the king doesn't mean it has be be omniscient. I have not professionally code in C ever. There are a lot of applications where C is not the best tool for the job. But for system programming there is nothing better than C, quoting Linus Torvalds:

...the only way to do good, efficient, and system-level [...][is] to limit yourself to all the things that are [...] available in C

OscarRyz
An argument from somebody else's opinion. Sagan's rule must applied here: always distrust arguments from authority.Write professional code in C for a few years and see what you think.
Tim Williscroft
+1  A: 

C will never be outdated because it sits a few hairs above the CPU in most cases. Unless CPU architecture changes fundamentally in the foreseeable future C will remain king where you need to sit right near the hardware.

The only change I can see would be toward language like Erlang where it's easy to leverage the concurrency available in modern multi-cpu systems. Even then, the types of language that leverage that kind of concurrency sit a fair way from the raw CPU code level.

I certainly wouldn't want to write anything that processes video in any language higher than C/C++; it'd perform like a pig.

C is being surpassed by other languages because most new languages make things like strings, hashmaps, arrays, etc part of the language or its CLR. When you program in C you have to be able to manage all those things yourself. In more modern languages you just don't care anymore... ie, in Ruby

h=Hash.new h['test'] = 'result'

Two lines to create a map structure and populate it with strings (not pointers to null terminated char arrays). In C that'd have taken a lot more lines and I'd have had to link to a library to manage hashed maps.

I think it's a shame that younger programmers aren't learning C because they're not learning how to really program the computer; programming in a language like C is a lot like cleaning your shotgun. It's enormously powerful but you can also blow your own head off if you're not diligent. It's a good language to teach programmers to be careful and think about what they're doing because it's so easy to stuff up.

Adam Hawes
A: 

I think you'll need a bit more clarity for your question in order to get a good response.

As many people have pointed out, C is certainly not the first choice for many types of applications. Even the most ardent C lover would be hard pressed to pick C for a web application over PHP, ASP.Net or Ruby. C is simply not meant for web applications.

On the other hand if you consider systems level programming, C is the first choice of many projects. Consider Windows, Linux and Mac OSX. All use C as the primary part of their kernel implementations. That's not a weird coincidence. These companies are picking the language best suited to their needs.

You can certainly argue that C may one day not be the standard for OS development (see projects like Singularity as an example. But right now, C is king here.

JaredPar
A: 

(Correct me if I am wrong here). The Microsoft Research Team is using C and ASM for the kernel and other low-level things on their C# OS.

C will never be outdated (with respect to your lifetime or mine possibly), but the number of things it will be used for will start to go down.

David Anderson
You're thinking of Singularity. http://research.microsoft.com/en-us/projects/singularity/
JaredPar
Well, C is what is used for OS design. There are some projects done in C++ but they have not proven to be very successful. As for Singularity, that's an interesting project but it gets a bit too much hype. It is mostly hyped from people who don't know much about OS research.
BobbyShaftoe
I have been watching the videos on Singularity and it is just cool stuff, however when Windows what at that stage I'd say the same thing. But know its in C# is even neater.
David Anderson
+2  A: 

-"If you don't have any other tool than a hammer, all your problems will look like a nail".

Joke aside. Before, c was used for everything. Now there is other tools in some areas (as stated above), but not in some areas (also stated above).

An in the areas like system programming and for the embedded world, c is really nice (and c is not outdated).

However as hardware will continue to be better, faster and smaller, the embedded world will move to other high level tools for some things... (much like what has happened in the normal PC world).

It is just a fact that you should use the right tool for the right job.

And c will continue to find it's own niche, and that niche will move a little from time to time (but that language is not outdated).

/Johan

Johan
A: 

One thing which was not mentioned. The backward compatiblity of C is one of the highest of all languages. I can not talk for Fortran or Cobol. There are just a few comparable languages like Common Lisp and Smallltalks, but that's mostly what there is. So even if C would be outdated, it still is used all over the world for the base infrastructure of nearly all our Operating Systems, Databases, Scripting Languages, Shells, Tools and heaven knows what else. However there are definitly problems with C and this problems were tackled with other languages or platforms. And I think currently we are in a very basic change. Till a few years the way for processors was just getting faster. This has really stalled the last 2-3 years. So it seems we are not near some physical limit and know we have the problem that one think will come into C s way. The reliance upon state, I can not see how C could overcome this barrier...

Regards

Friedrich
A: 

Maybe it is a bit outdated and mostly used for embedded systems, (real-time) operating-systems but personally I think it is very important to know and UNDERSTAND C since it's allways a plus to know the fundamentals.

If you know the historical evolution of programming or in that case of programming-languages, I find it a lot easier to learn and master new ideas and concepts.

"In the end it's all 1s and 0s.. "

Gambrinus
I get tired of all this "it's outdated and mostly used for embedded systems." How many applications on a typical server or regular home PC do these people think are written in Ruby or Python?
BobbyShaftoe
A: 

Old - yes, outdated - no.

Dev er dev
+2  A: 

The Spoken language analogy works well here.

Latin was spoken by the roman empire (who in their time were the top of their game) Over time different languages throughout europe formed. Each particularly prevelent to where they formed (French , English, German etc.)

Now to truly understand fundamental principle and application of these newer languages, a good grasp of latin really IS required and makes the transition between these languages much much easier.

OBv. C == Latin and C# (etc) == English , French (etc)

RAGNO
+1  A: 

"Is the C language really outdated?"

What a stupid question. What does "outdated" mean? What do you think, the compiler is going to stop working because it's outdated? You want to keep running your C program but you can't get the parts any more, because it's so old they don't make spare parts for your C program?

Actually, this is a real concern for maintenance of long lived system. Try to find a Phytos C compiler for 68K running on a Sparc 386 :) Of course, nothing to do with C per say.
Benoit
+3  A: 

Outdated? Look around:

Some famous software in C:

  • Most of the GNU utils (stuff you use on a daily basis on *nix like bash, gcc, make, etc)
  • The Linux Kernel
  • Wine (is not an emulator) like most of the native windows dlls
  • Vim and Emacs too
  • GIMP
  • Gnome
  • X.Org
  • PHP
  • Python
  • PostgreSQL
  • Apache HTTP server
  • SqLite
  • Git version control system
  • VirtualBox
  • lighttpd
  • Blender
  • GHC compiler for Haskell
  • SDL (Simple Directmedia Layer)
  • Lua
  • SVN (Subversion)

Also games:

  • Build engine (duke nukem, blood, shadow warrior)
  • Doom
  • Quake 1,2,3

C is still going strong where efficiency is a key factor.

Richard J. Terrell
Don't forget all those multimillion dollar games.....
Tim Ring
I have added some games
Richard J. Terrell
I'd argue that quite a few of these apps are outdated as well... Simply saying "these apps were coded in C" does not necessarily imply that C is the best tool that could have been used. In some cases it is, of course, but your list isn't in itself an argument for it.
jalf
What are you talking about? All of them -except for the games- are still being actively developed and used. This list proves what C is capable of, not that it is the best tool for everything.
Richard J. Terrell
And the notion "best tool" largely depends on your expectations. What matters is that in the end C does a great job. You can create both portable and fast software using it.
Richard J. Terrell
+1  A: 

This is that now classic The Parable of the Languages by Shelley Powers (which I believe was published as part of Joel on Software) book series has to say about C:

... Today, though, the group was quiet, much quieter than usual, because one of their members, PHP, was not its usual cheerful self. In fact, one could say that PHP was in a true funk, if one had a mind to say something like that aloud, or within the hearing of one's boss. Or doctor.

Why the blues, PHP, the other languages asked. All the languages that is but C, because all C ever said was "bite me", being a rude language and hard to live with, but still respected because it was such a good worker.

And PHP answered:

All I ever do, day in and day out, is work and work and work. The only time I'm noticed is when I break, and then I'm cursed and kicked, and roundly blasted for being useless. However, when things go well, I never get a kind word.

There's no notice of my ease of use, my elegance, my simplicity. Only my failures. ...

Totophil
That's because there are a LOT of failures with that trainwreck of a language.
temp2290
+2  A: 

Whatever your personal taste is (I'm a Python fan), C is used a lot in important applications, not just in the embedded world. These applications are used daily by almost anyone. Yes anyone, since everybody and his grandmother uses the Internet and a good part of the Internet infrastructure relies on servers written in C.

All are actively maintained so C is not just for legacy code. Recent competitors of these programs (such as NSD and Unbound as competitors to BIND) are in C, too.

bortzmeyer
+4  A: 

In a way. The C language is still widely used, and it is still the best language available for a range of tasks. So it is certainly not useless or anything like that.

However, I believe that if we were starting from scratch today, we'd have been able to make a far nicer, cleaner and more powerful language to do the same job as C. So in a sense it is outdated in that "we could do better today". But of course, we don't, because we already have our codebases in C, we already have established C compilers, we know C, so it's just not worth the effort of inventing a new language to replace it.

It's the same reason that D will probably never kill off C++. Sure, it's better when seen in isolation, because it learned from C++'s mistakes. But it's not so much better that people will ever abandon C++ in favor of it. It's not so much better that we're willing to ditch our mature compilers, debuggers and other tools, our existing codebases, our hard-earned C++ skills and everything else just for the incremental improvements that D offers.

But in that sense, you could say that C is "outdated". Not because it's not useful, or isn't the best tool available for a wide range of jobs, but because "were we to design a tool for these jobs today, we could probably do a better job".

But of course, it'd also be silly to deny that there are a lot of roles where C was once used, where it has now been more or less replaced by other languages. C++, Java, Python, Ruby, PHP and countless others.

And of course, C is the lingua franca in programming. Every language is able to interface with C, so when Python code has to interface with Java code, they go through a C API.

jalf
A: 

c is latest language which i ever had. I like self-hosting programming language.

Although, these day, X boom : Y programming language with Z virtual machine.

plan9assembler
A: 

Of course not!! There's a lot of applications that need to be written in C/C++:

Embedded devices

Drivers

programming for pics or DSPs.

Signal and image processing use a lot of C.

Programming for any device with limited memory or processor speed.

Dlls

Many SDKs are written in C++. This is also the language for Linux.

C# and Java are C-inspired. If you program in C, it will be easy to start with C# or Java.

Matlab is also written in C, and it's C compatible (Matlab is a programming language/environment for science and engineering).

yelinna