Jump to content


C# & XNA Vs. C++ ????


10 replies to this topic

#1 <<Nobody>>

    New Member

  • Members
  • Pip
  • 5 posts

Posted 06 August 2009 - 10:24 PM

hi guys
i want ask u about the best language to programming DirectX is it XNA and C#
or c++?
I want to know which one is the best and Why?
plzzzzzz help me

#2 imerso

    Senior Member

  • Members
  • PipPipPipPip
  • 434 posts
  • LocationBrasil

Posted 06 August 2009 - 11:00 PM

"best" is subjective and changes with objectives.

c++ is faster, but harder to learn/program with
c# is easier to learn/program with, and includes some newer programming concepts.

#3 <<Nobody>>

    New Member

  • Members
  • Pip
  • 5 posts

Posted 06 August 2009 - 11:03 PM

thanks man for ur opinion .
wating for other opinion okey ?
i'm watting for u

#4 genbox

    New Member

  • Members
  • Pip
  • 3 posts

Posted 07 August 2009 - 01:36 AM

If you are new to programming I would recommend C# and XNA. If you are an experienced programmer, I would recommend C++.

Why
It is easier to code and debug C#. It does dynamic type checking, automatic memory allocation/cleanup and a whole lot of other stuff. Suffice to say it helps you out a lot.
Coding C++ can be easy too, but as soon as you implement pointers, you are going to bend over backwards unless you know the system really good. You have to manually look out for resources and object lifetimes as there are no automatic cleanup of memory - this quickly leads to memory leaks and locked up resources.
C# has everything C++ has, plus a lot more. As for XNA; it is easy to use and it has everything you need for most games. You will still need to find physics libraries, animations, AI and so on (or you can create it yourself), but the fundamental components are at your disposal.

#5 <<Nobody>>

    New Member

  • Members
  • Pip
  • 5 posts

Posted 07 August 2009 - 01:05 PM

genbox said:

If you are new to programming I would recommend C# and XNA. If you are an experienced programmer, I would recommend C++.

Why
It is easier to code and debug C#. It does dynamic type checking, automatic memory allocation/cleanup and a whole lot of other stuff. Suffice to say it helps you out a lot.
Coding C++ can be easy too, but as soon as you implement pointers, you are going to bend over backwards unless you know the system really good. You have to manually look out for resources and object lifetimes as there are not automatic cleanup of memory - this quickly leads to memory leaks and unfreed resources.
C# has everything C++ has, plus a lot more. As for XNA; it is easy to use and it has everything you need for most games. You will still need to find physics libraries, animations, AI and so on (or you can create it yourself), but the fundamental components are at your disposal.

thank you very much , you were very helpful to me
thanks again

#6 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1227 posts
  • LocationOttawa, Ontario, Canada

Posted 07 August 2009 - 02:55 PM

It's a question of control. Very much like the choice between an automatic transmission (C#) and a stick shift (C++). Automatic transmissions are fine for day-to-day use and take some work out of the driver's hands so he can concentrate more on the road then on what's going on under the hood. It has an easy learning curve. Manual transmission requires the driver to learn how the mechanics work and it takes some skill to use. You're not allowed to make mistakes, or the gears will grind or the engine will stop. But in the hands of an experienced driver the higher level of control allows things like accelerating faster, improving fuel economy, having better control on slippery surfaces, maintain desired speed on slopes, and save your brakes. You won't see automatic transmissions on a rally car.

So what do you want? Ease of use, or full control? The biggest difference between C# and C++ is the memory management. With C# it's pretty much all automatic so you can concentrate more on the algorithms and design. C++ is not very forgiving when you make a mistake, causing memory leaks or memory corruption. But on the plus side once you master it you can write faster and smaller code that does exactly what you intended. It's not for the faint-of-heart and the learning curve is steep but it has no boundaries.

#7 poita

    Senior Member

  • Members
  • PipPipPipPip
  • 322 posts

Posted 07 August 2009 - 03:13 PM

What Nick said pretty much sums up everything you could say on the matter.

Personally, I wouldn't recommend a heavily OO language like C# or Java. In practice I find that the way they introduce objects to you is incredibly confusing to new programmers. In my opinion, you'd be much better off starting with a language like Python, where you will learn to use objects because of the benefits they bring, and not because the language forces you to.

Of course, you can't use DirectX with Python, but you can use SDL, which is more than enough for you to learn. I guess it depends on your specific circumstances.

#8 alphadog

    DevMaster Staff

  • Moderators
  • 1716 posts

Posted 07 August 2009 - 03:13 PM

Nick does a good summary of the differences, but nobody said why. So, I would add that with more control comes more ability to optimize for performance or other characteristics. When code "does things for you", sometimes it doesn't do it the "best way".

However, in many cases or large swaths of code in your overall program, performance is more than adequate with higher-level languages and the gains in terms of coding efficiency, readability and maintainability really dominates.

#9 <<Nobody>>

    New Member

  • Members
  • Pip
  • 5 posts

Posted 07 August 2009 - 03:45 PM

thank you Nick you made it very clear to me and thank all of you .

but actualy I'm 16 and i programming Visual Basic 6.0 just for 3 years

i never try to programming a game ,do you think it's better start with C# then learn C++ ??
because i find difficult understanding "pointers" in C++.

i really need your replay .

#10 alphadog

    DevMaster Staff

  • Moderators
  • 1716 posts

Posted 07 August 2009 - 04:04 PM

Yes. C# or Python.

And, as you enter the workforce, please learn to type in full sentence and words...

#11 <<Nobody>>

    New Member

  • Members
  • Pip
  • 5 posts

Posted 07 August 2009 - 04:09 PM

alphadog said:

And, as you enter the workforce, please learn to type in full sentence and words...

Is that better :)
Sorry But I'm new here





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users