Originally a original article, published and a forum, an increase in some things.
I said that the MFC is not designed, and the most important Class of MFC should be CWnd, right?
How many bytes of CWnd? I remember it seems to be 64 (60?) Bytes. According to your understanding, the 4 bytes that may be used in 4 bytes, and the 4 bytes of the most virtual functions need to be used. It is enough (ATL CWindow only 4 bytes, the virtual function is not, the message processing is passed Multi-layer inheritance achieves orthogonal decomposition). But why CWND has 64 bytes? Because there is anything in CWnd, even for a m_xdispatch object for COM, the IUnkonwn pointer, the returned value required by the derived class dialog box. It is always necessary to violate a good orthogonal decomposition, which is more than a good orthogonal decomposition, which is more integrated, low-coupling principle. When I use CWND, I don't need to deal with Dispatch, right? This design seems to be called God Class, and there is, it seems like a trash can, everything is in it.
Other I think you can also find it, then give an example, the MFC's CSocket cannot be used across threads because he uses a CWND object inside. OK, this is package details, I don't have to consider, but because CWnd can't use the threaded usage, I can't cross the thread, which becomes a detail of the implementation of the developer understanding. You don't see the source code, you don't know why. It can be understood that this is based on Win3.0 does not support multi-threaded legacy code, but it has never been improved, no matter how used as a class used in a network environment, it can't be used across threads, it is impossible to be a good design.
Although there is a CSocket class, there is no corresponding CSocketAddress similar class, OK, you can use CSocket :: Open ("LocalHost", 80) to connect network connections without handling the SockAddr structure, but if you want to use Localhost, 80 There is no door to a SockAddr structure, which can only be used in CSocket, and must be the function to connect Open, except for the most original copy of the post, you can't reuse something. The extraction is not enough, and there is too much permission.
Also seems to I remember its splitwindow, an implementation of a split window, not to bind to the DOC-View above, and a simple dialog program cannot be used. Not everyone needs doc-view. Right? But there is a lot of places where split windows is required, and the results of the MFC are not bind me to the DOC-View top. With the Anchor in Delphi, Dock is more than one century.
There are still many, such as cstring, cstring Reference Count is a thread secure, but the cost is a function using Interlock, although the price is very small, but if I always use it in a single thread, I should not pay this price, but no matter How, this code you have to use CString. Do you have any way?
Moreover, CString uses macro to determine if Wchar is still unreasonable. For example, my program is compiled into a Unicode version, but you need to use ANSI String, then CSTRING seems to be used.