Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > General Discussion
  New Posts New Posts RSS Feed - MFC vs .NET
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

MFC vs .NET

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: MFC vs .NET
    Posted: 05 November 2007 at 11:39am
Ok, try to be as unbiased as possible! We are going to compare MFC and .NET.
 
I know many elite programmers still prefer MFC over .NET (I know I do). Still, I sense it might be time to emigrate.
 
I'm involved in a project with 600k lines of 10 years old MFC-code. With GoF fresh in mind it is hard not to eager for a complete re-design. Especially since this is a project with a bright future.
 
Here's my dilemma. What should we do?
1) Rewrite all code in modern C++ with STL/Boost, together with Xtreme ToolkitPro for the GUI.
2) Emigrate to C#/.NET and use Xtreme SuitePro for some fancy GUI.
3) Other ideas?
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 05 November 2007 at 5:04pm
4) start migrating your business logic to pure C# (framework 2.0 and above) and wait a few months until native .NET GUI controls from Codejock will be released...
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 06 November 2007 at 2:34am
Sounds reasonable, but can you motivate it? :)
Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Posted: 06 November 2007 at 7:16am
Originally posted by znakeeye znakeeye wrote:

I'm involved in a project with 600k lines of 10 years old MFC-code. With GoF fresh in mind it is hard not to eager for a complete re-design. Especially since this is a project with a bright future.


Realistically, anything else but a step-by-step refactoring will fail.

There is a good article on Joel on Software:

"They did it by making the single worst strategic mistake that any software company can make: They decided to rewrite the code from scratch."

http://www.joelonsoftware.com/articles/fog0000000069.html

An other interesting article:

http://www.joelonsoftware.com/articles/fog0000000339.html

Keep that in mind.

For my (privately developed freeware) app I'll start to integrate .NET components into an MFC app (But only because there are no shiny MFC gauge controls). I've separated the logic from the UI before. If you've done that it's not a big deal to put a new UI on your app.

But unfortunately almost every MFC app I've seen in this century does not separate the logic from the UI. Most of the logic is in the view or dialog code and is bound to some controls.

Codejock support
Back to Top
apuhjee View Drop Down
Senior Member
Senior Member
Avatar

Joined: 02 September 2005
Location: United States
Status: Offline
Points: 130
Post Options Post Options   Thanks (0) Thanks(0)   Quote apuhjee Quote  Post ReplyReply Direct Link To This Post Posted: 06 February 2008 at 12:58pm
I wish I had the time to elaborate on some details, but I can say briefly from personal experience that a .NET solution will offer benefits in several key areas of development, including:
  • Versioning
  • Security
  • Deployment

Also, Microsoft patterns & practices offers a wealth of enterprise development patterns, if that's your cup of tea... the highlight for us being the Enterprise Library.

Cheers ~ jp
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 891
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 11 April 2008 at 3:40pm
My only thought is to stay away from COM interop! Those RCWs just hate to release your COM interface.
 
Either use .NET to the max or not. Mixing the two can be quite frustrating. If you do mix them, then this is your best friend:
 
GC.Collect(GC.MaxGeneration);
GR.WaitForPendingFinalizers();
GC.Collect(GC.MaxGeneration);
 
The other good friend is System.Marshal.ReleaseComObject() but constant GC takes away the pain of knowing just how many times you need to call ReleaseComObject (one call is almost never enough).
 
We run the GC code above everytime we are about to shut down the app or a document. Failure to do so can mean that when .NET decides to run GC and the RCWs that get collected call Release(), there may not be any object in memory (kaboom). The alternative is to wait for each object's final release, which may never occur until shutdown since GC runs when MS decides it does. If your documents contain as much data as ours, its totally impractical to wait for GC to recover your memory when the final release call comes.
Back to Top
MikeVance View Drop Down
Newbie
Newbie
Avatar

Joined: 06 October 2008
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote MikeVance Quote  Post ReplyReply Direct Link To This Post Posted: 19 October 2008 at 11:10am
MFC is amazing only for applications that need MAXIMUM ZIP, such as sexy best-of-the-best Photoshop-style apps. All others should be coded in either C#/VB/Delphi -- anything but MFC, due to the productivity penalty. I respect MFC for its leanness and tight message pump, but that is it.

Offhand, I would say avoid a complete rewrite and transition your app over to DotNet gradually using C++/CLI, using your existing code as much as possible. Do not drive yourself insane by attempting a complete rewrite; if you do that then everybody will hate you, including yourself.


Originally posted by znakeeye znakeeye wrote:

Ok, try to be as unbiased as possible! We are going to compare MFC and .NET. I know many elite programmers still prefer MFC over .NET (I know I do). Still, I sense it might be time to emigrate.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.313 seconds.