Article 3ACQJ CodeSOD: A Type of Standard

CodeSOD: A Type of Standard

by
Remy Porter
from The Daily WTF on (#3ACQJ)

I've brushed up against the automotive industry in the past, and have gained a sense about how automotive companies and their suppliers develop custom software. That is to say, they hack at it until someone from the business side says, "Yes, that's what we wanted." 90% of the development time is spent doing re-work (because no one, including the customer, understood the requirements) and putting out fires (because no one, including the customer, understood the requirements well enough to tell you how to test it, so things are going wrong in production).

Mary is writing some software that needs to perform automated testing on automotive components. The good news is that the automotive industry has adopted a standard API for accomplishing this goal. The bad news is that the API was designed by the automotive industry. Developing standards, under ideal conditions, is hard. Developing standards in an industry that is still struggling with software quality and hasn't quite fully adopted the idea of cross-vendor standardization in the first place?

You're gonna have problems.

The specific problem that led Mary to send us this code was the way of defining data types. As you can guess, they used an XML schema to lay out the rules. That's how enterprises do this sort of thing.

There are a bunch of "primitive" data types, like UIntVariable or BoolVariable. There are also collection types, like Vector or Map or Curve (3D plot). You might be tempted to think of the collection types in terms of generics, or you might be tempted to think about how XML schemas let you define new elements, and how these make sense as elements.

If you are thinking in those terms, you obviously aren't ready for the fast-paced world of developing software for the automotive industry. The correct, enterprise-y way to define these types is just to list off combinations:

<xs:simpleType name="FrameworkVarType"> <xs:annotation> <xs:documentation>This type is an enumeration of all available data types on Framework side.</xs:documentation> </xs:annotation> <xs:restriction base="xs:string"> <xs:enumeration value="UIntVariable"/> <xs:enumeration value="IntVariable"/> <xs:enumeration value="FloatVariable"/> <xs:enumeration value="BoolVariable"/> <xs:enumeration value="StringVariable"/> <xs:enumeration value="UIntVectorVariable"/> <xs:enumeration value="IntVectorVariable"/> <xs:enumeration value="FloatVectorVariable"/> <xs:enumeration value="BoolVectorVariable"/> <xs:enumeration value="StringVectorVariable"/> <xs:enumeration value="UIntMatrixVariable"/> <xs:enumeration value="IntMatrixVariable"/> <xs:enumeration value="FloatMatrixVariable"/> <xs:enumeration value="BoolMatrixVariable"/> <xs:enumeration value="StringMatrixVariable"/> <xs:enumeration value="FloatIntCurveVariable"/> <xs:enumeration value="FloatFloatCurveVariable"/> <xs:enumeration value="FloatBoolCurveVariable"/> <xs:enumeration value="FloatStringCurveVariable"/> <xs:enumeration value="StringIntCurveVariable"/> <xs:enumeration value="StringFloatCurveVariable"/> <xs:enumeration value="StringBoolCurveVariable"/> <xs:enumeration value="StringStringCurveVariable"/> <xs:enumeration value="FloatFloatIntMapVariable"/> <xs:enumeration value="FloatFloatFloatMapVariable"/> <xs:enumeration value="FloatFloatBoolMapVariable"/> <xs:enumeration value="FloatFloatStringMapVariable"/> <xs:enumeration value="FloatStringIntMapVariable"/> <xs:enumeration value="FloatStringFloatMapVariable"/> <xs:enumeration value="FloatStringBoolMapVariable"/> <xs:enumeration value="FloatStringStringMapVariable"/> <xs:enumeration value="StringFloatIntMapVariable"/> <xs:enumeration value="StringFloatFloatMapVariable"/> <xs:enumeration value="StringFloatBoolMapVariable"/> <xs:enumeration value="StringFloatStringMapVariable"/> <xs:enumeration value="StringStringIntMapVariable"/> <xs:enumeration value="StringStringFloatMapVariable"/> <xs:enumeration value="StringStringBoolMapVariable"/> <xs:enumeration value="StringStringStringMapVariable"/> </xs:restriction></xs:simpleType>

So, not only is this just awkward, it's not exhaustive. If you, for example, wanted a curve that plots integer values against integer values" you can't have one. If you want a StringIntFloatMapVariable, your only recourse is to get the standard changed, and that requires years of politics, and agreement from all of the other automotive companies, who won't want to change anything out of fear that their unreliable, hacky solutions will break.

atlasoft-50x50.png [Advertisement] Atalasoft's imaging SDKs come with APIs & pre-built controls for web viewing, browser scanning, annotating, & OCR/barcode capture. Try it for 30 days with included support. TheDailyWtf?d=yIl2AUoC8zAjzdISSAFoOc
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments