6 ms·
I think that any programmer worth their weight must disagree with the larger message you're giving here. C does _not_ suck at networking, concurrency, security
by wcarss 17y ago
I think that any programmer worth their weight must disagree with the larger message you're giving here.
C does _not_ suck at networking, concurrency, security, or readability.
Most code you write in a 'modern language' like Java, Python, or something similar, is implemented on a very low level in C. So those nice, clean, safe networking functions Python pulls out of nowhere are just well written C code being presented to the user through layers of abstractions. The same goes with modern type-safety and security (that 'proofed' kernel from a few days ago was Haskell mapped into C).
From a readability standpoint, C represents a tradeoff. The core C API can be kept in its entirety in a programmer's mind. Starting from scratch, you are able to know (essentially) every language feature C has, how to use it, and what side-effects it could cause. Compare this to Java, Python, or even C++, and you get into a scary world that's just too big to keep in mental RAM all at once - but a lot closer to english and more compact.
There was an article which came out a few days ago talking about how C has been and will continue to be the top choice for software over C++ _and_ assembly in embedded projects over the past 12-15 years. Given that embedded systems make up something like 98% of the computer market and the number of computers grow with each passing year, the argument should flow the opposite way:
Every year that goes by, C becomes more useful.
In addition, it's an ideal language for teaching the notion of pointers, the reasons for security, the value of good program structure, and yes, it's difficult. If you teach people to be comfortable dealing with C, they'll feel like Python is pie. (or.. py :P)
All that said, I cannot disagree with the value of functional, object oriented, or other paradigms being taught to students. Many people do not really learn to deal with recursion until they've learned a dialect of Lisp. Many people do not really learn the power of design patterns and the object model until they've written something in a high level language that uses it (take your pick).
The fact that these are good things to be exposed to and to use does not in any way diminish the importance or usefulness of C for both career programmers or computer scientists.
tl;dr: "C is still good too homg"
- defunkt 17y agoI took classes on C in school. I never really "got it." I then re-learned C after learning Python (and other higher level languages). I found it much easier to learn on the second try. On the first try I was learning about syntax, functions, loops, variables, and types as well as memory management, header files, and pointers. On the second try I was only learning about memory management, header files, and pointers - I already knew about the other stuff. On top of that, pointers were much easier to grasp because I had experience with 'references' in higher level languages. It's great to learn C, but I always recommend people learn to program by way of something like Python or Ruby. It's hard to beat print "hello" when you're just starting out.
- cema 17y ago(Almost) everything is easier to learn on the second try. Also, keep in mind you learned Python after C, so your experience is not clearcut.
- defunkt 17y agoExcept I never learned C the first time. That's the point.
- cema 17y agoSo you did not learn it, but you were learning it. Maybe you could not write a good working program in C, but you became aware of a number of concepts that you could build on later when learning other languages and when learning C the second time.
- ynniv 17y ago> C does _not_ suck at networking, concurrency, security, or readability Yes, it does. You will not find buffer overflows in JavaScript. You will not find threads in haskell. You will not see polling loops or select with switch dispatched networking code in Seaside. Your program will be easier to read in python or JavaScript (depending on your block syntax preference). You say that C doesn't suck at these things, but it is more realistic to say that it is possible for these things to be done correctly in C. It is more likely that they will be done incorrectly in C than in other languages. Maybe the result will be slower, maybe it won't run on your watch, but correctness is more important than speed. Speed (of instruction) is easy to fix - just wait a year. Better to get your program correct and your algorithms efficient than to waste your time on speed. > The core C API can be kept in its entirety in a programmer's mind I'm not sure what that means, and I'm fairly certain that you aren't taking into account the complexities of modern compiler runtimes and CPU instruction reordering. If you think that the assembly output and runtime characteristics of C programs are simple, you haven't looked recently. More practically, I can keep as much of the python "API" in my mind as I generally use. Do you include common libraries in your definition of "API"? > Given that embedded systems make up something like 98% Well thats a useless statistic (and I hear that 90% of statistics are made up on the spot). Are you suggesting that 98% of programming jobs are for embedded systems? > Every year that goes by, C becomes more useful. That must be why the number of C books decreases every year, and why new app platforms use python and Java. C is a really easy language to port to new hardware. It runs in very constrained environments, like tiny embedded systems. It is a generally useful language to know as a computer science major. It is a common language because worse is better, but when it comes to laying the groundwork for your programming career, better is actually better. Practice doesn't make perfect, perfect practice makes perfect. > If you teach people to be comfortable dealing with C, they'll feel like Python is pie No they won't, they'll think that Python is C with garbage collection and no curly braces. People who learn C first write programs that look like C no matter what language they're using. I'm not purposely trolling here, it is my opinion that C is a poor language to teach students. If you find Lisp and Smalltalk to be too removed from industry, lets use python.
- haberman 17y ago> I'm not purposely trolling here, it is my opinion that C is a poor language to teach students. If you don't teach students C, you're denying them a deep understanding of how all of the higher levels are implemented. If all you know is Python but I know Python, C, UNIX system calls, and even assembly, I'm going to run circles around you, even if we're both working 100% in Python. For example, suppose your Python program says "import foo", but it's not finding module "foo". How can you debug what is happening? I'm going to take two seconds and run strace on the program to see what files the process is trying to open. You're going to... read some docs? Post a question on a message board? Or suppose that your Python program tries to do an open("foobar", "w") but the open fails with: IOError: [Errno 26] Text file busy: 'test' I'm going to look at the manpage for open(2) to figure out what this error means. You're going to... go ask somebody who understands system software? People who don't understand system software are totally helpless compared to people who do. You may see C fading into history. What I see is every single relevant technological innovation -- 2nd-gen JavaScript interpreters, Flash, the JVM, .NET, browsers, OS's -- ALL using C or C++. I would challenge you to look around and find ANY stack of software that doesn't have C or C++ in it. It's just a matter of how deep you have to go to find it. Are you saying that we shouldn't equip students to deal with layers of software that deep? Are you saying we shouldn't equip them to understand things like trace compiling, which are the state of the art in language design and implementation? Sure, if all you want to do is web development, you can probably go a long ways without understanding system software. But you'll always be dependent on the people who understand the stack up and down.