<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" 
      xmlns:thr="http://purl.org/syndication/thread/1.0">
  <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/02/silverlight-for-business-appli.html" />
  <link rel="self" type="application/atom+xml" href="http://www.insideria.com/atom.xml" />
  <id>tag:www.insideria.com,2009://34/tag:www.insideria.com,2009://34.35460-</id>
  <updated>2009-11-16T15:13:59Z</updated>
  <title>Comments for Silverlight for Business Applications (http://www.insideria.com/2009/02/silverlight-for-business-appli.html)</title>
  <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.21-en</generator>
  <entry>
    <id>tag:www.insideria.com,2009://34.35460</id>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/02/silverlight-for-business-appli.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.oreilly.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=34/entry_id=35460" title="Silverlight for Business Applications" />
    <published>2009-03-01T02:11:44Z</published>
    <updated>2009-03-01T02:38:56Z</updated>
    <title>Silverlight for Business Applications</title>
    <summary>Good design is important in any business application. With Silverlight there are tools and techniques that can help improve the design and make an application more testable, modular and scalable.</summary>
    <author>
      <name>John Papa</name>
      <uri>http://johnpapa.net</uri>
    </author>
    
    <category term="Blogs" />
    
    <content type="html" xml:lang="en" xml:base="http://www.insideria.com/">
      <![CDATA[<p>Silverlight 2 has a lot of features that make it ideal for business applications. When you try to put it into an architecture there are some areas that really need addressing such as what patterns to use (if any), how to make it testable (if that is your sort of thing), how to make it scalable (which should certainly be on your list), how to make it modular, and how to make it loosely coupled. I'll address each of these briefly to give you an idea of what they are and how they can be accomplished:</p>

<p><strong>1) Patterns</strong><br />
Patterns are only good if they help you. Sounds pretty silly, but its true. I have seen many projects get caught up in the theory of development patterns and the project ends up suffering because the chosen patterns may not truly be needed in some cases. However I do believe in using the right tool for the job and some patterns really do make a big different in development.</p>

<p>The MVP (Model-View-Presenter) works well with Silverlight as does the MVVM (Model-View-ViewModel). In MVP the Model is the data representation, the View is the visual UI, and the presenter is what makes the 2 connect (and the presenter talks to any services it needs). However a better pattern for Silverlight IMO is MVVM. In MVVM there is a Model and a View, just like with MVP. However instead of a presenter there is a ViewModel. The ViewModel not only controls what the View sees, but it is also what the View is data bound to. In MVP the View is bound to the Model but in MVVM the View is bound to the ViewModel. One big difference this brings is that with MVVM the View can get the data in a different shape than how the Model represents it. Often the classes that return data in applications do not quite fit what a UI (a View) needs. MVVM addresses this by making a ViewModel in charge of what the View displays.</p>

<p>There are many other good aspects of MVVM with SIlverlight too, but I'll hit those in a future post. For now, I just want to make it clear how the right pattern like MVVM can make a positive difference in a Silverlight application.</p>

<p><strong>2) Testability<br />
</strong>The Silverlight unit testing framework is available to help with this, if so desired. Its a nice tool that can help get TDD into the Silverlight development process. However, if you simply want to create better tests, at a minimum I recommend using a DI (Dependency Injection) pattern in your development process. An oversimplification of DI is basically stating that each class that will be tested has an interface and the interface can be injected into other classes. </p>

<p>For example, a Service class that goes to get data could be injected into a ViewModel instance. The service class could have an interface IMyService that which has 2 concrete implementations: 1 to get the data from a web service and the other to get the data from a hard coded local list (used strictly for testing and design time). Using DI helps make testing much simpler. I recommend using either Microsoft's Unity tools for DI or using the Ninject tools fr DI with Silverlight. Both are excellent and make testing a breeze.</p>

<p><strong>3) Scalable, Modular, Loosely Coupled<br />
</strong>Developing large business applications often means having several different modules that an application can be split into. For example there could be a maintenance module, orders module, and an HR module for a storefront application. It would be ideal to have each module developed by different small teams and snapped into the main application when ready. This would allow each module to be developed on their own timelines and remain independent of the other modules. This modularity and loose coupling compliments scalability, too.</p>

<p>There are many ways to accomplish this type of modularity of design. I have even created my own home grown architecture to do this for Silverlight applications. However if you want a more supported and widely used toolset, <a href="http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=17399">Prism 2 might be a great fit</a>. Prism 2 is developed by the Microsoft Patterns and Practices team and it helps address modularity, among other things. It is also easy to use with DI and MVVM, if so desired. </p>

<p>This is just a quick overview of some of the ways you can help design a solid Silverlight business application. There is a LOT more to cover, but I'll leave that for future posts.</p>]]>
      
    </content>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.35460-comment:2054316</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.35460" type="text/html" href="http://www.insideria.com/2009/02/silverlight-for-business-appli.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/02/silverlight-for-business-appli.html#comment-2054316" />
    <title>Comment from savantadmin on 2009-03-01</title>
    <author>
        <name>savantadmin</name>
        <uri>http://www.virtualofficespace.com.sg</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.virtualofficespace.com.sg">
        <![CDATA[<p>I checked up on the various <a href="http://www.virtualofficespace.com.sg"> serviced office</a> available and their prices are pretty competitive. Any recommendations?<br />
</p>]]>
    </content>
    <published>2009-03-02T03:30:45Z</published>
  </entry>

</feed
