Thoughts about application packaging, Resources, MVVM and others

October 24, 2010

I thought a lot before decided to write this post…

First – I’d like to thanks Ariel Ben Horesh for “inspiring” me to write this post and for dedicating so much time to write his post!

After reading his post I thought a lot and my thoughts about the post are the follows:

1. First, I thought about the applications and the way to provide user with best experience while loading those applications… The users shouldn’t wait minutes for application to download… While authoring large Silverlight applications (MVVM or not) the author should consider to split package (XAP file) into multiple packages to improve loading time, memory footprint, etc. This will enable your application to only use what it needs, when it needs it but also provide an experience to the user and improve overall download times for your application. It is wrong to assume, that all applications are being used in company intranet on 100Mbps-1Gbps bandwidth like connection between developers workstation and internal test webserver. The best practice is very clear about it; for more information I suggest learn about it here; the specific lab named “Partitioning Your Silverlight Application for Deployment” and could be downloaded from here.
Generally, the practice when developer have to re-build the whole application package (let’s say 20+ projects) every time single DLL changes is not optimal for real LOB applications and to the real projects. Much easier to recreate a specific XAP package. I think Microsoft was very clear on this while introduced MEF and added it to Silverlight as well.

2. My second thought was about a resources… I realize, that many of developers uses a resources, but never thought about them in-depth.
To load resource from assembly in the same XAP package, the assembly should be loaded first and then get manifested resource stream from it (and load/add it to merged dictionaries).
To load an embedded resource from assembly packaged into external XAP (according to the technique described in my first point) the application should use a ResourceManager. The external XAP file need to be downloaded to the client machine first. Once downloaded, the assemblies from this package should be loaded and only then embedded resources could be used.
Last thing is about referenced assemblies in same XAP package. The referenced assemblies are not loaded if the types manifested in them are not used. In such case assembly should be loaded first (like in my first example) and the could be used. 
I created a small, but very self-explaining sample (not prism-based Smile) which introduces how to use resources from external assemblies. It could be found at the following location.

3. My last thought was about MVVM and Prism… As a consultant I see too many confusion between those two…

To put is very simple – Prism is not MVVM and MVVM is not Prism.

MVVM pattern is an adaptation of the MVC and MVP patterns in which the view model provides a data model and behavior to the view but allows the view to declaratively bind to the view model. The view becomes a mix of XAML and C#, the model represents the data available to the application, and the view model prepares the model in order to bind it to the view.
Prism is designed to help building modular WPF and Silverlight client applications. These types of applications typically feature multiple screens, rich, flexible user interaction and data visualization, and role-determined behavior.

Prism enable/supports MVVM, but MVVM itself is an architecture that much bigger than Prism. To learn more about Prism and MVVM please refer to the following links:

http://msdn.microsoft.com/en-us/magazine/dd943055.aspx
http://msdn.microsoft.com/en-us/magazine/dd458800.aspx

 

That’s it for now… I’d love to hear professional opinions about my thoughts – the professional discussion is always good!

Alex

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

6 comments

  1. Ariel Ben HoreshOctober 24, 2010 ב 22:02

    Hey Alex, Thanks for this post.
    [I don't understand why I "inspired" you and not just inspired you, but oh, well :) ]

    I found your resources sample interesting, but it wasn’t clear to me your recommendation, bottom line when do you need to use which method, perhaps you can elaborate.

    Beside that issue, I agree with most of your points.

    Have fun in PDC :)

    Ariel

    Reply
  2. MBT ShoesJune 17, 2011 ב 10:58

    Woo,It is my pleasure to share this ,good luck for you!

    Reply
  3. uggs.comAugust 11, 2011 ב 7:03

    this is definately a way to sustain your growth. Who doesn’t need more clients? Give it away if you can, and keep traffic coming in!

    Reply
  4. casque beatJune 19, 2012 ב 6:43

    After reading the article in this blog, I instantly grow a lot, I should treasure already grasp the future, rather than spend time, fallen, so that is not good. Want to know the author’s spirit is better, more thought, and positive.

    Reply
  5. prada schuheJuly 4, 2012 ב 5:27

    You in this blog article posts, but in my opinion are the essence! Are the quality of the article posts, there is little garbage article posts like it seems you put your blog to do well, at least I know in it seems to have no one quite like you!

    Reply