.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.

.NET, General, Presentations and sessions »

[1 Apr 2011 | 0 Comments]

clip_image001I’m happy to announce I’m going to do a session at the Norwegian Developer Conference in Oslo, June 8 – 10.  The session will be an in-depth session on architecting Silverlight solutions with WCF RIA Services and MVVM, and I’m quite excited about it; sessions like this are much more fun to prepare & deliver than high-level sessions, in my opinion..  If you’ve got things you absolutely want to know about these techs/frameworks, don’t hesitate to drop me a line – I’ll try to fit them into the session :)

 

In case you don’t know NDC, here’s some info straight from their site:

 

NDC 2010 was an unqualified success, with more than 1,300 participants and a range of Partners from leading IT companies. We are now about to repeat the success by organising NDC2011

  

   

Leaders in the field

Again in 2011, participants will be able to learn from the leaders in the field.

The conference promoters are ProgramUtvikling AS. Their vision is to provide developers with the very latest in practical expertise in technology and project performance. Norwegian developers are already well–respected for their abilities, and the aim of the conference is to stimulate the environment in Norway even further, so that Norwegian developers can maintain and enhance their sound position. The way this is being done is by establishing an international conferencing environment in Oslo and focusing on seminars of the highest quality.

     

 

Norway’s largest agile program development conference

NDC is Norway’s largest conference dedicated to .NET and Agile development. Along with ProgramUtvikling, Microsoft Norge AS is also supporting the conference and doing its bit to make the event a real boost for developers in the industry.

 

 

Access to new technology

Over many years, Microsoft has been focused on giving developers access to the latest technology – as demonstrated at NDC 2008, 2009 and 2010. For 2011, it has been decided that, as before, the conference should feature seven different specialist tracks, each including a series of relevant talks.

 

Hope to see you there?

Featured, Silverlight, Headline, WCF RIA Services »

[17 Mar 2011 | 0 Comments]

A lot of business applications that are being developed in Silverlight today are built with the help of WCF RIA Services. This should come as no surprise, as it’s a really powerful, extensible framework which provides us with a lot of features out of the box (validation, authentication, authorization, …) that otherwise would require quite a lot of custom code, workarounds & plumbing. In WCF RIA Services, you’re going to be working with a client-side Domain Context instance.

 

When you’re going to be working with this, there are several approaches you can take: you can work with one shared Domain Context instance, you can work with one instance per ViewModel, you can combine both, …

 

All strategies come with certain (dis)advantages, so if you’re architecting a new Silverlight solution, it’s important to know what these are (and how you can handle them).

 

For Silverlight Show, I wrote a two-part article series on this.  The first part has just been published, so if you’re interested in this, go check it out! :-)

 

Update: as of Saturday 19/03, the second part has been published as well.

 

Happy coding!