Silverlight & ASP.NET MVC vs Web Forms (Very High Level)

http://www.silverlighthack.com/post/2008/10/23/Silverlight-ASPNET-MVC-vs-Web-Forms-%28Very-High-Level%29.aspx

Silverlight 2 RTW has been out for a couple of weeks now and it is
already being compared to ASP.NET MVC which is an evolutionary way to
design web applications using ASP.NET.  I read a concise summary (pros
and cons) of ASP.NET MVC from Jason Young.  His article can be read here: http://www.ytechie.com/2008/10/aspnet-mvc-pros-and-cons.html

I decided to compare Silverlight in a similar way to what Jason did when
he compared ASP.NET MVC vs. Web Forms.

Here are the items he listed as ASP.NET MVC vs. Web Form:

PROs vs. ASP.NET Web Forms

  1. No ViewState or "surprise crap"

    • This applies to Silverlight as well.  Silverlight brings the
      "desktop" experience to the end user and there is no ViewState that is
      used in Silverlight.
  2. Faster server-side & client-side
    • Silverlight is faster on the client/server side depending on how
      you look at it.  Silverlight is compiled in a .NET subsystem of
      Silverlight.  You have access to multithreading, LINQ, complex data
      structures, etc.  The performance vs. an ASP.NET or AJAX/JavaScript
      application is it magnitudes times better because of the client
      execution and some of the items that normally are handled in a server
      BLL can be brought down to the client
  3. Simplified model for multiple related views
    • Silverlight supports the complete seperation of the data and the
      UI.  Taking this further by just creating seperate views for say another
      consumer of Silverlight is pretty powerful.  You can apply the same
      MVC/MVP pattern inside Silverlight and attain this level of
      abstraction.  Jason mentions an example of being able to create a
      seperate view for an iPhone and only the View component has to change. 
      This applies to Silverlight as well for different things.  For example, I
      have large sized Silverlight app I want to port to SharePoint.  I can
      create a "Smaller View" for SharePoint so it fits nicer into the UI. 
      Furthermore, Silverlight Mobile is being private tested now.  I would
      assume that same very powerful level of abstraction applies as well to
      create a "Mobile view" for your Silverlight application.
  4. Unit Testable
  5. Challenges if you are not running IIS 7
    • Silverlight does NOT care if you are not running on IIS 6 or IIS 7 or
      Apache for that matter.  This is one feature where Silverlight has an
      advantage over ASP.NET MVC.
  6. Client Caching
    • In ASP.NET Web Forms or MVC, you are caching on the server. 
      Silverlight allows you to cache on the client via Isolated Storage
      (which can be increased to hundreds of megs if necessary).  This allows
      applications to perform ultra fast without bogging down the hosting
      server.

 

CONs vs. ASP.NET Web Forms

  1. Difficult to convert existing code
    • Silverlight is a completely different programming platform than either
      ASP.NET WebForms or MVC.  Not only will a lot of the code not convert,
      you also have to think about the client layer and in most cases a
      complete re-architecture is needed if you are replacing large modules
      inside your existing ASP.NET site.
  2. NOT the best SEO out of the box
    • Google several months ago started spidering SWF files and adding them
      to the search engine.  I think Silverlight is probably still a ways away
      here.  What you can do for Silverlight SEO is the basic tricks to
      describe the meta data tags really well around the plug in.
  3. Data access
    • Data access in Silverlight is limited to Web Services/WCF/ADO.NET Data
      Services.  You cannot make direct calls via ADO.NET or stored
      procedures to a database.
  4. Security
    • Silverlight runs on the client.  A lot of your bits are then roaming
      in the wild on the internet.  Furthermore,  some of the data access
      techniques do not support full WS* standard security.  Therefore, beyond
      certificate based transport security, you are either writing a lot of
      your own plumbing code or waiting for the next rev.  The XAML code is
      pretty much insecure; not many applications have their Intellectual
      Property in their UI.  In Silverlight, that can be very easily reverse
      engineered using Silverlight Spy for example. Silverlight, just by
      nature, is a little less secure than an ASP.NET MVC application. 
      Obviously, you would want to encrypt/obfuscate your Silverlight
      assemblies before letting them off in the wild.

In conclusion, even though Silverlight and ASP.NET MVC are two
completely different technologies, they share A LOT of
the same pros and cons Jason pointed out vs. Web Forms.  The only
difference is that the hosting model for Silverlight is a lot simpler. 
Silverlight does have its nuances with data access and security that you
have to worry about.  Furthermore, you do get other benefits like
client-side performance and client-caching.

This entry was posted in UI. Bookmark the permalink.

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s