Why MFC Sucks
by Jason Voegele
The Microsoft Foundation Classes (MFC) make up a framework for developing
Microsoft Windows applications. This is why MFC doesn't cut the mustard.
-
MACROS_ALL_OVER_THE_FREAKIN_PLACE()
-
Compiler-specific guard-comments, such as:
//{{AFX_MSG(CMyApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
-
Tight cohesion AND tight coupling
-
Poor abstraction from the win32 API
-
Use of structs where classes are appropriate
-
Structured message-handling, rather than a more Object-Oriented approach
-
Document/View has ambiguities in responsibility (i.e. where should your OnPaste() handler be?)
-
Globals
-
Hungarian Notation blown way the hell out of proportion.
-
Design Patterns are non-existent
Some of these things were down due to trade-offs that had to be made. For
example, the message passing architecture was chosen because using lots of
virtual functions would have been too expensive. On the other hand, most of
them could and should have been cleaned up quite a bit. Look at Java's JFC
for a much better library from a DESIGN perspective. The implementation is
rather shoddy, but it's a clean, intuitive, and very flexible library, with
a lot of attention paid to design issues. It's too bad I can't use this
library for my C++ programs (at least without paying the performance price).
jason@jvoegele.com
[an error occurred while processing this directive]