Today's a simple one. We've all seen code that relies too heavily on string concatenation and eschews useful methods like Join
.
Nick L sends us this VB.Net example, written by a slew of mechanical engineers.
PartSearchDescription = _
dFrameType + _
dFrameSize + _
dSYZD + _
dPoles + _
dBearingType + _
dBearingInsulated + _
dTerminalBoxType + _
dMBBreatherDrain + _
dTerminalBoxSH + _
dMBServitPost + _
dMBNotes + _
dStandoffs + _
dStatorGnd + _
dLA + _
dCT + _
dMeteringCT + _
dSC + _
dIrisPartialDischarge + _
dLocation + _
dWOrientation + _
dStatorRTD + _
dBearingRTD + _
dBearingThermocouples + _
dTypeEE + _
dTypeJJ + _
dTypeKK + _
dTypeTT + _
dMainFrameSH + _
dThermostats + _
dSepAuxBoxes + _
dRotation + _
dAPI + _
dMCI + _
dFlanges + _
dIP55 + _
dCPLG + _
dPumpBrkt + _
dINPRO + _
dOilMist + _
dPipeExtensions + _
dCLO + _
dFloodLube + _
dwFlanges + _
dwSightFlow + _
dSumpHeater + _
dGemsPak + _
dSideDucts + _
dVAD + _
dLNFH + _
dShimPack + _
dAdapter + _
dBreather + _
dServitPost + _
dSolePlate + _
dDimensions + _
dGNDBrush + _
dGNDPads + _
dGNDStrap + _
dProbes + _
dKeyphasor + _
dTransmitter + _
dTachometer + _
dDialTherm + _
dDPS + _
dAccelerometer + _
dVelometer + _
dOptionNotes + _
dAdditionalNotes + _
dNoiseLevel + _
dLeads + _
dShaft + _
dSO + _
dLI + _
dCustomer
That's… a lot. It's basically throwing every field into a single string, separated by "_
". Which you know that means the other side, whatever it may be, has to unpack them with a split. If you don't know what serialization is, I suppose it makes sense.
I also see a lot of what looks like Hungarian notation, but every field starts with d
or dw
, and I doubt that dCustomer
, dLocation
, and dGNDStrap
are all the same type as dNoiseLevel
. In fact, this may be the worst use of Hungarian I've ever seen- at best Hungarian symbols are more noise than signal, but this one is just pure static. Even if they're describing the purpose of these fields ("d for data member"?), it's basically repetitive and pointless.