MFC - good or bad?

Started by
28 comments, last by Norge 22 years, 3 months ago
quote:
This is known as "reinventing the wheel". Which is all good and dandy if wheel design is your primary interest. However, for the people that wants a vehicle that actually goes somewhere, reusing the existing wheel design might be a better idea.


I would rather call it: "inventing a good wheel". One that is round and goes well. MFC is not: it''s a 4 sided square type wheel, it moves , but it''s very inefficient, with tons of overhead and extremely chaotic. So, why should one use MFC, if there is C++ and STL ?
Advertisement
As was mentioned earlier - if you have incurred alot of overhead from MFC, chances are very high that you are using it incorrectly.

The last MFC app I wrote was ~100K with statically linked MFC and 20K with a shared DLL. Where is all this overhead everyone talks about??? Please explain.

It could be built a little better, but that''s true for any large API - it''s never going to be as tight as a narrow solution. However, in terms of project cost, I''d much rather have people use MFC than implement GUI classes, database classes, etc. from the raw API.

If you are using an API incorrectly, you can''t blame the API for bad results.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
We develop commercial applications using MFC.

It''s ugly and I don''t like it, but I sure have better things to do than write my own Win32 API wrapper.

And I hope nobody here is trying to use it for embedded applications, so who cares about a 100k executable.

You can use MFC for games, with pretty much no overhead at all (no, you don''t have to use doc/view), but there''s no real advantage in doing so. It''s a good idea however, to use MFC (or at least some other wrapper) for your game-tools.
To the OP:

The amount of ignorance on MFC is absolutely incredible, this lead me to create an MFC & OpenGL website. Try it and make up your own mind after you have done a little homework. You can control the size, overhead and speed of an MFC program. It is not evil, it is just another tool in a programmer''s toolbox. It is your job to keep your tools sharp and use them wisely.

http://pws.prserv.net/mfcogl/

Joel
Thats a great site for MFC/OpenGL work, the only one I found

Just thought I''d tell everyone :D
quote:Original post by coderx75
MFC is just a quick way of doing something complex at the cost of some serious overhead.


Actually, it''s a quick way of doing something that isn''t relevant to most games. Very few games use the standard windows GUI, so won''t gain much from a GUI library (be it MFC or something you write yourself.)

quote:
In my opinion, its better to put together your own library of GUI objects and work off that. It''s cleaner but less standard (whatver "standard" means these days).


no no no, that''s not the right answer - the best way is to get _someone else_ to create that library of GUI objects, and use that

my personal preference is wxWindows (http://www.wxwindows.org/)
- the DLL is 2.5 meg, and a simple MDI text viewer/editor is about 70KB. Statically linked (ie: DLL not needed) it''s about 600KB.

quote:
A simple "Hello World!" program should run about 40k in win32... same thing in MFC is about 1.2 meg. That''s a lotta bytes to simply put 12 characters on the screen.


Not entirely a relevant statistic though - does that 1.2 meg stay constant while you add real functionality? I''m not saying there isn''t bloat, just that ''hello world'' isn''t the ultimate stress-test app for seeing how good MFC is

You could also use the Borland c++ Builder. I think its much faster, easier and more comfortable to use than VC++ with MFC. Although the exes arent really smaller than with mfc.
kvh is one of the only people here with a good idea of using MFC.
He is also probably one of the few people who have actually tried using it rather than hearing someone badmouth it and repeating them.
Also, almost all of you are talking to Norge as if he was talking about games in specific. He said "developing programs" not games. He also asked for a recommended purpose. You have all lost the purpose of this thread!
I admit that i haven''t used it but at least i''m not crapping on it. ANSWER HIS QUESTIONS!
Good point. Here''s a better set of answers:

quote:Original post by Norge
I just wonder, is MFC a good thing to use when developing programs for commersial use? For what purposes is MFC recommended? Will there be any problems with missing/wrong version-dll''s ?

Thx in advance..

/Andreas


1. Good Thing?
I would say yes. I''ve developed several commercial applications and I''ve used MFC for all of them. The only time I''ve ever seen any of the "evil" of MFC is when I''ve used it improperly. Until someone proves otherwise, I''m guessing that most of the above comments were made in ignorance.

2. If an MFC class exists for a feature you are interested in, I''d say use it in most cases. Sometimes you want to reinvent the wheel so that the wheel works exactly the way you want it to, but in most cases, let the MFC team work for you.

3. Missing DLLs - could be... If you are very worried, you could compile MFC as a static library.

Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
If you really are concerned with the speed issue, take a look at this link.

http://www.gamedev.net/community/forums/topic.asp?topic_id=61563

The exe''s are availible upon request. As with the source. (Note the MFC app is staticly linked, and as such is much larger, if it wasn''t the size difference would be negligble)

Either way, it''s important to realize while games usually don''t directly use MFC, map/level/art editors are all perfect uses of MFC. Of course, if you aren''t well versed in C++, MFC will seem chaotic. If you opt to write your own code (no VC++ generated code) you will the find the code quite easy to follow, and gasp much shorter then a WIN32 app of the same purpose.

"If all that matters is what you get in the end, why go through life?
~Michael Sikora

This topic is closed to new replies.

Advertisement