Partilhar via


Silverlight and The Application Design

Today is August 5th 2008 and I am writing this short post just to convey how Silverlight changes the overall design of a conventional browser based application. Current public version of Silverlight is 2 Beta2.

There are many reasons to use Silverlight;

  • To enhance the UI of existing browser based applications; When we install Silverlight plug-in, browser can understand more set of tags (XAML) apart from HTML tags. Moreover we can use the capabilities of the presentation engine of Silverlight to draw better UI.
  • To scale the application; Since now most of the end user interaction and processing will happen at client side itself, there will be less number of hits on the server. So now the application could support more number of concurrent users.
  • To do things beyond JavaScript; Not many things can be done with JavaScript which can be achieved with Silverlight. one example could be rendering HD video, which requires us to use graphics card capabilities to render it.
  • To use existing skill set of developers; Silverlight supports multiple languages (like C#, VB.NET, IronRuby, IronPython etc.) we could reuse the existing capabilities of developers to create better applications over web rather than learning new technologies to enhance the UI of browser based applications.

Apart from these and many other features, one thing that attract me most is the way application deployment design changes with Silverlight development.

Almost every business application has three layers: The presentation/UI layer, Business Logic layer and data Layer. If we talk in context to browser based applications, the presentation layer sits over Browser, while the rest of layers (Business + data) sits at server side. Whenever there is a requirement to do some business processing or access data we go back to the server and this gives a bad end user experience.

With Silverlight, this design changes a little bit, but that little makes huge difference. With Silverlight, Presentation and Business Logic Layer can sit at Browser side while Data Layer can sit at server side. This means that now we have to go back to server ONLY when we need to get some data, otherwise we can sit happily at client side and attend them in real time fashion; just like windows applications do. On top of that, whenever we want to talk to server for data, we do so asynchronously which means end user doesn't come to know about whether server interaction is happening or not.

The above idea is conveyed in figure given below.

SiverlightBusinessLayer

 

Any comments/suggestions/questions more than welcome.

Rahul's

Comments

  • Anonymous
    August 05, 2008
    Would it be wise to put all business logic on the client? I'm looking at this with a MVP or MVC pattern in mind. Also reuse of the BI and it not being tied to the client. If I put all of the BI (the Model) in SilverLight how do I reuse the model for a local WPF client or a none SilverLight application? Would it be better to put BI on the server and use WebServices (then call business logic layer the Model). Is this because some of the BI in your diagram is in the Controller or Presenter? I'm just wondering if there is more logic in your explanation of the Business Logic layer being more than just BI. Or if something is missing. Also to me the Model contains both data and BI where as in your description it is separated. Before (ASP.NET MVC?): MC <------> V Server      Client After M <------> CV Server     Client I reread for the fourth time. The key word in one of the sentences is can. "With Silverlight, Presentation and Business Logic Layer can sit at Browser side" And to the point of reducing traffic over the wire. I don't know which would prove better. Anyone should accomplish that if designed correctly. D-BI-P or M-V-C or M-V-P

  • Anonymous
    August 05, 2008
    Hi some one Here is what I think:

  1. When you put Business Logic Layer in Silverlight it doesn't mean you cannot reuse it. You can develop Business layer as class libraries and use in Silverlight and then reuse teh code (will have to recompile) in WPF or any other applications. After all the CLR of both silverlight and .NET framework are one and the same (CLR and AGCLR are same). Its the BCL that differs. Just make sure that we use the common namespace of .NET framework and Silverlight BCL while implementing Business layer. So, you can implement MVC/MVP even when Business layer is at client side and I do not see this an any hurdle to implement these patterns.
  2. You can definitely choose to host business Layer as WCF service and reuse it. In fact this is the only option in some scenarios (like you need some namespaces that are not available in Silverlight BCL). Go for it when you need it! This option was always available, even with AJAX so I did not talk about this.
  3. The option that I described in the post talks about a possibility and not something that we must go for. It all depends on the scenario. The option of porting Business layer to client side is useful where Business layer is invoked more frequently which could save some bandwidth and help us to scale the server.
  4. I want to specify something unique which can happen only with Silverlight and no other existing Microsoft browser based technologies. Porting business layer to client side falls in that category. Hope this helps. Rahul Gangwar
  • Anonymous
    October 02, 2008
    Бродил как-то по Сети и наткнулся на [url=http://awmkurs.ru]видео-курс[/url] о том, как заработать на адалт-сайтах. После того, как я прошел данный курс, я реально зарабатываю в Интернете. Вот сайт этого чудного издания - [url=http://awmkurs.ru]awmkurs.ru[/url]. Удачи всем!

  • Anonymous
    November 11, 2008
    Хотел купить автомобиль из США. Много искал и нашел. У них есть в наличии и на заказ: http://hotauto.narod.ru/

  • Anonymous
    November 11, 2008
    Хотел купить автомобиль из США. Много искал и нашел. У них есть в наличии и на заказ: http://hotauto.narod.ru/

  • Anonymous
    December 30, 2008
    In our Silverlight project. We have 4 layers Client side: UI, Business Layer (Silverlight and client side processing) Server Side: Business Layer (server related processing), Data Access Layer

  • Anonymous
    May 13, 2009
    Недавно у дочки был день рождения. И я ей подарил - [url=http://www.avto-card.ru/]авто-открытку[/url]! Это обычная Газель, а с двух сторон установлены баннеры с поздравлениями! Если кто-то хочет порадовать и удивить своих близких - обратите внимание на avto-card.ru. Очень впечатляюще и просто удивительно. Рекомендую!!!

  • Anonymous
    May 13, 2009
    Недавно у дочки был день рождения. И я ей подарил - [url=http://www.avto-card.ru/]авто-открытку[/url]! Это обычная Газель, а с двух сторон установлены баннеры с поздравлениями! Если кто-то хочет порадовать и удивить своих близких - обратите внимание на avto-card.ru. Очень впечатляюще и просто удивительно. Рекомендую!!!

  • Anonymous
    August 23, 2012
    Okay I get your point but what about security ? I mean anyone can see inside your business layer and overcome your business rules