Home > Articles

  • Print
  • + Share This
From the author of

The Microsoft Development Environment

So it isn't C++, per se, that upsets me about modern programming development environments. What really drives me insane can be summed up in a single statement: There is too much choice. Let's take an example and look at strings again. Microsoft has, probably correctly, decided to promote Unicode—hence, there are 16-bit characters and 8-bit characters and conversion routines. In addition to the C char strings, there are wchar_t–wide character strings. Here we have an example of unavoidable complexity.

But Microsoft now tries to make life easier. To aid program portability, Microsoft has created a TCHAR data type that works out during compilation whether the string uses 8-bit or 16-bit characters. All string library functions (those that get the string length, concatenate, move, and so on) now come in three forms. However these are all null-terminated strings—and I'm not the only person who thinks that null-terminated strings stink because Microsoft has a set of alternatives. In the Microsoft Foundation Classes (MFC) library, there is the CString class. But if you want to pass a string to a COM object, you must use BSTR or a string variant. There is also an OLESTR. The Standard Template Library (STL) also includes some string handling. There are numerous conversion routines to convert from one format to another.

This applies not only to strings. Which disk file-handling routine should I use—C stream files, MFC CFile (or CArchive, CStdioFile, or CSharedFile), Windows SDK files, or C++ stream files? Should I use MFC for my project, Active Template Library (ATL), or plain vanilla Windows SDK? If I want a 32-bit integer, should I use int, __int32, INT32, DWORD, DWORD32, unsigned int, UINT32, long, LONG32, or ULONG32?

Wherever you look in Microsoft development land, you are faced with many, many options. Sometimes I think that the problem with Microsoft is that its R&D budget is too big. This has allowed developers the luxury of reinventing the wheel.

Many options sound good, but what you really want is a few good options that do everything. The huge number of choices makes the development environment extremely unproductive. The programmer cannot possibly be educated to know all the options, and he must therefore spend large amounts of time searching the documentation. When you make your choice, you always have the nagging feeling that it is the wrong choice, so you hide your decision behind a typedef or a define, hence increasing the difficulty of another programmer understanding your code. Working with a modern development environment is like having a toolbox with 500 screwdrivers in it, most of which have a serious flaw, such as a broken handle. To misquote Einstein, development environments should be as simple as possible, and no simpler.

  • + Share This
  • 🔖 Save To Your Account