Staffing Talk » Staffing Software » The Disturbing Lack of Preprocessor Macros in C#

The Disturbing Lack of Preprocessor Macros in C#

Written by

August 31, 2010

Every language has its negatives.  English its awkward spelling;  French its impossible-to-acquire “chanson”; and Japanese its multiple alphabets. 

And C#?   What about it? It has no preprocessor macros!  And unlike the natural languages, C# lacks the excuse of having acquired this flaw by accident.  Designed with guidance from ancestor languages – C, Java, FORTRAN, C# corrected their flaws in many areas.

But as is often the case with remakes – think Psycho and Breathless – the baby gets thrown out with the bath water.  In this case the designers of C# wanted to avoid the bad coding practices of preprocessor macros … by eliminating them altogether!

Yup, what Hutus did to the Tutsis, the CUP (Turks) to Armenians, the Nazis to Jews, Mao to free-thinkers and so on, that was the solution the C# designers came up with.  The final solution.  That is so 20th century. 

So now we have our Microsoft apps packed with long-winded, hard-to-read monstrosities like this:

public short ContactMethodTypeId
        {
            get
            {
                CanReadProperty("ContactMethodTypeId");
                return _contactMethodTypeId;
            }
            set
            {
                CanWriteProperty("ContactMethodTypeId");
                if (_contactMethodTypeId != value)
                {
                    //_oldcontactmethodtypeid = _contactMethodTypeId;
                    _contactMethodTypeId = value;
                    PropertyHasChanged("ContactMethodTypeId");
                }
            }
        }

In previous generations we could have just replaced all those lines with something as short as “qprop ContactMethodtypeId”. 

Faster development.  Easier maintenance.

Would you like to write a guest post for Staffing Talk? Please send your article submission to guest@staffingtalk.com.

Gregg Dourgarian

This article was written by Gregg Dourgarian

Gregg wrote the first TempWorks software as a teenager in 1975 with his staffing pioneer father who founded Manpower's technical and payroll operations. Gregg also built an airline software company. Its product, Supertrace, helps keep airline reservation systems running smoothly worldwide.


Leave a Comment

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Previous post:

Next post: