No Excuse
Recently, I've encountered the following code, in a commercial API for a software that costs dozens of thousands of dollars. Now you don't need to know what this method is supposed to do, all you need to know is that Geometry is an abstract base class for all types of, well, geometries, and Point inherits from Geometry.
public DataTable[] Identify(Geometry geom)
{
//... Do some stuff ...
if (!(geom is Point))
throw new NotSupportedException();
//... Do some more stuff ...
}
If you're wondering how I got to see the code - I used Lutz' Reflector for that.
Now, silly me, I thought that when a method accepts a Geometry parameter, it should work for all types of geometry, and not only for points, so of course I was extremely surprised to see this unclear exception get thrown in my face.
You might say, "maybe they intended to add the functionality in the future". Well, that's no excuse. They could supply an overload just with a Point parameter for now.
Anyway, the amusing thing is that this method does work for other types of geometries. All you have to do is to copy the code from the Reflector, remove the weird exception throwing, and it works like a charm. I don't understand how this kind of bug could get into production code. Makes you wonder if they even test their code.
The software in question is ESRI ArcGIS Server 9.2, which is one of the world's leading products in supplying server-based GIS. Go figure.