|
|
|
Its my view that MFC is the best library
for professional developers. Its comprehensive, well documented, and
officially supported by Microsoft. WTL is also a very impressive body of
work. Its a good alternative to MFC for the experienced programmer who wants
to work more closely with the Windows API. Even so, I doubt that either of
these platforms are an ideal choice for novice C++ programmers.
The reason I take this view is that I believe that both MFC and WTL are
tailored more for the professional or experienced programmer than the
beginner. Speaking from experience, they don't necessarily meet the
requirements of someone looking to teach themselves to program windows in
C++. The requirements that I believe a novice programmer is likely to have
from a windows library are somewhat different from the experienced
programmer. They include:
- The library should make it easy to get started. To be fair, MFC
attempts to help here by providing wizards to automate some of the
programming, and macros to hide some of the complexity. For the
experienced programmer these work well. The wizards speed the initial
code development, and the macros keep the code tidy and easy to read. The
problem for the novice programmer is that they end up with code in their
source files they simply don't understand, and that's not a good thing.
- The library itself should be simple and easy to understand. WTL
fails this rather badly. Yes it's neat and brilliantly written, but that's
actually its problem. The dependence on templates will put its actual
workings beyond the comprehension any normal novice user. MFC also fails
this test, simply because its so vast.
- We shouldn't need to learn a lot of new things in order to use it.
MFC in particular fails this test. It is a vast and comprehensive library,
but this makes it all the more difficult for beginners to get started with it.
- The library should compile on free compilers, not just Visual Studio.
Visual Studio is not cheap, and novice programmers probably won't want to
spend lots of money to experiment with C++ and learn to program. Some are
probably still at school. Their first choice of a C++ compiler/IDE will
probably be a free one like Dev-C++.
- The library should be freely available and free of charge.
Whether we're a novice programmer or an experienced one, I believe its
important that we understand each line of our source code. This applies both
to the code we write by hand, and any code written for us by wizards. For
me, the thing which separates computer programming apart from many other
disciplines is that its a precise science. A well written program is one
that (among other things) behaves precisely as the programmer intended.
The problem for beginners with libraries like WTL and MFC is that they are
likely to end up with source files that includes lines of code that they
don't actually understand. The convenience of wizards in MFC can actually
make this problem worse. Novice coders are perhaps encouraged to think that
they don't need to understand all the lines of code in their source, since a
wizard will do the work for them. When this happens, programming becomes
less of a precise science, and more of a black art. Worst of all, the
failure to understand their own code is rather likely to hold the novice
programmer back, and cause them to gloss over fundamental concepts, like
message maps.
In my case, after using MFC for a while I realized that I didn't thoroughly
understand the code I was writing. I wasn't happy with that so went back to
working with the windows API directly. This library was the result. I
imagine that others who teach themselves to program for windows using C++
would also face similar challenges, and I hope they find the library I
developed useful. |