Prism & Silverlight: Part 1 - Taking Sketched Code Towards Unity

Sign in to queue

Description

This is part 1 of a series of screencasts illustrating some of the ideas found in "Prism" or the "Composite Application Guidance" from the Patterns and Practices team that can be used to build Silverlight applications in a way that lends itself to testability and modularity.

In talking to customers building business applications with Silverlight I find that Prism (and it's friend Unity) is frequently mentioned but not everyone has seen it and so I thought I would explore it myself and capture some of the results of that exploration here.

We start off with some fairly basic code which we move towards making use of dependency injection and modularity;

and then we move that code into the Silverlight world and try to illustrate some specific areas of Prism;

and then finally we try and bring some of these concepts together in a longer, more realistic example of a simple Email application built using the Prism framework - warning, this is a much longer session but I wanted something that draws things together;

The recommendation would be that you watch the 10 screencasts in order but if that feels like too long a process or if you're already very familiar with concepts like dependency injection and containers like Unity then perhaps watch the last screencast first and then refer back to the previous screencasts if certain areas need more illumination.

I put the source code for Video 10 here for download as it's a bigger set of source and something you might want to explore after the video - this does not necessarily represent "best practise" but is, instead, just meant to illustrate some of the Prism ideas.

Embed

Download

Download this episode

The Discussion

  • User profile image
    Richard.Hein
    Thanks, that was good and the presenter is a very fast and flies through the code with impressively few typos ... I find it distracting when someone is typing live code and is constantly correcting typos through the presentation.  That makes it enjoyable to watch and follow along in VS, even if I had to "rewind" repeatedely while catching up.
  • User profile image
    rgruchalski

    Is the lack of audio planned? I mean, I don't mind but this looks somehow strange without audio?

  • User profile image
    Moshe

    Great video! Very nice to see good software design practices demonstrated in an easy-to-learn video. I was wondering what screen capture software you use to make these?

  • User profile image
    figuerres

    Interesting will have to view this later and see if it helps.

     

    from my view right now we have a rainstorm of bits coming out and no really clear directions.

    RIA

    WCF

    ASMX

    ADO Entitiy framwork

    MVVM

    linq to this that and the other....

    and

    ASP.NET MVC

     

    just to name the first few that come to mind

     

    and then add Azure (sp?)  and prism and unity

     

    Ah we need some UNITY in a really big way right now.....

    while beeing able to chose is mostly a good thing when you have so many and so little idea which ones to spend time with it's hard to

    get focus on any one thing.

     

    also after the way linq to SQL has been sidelined it now makes me ask what other cool stuff that's in the works today will be droped next year?  it's very very frustrating to try and pick the winner like it's a lotto when it's my time and money and my rep on the line.

  • User profile image
    Richard.Hein

    There should definitely be audio ... I haven't had any problems.

  • User profile image
    mtaulty

    Hi,

     

    I used Expression Encoder 3 Screen Capture - try it yourself from here http://www.microsoft.com/expression/products/Encoder_Overview.aspx - the standard version is free and will let you record up to 10 mins of screen capture.

     

    Mike.

  • User profile image
    mtaulty

    No, there's definitely meant to be audio - as a silent movie this is going to be a major flop Smiley

  • User profile image
    rgruchalski

    Yeah, just noticed, on the headphones earlier on I couldn't here the audio at all. Now I can hear it but it is really silent Smiley I found this to be an issue across c9 in general lately. Anyway, this looks like a great series, gonna have a late night tonight!

  • User profile image
    Deactivated User

    Comment removed at user's request.

  • User profile image
    Deactivated User

    Comment removed at user's request.

  • User profile image
    Kevin Nixon

    This is the good stuff.  I've previously used Prism in conjunction with Unity to create composite WPF clients in this manner, but it's useful to see a run through of the whole process (disclaimer .. I watched the first 40 minutes or so .. will continue with it tonight).  It's tackled at a refreshingly rapid pace whilst remaining clear and entirely comprehensible too.  Bravo.

  • User profile image
    Edsilv

    Gah! I keep getting MEDIA FAILURE errors as it loads Sad

  • User profile image
    mtaulty

    All wallpapers are from http://www.wallpapers-room.com/ and cycled every so often via Windows 7 Smiley

     

    Thanks,

     

    Mike.

  • User profile image
    Raumornie

    Wonderful videos Mike.  The 'live coding' style of presentation works far better for me than a cut and paste, pre-packaged format that seems to be all too common.  Keep up the good work!

  • User profile image
    mtaulty

    Thanks - will try Smiley

  • User profile image
    IanBlackburn

    Looks great Mike - many thanks - looking forward to watching these on my trip to Belfast this week.

     

    On a download point - for those trying the zune format download - none worked for me; the Zune player complained that all the files were corrupted (using the latest Zune software); download the wmv files instead which worked fine (but were bigger).

  • User profile image
    saschab

    Where do I get the lifetime back, I spent on this video ? ;o) I didn't expect a Webcast that has nothing at all to do with unity ...

  • User profile image
    mtaulty

    Ah, apologies if it wasn't useful to you. As I said "we start off with some fairly basic code which we move towards dependency injection and Unity". I didn't feel that just starting off and saying "Right, here's Unity" would necessarily work for everybody and so this video is really just the starting point for the code that we manipulate in the next three videos.

     

    As I say - one way to view these is to start with video 10 and then work back if and only if there's something that needs more explanation. The other way is to treat videos 1-9 as a set that make (hopefully) sense together.

  • User profile image
    Yazid

    How can I download it and watch it on the train or plane?

     

    Thx

    Yaz

  • User profile image
    Aaron Hoffman

    The audio did not work in VLC for me, but did work in WMP 11 (fyi, I have the Expression 3 suite installed...)

  • User profile image
    Andy Kakembo

    Thanks for this Mike. It was the series that got me from reading about to using PRISM  & MVVM.

     

    The journey from monolithic to composite app matches a battle we've had at Pentagon and this has helped us loads in pulling all the technical strands together.

     

    A brilliant learning resource. Once again, thanks.

  • User profile image
    Joe Kahl

    Audio is there.  Definitely.

  • User profile image
    dianar77

    You are a great teacher, It is really a great series. I am right now in #6. and it has helped me a lot to understand prism. Thanks a lot.

  • User profile image
    v1r0n

    Please do update (or create new) videos with the latest Prism build.

     

    Thank you.

    viron

  • User profile image
    sirfmemon

    Hi Mike,


    can you pplease provide complete set of code from begining till end. I liked your way of explaining the modular apporach.

     

    thanks

  • User profile image
    GautamG

    Mike,

    This is the best explanation that I could find to learn about Prism and Unity. Thank you for all your effort and the great tutorials you have posted. 

  • User profile image
    mrooney

    Wow!  What a wonderful, concise and very fluid setup...  Not understanding why I would want to use Unity at the beginning of this video, I'm now seeing it's value!  Great Job!  Very Professional.  Wish you were my prof in university!

  • User profile image
    Stephen McMahon

    Winston Pang mentioned that all of the iPod versions were the same.  Actually, they are all different, but when imported the MP4 files into iTunes they all have the same title which makes it difficult to determine the order in which to watch them.  I compared the times from the web versions and changed the titles accordingly and then re-synced to my iPad.
    That aside, I believe that these are excellent sessions.  I really appreciate that these start at a very basic level and slowly bring the user into the actual goal of the presentation.  I have already recommended this to my co-workers.
    Stephen

  • User profile image
    Santosh

    Hi Mike,

    Really Great explanation!! I was trying my implementation in the same way, but there is some problem while configure the container from App.config file, there is "The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)" error shown at run time. However the references are accurate. Can you please explain more about the unity container app.config file?

    Thanks!
    Santosh Dubey

  • User profile image
    Nikunj

    I am not able to load video since 30 minutes, can anybody tell me what is the issue?

    Thanks

  • User profile image
    SchalkvanWyk
    Hi Mike Great effort, but please inform the more advanced guys in ADVANCE to start watching the videos from the bottom up. The first video gives a good background, but man it's not something I need to go through... (would have been great about 5 years back). I will download part 10, hopefully it will be more useful...
  • User profile image
    Boris

    Mike, thank you so much for these videos - they've been immensely helpful to me so far. However, I am facing a problem with your sample and I was wondering if you could share your thoughts with me on that:

    At the end of your 3rd video "Modularity with Prism", the code should be divided into modules and the Program.cs should run them with the manager. I am fairly sure that my code matches yours, but upon debugging the app, the loading of the first module CalculatorCommandParsingModule throws an exception with the message:
    "An exception occurred while initializing module 'Parsing'.
    - The exception message was: Could not load file or assembly 'Interfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
    Now, interfaces is referenced from the CalculatorCommandParsing library and everything build with no error.

    Any ideas?
    Thank you very very much.

  • User profile image
    Manish

    Amazing presentation and structuring... Great Job altogether...

  • User profile image
    Jignesh Gandhi

    Mike

    Fantastic videos. I really learnt a lot more faster with the live code presentation.

    Thanks a ton!!!!

    Jignesh

Add Your 2 Cents