June 4, 2007

From Web Maps to Case Sensitive Languages

I worked on a web map during the weekend... and found (among other things) what people can end up doing with case sensitive languages, like JavaScript.

Over the weekend I've worked on a map. I had to display some pictures and a path. In the past I used Google Maps for a similar work, but this time I had to use Microsoft's Virtual Earth technology, because for the area in question (up the hills in the county where I live) Google Maps and Google Earth have no good quality satellite images. So I spend quite some time working on both sides, and I have to say that each has its own advantage. Virtual Earth birds view images (my house is in this one) are very nice indeed. Recent Google Maps with pictures taken on the roads is impressive (although I had already seen a similar features on Amazon's A9 some time ago).

Programming against the two technologies is similar (well, if you don't consider Google Earth, of course). Both mapping sites allow you to host a map (basically a JavaScript component) in your own site. In case of Google you have to sign up for a free account, Microsoft let's you start coding right away. Documentation is very high quality in both cases, although I tend to prefer Google descriptive one. On the other hand, the wizard / build helper (or Interactive SDK) provided by Microsoft to get you started is very nice. In the end, with both components you can set the center of the map using latitude and longitude, the zoom level, add lines, add pins that open up small HTML surfaces (optionally including images) when activated, provide buttons to pan to other locations and zoom, and the like.

Event handling is slightly different, but not that much. But this is where I found something absolutely shocking. JavaScript is a case sensitive language, but you won't expect a programmer to use the same name with different cases to mean to different things. Even less you'd expect a similar "feature" in an object with a public API. However, this is the case. Here is what I found in this page:

A view object, which has the following properties:

Property

Description

latlong

The center of the map. Includes .latitude and .longitude properties (note lower case names).

LatLong

The latitude and longitude (VELatLong object) of the point on the map where the user clicked the mouse.

Yes, the first two properties of this object do have the same name, with a different CamelCase! "Note the lower case names"? Astonishing...

Getting back to the main topic, I still prefer using Google Maps because of the ways to pass information to them via Google Earth, which in turns interfaces with Google Sketchup. Using this tools (in the reverse order) I was able to import a graph from an AutoCAD drawing, convert it with Sketchup and export it to a map. I couldn't found any similar (free) program to convert the same path to the GeoRSS format used by Microsoft maps.

PS. My story is not as interesting as the one Danny Thorpe recently covered in his blog, mixing and matching Google and Microsoft properties. Notice also that Danny finally unveiled what he worked on while at Google.





 

5 Comments

From Web Maps to Case Sensitive Languages 

Er... you might want to check the "this page" link...
Comment by Marcel Popescu [] on June 4, 10:58

From Web Maps to Case Sensitive Languages 

Ok makes more sense now :) And as for your main 
point - yea, I'm in complete agreement with Jeff 
Atwood that case sensitivity is an extremely stupid 
idea. Thanks for the example, I hope someone at 
Microsoft takes notice.
Comment by Marcel Popescu [] on June 4, 11:17

From Web Maps to Case Sensitive Languages 

"Even handling": you probably mean "Event", no?

As for the names, it's a bit shocking to see them use
that for two publicly accessible names! Someone must
have screwed up big time! :)
Comment by Fernando Madruga [http://memyselfanddelphi.blogspot.com] on June 4, 11:51

From Web Maps to Case Sensitive Languages 

 Hi Marco!

Here's the link to the live Silverlight cross-domain 
Video RSS player that I talked about in that blog 
article you mentioned.  Microsoft is a little 
uncomfortable linking to the app from a Microsoft 
site (including msdn.com) because of some worrisome 
elements in the Google Feed API terms of use.

http://www.dannythorpe.com/silverlight/vid1/C9Vids.ht
ml
Comment by Danny Thorpe [http://blogs.msdn.com/dthorpe] on June 13, 06:05

From Web Maps to Case Sensitive Languages 

What language is this? Doesn't this language have
conventions for the case of such things? Any decent
case-sensitive language has such conventions which
avoid such things from happening.

But the case oddity is just a side effect of the
bigger problem. These variables aren't named in a
useful way. They don't convey anything about their
meaning, they are named after their type (like naming
an integer variable "number"). mapCenter and
pointClicked would be more reasonable names. This is
incredibly basic and I it is sad and grossly negligent
they are allowing someone this incompetent to be
defining public APIs. But pretty typical of Microsoft,
I am afraid.
Comment by Eric on March 8, 21:39


Post Your Comment

Click here for posting your feedback to this blog.

There are currently 0 pending (unapproved) messages.