C++ MFC 与 .NET? [英] C++ MFC vs .NET?

查看:25
本文介绍了C++ MFC 与 .NET?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的同事正在使用 Visual Studio 2002 并使用 C++ MFC.我正在用 C# 开发.

My colleagues are using Visual Studio 2002 and uses the C++ MFC. I am developing in C #.

以前没有任何问题,但现在询问我们的客户是否真的应该在不同的环境中开发.我的同事(当然)认为我应该转向 C++ MFC.我认为他们可以使用 .NET 而不是 MFC.

It has not been any problems before, but now questioning our customers if we really should develop in different environments. My colleagues think (of course) that I should move to C++ MFC. I think that they can use .NET instead of MFC.

学习MFC有什么意义吗?感觉有点过时了,还是我错了?与 MFC 相比,反对和支持 .NET 的论据是什么?

Is there any point to learn the MFC? It feels a bit outmoded, or am I wrong? What are the arguments against and for .NET compared with MFC?

我们正在为核工业开发工艺系统和辅助应用程序.主要应用程序是模拟旧计算机系统并使用 C++/MFC 的模拟器.这对时间非常关键,也许核心应该仍然是原生 C++.但模拟器和所有周边应用程序的 GUI 并不是特别重要.

We are developing process systems and assistance applications for the nuclear industry. The main application is an emulator that emulates an old computer system and uses C++/MFC. It is very time critical, maybe the core should it still be in native C++. But the GUI to the emulator and all surrounding applications are not particularly critical.

你有什么真正的理由应该替换现有的 MFC 应用程序吗?

And is there any real reason that you should replace the existing MFC application?

推荐答案

我已经广泛使用 MFC 和 Windows 窗体很长时间了.我来自视频游戏行业,所以多年来不得不编写许多桌面应用程序,而在 .net 之前,MFC 非常有用.甚至在那之前,我都在用纯 Win32 编写工具.

I've used both MFC and Windows Forms extensively for a very long time. I'm from the video game industry, so have had to write many desktop applications over the years, and before .net, MFC was extremely useful. Even before that I was writing tools in pure Win32.

MFC 确实有其怪癖,但总体而言,它让生活变得更轻松.将 OpenGL 和 Direct3D 集成到自定义视图中非常容易,一旦掌握了它的窍门,编写自定义控件就是小菜一碟.最重要的是,我可以用纯 C++ 编写代码,而这恰好是我选择的语言.另外,我发现 MFC 非常高效且快速.

MFC definitely had its quirks, but overall it made life a lot easier. It was very easy to integrate OpenGL and Direct3D into custom views, and once you got the hang of it writing custom controls was a piece of cake. Best of all, I could just code in pure C++, which just happened to be my language of choice. Plus I found MFC to be very efficient and snappy.

MFC 逐渐开始获得外部控件库的支持,尤其是停靠/工具栏库,所以我的 3D 模型查看器和关卡编辑器之类的工具看起来都很不错.

Gradually MFC started to get external control library support, particularly docking/toolbar libraries, so my tools like 3D model viewers and level editors, all looked pretty sweet.

我编写的大多数应用程序都以编程方式创建 UI,因此对话框/窗口布局工具足以满足我的需求.

Most applications I wrote created the UI programmatically, so the dialog/window layout tool was more than adequate for my needs.

MFC 9 也很酷,尤其是 Microsoft 已作为功能包的一部分发布的 Ribbon 控制/停靠库.所以老狗还有生命,这是肯定的!:)

MFC 9 is pretty cool too, especially with the Ribbon control/docking library that Microsoft has released as part of the Feature Pack. So there is life in the old dog yet, for sure! :)

当 .net 1.0 出现时,我发现过渡相当容易,因为它支持托管 C++.它并不漂亮,但为 .net 框架提供了一个相对简单的入口.但是当我开始编写更需要 Windows 窗体设计器的工具时,我的转折点出现了,大约在 .net 2.0 的时候.我决定重新开始学习我喜欢的 C#——尽管我永远不会习惯在没有 delete() 的情况下使用 new() ;).然后我开始编写用户控件,发现整个体验非常好和简单..net 框架很大,得到很好的支持,而且我发现在 C#/.net 中做几乎所有事情都更容易.此外,编译速度快如闪电,而且在 Visual Studio 中重构的能力也很棒.

When .net 1.0 came out I found the transition fairly easy, because it supported managed C++. It wasn't pretty, but gave a relatively straightforward on-ramp to the .net framework. But the tipping point for me came when I started to write tools that needed the Windows Forms Designer more, around the time of .net 2.0. I decided to start again and learn C#, which I loved - although I'll never get used to having new() without delete() ;). I then started writing user controls, finding the whole experience very nice and straightforward. The .net framework was huge, well supported, and generally I found it easier to do just about everything in C#/.net. Plus, compilation was lightning fast, and the ability to refactor in Visual Studio was awesome.

c#/.net 的美妙之处在于它不会限制您仅使用托管代码进行编写.如果性能是一个问题,或者如果您需要在平台之间共享代码,您仍然可以使用非托管代码.例如,我的数学库是用 C/C++ 编写的,我将其放入一个库中,使 C# 能够包装/使用相同的代码,尽管这只是暂时的.我也会及时将这些库移植到 C#,所以一切都是纯 .net.

The beauty of c#/.net is it doesn't limit you to just writing in managed code. You can still use unmanaged code, if performance is an issue for instance, or if you need to share code between platforms. For instance, my math libraries are written in C/C++, which I put into a libraries enabling C# to wrap/use the same code, although that's only temporary. I'm going to port those libraries to C# in time too so everything is pure .net.

我要提到的最后一次经历是,过去几个月我一直在远离主机游戏编程,并花时间对 InterWeb 进行编程.我一直在使用微软的堆栈,在 ASP.net/C# 中编程,我不得不说它非常好,所有 C# 的知识都直接适用.唯一的学习曲线是 ASP.net,而不是语言和支持库.随着 .net 3.5(LINQ 是甜蜜的)的到来,使用 C# 的 .net 框架中的生活是美好的.

The last experience I want to mention is that I have been spending the last few months away from console game programming, and spending time programming the InterWeb. I've been using the Microsoft stack, programming in ASP.net/C#, and I have to say it's very nice, with all of the knowledge of C# directly applicable. The only learning curve was ASP.net, not the language and support libraries. With the arrival of .net 3.5 (LINQ is sweet) life in the .net framework with C# is lovely.

无论如何,我不想把它变成我的人生故事,但我只是想简要介绍一下一个已经完成了你所询问的所有技术的人.我还想提一下,尝试不同的语言/框架对您有好处.我已经为 iPhone 编写代码一年了,并且已经成长为非常喜欢 Objective-C.都是编程,一切都很好.

Anyway, I don't want to turn this into my life's story, but I just wanted to give a brief experience of someone who has moved through all of the technology you've asked about. I'd also like to mention that it's good for you to try different languages/frameworks. I've been coding for the iPhone for a year now, and have grown to really like Objective-C. It's all programming, and it's all good.

关于 MFC/.net,两者各有优缺点,我真的一点也不介意 MFC,但就前进而言,我可能会坚持 C#/.net,但请,请,请了解它是如何工作的.我要说的唯一说教就是了解 .net 中的内存是如何工作的,即使一切都已为您处理";)

With respect to MFC/.net, both have their pluses and minuses, and I really don't mind MFC at all, but in terms of moving forward, I'd probably stick to C#/.net, but please, please, please understand how it works. The only preachy thing I'll say is to understand how memory in .net works, even though 'it's all taken care of for you' ;)

您的 C/C++ 知识应该完全独立于您是否使用 MFC,它仍然是一种关键语言(尤其是在基于控制台的视频游戏编程中),但是对于 Windows 上的桌面应用程序编程,它变得越来越难反对.net.它快速、简单、有强大的工具支持、优秀的 3rd 方库、一个庞大的成长社区,现在是跨平台 (Mono),使您能够在所有当前/新兴的 Microsoft 技术(ASP.net、WPF、Silverlight、WCF)之间移动等).

Your knowledge of C/C++ should be completely independent of whether you use MFC or not, it's still a critical language (particularly in console-based video game programming), but for desktop application programming on Windows, it's getting harder and harder to argue against .net. It's fast, easy, has great tool support, excellent 3rd party libraries, a huge growing community, is now cross platform (Mono) and will enable you to move between all current/emerging Microsoft technologies (ASP.net, WPF, Silverlight, WCF etc).

尽管如此,我仍然将 Visual Studio 设置为 C++ 环境.有些习惯永远不会消失;)

For all of this, though, I still set up Visual Studio as a C++ environment. Some habits never die ;)

这篇关于C++ MFC 与 .NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆