back

by ColinWright·15y ago·view on hn ↗
<fx: sigh>

For some things, C++ is better than C. For some things Lisp is better than either, and for yet other things, Python is better than them all.

Why are people so insistent on declaring their view is absolutely right, with no arguments, everyone else is wrong, and that one language will rule them all?

Trust me. For some things I do, C is vastly superior to C++, but I'm not going to try to convince everyone that C is better than C++ (or anything else) for everything that anyone wants to do.

That would just make me look stupid.

4 comments
I think much language criticism miss the non-technical context which influences which language is the best tool for the job. We are good at providing technical arguments (Erlang is fun if you need concurrency, C is cool if you need to get close to the metal), but there are important non-technical issues.

Things like: How many people is on the team who have to work on the code? How big is the turnover among the developers? How experienced are they? How long is the code going to live? Will some people have to jump in and fix bugs in the code on short notice?

For example, I have noticed that I prefer a nice clean dynamic language like Python when I know I am only person on the project. But in cases where I had to work on and improve code of a dubious quality, I much prefer it to be in C#, since type analysis makes it a lot easier to figure things out and refactoring in a safer way.

To put it another way: I like to work with nice clean code in Python or Haskell, but when I have to work with bad code, I prefer to work with bad C# code.

I think you know you've cracked when you prefer bad C# to clean Haskell.
Bad C# over bad Haskell, I think.
I have a... secret wish? private fantasy?... where I take a moderately complicated problem and outsource it to a known bad outsourcing company, but rigidly require that they write it in Haskell. Just to see what pops out.
Edited to be less ambiguous :)
Are you saying that you can do better type analysis in C# than in Haskell?
Indeed.

This article is more "why C++ makes this particular program easier to write" and is in no way any proof that C++ is better than C.

On the other hand, I don't think I've ever written a program that doesn't use containers, manage memory, and handle errors.
C and C++ have considerably overlap in use cases, which is what makes this argument valid.

Comparing C or C++ to Ruby or LISP is stupid.

Directly, yes.

But comparing C or C++ to C# isn't completely off the mark. And comparing C# to Java isn't crazy either. And once you're at Java, there are plenty of cases where a comparison to Ruby or Lisp makes sense.

So anytime a use case starts in Java (web, mobile, and desktop applications), I think there are very good comparisons to be had on which direction to go.

I don't think this article is about declaring C++ the ruler of all languages.

If you have an example of C being a better fit for a problem than C++, feel free to share it.

Embedded systems, 128 bytes of RAM. I really do just want portable assembly.
But you don't have it, unfortunately. At that level C is just as unsuitable. Time to break out your assembler. ;)
To put that in perspective, 128 bytes is an x64 program's stack's red zone. :D
> If you have an example of C being a better fit for a problem than C++, feel free to share it.

http://www.kernel.org/pub/linux/kernel/v2.6/