The Silverlight 3 development experience, ups and downs
I started a little science project for CoasterBuzz about a week ago or so. I wanted to build a little Silverlight app that sucked down updates of all kinds, and make it live outside the browser. There are constantly new posts, topics, news items and photos hitting the site, and anything that encourages people to keep coming back is a good thing. It's not a giant community, but big enough that people like to be involved as much as possible, even if they're "readonly" types.
As it turns out, the back end of the project was more interesting to me, as I built a mini-framework that publishes events via any number of publishing services. In this case there's only one, a database writer, but I could just as easily pop in a Twitter publisher or Facebook publisher or what have you. Yay for extensibility and loose coupling!
As far as the Silverlight app itself goes, there are some things that bring me great joy:
- The effects and projection stuff are a nice addition. You can add just a little extra polish to the app with these.
- Support for Binary XML in a WCF call is easy. See previous post.
- I'm thrilled that the app, at 500-ish lines of code, is relatively small, around 55k. That's smaller than many of the photos on the site.
- Building feels faster. Admittedly, I've not measure this.
- Isolated storage is so ridiculously easy, especially if you use the built-in ApplicationSettings collection for small stuff.
- Auto-updating for out-of-browser is pretty cool (though I wish there was a method to restart the app).
- Out-of-browser experience is very streamlined for the user.
- Resource use OOB doesn't seem too bad for this little thing. CPU never goes over 2%, and it's consuming about 35 MB of memory on the Mac. That's not bad considering it has to run in a sandboxed host on top of a runtime and framework. A native app like Adium (which admittedly does a heck of a lot more) uses about 45 MB in OS X.
- OOB window resizing shows
just how awesome Silverlight/WPF layout works, without all of the work
from the bad old days of Windows Forms.
I've got all kinds of frustrations too. Here are some of them:
- Blend 3 seems to take hours to load, and then it frequently doesn't work. For example, I have a UserControl that inherits from a base class, and Blend can't load the base type. That's ten times as annoying since there's no designer in VS2008.
- That you need Blend at all is annoying. "Wait for VS2010" is not a
solution when you want to build stuff today. Making a tool for
designers was a really good idea. Artificially forcing the separation
on developers was not. Worse, it appears the MSDN subscribers at
mid-levels don't get Blend anymore, and that sucks with the
aforementioned lack of a designer.
- No GIF support. OK, perhaps I should have RTFM'd, but I couldn't understand why my image was coming down the wire and not appearing.
- Documentation in some places leaves a lot to be desired. Sure,
there's a MouseWheel event now, but what do you do with the delta value
returned? It took the 50th result in a Google search to figure that one
out. Oh, and it's frustrating that the scrolling doesn't work in OOB on
a Mac. I assume the bootstrapper is platform specific, so what's the
deal? It does work in-browser, I think.
- No compile-time checking of XAML for rogue attribute values. Accidentally slip an extra character in that Width attribute? You won't find it until runtime. That concerns me in all kinds of ways.
- How is this for weird: With virtually any control, you can use HorizontalAlignment="Stretch" to make the thing fill the space it has. So I drop a Grid inside of a HyperlinkButton, and it doesn't fill the space, meaning right-aligned text isn't at the right. I pulled my hair out on this for way too long. Finally, by accident, I noticed that HyperlinkButton has a property called HorizontalContentAlignment. Sure enough, set it to Stretch, and you're good. Why the strange one-off, inconsistent behavior?
- Debugging is still... weird. While I can hit break points, why can't exceptions hit in the debugger? Piping them out to the browser blows because you can't inspect the state of anything.
- Out-of-browser debugging is a pain. You can attach to the bootstrapping app that hosts it, but you have to do it manually. It feels like everything for OOB is a little half-baked in terms of tooling, and I'm hoping that VS2010 is better.
- It'd be nice if the OOB app could remember window position and size.
- Using a base class for UserControls requires awkward XAML.
All of that said, I do dig Silverlight. Most of my frustrations come
from the somewhat uncoordinated release schedules. I love that they're
iterating quickly, but the tooling has to catch up. I know we don't
have much longer to wait. I'll post the general link to check out this
app after I've done some refining. Right now it's available to paid
subscribers to try out.