Mostly Grails tips from Code Panda

The NBC Olympic site and other stupid design choices

Here are a couple of bad design decisions I’ve run into that have ruined my interaction with websites or products. They all relate in some way to Flex and Grails, so I thought I would put them up somewhere.1. NBC Olympics Site + Silverlight

During the olympics, I heard about NBC having full replay of some olympics events. Went to the site, and was greeted by a wonderful : In order to view these videos, you need Silverlight installed.

OK, fine. Silverlight is a big download but it’s an up and coming technology. Seeing that NBC is probably part of the Microsoft partners ( and got the memo that Microsoft was promoting Silverlight, as opposed to say, um, the Microsoft Vista site — which was created by people with common sense and runs Flash ). So I gave it a chance.

Downloaded the plugin files, waited. Installed files. Waited.

Man, Silverlight sure does take a while to download.

Went back to the site and was greeted by : Sorry, we cannot stream content outside of the United States. ( I’m in Canada )

NBC DESIGN GUY, IF YOU KNEW THIS, WHY DIDN’T YOU CHECK MY COUNTRY BEFORE YOU FORCED ME TO DOWNLOAD YOUR PIECE OF GARBAGE PLUGIN.

Would it have been so hard for you idiots to include a javascript check of the county? I guess a foreigner’s time doesn’t matter. What an absolutely stupid design. Comedy Central knows how to do this, how come your superstar design company doesn’t?

First thing to get deleted was the Silverlight plugin. What a joke. It’s bad design choices in really good and elegant sites like this that sours the user experience

Sorry, had to get that off my chest.

2. XStream’s handling of the underscore ( Grails + XML )

If you ever serialized domain objects into XML, maybe you might have noticed that your domain classes named Blahda_Pac get translated into Blahda__Pac. This is quite confusing. I just had a long discussion with my co-worker Tim about this today.

After a little bit of digging, we find this gem of wisdom in the XStream site:

Why do field names suddenly have double underscores in the generated XML?

XStream maps Java class names and field names to XML tags or attributes. Unfortunately this mapping cannot be 1:1, since some identifiers of Java contain a dollar sign which is invalid in XML names. Therefore XStream uses an XmlFriendlyReplacer to replace this character with a replacement. By default this replacement uses an underscore and therefore the replacer must escape the underscore itself also. You may provide a different configured instance of the XmlFriendlyReplacer or a complete own implementation, but you must ensure, that the resulting names are valid for XML.

Wait, so you mean to say that in their infinite wisdom, whoever designed the XStream converter decided that there were more classes out there with the name blah$kd$kd$kds than, um english_CA?

How often do people really use the $ in their domain classes? And you decide to replace this with one of the most commonly used separator characters that work in both Java and XML world?

Why not replace the $ with the double underscore __ and leave the underscore the fuck alone!?

3. Flex’s handling of XML Databinding

In Flex, you bind data like so,

<myComponent datasource=”{somedata}”/>

However, if you try to bind data as XML, you will see this magnificently lovely peal or wisdom

[Warning]Data binding will not be able to detect changes to somedata

If you dig a little deeper, you will see that this is because the brilliant genius that had the joyful task of programming the XML event change handling decided it would be a good idea to bind this model in Flex with completely different events!

Not even events that inherit the same events or subclass it, completely different ones?!

So now, in order to compensate for this stupid design choice, I have to explicitly tell Flex that I am binding an XML.

<myComponent datasource=”{XML(somedata)}”/>

We recently started another project in Flex, and EVERY SINGLE ONE of our programmers made this mistake and ignore the stupid warning. The stupid thing is that Flex knows that somedata is an XML. Would it been so hard to add some code to handle this?

Maybe. Maybe after writing an entire framework, it was too hard to add

if( bindableData instanceof xml or xmllist )

handle events xml way

else

work normally

Wait, actually somebody decided somewhere that it would be a better idea to throw a warning in the debugger instead of just making it work intuitively. Wow.

4. Adobe Bridge + it’s friendly Opera browser installation.

So for the last few weeks some of my file preferences have been opening to the Opera browser. Mysteriously and magically.

Guess who decided to bundle Opera in their tool? Adobe Bridge…Ya, that’s the first place I would go looking for the Opera browser that breaks my download of the Ubuntu torrent. Great job guys.

Post navigation

5 thoughts on “The NBC Olympic site and other stupid design choices”

I would strongly urge you to continue to give Silverlight a chance. You can’t throw it out the window because one site didn’t do a good job with it. If that was the case I would have quit web development a long time ago as there is plenty of crappy sites out there. I too was a skeptic of Silverlight, and have never been a huge fan of MSFT, but is actually shows great promise for the RIA industry. It already has Adobe thinking on their toes. Competition is never a bad thing. Several reasons Silverlight shows promise: 1) xml based design. I don’t need to buy an expensive piece of software (Adobe Flash) just so i can make a Silverlight app. If I wanted to, I could write it in notepad. Granted, Adobe is coming around to this and realizing the potential with this and thus XFL was born. 2) designed for coders. To a coder, as you would know, it is unnatural for most 3-4th generation programmers to think of their program in terms of frames. Naturally we think in terms of objects. Silverlight was built from the ground up with this concept. Flash tried to tie that in and, in my opinion, has always struggled with this. 3) code behind is in a language we can be familiar with. If i am a .net programmer, i don’t need to learn a new language to code for Silverlight. Even if I am not a .net programmer, C# was built of it’s big brothers, Java and C++. Any Java or C++ person would find C# easy to learn. Action script is a bit of a different story. And finally 4) you don’t need special “hacked” libraries to interact with the DOM, or javascript from Silverlight.

Don’t get me wrong. Flash is an amazing product and will continue to be a dominant player in the RIA world. I just get tired of people immediately turning their back to things that are not familiar and new, just because they are comfortable with the old. The internet world moves entirely too fast to be sticking with just one thing. With all that said, that’s freakin ridiculous that MSFT would not do a country check before making you install Silverlight. But if you really think about it, they got you to do exactly what they wanted you to do, they got you to install Silverlight. Looks like their typical sneaky way.

Yes, but we’re talking about domain classes that get serialized and passed down the wire here. I could be missing something, but I haven’t ran into cases where I had to serialize POJOs and POGOs with deep inner class structures.

The point is that this behaviour is unexpected and random, but i see your point. And yes, this can be overwritten, but a default of _ is just puzzling, why not something less used, or the double underscore to represent $?