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

Edeea1de1a293e4ff621b22fe957f115
0
__Nobody__ 101 Aug 06, 2009 at 22:24

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

10 Replies

Please log in or register to post a reply.

17ba6d8b7ba3b6d82970a7bbba71a6de
0
vrnunes 102 Aug 06, 2009 at 23:00

“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.

Edeea1de1a293e4ff621b22fe957f115
0
__Nobody__ 101 Aug 06, 2009 at 23:03

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

8fb959e8f9c3d5ded519c3e54b907123
0
genbox 101 Aug 07, 2009 at 01:36

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.

Edeea1de1a293e4ff621b22fe957f115
0
__Nobody__ 101 Aug 07, 2009 at 13:05

@genbox

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

99f6aeec9715bb034bba93ba2a7eb360
0
Nick 102 Aug 07, 2009 at 14:55

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.

36b416ed76cbaff49c8f6b7511458883
0
poita 101 Aug 07, 2009 at 15:13

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.

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Aug 07, 2009 at 15:13

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.

Edeea1de1a293e4ff621b22fe957f115
0
__Nobody__ 101 Aug 07, 2009 at 15:45

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 .

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Aug 07, 2009 at 16:04

Yes. C# or Python.

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

Edeea1de1a293e4ff621b22fe957f115
0
__Nobody__ 101 Aug 07, 2009 at 16:09

@alphadog

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

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