1
DF General Discussion / Re: What programming language?
« on: May 15, 2010, 10:56:16 am »It's up to you, as a developer, when your errors will show themselves; unit testing is one way, and neat little tools like Toady's arena are another. Very simple errors will be caught by a compiler, but they'll rarely go unnoticed by a capable programmer for long. I don't think I've lost more than an hour or two in every hundred to tracking down bugs caused by typos (in languages without declarations) and I've certainly gained more than that by not feeling constrained by declarations. It's all a matter of style and self-discipline in the end, even in C. (It's amazing what you can get away with.)
Have you ever tried a really high level language like Mercury or Haskell? I've had the compiler catch some pretty deep bugs that would have been a real pain to track down. I'm not just talking easy to catch type mismatches - Mercury for instance also tests the determinism if the code (is there a case that might fail? Is there an undeclared ambiguity?). I've found that once it compiles, it probably works (although the error messages are even worse than the ones given by C++ when using STL, which can make the learning curve horrible). Testing, unit tests, etc. are still important, but even as a very experienced programmer, I'll take all the help I can get to keep the bugs out of my code.
I agree that C and C++ are different languages (I use both, and declare them separately on my CV). C is great for embedded stuff, C++ for larger projects, and it's a travesty when C++ is taught as 'C with nicer output functions'.