DCSIMG
No Excuse - Doron's .NET Space

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.

Published Friday, February 09, 2007 9:16 AM by dorony
תגים:,

Comments

# re: No Excuse

Wow! I never thought I'd find this posting connected to Ayende's blog. You're absolutely right, this is a prime candidate for a "nightmare platform".

I have just left my role as GIS Developer and am glad I did so. The 9.2 Web ADF is incredibly frustrating, especially if you want to build something slightly out of the default templated mapping application. So glad I don't have to put up with it anymore!

Saturday, November 17, 2007 6:53 AM by Dany

# A Geographic Nightmare

Oren Eini talks about nightmare platforms , and so I got the urge to talk about my issues with the GIS

Wednesday, November 21, 2007 9:29 PM by Doron's .NET Space

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: