.NET, Silverlight, WCF RIA Services, WCF, RIA »

[14 Jul 2011 | 0 Comments]

Just a quick heads-up: in case you haven’t noticed, Silverlight Show started publishing e-books a few weeks ago.  These provide a convenient way to read up on some of their most popular article series, including source code, while you’re offline.

 

I’m glad to announce that two of my article series are now available as e-books:

 

 

Happy coding! :-)

Featured, General, Headline »

[23 Jun 2011 | 2 Comments]

Quick post: the slides and demo-code from my Silverlight, MMVM & RIA Services – an Architectural Story are available for download from my SkyDrive.

 

Thanks for joining the session, the nice comments and interesting questions afterwards :-) I enjoyed delivering it, hope you enjoyed listening to me, and if you’ve got any questions, drop me a line.

.NET, MVVM, RIA, Silverlight, WCF RIA Services »

[9 Jun 2011 | 0 Comments]

I’ve just finished my session on Silverlight, MVVM and RIA Services – an architectural story at NDC2011.  Almost a full room, thanks for such a great turnout!

 

riaservarch

 

As promised, the slides + democode are available for download.  Any questions on the session or the principles discussed therein?  Drop me a line or contact me on Twitter.

 

Cya around! :-)

.NET, Featured, RIA, Silverlight, Headline, WCF RIA Services »

[10 May 2011 | 0 Comments]

With the release of SP1 for WCF RIA Services, a bunch of new and/or enhanced collection types became available to developers: the EntitySet, EntityList, ICollectionView & DomainCollectionView. 

 

I wrote a round-up of these collection types for SilverlightShow, explaining how they can be used and for what scenarios they are best used.  The first part of this series has been published today, and the second part will follow shortly.

 

If you’re working with WCF RIA Services, knowledge of these new types is essential, as they offer a lot of productivity value for your applications.  Have a look at the series, and feel free to let me know how you feel about them!  Source code is, as usual, included.

 

Happy coding! :-)

.NET, Silverlight »

[26 Apr 2011 | 0 Comments]

 

clip_image001Those of you who read my Twitter messages might have picked up a few hints about this already: a few months ago, we started working on an official application for Techdays 2011, which would allow attendees to have a look at the agenda, compile a list of favourite sessions, and give both general as well as session-specific feedback.

 

This app is now available in the marketplace.  It’s part of a larger “group of apps”, which started as a way to, essentially, test how we could bring together all the cool new techs we’ve heard about the last few years: we’ve got a Silverlight backend app, a WP7 app, an MVC frontend (both full & jQuery-mobile based), and all this is backed by WCF RIA Services and fully hosted in the Azure cloud.

 

If you want to find out more about how we did this, make sure to come to the session Maarten Balliauw & yours truly will be giving at Techdays, right after the keynote.

 

 

Cya there?  For now, feel free to check out the app! :-)

RIA, Silverlight, .NET »

[14 Apr 2011 | 0 Comments]

At MIX11 today, Silverlight 5 beta was released.  It includes a whole load of new features (most of which were already known by people who watched the Firestarter event last December), you can find the full list at Tim Heuers’ blog.

 

One of the small, yet pretty interesting additions in my opinion are Markup Extensions.  Tim quickly mentions it, but there’s no example to be found on Silverlight.NET, so I figured: why not try it out myself? :-)

 

With custom markup extensions, you can in essence execute your own code instead of the default Binding markup extension, which will provide the correct desired value for the property you’re using the markup exension for.  One of the typical uses for this could be for multi-language apps: getting the correct text in the correct language from your resource dictionaries. 

 

Up until now, I had to provide quite a bit of code to enable my app to handle multiple languages: I would typically create some kind of resource wrapper, make that available through App.XAML or a resource dictionary, reference the resource on all my Views and bind to the resource wrapper + resourceKey property of that wrapper.

 

With markup extensions, this becomes a lot easier.  Start out by creating a new SL project, and add 2 resx-files: one default, one with the .nl extension for Dutch translations.  Then, add a new  class to your project, and make it implement the IMarkupExtension<T> interface, where T is the type of object you want to get back from the code.  In that class, you can add a bunch of properties, methods, … to your liking.  In this case, all I need is a string property, ResourceKey.  The ProvideValue method is what gets executed to get the desired value, which, in this case, comes down to getting the translation with key ResourceKey from the resx file.  That’s no more than a few lines of code:

 

public class TranslationExtension : IMarkupExtension<string>
{
    public string ResourceKey { get; set; }

    public string ProvideValue(IServiceProvider serviceProvider)
    {
        // get the ResourceKey value from translations
        return SL5MarkupExtensions.TranslationResources
               .Translations.ResourceManager.GetString(ResourceKey); 
    }
}

 

Next, we need to use this in XAML.  Import the correct namespace, and call the Markup Extension from XAML, passing in the ResourceKey parameter:

 

<TextBlock Text="{me:TranslationExtension ResourceKey=DemoResourceKey}"/>

 

And… that’s it.  Really.  Instead of having to create all I described in the beginning, all I need are these few lines of code.  To check if it still works when changing the language, I added a button which will set the culture to “nl”, and navigate to another View, containing a TextBlock using the markup extension with the same ResourceKey.

 

This is one really short example to show you how easy it is to use markup extensions, but I ‘m pretty sure you can already see how it can prove useful.  For example, you might use it to get the correct ViewModel for your View, if you’re using MVVM.

 

By the way, in case you’re wondering why I’m navigating to another View: I want to make sure the markup extension code gets executed again.  If you want true on-the-fly language changing in your app, you’ll have to provide a way to notify your app it should re-execute the extension.  This goes beyond the point of this blog post, but there already are quite a few implementations for this available for WPF, like this one, which should be easy to port if you really need it.

 

That’s it!  You can download the source code here.  Happy coding! :-)

.NET, Featured, General, RIA, Silverlight »

[12 Apr 2011 | 1 Comments]

I've just seen the MIX11 keynote, and followed my first session at MIX (HTML5 for Silverlight Devs :-)). Everyone who's here or who's following online will already have noticed there's a heavy focus on HTML5 this year - you can feel it in the Day 1 keynote (in tomorrow’s keynote, we’ll get some Silverlight 5 / Windows Phone 7 stuff), you can grasp it from the amount of sessions about HTML5. We're getting demo's showing off some CSS features, graphic features, video features, animations, …

 

Hold on. Let me rephrase that: we're getting demo's of how these features work great in IE9 & IE10 (get the preview now), and don't run all that great in, say, Chrome.

 

The problem? I build business apps, and for these apps, I'm not buying it. It's too early. It's immature. There's not enough browser support.

 

Interestingly enough, Dean started his keynote by stating that what people want are native apps on their devices. I tend to agree with him on this one - but that means that, for your mobile devices, you will want to write a native app in whatever tech it is that's supported on that device - you'll have to write iPhone apps, WP7 apps, Android apps , … in their native development languages. I agree, but that makes me wonder: why all that talk about "write your app in HTML (5) so it works on each device," when in essence it will offer you a sub-par experience, a fallback experience really?

 

If you want to offer the best experience to your consumers, you will have to write a native app for each device. But this post isn't about that - I'll write another one with my thoughts on building apps for multiple devices & multiple form factors in the near future.

 

I've seen some pretty cool stuff today. Jumplists from Facebook (needs IE9 & Windows 7). A FourSquare playground built in HTML5 (needs IE9 & Windows 7). CSS gradients. Auto resizing grids (runs great in… IE10). Are you catching my drift here?

 

We've got Canvas. We've got SVG. We've got native sound. We've got the video tag. But it won't work across browsers. It won't work in older browsers. It won't work natively at all for most of the people & devices out there.

 

As said, I've seen pretty cool stuff, but I've mainly seen UI features – UI features that are already available in plugin-based technologies.  What's more: I've seen that native cross-browser support for these features is nothing more but a distant dream; and even if the features are supported, they seem to run fast in a certain browser, but run like crap in any other one.

 

Do you really want this for your apps?

 

Now, of course you can write your sites to gradually decrease as far as UI capabilities are concerned, or you can use something like Modernizr to "fake" HTML5 features using JavaScript / ECMA Script 5 (input elements are a nice example of why you’d want to use this), or at least to check if a certain feature is supported by the users’ browser.

 

But again, I'm not building sites, I'm building business apps.

 

So let's step away from the great, pretty, flashy, gradient-y HTML5 features. The real power of HTML5 are, in my opinion, its state/dev-related features; and these are either available or not: you can't use something like Modernizr to magically enable them on older browsers. 'm talking Local Storage, Session Storage, File API, WebSQL API, WebSockets, Offline Apps, … the stuff we've got in plugin-based approaches but are missing from HTML. This is the stuff that makes HTML5 great.

 

Problem is: I can't use these features. Not all of them are implemented at the moment, not even in the latest preview builds of most browsers. There's not enough browser support for this, my users probably won't have the correct version of the correct browsers, and there's no way to gradually adapt my app for older browsers when using these features: they either fully support them natively, or they don't.

 

So what are we left with, from a business app point of view? Flashy semi-supported, semi-fast or slow (depending on your browser) features, poor cross-browser support & not enough market penetration to start using the interesting features. And I'm not even talking about tooling support for these features. I need support for these features across browsers, and I need a substantial amount of users having a modern browser which supports them.

 

Are you really going to build a business application today, using HTML5?  I won't.

 

Don't get me wrong: I like where the new HTML spec is going. You'll probably see me blogging about the latest cool HTML5-based business application we're building at my job… in about three years or so. But not now.

 

So, what should you use to build your business apps today? In my opinion: use a plugin-based approach (Silverlight, for example) if you need it to run on the web (or on the desktop, cross-platform even).

 

What if that’s not an option?  Use ASP .NET MVC + jQuery if you need your app to be HTML-based, pairing it with something like Modernizr to enable you to use some of the UI-related HTML5 features.

 

Need it to run on mobile devices or devices with another form factor?  Build them natively in the technology the device supports (but as said, more on that in another post).

 

But don't get caught up in the HTML5 hype. There’s cool stuff underway.  It will get there, but it's not there yet. Not now. Not today. Not in the near future.