Jump to content



Photo

  • Please log in to reply
26 replies to this topic

#1 henriko

henriko

    Neowinian

  • Joined: 29-May 12

Posted 31 May 2012 - 15:05

I have been programming C# for the last 6-7 years or so (yes so I’m one of the “coffee based” coders as well), before that mostly C++. At the moment I'm at a crossroad, undecided if I should switch back to C++11. Why you say? At this point mainly because I need performance, but on a grander scale because my gut feeling has started to worry me that there might be some changes coming and that C++ could be the right choice for the future?

Let me pull back a little. At the moment I'm about to start on a pretty large project, and since the project will be ridden with heavy math calculations, and I know performance will be very important, I was a little hesitant just to jump out and start implementing in C# (as I normally do). To be honest I want to choose C#, but I'm afraid it's not the correct choice do to performance issues. C# and the.NET library is beautiful and a joy to work with, and there are countless of projects where customers have been stunned of how fast I was able to produce results. This was on the other hand almost never the case with C++. But this performance thingy is nagging me big time, I’m really afraid to choose the wrong environment and discover down the path that this was a failure. So I first started out on a googling mission to find performance comparisons, tech articles, blog posts about C++ and C# performance.
During this time there was also a lot of developer anxiety due to Microsoft’s poor public relation management prior to Windows 8 pre-release and the Build conference. You have probably read most of it yourselves. In general the feeling is that Microsoft is discontinuing (read: scrapping) Silverlight and XNA, and honestly the future of .NET as a first class citizen on WinRT is also questionable. Here are just two small articles exemplifying what I’m talking about:
http://www.guardian....oft-programming
http://channel9.msdn...all-of-a-sudden

But maybe more importantly, I watched some videos with Herb Sutter from Microsoft, where he talks about why he considers C++ being the right choice for the future. For instance he talks about the Microsoft Longhorn project and Microsoft’s efforts to make managed languages a core part of Windows, and how that failed. He also talks about how they now feel the new era is towards native development with the now “new and shiny” C++11. Take a look at the video, it’s quite interesting:
http://channel9.msdn...rb-Sutter-Why-C

Also you could supplement with this article giving a historical background explanation of Microsoft’s path towards WinRT:
http://arstechnica.c...n-dream-reborn/

And finally this video where Herb talks about how he feels C++ is now closer to C# and the managed languages, and nothing like the old C++ from back in the days:
http://channel9.msdn...our-Father-s-C-

So, what do you guys think? I would love to hear comments on the videos and what do you guys consider for the future. Should we start the journey from C# and managed and venture over to this new shiny toy C++11? Is it the right choice? Will Microsoft silently and slowly stop focusing on managed development, stop improving the CLR performance, and focus more on native development?

On the other hand, my C++ skills are fairly rusty since it's almost 10 years since I programmed any big projects in it, and it's not entirely trivial to write a high performance program in C++. I guess there will be a somewhat steep learning curve coming back to C++11, and I need to take some of that on my free time and it’s going to be rough as well (at some point I remember swearing I’ll never go back :-) But I guess, if I decide to do it, it’s because I feel it might be the right thing to do at this point in preparation for the future. So what do you all think? All comments are welcome! Yes and on a side note, anybody know a good C++11 book?


#2 CentralDogma

CentralDogma

    Neowinian Senior

  • Joined: 29-February 08

Posted 31 May 2012 - 15:21

It seems like your main reason for switching is performance. You’re going to be more knowledgeable in the core functionality of your application; you should go check out some benchmarks or run some yourself to see what performance you can achieve in each. You’re going to have to weigh the cost of adding development time by having to relearning C++ vs. the performance you application will get in the switch. If development time is negligible, than even a modest performance gain might be worth the switch. If the application is needed “right now”, it might be best to stick with what you know except in the most extreme case of performance.

By the way, thanks for the videos, I’ll have to check them out when I get some free time.

#3 MFH

MFH

    RAII fanatic

  • Joined: 24-June 10

Posted 31 May 2012 - 15:47

I'm a C++ programmer by heart - actually using C++11 on a daily basis. If you don't want to switch completely to C++ (e.g. for UI [WPF?]), how about combining C# and C++/CLI? VS 2010 supports that combination - though there are some corner cases where C++/CLI will always be incompatbile to C++11 (e.g. the nullptr-thing)

#4 Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 14
  • Joined: 26-October 05

Posted 31 May 2012 - 16:22

.NET is still a first-class citizen on Windows 8. The entire .NET stack is seeing major upgrades (much more than C++) in the next release which coincides with Windows 8. WinRT is not .NET, but it exposes its functionality using .NET metadata, so if anything the integration of .NET in Windows has made a huge step forward. The integration of new Windows libraries in .NET is much more seamless than it has been in Vista/7. C++, on the other hand, requires non-standard extensions (C++/CX) to make use of the WinRT types.

The future of certain technologies is indeed uncertain: XNA in particular, Silverlight also probably. But I think .NET as a whole will remain as relevant on Windows 8 at it has been on Windows 7. What can you suddenly do with C++ that you couldn't before? What can't you suddenly do with .NET that you could before? If it's about performance then the situation hasn't changed, only a tiny minority of code really benefits from going the C++ route - and then the added costs of development have to be weighed against the added value anyway.

We don't know the entire story behind the failure of the .NET rewrite of Windows (Longhorn); poor vision and management certainly had as much to do with it as .NET's inherent limitations. Also it was .NET 1.1 at the time, which was an early rushed-out version of the framework - it didn't even have generics and all the collection classes sucked. We're not talking about the same .NET in 2012.

Sutter is trying to present C++11 as something fundamentally different than C++98, and I disagree entirely. C++11 has all the same major flaws the language always had: header file management, absurd compilation time, cryptic compiler errors, poor tooling support, esoteric template language, poor, confusing and redundant standard libraries, brittle memory model, undecidable grammar, and I could go on.

In short I don't understand the hype around an old broken language that has been slowly but steadily on its way to niche status, just because it gets a few features other languages have had for years.

#5 simplezz

simplezz

    Neowinian Senior

  • Tech Issues Solved: 8
  • Joined: 01-February 12

Posted 31 May 2012 - 16:35

C# and the.NET library is beautiful and a joy to work with, and there are countless of projects where customers have been stunned of how fast I was able to produce results. This was on the other hand almost never the case with C++.

Why would coding in C# be any faster? If you use libraries like Boost, C++ apps can be coded pretty fast provided you start out with a solid design.

#6 Aethec

Aethec

    Neowinian Senior

  • Joined: 02-May 10

Posted 31 May 2012 - 16:36

Microsoft has some working prototypes of fully managed OSs, some public ones (e.g. Singularity) and some internal ones (e.g. Midori, see http://webcache.goog...lient=firefox-a ).
Apparently, they've also created a "language like C# that has the performance characteristics of C++" ( http://www.microsoft...-94035/1514399/ 2nd sentence of 2nd paragraph).

Their sudden love for C++ is a way to tell native developers they haven't forgotten C++ exists.

#7 ArialBlue

ArialBlue

    var lulz;

  • Joined: 24-June 10
  • Location: Democratic People's Republic of Korea
  • OS: Windows Master Race

Posted 31 May 2012 - 16:36

That is an odd first post

#8 Miuku.

Miuku.

    A damned noob

  • Joined: 10-August 03
  • Location: Finland, EU
  • OS: :: OS X :: SLES ::

Posted 31 May 2012 - 16:38

That is an odd first post

There's a reason for it.

#9 Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 14
  • Joined: 26-October 05

Posted 31 May 2012 - 16:59

Yes and on a side note, anybody know a good C++11 book?

The latest (6th) edition of the C++ Primer Plus by Stephen Prata covers C++11.

#10 @Leo

@Leo

    Under Derp Patrol

  • Joined: 06-June 10
  • Location: /dev/null
  • OS: OS X 10.8.2; Windows 8 Enterprise
  • Phone: iPhone 4S

Posted 31 May 2012 - 17:11

We don't know the entire story behind the failure of the .NET rewrite of Windows (Longhorn); poor vision and management certainly had as much to do with it as .NET's inherent limitations.

http://stackoverflow.com/a/7524710/983912 :)

#11 +Xinok

Xinok

    Resident Reresident

  • Joined: 28-May 04
  • Location: Shikaka
  • OS: Windows 7 x64
  • Phone: Galaxy S3

Posted 31 May 2012 - 17:36

I've looked through the Wikipedia page on C++11. Many of the solutions to previous issues and limitations use whatever space is available in the syntax. For example, strongly typed enums are defined as "enum class" (or "enum struct"). The keyword, "using", may be used as an alternative to "typedef" in certain cases. It's a mess.

There are alternate languages available today, with Go, D, and perhaps Rust being the most popular. I'm personally an advocate for D, and it already has many of the features added to C++11 with a much more elegant syntax. I don't think it's time to reconsider C++, I think we're long overdue for a new language that does things right.

#12 MFH

MFH

    RAII fanatic

  • Joined: 24-June 10

Posted 31 May 2012 - 17:37

esoteric template language,

There's absolutely nothing esoteric about templates, maybe you should look up the definition of esoteric programming languages...


poor, confusing and redundant standard libraries

Funny to read that out of the mouth of a .NET supporter - name the redundancies in the C++ standard library than...


In short I don't understand the hype around an old broken language that has been slowly but steadily on its way to niche status, just because it gets a few features other languages have had for years.

Niche status? You do realize that almost everything sold by Microsoft (including Windows, Office, Visual Studio and so on) is written in C and C++?! Not to mention that the industry reinforces it's focus on C++ as "the free lunch" is over,,,

#13 Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 14
  • Joined: 26-October 05

Posted 31 May 2012 - 17:37

http://stackoverflow.../7524710/983912 :)

Allow me to doubt the theory of Mr. "user480729" who has only one post on stackoverflow and when Larry Osterman, developer at Microsoft, calls it a conspiracy theory.

#14 RATiO

RATiO

    Neowinian

  • Joined: 25-February 06
  • Location: England, UK
  • OS: Windows 7/8, Android

Posted 31 May 2012 - 17:38

what is a "coffee based coder"?


#15 @Leo

@Leo

    Under Derp Patrol

  • Joined: 06-June 10
  • Location: /dev/null
  • OS: OS X 10.8.2; Windows 8 Enterprise
  • Phone: iPhone 4S

Posted 31 May 2012 - 17:44

Allow me to doubt the theory of Mr. "user480729" who has only one post on stackoverflow and when Larry Osterman, developer at Microsoft, calls it a conspiracy theory.

There are two possibilities with that post - either it's written with a lot of humor, or by someone who does not wish to be identified. Either way, it is an amusing read.