3 ms·
I don't think that's true. Let's pick the Node.js ecosystem for an example (chosen because I use it very little, so I'm not hyping up my own pet language). Lots
by kstrauser 10y ago
I don't think that's true. Let's pick the Node.js ecosystem for an example (chosen because I use it very little, so I'm not hyping up my own pet language). Lots of non-expert programmers are writing Node packages, both for their own in-house use and to share with others. I'm going to assert that the average Node user has fewer years programming than the average C user. And yet, they seem to have fewer critical vulnerabilities per amount of code written. They still make mistakes all the time, sure! But they're a higher class of mistakes, more "this sets the wrong HTTP status code" and less "this exposes kernel memory to remote users". JavaScript handles the low-level abstractions so that its users can concentrate on breaking the higher-level stuff, hopefully in ways that are easier to test and notice.
Also, almost every language has a way to use C code directly (For example, see Go: https://golang.org/cmd/cgo/ https://golang.org/cmd/cgo/). C may be the best way to write low-level driver code. If it is, use it for that! I'm not convinced that there's a single best language for Ethernet card drivers and HTTP stacks, though.
- taeric 10y agoWhat systems are we talking about, then? Few people are writing stuff in C/C++ nowdays. And the fields that do this on a regular basis are pretty much unchallenged by any of the higher level languages. And, agreed, on truly expert systems, things do go polyglot. This has been true since pretty much the beginning of computers. I'm not sure what sort of evidence this provides, though. So, to bring it directly to point. Where is the evidence that the systems people typically write in C could be written well in another language? About the best I have seen is some system utilities written in rust. Which is awesome, no doubt. And the beginnings of the evidence I'm asking for. (To be fair, we often speak of mysterious wizards that wrote the symbolic lisp systems as though they succeeded at this. I want that to count as evidence, but it feels more like hearsay.)
- hodgesrm 10y ago(Now arguing the other side...) There is a case for looking at safety issues in C. Reducing the possibilities for mayhem from null pointers would be helpful. What I don't fully understand is critiques of C that lump safety issues in with use of braces or semi-colons.
- taeric 10y agoA lot of the safety issues in C have been decently solved, though. You just have to use a larger tool chain than just the compiler. (Valgrind, coverity, etc.)
- hodgesrm 10y agoFair point, I think what's missing from some of the discussion here is that very few languages are productive without an effective toolchain.
- taeric 10y agoYeah. I have tried times in the past to make sure folks don't just think in terms of language, but full toolchains. I confess I am not good at that thinking, either. :(
- hodgesrm 10y agoBut it seems the OP's implicit point was that C is not the right language for higher-level operations. For low-level access it's not very obvious what else you would use. Personally I rarely use C because I currently write network services with REST APIs. C is close to worthless for that purpose for many reasons, not just errors. It's analogous to writing an accounting app in assembler. Most people stopped doing that in the 1960s.
- pjmlp 10y ago> For low-level access it's not very obvious what else you would use. Extended Algol, created in 1961. Almost 10 years before C. There are tons of other examples. C got widespread thanks to UNIX, just like a few decades later, JavaScript got widespread thanks to Web 2.0 and the browser. > It's analogous to writing an accounting app in assembler. Most people stopped doing that in the 1960s. Lotus 1-2-3 was initially written in Assembler, Ι will let you track down when it was created. My last 100% Assembly program was for MS-DOS in 1996.
- hodgesrm 10y ago> Lotus 1-2-3 was initially written in Assembler, Ι will let you track down when it was created. Interesting! I did not know that. I would still stand by the point that application programming by the end of the 60s was leaving the Assembler era and moving on to languages like COBOL and FORTRAN. (And weird cul-de-sacs like RPG which was my second programming language after BASIC.)
- pjmlp 10y agoThis was true on mainframes and workstations. At 8 bit and 16 bit computers target for consumers it was a different story. Forth, Basic, Pascal, C, Amos, Modula-2, Clipper were the "managed languages". Anything that required performance was written in Assembly, or high level in such "managed language" (Turbo Pascal on my case) with lots of inline Assembly.
- ksk 10y agoIMHO, people constantly introduce vulnerabilities when using high level code. Most websites are defaced this way. They're not exploiting flaws in Apache or IIS anymore. Its the Python or PHP or Node.js application or wordpress blog or similar that doesn't sanitize user input or has a buggy web api.
- jerf 10y agoA C program talking to the web will have memory vulnerabilities, encoding vulnerabilities, and business logic vulnerabilities. A modern program talking to the web will have encoding vulnerabilities and business logic vulnerabilities. It's still progress. There are cutting edge stacks which will effectively eliminate the encoding vulnerabilities, too, leaving more-or-less just the bugs you put in. (Obviously I'm simplifying the types of vulnerabilities that exist to make a point.)
- ksk 10y agoWell, you could make another argument too. Given X amount of time in a day, a C programmer can't really pump out _that much_ business logic code because they're also dealing with the other lower level stuff. A high level language OTOH allows you to be more productive in terms of the business logic stuff, and therefore, I'm using a rough metric here, more lines of code, which also means more bugs in the business logic. Like you said, these are all simplifications, but I think the primary problem is that people undertake projects that are way above their competency level. Edit: If we could get some multiplayer-game like matching system where you are matched with the project depending on your skill level that would be awesome.
- dmitrygr 10y ago> fewer critical vulnerabilities per amount of code written Because nobody uses node.js in serious infrastructure. Show me a serious ISP whose DHCP server is written in node. Know any whose DNS server is written in node? Your statement is equivalent to: we should build bridges out of legos and not out of concrete because fewer people have been killed by collapsing lego bridges