Jump to content


difference between C# C++ and Basic


38 replies to this topic

#21 Mihail121

    Senior Member

  • Members
  • PipPipPipPip
  • 1059 posts

Posted 16 February 2011 - 04:39 PM

With usability I mean the standard combo of effectivity, efficiency and user-satisfaction with respect to some goal. C++ is just archaic in the sense that the user is expected to do quite a lot and the compiler is assumed to be rather dumb. Well modern compilers are quite smart so languages can be simplified which in turn requires less reading and reduces the price of software (while quality is high enough).

While I don't expect Smalltalk-like standard library from any language other than Smalltalk, C++ fails to meet even basic principles of code reuse. It's easy to reuse primitives like strings, stacks, vectors etc., but managing COM objects, service containers etc. becomes quite hard (don't give me the ATL argument). Managing Java Beans on the other side is quite easy.

The whole purpose of C++ is performance and some code reuse, but I believe only the first goal is achieved and that particular goal is achievable with pure C as well. Can you really tell your customers you'll boost the price of the product by $10 just to get one additional frame per second? Nope. Will they be happy that I can generate half of the code base from nicely structured, understandable, domain-specific UML models and then manually link the rest of the puzzle? Yes!

There is no single truth of course, but writing a whole game in just C++ sounds quite a bit of an overkill.

#22 alphadog

    DevMaster Staff

  • Moderators
  • 1716 posts

Posted 16 February 2011 - 05:09 PM

You've conflated a lot of different issues.

For example, COM is a framework. In fact, Microsoft bills COM as a language-neutral concept that allows objects to communicate across systems, platforms, languages, etc. And, managed C++ is different from the broader concept of the C++ language itself.

Take C++, sprinkle in the right few libraries as needed, so as to minimize the amount of code you have to write in your project, and it's no less effective, efficient or satisfying that C# or Java.

The only difference is that C++, without libraries/frameworks, does less for you than C# without libraries/frameworks. That can be both a curse and a boon. What if you don't like how C# garbage collects? What if you have an actual need for multiple inheritance? What if you could make efficient use of pointers and be really user satisfied by it?

But, although the road you took seems wrong to me, the final conclusion is something I agree with: writing a whole game these days in C++ may not be your best option. Writing the non-critical parts in a productive, higher-level language like C# or Python, and cutting in the performance-critical parts with C is a useful, best-of-breed approach.
Hyperbole is, like, the absolute best, most wonderful thing ever! However, you'd be an idiot to not think dogmatism is always bad.

#23 juhnu

    Valued Member

  • Members
  • PipPipPip
  • 292 posts

Posted 16 February 2011 - 11:03 PM

alphadog said:

Take C++, sprinkle in the right few libraries as needed, so as to minimize the amount of code you have to write in your project, and it's no less effective, efficient or satisfying that C# or Java.

One problem with C++ in this scenario is that it doesn't have commonly accepted coding conventions, programming patterns and rich enough base API. This means that every library must implement it's own coding standards, which means libraries do not fit well together and have different look'n'feel in them: starting from basic error handling to parameter passing, memory handling. Even worse thing is that since there is no rich enough base API to use, every library must use a framework of some sort to do similar things. There are lots of boilerplate you need to write to make things interoperate in a nice way and it's not prettly really and even worse - it's not efficient in any way.


Quote

The only difference is that C++, without libraries/frameworks, does less for you than C# without libraries/frameworks. That can be both a curse and a boon. What if you don't like how C# garbage collects? What if you have an actual need for multiple inheritance? What if you could make efficient use of pointers and be really user satisfied by it?

You are right that there are some features in C++ that someone might favor, but don't forget that there are many constructs in modern languages that are simply impossible to do in C++ in a sane way. For example C# has LINQ, support for anonymous delegates, etc. which have no C++ counterparts at all.

Quote

But, although the road you took seems wrong to me, the final conclusion is something I agree with: writing a whole game these days in C++ may not be your best option. Writing the non-critical parts in a productive, higher-level language like C# or Python, and cutting in the performance-critical parts with C is a useful, best-of-breed approach.

This one I think we all agree on, but that said I think that most games could do without C-coded parts completely and not even notice it.

#24 alphadog

    DevMaster Staff

  • Moderators
  • 1716 posts

Posted 17 February 2011 - 12:03 AM

juhnu said:

One problem with C++ in this scenario is that it doesn't have commonly accepted coding conventions, programming patterns and rich enough base API.

Unless I misunderstand you, this is an issue pretty much for any language. Are you saying that all C# library/framework writers write with the same conventions and patterns, and create similar look-and-feel APIs?

juhnu said:

You are right that there are some features in C++ that someone might favor, but don't forget that there are many constructs in modern languages that are simply impossible to do in C++ in a sane way.

And, vice versa. That was exactly my counterpoint to Mihail121... perhaps poorly made. My point was that generally-speaking, selecting a language is selecting tradeoffs. C++ is not universally less useable, in toto, than C#. But, with that said, yes, there are tradeoffs. An OO language will be different than a functional language.

juhnu said:

For example C# has LINQ, support for anonymous delegates, etc. which have no C++ counterparts at all.

Sure. And, C# isn't quite on par with Haskell. For example, the Haskell system of type classes is more "powerful" than the generic type system in C#.

As my own counterpoint, lambda functions and expressions are in the C++0x specification, and is already part of many compilers. So, you can get some lambda sugar in your C++, if you crave for it. But, you should make one type of language pretend its another. :)
Hyperbole is, like, the absolute best, most wonderful thing ever! However, you'd be an idiot to not think dogmatism is always bad.

#25 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 17 February 2011 - 08:08 AM

TheNut said:

:)
I wasn't trying to be funny or sarcastic, I'm sorry if I came across that way. Mihail spoke about "idiotic revisions" that made it completely unusable. Since he couldn't be talking about C++ (as it only had 1 revision since standardization, in 2003, and the next one on the way - both of which are far from idiotic let alone made it unusable), I assumed he must've been talking about something else.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#26 juhnu

    Valued Member

  • Members
  • PipPipPip
  • 292 posts

Posted 17 February 2011 - 11:19 AM

alphadog said:

Unless I misunderstand you, this is an issue pretty much for any language. Are you saying that all C# library/framework writers write with the same conventions and patterns, and create similar look-and-feel APIs?

Yes, that's exactly what I meant. Another thing is that since the .NET API is rich enough, the libraries do not need to reinvent the wheel or use some third party frameworks, which in turn makes them simpler and more lightweight to use and include in your project.


Quote

Sure. And, C# isn't quite on par with Haskell. For example, the Haskell system of type classes is more "powerful" than the generic type system in C#.

As my own counterpoint, lambda functions and expressions are in the C++0x specification, and is already part of many compilers. So, you can get some lambda sugar in your C++, if you crave for it. But, you should make one type of language pretend its another. :wacko:

Sure things can be in theory anything and what not, but it ultimately boils down to productivity/quality/usability in the end. I guess my original point was that "performance" shouldn't be the main factor deciding what language to use and people need to take account many other things, that are often much more important, as well.

#27 enjoycrf

    Banned

  • Banned
  • PipPip
  • 52 posts

Posted 25 February 2011 - 08:18 PM

VB is for total noobs
c# is for medium noobs
c++ is for non noobs

#28 enjoycrf

    Banned

  • Banned
  • PipPip
  • 52 posts

Posted 25 February 2011 - 08:23 PM

i learned basic when i was 9
and thats the sad truth

#29 Mihail121

    Senior Member

  • Members
  • PipPipPipPip
  • 1059 posts

Posted 25 February 2011 - 08:31 PM

enjoycrf said:

i learned basic when i was 9
and thats the sad truth

I'll be sorry to disappoint you, but all three languages are Turing-complete, well accepted and in active use. "Learning" a language just because is not a wise choice, picking the right language for a specific job on the other hand is.

#30 enjoycrf

    Banned

  • Banned
  • PipPip
  • 52 posts

Posted 25 February 2011 - 08:34 PM

i know them all MISHA plz stop bothering me jeezus
listen to what you just said
its kind of like saying
being wise is not wise

#31 alphadog

    DevMaster Staff

  • Moderators
  • 1716 posts

Posted 25 February 2011 - 09:05 PM

enjoycrf said:

VB is for total noobs
c# is for medium noobs
c++ is for non noobs

Thank you for your in-depth evaluation and poignant comparison of the pros and cons of three major languages. I definitely learned a lot.
Hyperbole is, like, the absolute best, most wonderful thing ever! However, you'd be an idiot to not think dogmatism is always bad.

#32 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 26 February 2011 - 12:10 PM

enjoycrf said:

VB is for total noobs
c# is for medium noobs
c++ is for non noobs
I'm sorry but I just can't take someone who thinks that way seriously. It just shows a complete lack of professionality. How old are you? Like, 12? And for god's sake, learn to use punctuation.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#33 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2759 posts

Posted 13 August 2011 - 07:26 AM

I learnt basic when i was 7, and now i just code procedurally. :)

(actually if im honest it was 8, i was begging my father for a computer at 7... i remember in year 2, "what do you want to be when you grow up?" "i want to be a computer programmer" :) )
you used to be able to fit a game on a disk, then you used to be able to fit a game on a cd, then you used to be able to fit a game on a dvd, now you can barely fit one on your harddrive.

#34 v71

    Valued Member

  • Members
  • PipPipPipPip
  • 357 posts

Posted 13 August 2011 - 02:03 PM

i learned basic at 4
Check my code in the c/c++ section :
http://www.binpress.com/browse/c

#35 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2759 posts

Posted 13 August 2011 - 05:59 PM

wow! not lieing?
Im not sure I even knew what a computer was at that age, I was too busy climbing the cupboards. :)
you used to be able to fit a game on a disk, then you used to be able to fit a game on a cd, then you used to be able to fit a game on a dvd, now you can barely fit one on your harddrive.

#36 moe

    Valued Member

  • Members
  • PipPipPip
  • 276 posts

Posted 13 August 2011 - 06:16 PM

When I was 4 nobody could afford a homecomputer... damn I am getting old :(

#37 v71

    Valued Member

  • Members
  • PipPipPipPip
  • 357 posts

Posted 14 August 2011 - 02:28 PM

Well , i was lying, i learned at 6 , lol, it was my daddy's tandy 8 bit
Check my code in the c/c++ section :
http://www.binpress.com/browse/c

#38 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2759 posts

Posted 14 August 2011 - 10:49 PM

hehe still very young computer scientist there.
you used to be able to fit a game on a disk, then you used to be able to fit a game on a cd, then you used to be able to fit a game on a dvd, now you can barely fit one on your harddrive.

#39 jcurtis

    New Member

  • Members
  • Pip
  • 5 posts

Posted 05 September 2011 - 02:21 AM

It actually is difficult to give an advice as the two questions you posted are not in parallel with each other. Though for the language, I suggest that you do not use VB unless you are willing to upgrade it to .net or just use C#.

I have to agree with the post above that you need to know the base knowledge in game development or you might find it hard to cope up. Though I am sure that you will learn from whatever experience you pick up and from feedback from people you will hire, which I assume are professionals.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users