"In a strictly object oriented environment like C#/.NET," writes J.D., "there's really no such thing as 'global variables'. Sure, you can create a public class called 'Global' with a bunch of static fields, but the folks looking to (ab)use global variables generally have a hard time making that conceptual leap."

"I work with those people each and every day — most of them senior to me — and while they haven't quite made that conceptual leap, they have discovered a workaround."

public bool DoQualityControlChecksPass(
    out short actualValTypeID,
    out bool replInsurRateInRange, out decimal actualReplInsRate,
    out bool rentalYieldInRange, out decimal actualRentalYield,
    out bool propValUnderMax, out decimal actualPropValue,
    out bool livingAreaInRange, out double actualLivingArea,
    out bool riskRatingsAllUnder4, out bool riskRatingsHave3OrMoreOver3,
    out bool twoTierMktIsNo, out string actualTierMkt,
    out bool mktValEqualsContrPrice, out decimal actualContractPrice,
    out bool mktValVarianceFromEMVInRange, out decimal actualEMV,
    out bool valDatePastOrPresent, out DateTime actualValuationDate,
    out bool intCondWordsNotFound, out List<string> intCondWordsFound,
    out bool extCondWordsNotFound, out List<string> extCondWordsFound,
    out bool essRepairsWordsNotFound, out List<string> essRepairsWordsFound,
    out bool commentsWordsNotFound, out List<string> commentsWordsFound,
    out bool salesCountCorrect, out bool salesPricesInRange,
    out bool salesNotTooOld, out List<int> invalidSalesIDs, out bool minReqSalesInSameSuburb,
    out bool sameValAndValValidDate, out bool sameTenderPriceAndCheckCost,
    out bool latestSaleGreaterThanValAmount, out bool strataEqualsStratum,
    out List<string> falseSecuritisationFields,
    out bool currentUseIsResidential,
    out string currentUseNotAsResidential,
    out bool impValRateInRange, out decimal impValRate,
    out bool landValRateInRange, out decimal landValRate

"The results of this 43-parameter method are then fed into another method."

public string GetQCRuleFailuresText(
  short actualValTypeID, bool replInsurRateInRange,
  decimal actualReplInsRate, bool rentalYieldInRange, decimal actualRentalYield,
  bool propValUnderMax, decimal actualPropValue, bool livingAreaInRange,
  double actualLivingArea, bool riskRatingsAllUnder4,
  bool riskRatingsHave3OrMoreOver3, bool twoTierMktIsNo, string actualTierMkt,
  bool mktValEqualsContrPrice, decimal actualContractPrice,
  bool mktValVarianceFromEMVInRange, decimal actualEMV, bool valDateNotInFuture,
  DateTime actualValuationDate, bool intCondWordsNotFound,
  List<string> intCondWordsFound, bool extCondWordsNotFound,
  List<string> extCondWordsFound, bool essRepairsWordsNotFound,
  List<string> essRepairsWordsFound, bool commentsWordsNotFound,
  List<string> commentsWordsFound, bool salesCountCorrect,
  bool salesPricesInRange, bool salesNotTooOld,
  List<int> invalidSalesIDs, bool minReqSalesInSameSuburb,
  bool sameValAndValValidDate, bool sameTenderPriceAndCheckCost,
  bool latestSaleGreaterThanValAmount,
  bool strataEqualsStratum,
  List<string> falseSecuritisationFields,
  bool currentUseIsResidential, string currentUseNotAsResidential,
  bool impValRateInRange, decimal impValRate,
  bool landValRateInRange, decimal landValRate)

J.D. continues, "this naturally results in the worlds longest single method call."

short actualValTypeID = 0;
bool replInsurRateInRange = false;
decimal actualReplInsRate = -1.0m;
bool rentalYieldInRange = false;
decimal actualRentalYield = -1.0m;
bool propValUnderMax = false;
decimal actualPropValue = -1.0m;
bool livingAreaInRange = false;
double actualLivingArea = -1.0d;
bool riskRatingsAllUnder4 = false;
bool riskRatingsHave3OrMoreOver3 = false;
bool twoTierMktIsNo = false;
string actualTierMkt = null;
bool mktValEqualsContrPrice = false;
decimal actualContractPrice = -1.0m;
bool mktValVarianceFromEMVInRange = false;
decimal actualEMV = -1.0m;
bool valDateNotInFuture = false;
DateTime actualValuationDate = DateTime.MinValue;
bool intCondWordsNotFound = false;
List<string> intCondWordsFound = null;
bool extCondWordsNotFound = false;
List<string> extCondWordsFound = null;
bool essRepairsWordsNotFound = false;
List<string> essRepairsWordsFound = null;
bool commentsWordsNotFound = false;
List<string> commentsWordsFound = null;
bool salesCountCorrect = false;
bool salesPricesInRange = false;
bool salesNotTooOld = false;
bool minReqSalesInSameSuburb = false;
List<int> invalidSalesIDs = null;
bool sameValAndValValidDate = false;
bool sameTenderPriceAndCheckCost = false;
bool latestSaleGreaterThanValAmount = false;
bool strataEqualsStratum = false;
List<string> falseSecuritisationFields = null;

string qcResultText = null;
bool qcRes = false;
bool currentUseIsResidential = true;
string currentUseNotAsResidential = string.Empty;
bool impValRateInRange = true;
decimal impValRate = 0;
bool landValRateInRange = true;
decimal landValRate = 0;

    qcRes = DoQualityControlChecksPass(
              out actualValTypeID,
              out replInsurRateInRange, out actualReplInsRate,
              out rentalYieldInRange, out actualRentalYield,
              out propValUnderMax, out actualPropValue,
              out livingAreaInRange, out actualLivingArea,
              out riskRatingsAllUnder4, out riskRatingsHave3OrMoreOver3,
              out twoTierMktIsNo, out actualTierMkt,
              out mktValEqualsContrPrice, out actualContractPrice,
              out mktValVarianceFromEMVInRange, out actualEMV,
              out valDateNotInFuture, out actualValuationDate,
              out intCondWordsNotFound, out intCondWordsFound,
              out extCondWordsNotFound, out extCondWordsFound,
              out essRepairsWordsNotFound, out essRepairsWordsFound,
              out commentsWordsNotFound, out commentsWordsFound,
              out salesCountCorrect, out salesPricesInRange,
              out salesNotTooOld, out invalidSalesIDs, out minReqSalesInSameSuburb,
              out sameValAndValValidDate, out sameTenderPriceAndCheckCost,
              out latestSaleGreaterThanValAmount, out strataEqualsStratum,
              out falseSecuritisationFields,
              out currentUseIsResidential, out currentUseNotAsResidential,
              out impValRateInRange, out impValRate,
              out landValRateInRange, out landValRate);

"Of course, since the variable declaration isn't always consistent in the dozen or so places this method is called, the DoQualityControlChecksPass method re-initializes all parameters anyway."

actualValTypeID = 0;
replInsurRateInRange = true;
actualReplInsRate = 0m;
rentalYieldInRange = true;
actualRentalYield = 0m;
propValUnderMax = true;
actualPropValue = 0m;
decimal actualImpValue = 0m;
decimal actualLandValue = 0m;
livingAreaInRange = true;
actualLivingArea = 0d;
riskRatingsAllUnder4 = true;
riskRatingsHave3OrMoreOver3 = true;
twoTierMktIsNo = true;
actualTierMkt = null;
mktValEqualsContrPrice = true;
actualContractPrice = 0m;
mktValVarianceFromEMVInRange = true;
actualEMV = -1.0m;
valDatePastOrPresent = true;
actualValuationDate = this.moJob.ValValidDate;
intCondWordsNotFound = true;
intCondWordsFound = null;
extCondWordsNotFound = true;
extCondWordsFound = null;
essRepairsWordsNotFound = true;
essRepairsWordsFound = null;
commentsWordsNotFound = true;
commentsWordsFound = null;
salesCountCorrect = true;
salesPricesInRange = true;
salesNotTooOld = true;
minReqSalesInSameSuburb = true;
invalidSalesIDs = null;
sameValAndValValidDate = true;
sameTenderPriceAndCheckCost = true;
latestSaleGreaterThanValAmount = true;
strataEqualsStratum = true;
bool noSecuritisationFailures = true;
falseSecuritisationFields = new List<string>();
currentUseIsResidential = true;
currentUseNotAsResidential = string.Empty;
impValRateInRange = true;
impValRate = 0;
landValRateInRange = true;
landValRate = 0;

"This is one of the reasons our average .cs codefile hovers in the 22,000 lines-of-code range."

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!