Jump to content

  • Log In with Google      Sign In   
  • Create Account

DirectX11 which programming language?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
25 replies to this topic

#21 JWalsh   Moderators   -  Reputation: 463

Like
2Likes
Like

Posted 02 August 2012 - 12:49 PM

I do have a question though. Why is C# a "productivity language"? I've searched a bit and read couple threads on stack overflow but haven't found huge advantages in using C# over let's say C++ & QT. I've been programming with C++ for a loooong time now. Why should I pick up C# to further my productivity?


Two reasons:

1. The language itself has many features that makes it easier to be productive. You can do more with less lines of code, and the code that you do have to write tends to be less repetitive and more direct. Simplicity and elegance have been major design goals throughout the lifetime of the language. As a result, it's just easier and more enjoyable to use C# than C++. I always find it a little tedious having to go back to C++.

2. The ability to access the .NET Framework Library and all of the related frameworks means a whole lot of code is written for you when using C#. If you just look at some of the namespaces of the .NET Framework Library there is MS Build integration, all the container classes, language generation, SQL Server bindings, OO wrappers around Win32 API Library Functions, CodeDOM, Diagnostics, Drawing, Enterprise Services, IO, Isolated Storage, Ports, Media, Messaging, Network programming, Reflection, RPC, Security, Authentication, Cryptography, Threading, Transactions, XML parsers & Serializers, XPath queries, and tons of Web stuff: Complete HTTP engines, Email classes, various protocols, etc...

In addition to all the basic classes in the .NET Framework Library you also have WinForms for creating GUI Windows applications, WPF, WF, WCF, and ASP.NET.

So I guess the better question is, when you want to write a complex Windows Application with multiple windows, tab controls, tree controls, animations, etc... How do you do it in C++? Likewise, if I asked you to create a database application that made connections to multiple databases, performed transacted queries against the databases and displayed results in a GUI application, how would you go about doing it? How about, write a GUI application that lets you enter in the email address of multiple people, subject, and a message body and then send the message out to all the people in the email list in formatted HTML over TLS secured SMTP?

Most of these things would make the average C++ programmer shiver. At the very least they'd be searching the interwebs for available libraries, and at worst they'd be looking for RFCs on protocols to begin implementing them themselves. In C#, the above programs range from a couple dozen lines of code to a couple hundred (maybe some in the low thousands), because most of the boilerplate stuff is done for you. It's literally half a dozen lines of code or less to open a database connection to SQL database and make a query. The support provided to programmers to develop "every-day" applications is just amazing to me.
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints

Sponsor:

#22 phantom   Moderators   -  Reputation: 7278

Like
2Likes
Like

Posted 02 August 2012 - 01:32 PM

Basically what JWalsh said; I recently spent 2 months at work writing C# code for a new data build system - I was productive, relaxed and enjoying myself :D

Even the things which would take annoying amounts of C++ code and extra libraries are a breeze in C#; want to load an XML file and then fill a container based on a subset of the data include? Easy! Just load with XDoc and then use LINQ to filter the data and return an anonymous object type with the fields you want in it.

Don't get me wrong; I still enjoy using C++, certainly with the C++11 features but C# is where I'm headed whenever I want tools or to do things quickly.

#23 french_hustler   Members   -  Reputation: 366

Like
0Likes
Like

Posted 02 August 2012 - 03:02 PM

Thanks for the insight guys.
I'm very tempted to start messing with C#. It definitely seems like it would be the way to go for creating utility tools that'll generating assets for my engine.

#24 Hodgman   Moderators   -  Reputation: 30387

Like
2Likes
Like

Posted 02 August 2012 - 08:17 PM

I do have a question though. Why is C# a "productivity language"? I've searched a bit and read couple threads on stack overflow but haven't found huge advantages in using C# over let's say C++ & QT. I've been programming with C++ for a loooong time now. Why should I pick up C# to further my productivity?

I'm not saying you should, but it's damn popular, so might be valuable to learn. There's plenty of Cx vs Cy threads already on the forums. The short and annoying answer is: try it out and see ;-P
N.B. I'm not a C# fanboy; C++ is by far my favourite language, and I'd recommend every serious programmer learn C++ after learning the basics of programming (I started with BASIC, AppleScript and a simple assembly language to learn the basics). After using both for a decent period though, it's obvious that C# gives you more tools out of the box (bigger standard library) and it requires far less programmer skill to use correctly.

I think that the language is moving in a direction that makes it really easy for beginners who have low knowledge of things like memory management to come in and write proper applications. Though you still have to learn the proper usage of such features since it isn't handled under the hood, it seems that both languages are advancing towards a common middle ground. But I'm just playing devil's advocate.

The difference is their starting points -- I'd liken it to comparing the US constitution to the Japanese constitution. One starts off dangerous and adds features to make it safer, the other starts off safe and adds features to make it dangerous.
With C++, you're also following the "pay for what you use" concept at all times, which relies on the fact that you explicitly know what every line of code really means. For example, if you pass a smart-pointer by value (instead of by const-reference), then you're explicitly asking for the reference counter to be incremented and decremented at the start/end of your function call (which may or may not be what you want). Also, smart-pointers don't at all fit into the same category of C#'s references -- e.g. smart-pointers require the explicit choice between strong and weak links in order to avoid circular references, whereas C#'s GC are built assuming that that you'll create any kind of graph with them. Also, despite all of the nice library additions to C++, you're still relying on these libraries to have debug code to detect invalid usage (e.g. out of bounds accesses), and no library can detect invalid language usage (e.g. writing to a bad pointer). Conversely, C# can detect these abuses at the language level (in debug or optimised builds) and prevent you from corrupting your memory.

#25 JWalsh   Moderators   -  Reputation: 463

Like
4Likes
Like

Posted 02 August 2012 - 09:04 PM

it's obvious that C# gives you more tools out of the box (bigger standard library) and it requires far less programmer skill to use correctly.


Agree with everything but the last part of this line. It gives you more tools out of the box, but the tools don't necessarily require less skill to use. Like any trade, it takes a certain amount of knowledge/skill to know which is the proper tool at the proper time, and with more tools comes a greater need for discrimination.

I really like the carpentry analogy. With C++ you're building a house one 2x4 at a time. With C#, you're given a collection of frames, joists, and maybe even a pre-built ceiling. Heck, you might even be given pre-made cabinets. But it doesn't mean you don't need to know how to use a hammer. It makes the process easier, faster, and more enjoyable, but if you don't measure carefully, haven't engineered a proper blue-print to begin with, or if you're over-zealous with your cutting tools, you can still end up with a fragile, expensive, and/or unattractive final project.

Ultimately, the language you use is the least important element of software engineering. So if one language makes the least significant part a little easier, it doesn't really say much about a person's overall capabilities as an architect or problem solver.
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints

#26 147   Members   -  Reputation: 197

Like
0Likes
Like

Posted 06 August 2012 - 06:07 AM

Now I have a further Problem. I do not know if it fits 100% in this Topic, but I couldn't find any good tutorial about SharpDX. The tutorials on sharpdx.org do not work, I only see a blank page. Perhaps anyone knows another source? This also leads to an aspect for the choice of a language, the amount of tutorials, documentation and sources.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS