views:

531

answers:

3

What are your thoughts about them?

Sometimes I have to write unmanaged code at work, but with large scale (games) projects, it just becomes way more time-consuming and complicated, which is solved by throwing more people at it.

Do you think managed code is viable for large scale applications? (applications like Photoshop, 3ds Max, Maya, XSI, etc, which are computationally intensive but don't have the realtime requirements of games (to a degree).

+3  A: 

I think using unmanaged code for performance reasons is one of the worst premature optimizations I´ve ever heard of. Before you choose some technology that is harder to work with just because it might faster you should be very sure that you need the speed.

Besides the CLR is so close to unmanged performance that 99 out of 100 cases shouldnt even have to think about it. And even if you fall into the camp that needs the performance you should write most of your code in the managed space and then switch to unmanged in the parts that your profiler tells you to.

About games in particular: there have been a few bigger titles writen in on mono now that gained performance, because they could write everything in manged code and didnt have to resort to scripting languages for the abstract parts like AI.

LDomagala
Thanks. Yeah I didn't mean using unmanaged in managed. Was just pointing the fact that most stuff used in games or even large scale apps like I mentioned above are unmanaged but was wondering if it would be possible to create an app of the same caliber using managed code.
Joan Venge
it´s very possible and its usually alot easier then in unmanged code. you wont belive what a difference the garbage collector makes if you havent used manage and unmanaged before. besides the gc you gane alot of other productivty tools in managed code
LDomagala
Yes, I use managed for most of my stuff and I don't see much difference, but I never attempted to write a large scale app like photoshop. :)
Joan Venge
+2  A: 

Hi! I think you can do large applications with .NET. There are many examples out there:

  • Parts of VisualStudio are written in .NET (e.g. WinForms editor and WPF editor)
  • Expression Blend is written in .NET and WPF
  • Stackoverflow uses .NET and ASP.NET, as do many other sites.
  • In VisualStudio 2010, the new editor (replacement for the current implementation) is written in .NET and WPF

One word about computationally intensive applications: Since the code is compiled to machine code by the interpreter, most calculations should be as fast as unmanaged code.

On the other hand you have a lot of advantages:

  • (almost) no memory leaks (garbage collector)
  • you get exceptions when something is wrong, no crash without information
  • the code runs equally well on x32 and x64, without the need to change or recompile the application
  • C# is easier to use than C++ (delegate, collections, LINQ etc)
  • ...
+1  A: 

Because you mentioned PhotoShop ... paint.net is a nice graphics package (not quite up to PhotoShop, but impressive nonetheless), written in C#.

Justice
Thanks, that's the only one I knew :)
Joan Venge