BT

Interview with Mathew MacDonald, Author of Pro Silverlight 5 in C#

Posted by Jonathan Allen on May 29, 2012 |

InfoQ: Silverlight 5 has only been out for three months. Do you see a lot of developers already jumping into it or are they sticking with Silverlight 4 for the time being?

Mathew MacDonald: Developers have certainly flocked to Silverlight 5 in terms of playing with it, learning about it, and getting excited about its new features. Whether they actually deploy Silverlight 5 in a project depends on whether they need one of its new features. If not, developers are likely to stick with Silverlight 4, which is completely backward compatible. That said, Silverlight 5 is, as with all Silverlight installations, a nearly effortless micro-install.

InfoQ: Do you see Silverlight as more of an Internet technology like Flash or something that is better suited to internal LOB applications?

Mathew: Increasingly, it’s becoming clear that developers who want to create cross-platform applications in the future will have only one choice: HTML5 and JavaScript. That future is still far off (and it comes with a number of tradeoffs), so in the interim Silverlight is a great tool that fits specific development niches.

LOB applications is an example where Silverlight fits exceedingly well. Increasingly, companies are bypassing on the full .NET platform and rolling out internal applications that use Silverlight. In a sense, Silverlight has become a sort of "WPF lite"-if you don’t need the full capabilities of WPF, Silverlight is a more streamlined and easier to manage alternative. Its features for managing and displaying large amounts of data (say, items in a product catalog) are far beyond any other web plugin or JavaScript toolkit that’s available today. And Silverlight gives .NET developers a way to use the same platform over the whole pipeline-they can run a web server that exposes a database through .NET web services, and Silverlight can talk to those services effortlessly.

Another niche where Silverlight makes sense is when creating media applications (for example, video players) or rich, graphical games or simulations. Programming these with HTML5 today is very difficult.

InfoQ: What particular advantages do you see Silverlight having over WPF when it comes to LOB applications?

Mathew: WPF is great too, but Silverlight is a bit more lightweight, easier to deploy, and allows you to run inside a web browser, if that's what you want.

InfoQ: Aside from situations where the features simply aren't supported (e.g. direct database access), what LOB scenarios do you think Silverlight shouldn't be used in?

Mathew: Well, I assume you mean direct access to a local database, and Silverlight developers can use local storage to invent some pretty reasonable workarounds, if that's what they need. Silverlight is a good fit for LOB applications, all around.

InfoQ: Any thoughts on what is necessary for HTML5 to truly replace Flash > and Silverlight for games and media applications on the web?

Mathew: Hard to say. Obviously, the most important factor is time--time for the browser that support the technologies to become more and more adopted, and time for the various standards that are generally described as or lumped in with HTML5 to evolve. Developers who are using HTML5 today will find that it's a "build it from scratch" experience. Somehow, that gap needs to be filled so ordinary developers can create practical applications without genius-level coding. Whether that gap will be filled by improving standards, other development frameworks that generate HTML5 and JavaScript, or some combination, remains to be seen.

InfoQ: Silverlight 5 was a pretty big release, is there any particular features you think developers should concentrate on?

Mathew: Although Silverlight has a slew of minor refinements and improvements, it chiefly stands out for a limited number of new features, which are important in specific scenarios. These include:

  • More powerful full-trust applications that can access virtually any file (much like a real desktop application)
  • Better performance with H.264 media playback
  • Gaming support on Windows computers-that means lower-level audio playback and an entirely new 3D model based on a reduced version of Microsoft XNA (the same toolkit that’s used on the Xbox).

InfoQ: What do you think is the most important thing for developers to learn about programming for Silverlight in general.

Mathew: They need to understand exactly which needs Silverlight addresses and which ones in doesn’t. In particular, Silverlight is not for mobile devices.

InfoQ: Do you have any thoughts on the Microsoft's decision to exclude plug-ins from the Metro Browser?

Mathew: This means that Silverlight will not be a good choice for developers who want to create apps for mobile devices (say, tablets) running Windows 8. If that’s your goal, you need to consider Metro (for a native app experience) or HTML5 (for a web-based solution).

Does that mean Metro or HTML5 is a better platform choice then Silverlight? No. Right now, developers need to navigate a complex set of tradeoffs. If you use Metro, you are tied to the Windows 8 platform-there’s no way to run the same app on an iPad, a Windows 7 desktop, a Linux computer, and so on. If you use HTML5, you don’t have all the rich features of a mature platform like Silverlight, and you’ll need to pick up third-party toolkits, right some tedious code, and possibly reinvent the wheel a little. So it’s very important to understand exactly what you gain--and give up--with Silverlight.

InfoQ: There seems to be a lot of differing opinions on exactly what the MVVM design pattern is? How would you define the pattern and do you see it as something essential to Silverlight programming?

Mathew: The MVVM pattern is very popular with Silverlight developers. It's a bit confusing, because the pattern is itself is a bit theoretical. Very generally, the MVVM pattern deals with the separation of concerns-for example, making sure the set of code that deals with displaying your data isn't intermeshed with the code that processes or retrieves your data. Any conscientious programmer will be aware of these issues, with or without MVVM (and MVVM is clearly overkill for simple applications). So the theoretical underpinning of MVVM is a bit of a red herring.

The important part is the *implementation* of the MVVM pattern in Silverlight. Essentially, Microsoft has a series of interconnected tools that make it easier to design complex line-of-business applications that interact with a database on an ASP.NET web server. Without getting into the technical details, a Silverlight developer who uses these tools gets several advantages, such as automatic code generation (for the data access code), integration with ASP.NET services (such as authentication), and an easier
way to implement validation rules on the client and server. That said, MVVM isn't necessary to perform these tasks, and many of these features can be used independently. Personally, I don't use MVVM unless the scope of the project clearly warrants it.

InfoQ: Do you see Moonlight, the Linux version of Silverlight, as being a viable platform at this time?

Mathew: Moonlight is an incredible technical achievement, but it is a niche product. It has struggled to keep up with new Silverlight features, and with the inclusion of more and more Windows-specific features, the distance has only increased. Furthermore, the JavaScript+HTML5 approach is likely to increasingly crowd out Moonlight on Linux, more than it threatens Silverlight on Windows.

InfoQ: Would you say that you are happy with Silverlight on OS X or are there some key features missing?

Mathew: Silverlight on OS X lacks a few Windows-specific features (like the new native 3D engine). The vast majority of Silverlight applications will run perfectly on OS X, but this is a clear sign that Microsoft is not pushing forward as aggressively in the Mac space--and that the popularity of Silverlight on Mac won't increase in the future. For many people today, Silverlight is a lightweight .NET platform, and the Mac support is a nice frill, but not essential.

InfoQ: Given that Silverlight is losing its cross-platform vision, do you think it would be appropriate to remove the boundaries between it and the rest of the .NET stack? Or in other words, should Silverlight be allows to use any .NET assembly?

Mathew: Well, a couple of versions ago .NET introduced the ability to compile an assembly that could be shared with Silverlight and .NET. Obviously, in order for this to work, that assembly needs to use a more limited subset of the .NET Framework--if it uses classes that aren't available in .NET, it can't be shared in this way. But if you're a developer who needs to share business logic, the capability already exists.

The other barriers (to getting more features in Silverlight) are technical. For example, Microsoft has been strict about limiting the size of the plug-in download, ensuring the best possible compatibility on Mac, etc.

Sample Chapter

We are proud to offer a chapter from Matthew’s book titled Animation Basics. His book, Pro Silverlight 5 in C#, also includes chapters on advanced animation, 3D graphics, sound, and video.

About the Book Author

Matthew MacDonald is an author, educator, and former Microsoft MVP for Silverlight. He’s the author of more than a dozen books about .NET programming, including Pro Silverlight 5 in C#, Pro WPF in C# 2010, and Beginning ASP.NET in C# 2010. He’s also the author of Your Brain: The Missing Manual (O’Reilly), a popular look at getting the most from your squishy gray matter. Matthew lives in Toronto with his wife and two daughters.

 

 

 

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Useful for reformulating Silverlight Strategy by Mike Gale

Moonlight is now no longer being developed so that's off the table, long term.

Given that the old dream of one UI for all is now obviously dead I think that a WPF / Silverlight place in the sun might be closer.

HTML5 is not real for everybody today, and won't be for some time. (I see about half of visitors to some sites being IE 8 or earlier. Try serving HTML5 asides to those guys!)

The small devices form a small but growing part of visitors to some web sites...

So the honest evaluation is that for trivial stuff to reach all, use pre-HTML5 markup.

For more serious work, but to limited audiences, use something more capable. (And do more of what's right than what's possible.)

I think realisations like that might open the door for some who've been holding back on Silverlight.

Re: Useful for reformulating Silverlight Strategy by Panda Wood

>> I see about half of visitors to some sites being IE 8 or earlier

These are my website's browser stats as of now ... IE8? don't care ;-)
1. Chrome 4,786 29.67%
2. Firefox 4,482 27.78%
3. Safari 3,063 18.99%
4. Internet Explorer 2,373 14.71%

Re: Useful for reformulating Silverlight Strategy by Mike Gale

You're right you must look at your own stats.

Like you I'm inclined to think that dumping 15% or less of the audience is a good cut point.

For an analysis from Ars Technica, 5 June 2012 see j.mp/M1UUcC, I think this is US centric. Note how many Chrome users Ars has. (Bottom of page.)

For a round the world analysis early April 2012 see j.mp/Ioiodr

(Naturally the real situation at any particular site can be way outside the range of these.)

Re: Useful for reformulating Silverlight Strategy by Panda Wood

15% is IE *all versions*.
Around half of that is IE8 -> 7%.
If 7% of my users miss out only on the functionality specific to HTML5 that isn't supported in IE8.. yes for my particular case, that is fine. I can't spend time on 7% (and falling).

I'm just putting my hand up & telling you my situation, please don't assume I'm trying to make a general statement that should apply to anyone else. I don't care what the world analysis is.

Yes you are right that I must look at my own stats, I have no idea why I would look at someone elses.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

4 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT