News for hackers. Stuff that matters.
Re:How can C Programs be so Reliable? by jd on Tuesday November 11, 2008 @08:34PM (#361237)
People often write in higher level languages because they want lots of bad code fast. Almost all business applications are CRUD apps (create/retrieve/update/destroy) with some business logic, and they're generally written in C#. The app may crash when you click the wrong button, but the app is cheap to develop and the programmers are easily replaceable.

Of course I'm generalizing, and a lot of C# programmers write great and reliable code. The point is that they often don't -need- to write great code, because lousy code is good enough for all business purposes (except when the software is your product, which is rarely the case).

The second issue is that people who choose C for their projects tend to (a) understand low-level concepts, (b) care about speed / memory usage / reliability / dependencies, (c) don't consider development time that important. That you create more reliable software that way is obvious - the same programmers would create reliable software in C# (or similar language). But there aren't many situations in which development speed doesn't matter, speed and memory usage don't matter, dependencies don't matter but, for some reason, reliability is very important.

Re:How can C Programs be so Reliable? by scott_s on Tuesday November 11, 2008 @09:30PM (#361291)
I come from the systems research world. I've seen people choose C not for the reasons you mention, but just because it's what they know best. This is not always the best thing to do.

One instance is a colleague who needed to do data post-processing, and just did it in C because it was most familiar. A language like Perl or Python would have been a better choice, and saved him time in the long run, since string manipulation in C is tedious and error prone.

Re:How can C Programs be so Reliable? by bsaunder on Wednesday November 12, 2008 @09:22AM (#361813)
Your colleague may be interested in pcre (perl compatible regular expressions) see http://www.pcre.org

But I agree, C isn't the best choice for that task.

Re:How can C Programs be so Reliable? by luckystrike on Wednesday November 12, 2008 @05:16AM (#361662)

  People often write in higher level languages because they want lots of bad code fast. 
I assume you simply meant programmers who want to churn out something quick prefer high level languages. (Majority of them would never like to write 'bad' code intentionally)

Your second assertion is spot on. If one needs to develop a high performing solution optimized for speed and memory consumption, plus high reliability and if it also needs to be reasonably cross platform, one would gravitate towards C. Add to this the established heritage/ecosystem and the tools, and availability of a (relatively) big pool of programmers, C tends to be a good choice.

The only con is a relatively longer development cycle. (True only for mortals like me though, some people stream out C code faster than i write an email. :-) )

Re:How can C Programs be so Reliable? by nihilocrat on Wednesday November 12, 2008 @08:48AM (#361795)
Just do what the gaming industry has been doing for awhile (in various ways).... core libraries / engine in C/C++ with higher-level logic in a higher-level scripting language.

This gives you the advantages of a high level language where the extra overhead and consequences for coding a little poorly aren't as detrimental.

Re:How can C Programs be so Reliable? by luckystrike on Wednesday November 12, 2008 @08:56AM (#361802)
Yes, we are doing something similar currently. A combination of C & Ruby is working out quite well. (The product is for the Ruby domain so the high level language choice was very straightforward.)
Re:How can C Programs be so Reliable? by brlewis on Wednesday November 12, 2008 @09:06AM (#361805)
Yes, lots of bad code fast is half the reason I use Scheme almost exclusively now after 12 years of C. The other half is converting bad code to good code fast.
Re:How can C Programs be so Reliable? by greyman on Wednesday November 12, 2008 @04:26AM (#361639)
Interesting perspective. I was programming a long time in C, C++ and C#, and I don't feel that programming in C# is easier in some fundamental way, or that C# programmers are easily replaceable. Yes, the mode of thinking is different in each language, but the issue that you have to think carefully is basically the same. ;-)
Re:How can C Programs be so Reliable? by lhorn on Tuesday November 11, 2008 @10:40PM (#361353)
I am not sure why are you bringing enterprise software into the discussion. Despite being the most popular form of employment for "programmers" it has always been the absolutely lowest form of life in a software ecosystem and, therefore, should be ignored and left out of any intelligent discussion about programming.

In the 90s it was Visual Basic, now it's Java and C#, but it has absolutely nothing to do with what most of us consider to be discussion worthy.

Re:How can C Programs be so Reliable? by jwilliams on Tuesday November 11, 2008 @10:44PM (#361356)
> Despite being the most popular form of employment for "programmers" it has always been the absolutely lowest form of life in a software ecosystem

It just runs our banks, hospitals, governments... Much better to solely focus on those that write kernels, device drivers and filesystems?

Re:How can C Programs be so Reliable? by lhorn on Tuesday November 11, 2008 @11:07PM (#361374)
So? Despite being useful, what's so interesting about CRUD programming for the enterprise? I've been there, I've had my share of dealing with coworkers that openly admit that they haven't touched a single book since graduation 10 years ago and they see no reason why would they want to.

That's the kind of programmers this industry attracts, and that's the kind of software it builds. What's so interesting about it? Why even bother mentioning these numerous java/C# jobs? My ex-wife with zero programming experience has trained herself in less than a month to run a simple SQL queries in Visual basic and blast results in a grid control on a form, so did thousands of ex-taxi drivers in late 90s. So?

Re:How can C Programs be so Reliable? by jwilliams on Wednesday November 12, 2008 @12:01AM (#361424)
> My ex-wife with zero programming experience has trained herself in less than a month to run a simple SQL queries in Visual basic and blast results in a grid control on a form, so did thousands of ex-taxi drivers in late 90s. So?

To be honest, I'm still not sure what point you're trying to make is. At best it's somewhat of an Ad Hominem attack.

Re:How can C Programs be so Reliable? by lhorn on Wednesday November 12, 2008 @12:35AM (#361458)
I am arguing against this line:

"People often write in higher level languages because they want lots of bad code fast."

Even if this is true, it's true only in enterprise software environment where code quality has never been terribly important. Therefore it can't really be an argument against higher level languages in the context of a typical HN discussion.

Makes sense?

Re:How can C Programs be so Reliable? by rglullis on Wednesday November 12, 2008 @01:10AM (#361503)
No, it doesn't.

I'm in no way trolling here, but if you think about it, most of the guys working on startups are also producing lots of bad code fast. The only difference is that most of them are aware of it, and will improve the code based on the requirements from the market.

Re:How can C Programs be so Reliable? by mixmax on Tuesday November 11, 2008 @11:45PM (#361405)
I think how interesting it is depends on your interest.

If you are heavily into programming, as it seems you are, I can understand that SQL queries seem trivial and boring. If your interest is elsewhere programming is often just a tool used to create the interesting stuff. Whether that is usability, design, getting people to interact in new ways, launching rockets or automatically turning off your garden lights when your computer powers down.

Believe it or not there are interesting discussions to be had about other things than programming.

Re:How can C Programs be so Reliable? by jmtulloss on Wednesday November 12, 2008 @12:24AM (#361445)
But this article isn't about those things.