Comment C Just works (Score 4, Insightful) 535
The bulk of my recent programming has been in Objective C but once I leave API calls my code quickly becomes pretty classic C with elements of C++. Yes I love the simplicity of a foreach type structure where it is brain dead to iterate through some set/hash/array of objects with little or no thought about bounds but once I start to really hammer the data hard I often find my code "degenerating" into c. Instead of a class I will create a structure. Instead of vectors I use arrays. I find the debugging far simpler and the attitude to what can be done changes. In fairly raw C I start having thoughts like: I'll mathematically process 500,000 structures every time someone moves their mouse and then I literally giggle when it not only works but works smoothly. What you largely have in C is if the machine is theoretically able to do it then you can program it. Good mathematics can often optimize things significantly but sometimes you just have brute manipulations that need to be fast.
But on a whole other level my claim with most higher level languages ranging from PHP to .net to Java is that they often make the first 90% of a large project go so very quickly. You seem to jump from prototype to 90% in a flash; but then you hit some roadblocks. The garbage collection is kicking in during animations causing stuttering and the library you are using won't let you entirely stop garbage collection. Or memory isn't being freed quickly enough resulting in the requirement that all the users' machines be upgraded to 16Gb. Then that remaining 10% ends up taking twice as long as the first 90%. Whereas I find with C (or C++) you start slow and end slow but the first 90% actually takes 90% of the final time.
But where C is a project killer is the whole weakest link in the chain thing. If you have a large project with many programmers as is typically found in a large business system working on many different modules that basically work on the same data set that a safer language like Java is far far better. I am pretty sure that if the business programmers working on projects that I have seen were to have used C instead of Java that those server systems would crash more than once a minute. You can still program pretty badly in Java but a decent programmer shouldn't blow the system apart. Whereas a decent C programmer might not be good enough for a large project.
So the story is not if C is better than say Java but what is the best language for any given problem set. I find broad systems, like those found in the typical business, with many programmers of various skill levels are idea for Java. But for deep system where you layer more and more difficulty on a single problem such as real-time robotic vision that C or C++ are far superior. A simple way to figure out what is the best language is to not compare strengths and weaknesses generally but how they apply to the problem at hand. In a large business system where horsepower is plentiful then garbage collection is good and pointers are only going to be a liability. But if you are pushing up to the limits of what the machine can do such as a game then a crazy pointer dance might be the only possible solution and thus demand C or even ASM.
Lastly do you want your OS programmed in Java?
But on a whole other level my claim with most higher level languages ranging from PHP to
But where C is a project killer is the whole weakest link in the chain thing. If you have a large project with many programmers as is typically found in a large business system working on many different modules that basically work on the same data set that a safer language like Java is far far better. I am pretty sure that if the business programmers working on projects that I have seen were to have used C instead of Java that those server systems would crash more than once a minute. You can still program pretty badly in Java but a decent programmer shouldn't blow the system apart. Whereas a decent C programmer might not be good enough for a large project.
So the story is not if C is better than say Java but what is the best language for any given problem set. I find broad systems, like those found in the typical business, with many programmers of various skill levels are idea for Java. But for deep system where you layer more and more difficulty on a single problem such as real-time robotic vision that C or C++ are far superior. A simple way to figure out what is the best language is to not compare strengths and weaknesses generally but how they apply to the problem at hand. In a large business system where horsepower is plentiful then garbage collection is good and pointers are only going to be a liability. But if you are pushing up to the limits of what the machine can do such as a game then a crazy pointer dance might be the only possible solution and thus demand C or even ASM.
Lastly do you want your OS programmed in Java?