William Bartholomew

Musings on software engineering, technology and Aspergers Syndrome.

Documentation Is There For A Reason

leave a comment »

Michael Kaplan’s post “y? Because it’s documented that way!” raises a good point about undocumented behaviour. Basically, just because it works doesn’t mean you should, unless it’s documented that is. If you rely on undocumented behaviour you are exposing yourself to a higher level of risk when the API you use is revised.

Whether one looks at the Custom Date and Time Format Strings used by things like DateTime.ToString(string) or the strings in GetDateFormat or the strings in GetTimeFormat, it is clear that some characters (like H and M) have specific meaning attached to the cased variants.

In my book, since only the lowercase y is used here, the uppercase behavior is undefined — if it works then have fun but you really shouldn’t; if it fails then you kind of asked for that failure….

And more importantly, if the meaning changes in the future then that is also something requested in the improper use. and the nature of H vs. h and M vs. m kind of underscores this.

Written by wbarthol

November 25, 2008 at 10:28 pm

Posted in dotnet, programming

Leave a Reply