Sign in to follow this  
Followers 0
timbo

C++ *heart* C# (or vice versa)

7 posts in this topic

Hello all,

I've often read posts where people ask "which is the best language" or "I want to learn a language, which is best". I more often than not read these posts as I (used to) wonder this myself. As many of you would know, the replies are often the same - "Depends what you want to do", sound advice...

I only have experience with scripting languages (AutoIt isn't encouraging me to develop in anything else), so I have very little understanding of the benefits to using either language (C++ or C#), so my interest was tweaked when I read a job advert for a Software Engineer position (which I am grossly under-qualified for).

The job advert specified they would like a person with deep technical knowledge in C++ & C#. It also went on to say that the company used C++ for their data processing (i.e. number crunching), and C# for their UI (i.e. client/user facing apps).

This seems to follow the trend of people saying C and C++ are "fast" (relative term I know) languages, and C# makes programming GUI's easier? I don't know if the aforementioned benefits are correct, so this brings me to my question (sorry it took so long):

Q1. Does this sound like "good practice" (if you can pull it off), or is it purely seeking perfection in a competitive corporate environment?

I've written a few scenarios down below to see if I've grasped what the company looking for a Software Engineer would be interested in accomplishing.

The following scenarios are no doubt highly dependant on the programmer's ability, so let's assume the programmer (in this case, me) would be proficient in the specified language (C++ or C#):

  • If I wanted to build a program to process data quickly and efficiently, without the need for a UI (probably on a server somewhere), I imagine the best language would be: C++
  • If I wanted to build a program to retrieve the aforementioned processed data (i.e. the result) probably via SQL, and display it in a friendly UI for the client/user, I imagine the best language would be: C#
Seems pretty straight forward so far...

  • What if I wanted to build a program in which the client/user had to enter a large amount of data (of which the program would then need to quickly and efficiently process), and then return the result to the user?
Well... I imagine if you were proficient in both C++ & C# you could create a UI in C# and pass the data off to a C++ module (correct term?) for processing, if you were proficient in one more than the other, then I imagine you write the whole thing in that language.

Now my final question/s:

Q2. In your personal (experienced programmers) opinion, would you use this method if you were proficient in both languages? If not, why?

Thanks in advance for any input. I hope that I have grasped enough of the basic concepts of lower level programming to portray my questions in a legible fashion.

-Timbo

Share this post


Link to post
Share on other sites



Companies that try to write one program in two languages are doing it wrong usually.

C# can be as fast as C++ when it comes to execution. C++ on the other hand will never match the GUI builders C# has.

I'd just vote to use C#.

Share this post


Link to post
Share on other sites

If you want to know whether C# is easy to build GUIs in then download visual studio and try. I use C# to prototype GUI's when I wat to write them in other languages, thats how easy it is.

Share this post


Link to post
Share on other sites

C# can be as fast as C++ when it comes to execution

And adding to that: I'd even go so far as to say recently (using .NET 4.0), I have yet to come across any practical situation where single pass (not spending hours on perf-testing/optimizing) C++ is faster than C#, especially C# with parallel extensions (http://en.wikipedia.org/wiki/Parallel_Extensions).

All my developmental is for Windows though, and typically running on higher-endish servers with modern hardware.

Only time I use C++ anymore is for platforms that don't support .NET (ever less common as Mono develops).

I've resigned to the fact that C# and CLR compilers will micro-optimize my code across multiple hardware platforms better than I can optimize C++ for even a single one (at least in any sane-timely manner).

Share this post


Link to post
Share on other sites

Well then, a couple of votes for C#, not much regarding C++?

So it seems C# is gaining a huge following (duh), and is obviously getting quite flexible (with its ongoing revisions). So is C++ losing it's relevance in the general application development arena? (Please don't flame me)

I understand that many games and even operating systems are built on C++, and it's probably the go-to choice for corporations that wish to release software to the public (citation needed). But for the average company developing in-house software, would I be correct to assume they'd more often be developing on C# these days?

The reason I ask is, one day, in the very distant future I will attempt to learn one (or both of the languages), talk is cheap I know. But since I was in school (many years ago), C++ was the language to learn. Here I am many years later, and it's obviously still heavily used, but I now have the option of the younger rival C#.

All that said, I can't see myself ever working for a games company or Microsoft where I'd be hacking out code for a multi-million dollar project, more likely a small to medium business designing a custom CRM, or some sort of (no UI) back end data processing. So I'm wondering (without being too selfish), how will these two languages will help me?

-Timbo

Share this post


Link to post
Share on other sites

@timbo:

The big problem with C# is its tie to Windows. Yes, there is Mono, but it will never be complete, and no company will ever rely on it instead of using a language that can be compiled/run on whatever platform they want. That's why in many fields C# will never wholly replace Java (that's the language I would learn today if I had to choose a single one) or C++.

As you said, in relatively small companies where platform changes are not expected, and that run on Windows already, C# is a great choice: it has tons of libraries, many features useful for large code-bases, and it's usually more productive than e.g. C++.

Share this post


Link to post
Share on other sites

The big problem with C# is its tie to Windows. Yes, there is Mono, but it will never be complete, and no company will ever rely on it instead of using a language that can be compiled/run on whatever platform they want. That's why in many fields C# will never wholly replace Java (that's the language I would learn today if I had to choose a single one) or C++.

On that note, I've run jar files in a JVM written entirely in C# and executed in Mono.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0