C# and C++
Members - Reputation: 118
Posted 20 September 2012 - 09:05 PM
PS: If the difference is. for example, if a project takes 1 year in one in the other it takes 1 year and 10 days then the difference doesn't matter to me as 10 days is not a lot of time
Moderators - Reputation: 42118
Posted 20 September 2012 - 10:41 PM
I think it's less bullshitty, if you factor in both the experience of the language user and importantly the nature of the problem that you're trying to solve.I call bullshit.
As long as the developers are experienced with the chosen language, it will not make a lot of difference in development time.
There will be some small set of problems where it will be quicker for an experienced author to solve it in C++ rather than C#.
e.g. "refactor this collision detection system so that it generates no more than 5 cache misses per frame".
I'd say (IMHO) this kind of task is more suited to C++, but if the code was in C#, and I was a C# expert, then I'd be able to use explicit struct layouts, etc, to achieve the same results in a similar time.
As usual, generalizations only give us a general idea of the truth.
It depends on the problems being solved. I use both languages professionally -- about half my code is C# and the other half is C++.
So bottom line, does it take more time or not??
For the half of the code-base where C# is my chosen language, I do find it to be much less taxing on my brain energy...
Edited by Hodgman, 21 September 2012 - 02:14 AM.
Senior Staff - Reputation: 23493
Posted 20 September 2012 - 11:53 PM
Unfortunately, the "bottom line" answer has to be it depends.
So bottom line, does it take more time or not??
It depends on the knowledge and experience of the programmer in question. It isn't always enough to figure out the syntax of a language and be able to write a syntactically correct and error free program; if you haven't also adjusted to the style and idioms of that language you might still be using it in a sub-optimal way. A programmer who knows a language brilliantly might still be less efficient at solving a particular problem if they happen to be unaware of the library or a specific language feature that can help to solve that problem.
It also depends on the problem at hand. Certain problems are better expressed in different languages, and otherwise equivalent solutions in two different languages may have vastly different performance. In some cases certain problems become trivial in certain languages thanks to specific language features or existing solutions provided by libraries.
I'd have to agree with this. There isn't a universally applicable answer to your question, but my own personal attempt at a general answer might be:
As usual, generalizations only give us a general idea of the truth
"for most people, programming in C# is generally more productive than programming in C++ unless the problem at hand is poorly suited to the language, assuming they have taken the time to properly learn the language and libraries available."
I'd still strongly advise taking a little time to try both languages yourself, and then make your own informed decision based on your own initial impressions and experiences. Where there might be a huge productivity advantage for one programmer, there might be only a small one -- or even a disadvantage instead -- for you. C# can be significantly more productive than C++, but it might not be for you. You'll have to spend a little more time doing your evaluation, but if you really value your time in the long run it should get you the best result1, as you'll be able to make a decision that matches your needs rather than relying on a general case or the experiences of others.
You know what the least productive thing you can do is?
Spending forever trying to choose between two languages rather than actually getting started. Ultimately, both are very capable languages that should be able to meet most -- if not all -- needs you are likely to have. It's possible that you might be more productive with one of them rather than the other, but it's a certainty that you'll be more productive using either of them rather than spending day-after-day trying to choose between them.
Either start going about the process of trying both so that you can make an informed opinion, or just pick either one -- flip a coin if you're still not sure but don't want to spend time trying both -- and get started learning! You could spend months researching and asking questions without getting better answers than you've already received, or in the same time you could possibly finish your first game!
1Assuming you mean that you have limited time per-day rather than a strict deadline such as a 6 month period in which you must complete a project. If you're dealing with a strict deadline pick either language and get to work!
Hope that helps!
- Jason Astle-Adams.