Silverlight Hack

Silverlight & related .NET technologies

About Me

My name is Bart Czernicki.  I have been playing around with computers since 1988 and have over 11 professional years in the IT field.  I currently work as a Sr. Software Architect at a software development company.

NONE/NADA/ZERO of the comments or opinions expressed here should be considered of my past or current employer(s).  The code provided is as-is without any guarantees or warranties.

Currently working on: Silverlight 2.0 Projects with WCF

Contact: bartczernicki@gmail.com

View Bart Czernicki's profile on LinkedIn

Calendar

<<  January 2009  >>
MoTuWeThFrSaSu
2930311234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar

Silverlight 2 for Mobile - Why you should start using a MVC pattern

Silverlight 2 for Mobiles was announced at the PDC.  I wasn't there, but I read about it on Chris Hayuk's blog here.  The real cool part of the announcement is what they announced that there will be no changes required to your code.  So, this is not some Silverlight-type Compact Framework step child subset of .NET.  To quote Chris exactly:

"YOU DO NOT HAVE TO DO ANYTHING

TO MAKE YOUR SILVERLIGHT APPLICATION TO MAKE IT WORK ON THE MOBILE,

NO RECOMPILING, NOTHING."

That is a pretty cool goal if Microsoft achieves this kind of transparency with the Silverlight 2 plug-in on mobile handhelds.  However, to think that your 1280x1024 site with huge graphics and animations is going to automatically scale properly is ludacris.  However, this is what software design/architecture patterns were made for.

You have problaby heard of the ASP.NET MVC Beta out there that has all the no postback and no viestate fluff etc.  However, the MVC pattern at its core seperates the business logic from the UI.  For example, in your web form you have a button and then you write a click handler to print "Hello".  In ASP.NET this would be handled all in your codebehind cs file.  With the MVC pattern changes this where the user click is handled by the controller and then sent to the model.  I am not going to go over MVC in any kind of detail.  However, the main thing to understand is that the UI code is seperated from the business logic properly and other UIs can simply be plugged in with a different View component.  This lends itself very nicely to the Silverlight MVC pattern.  Imagine writing an application in Silvrerlight 2 and simply swapping out the View for Silverlight 2 Mobile and the entire application just works.  No code changes just that inside a regular browser you will load a normal View object and for Silverlight 2 Mobile you will use your Mobile View.  This mobile view might be: simpler in scale, use a simpler/clearer theme, use less animations in order to fit nicely inside the smaller resolution screens.  Depending on how your app is designed this might be all enclosed inside your XAML.

 

I had my "oh that makes sense now" moment with MVC several months ago, after seeing an example similar to this.  Hopefully Silverlight developers can see that using a pattern like MVC (or MVP etc) is really powerful and not just some loosely thrown around "best practice".  Furthermore, hopefully this example with Silverlight 2 Mobile helped.  If Microsoft achieves its goal of being able to have one single runtime for the web and mobile; investing in the MVC pattern can potentially save you a ton of work in the future if you are thinking about targeting the mobile market.

Posted: Oct 28 2008, 19:37 by Bart Czernicki | Comments (5) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: Silverlight | Mobile
Tags:
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading