This article explains about why Silverlight is needed, why we should move to Silverlight and it also explains about the relationship between Web Server, Web Browser and Silverlight.
What made me really invest time in learning Silverlight? Hope this will be helpful for beginners who want to know about "Why Silverlight?"
I will try to write a post daily but my first post will concentrate on “What made me move to Silverlight?”. The second post will include more on the technical side of Silverlight. After a few posts, I will be writing one application which will help us to understand Silverlight starting from Login, WCF, Data Binding, Prism, ADO.NET Entity framework, which will give us a complete flow and help us to understand Silverlight. Please feel free to write to me at email@example.com for any suggestions or questions. Please do leave comments on the post.
So let’s start.
Before beginning to know more on Silverlight, first we should know:
- Why Silverlight?
- Importance of Silverlight?
- Where to use?
- Underlying architecture
Before I begin with any new language, I always want to know what language it is? How to use it? And what is the architecture behind it?
I will answer these questions with a case study. In that way, you all will understand it very clearly.
I got one project last year. The client need was to develop a website for some product which will have tree control, menu item, UI elements and business logic involved in it, etc. Then I took the project and started working on it.
Here you won’t find simple Hello World Stuff.
Somehow I managed to complete the project and delivered it. The same client again came to me and started asking me that he will be giving the demo of this application to his client and needs a good UI and said he will pay me for that. Then I said ok, I will look into it then I got to know that in Adobe Flash, we can do a lot of good UI stuff, animation, etc. I had very little time to deliver this, therefore started searching for a Flash designer. Then I found one who did his job well. He created a very nice UI with Menu Dropping from top and very good jazzy user interface. Then the biggest problem was waiting for me. How will I call events from Flash??? Damn…. There is something called action script in Java which will do that work. I failed to find an action script programmer. People who know Flash just know UI and animation they don’t know about action script. I struggled a lot to find one developer and get it done. Finally I ended up learning:
- Action Script
All need different expertise and I got really very frustrated learning them. I know everything but I am not a master in any one of those. Take any of the above mentioned languages. They need more time and effort to get expertise in them. All I was doing was wasting time and money in outsourcing each and everything to another company and not giving the client a very good product.
- HTML replaced by Silverlight
- Flash replaced by WPF
<TextBox Name=”txtBox” Text=”Hello Silverlight!”>
The above XAML code will create a
TextBox with “
Hello Silverlight!” written in its
textbox. It’s so simple. Now I have a technology which is worth learning.
And that’s Silverlight. Now you might have got enough idea on Why Silverlight?
Now we can move to the relationship between WebBrowser, Webserver and Silverlight.
We will try to understand the relationship between web browser, web server and Silverlight.
- Web Browser
- Web Server
- HTTP Protocol
This post is dedicated to these.
1. Web Browser
Web browser is nothing but an application residing on the Operating system which will render the HTML.
Rendering means that it will know how to present the HTML Tags. It’s very important to know about working of web browser and most of the content here will talk about web browser and web server.
I will explain with one example.
When you type http://www.dhaneel.com, you see my blog, but what is happening behind is what I am going to explain.
What web browser does the same thing we are going to do to it with telnet command.
- When you type http://www.dhaneel.com -> what is happening is it’s connecting to web server on remote host and giving me the page back.
Please note that web browser by default connects to port number 80.
Now open command prompt. You can do that by going to Start -> Run and type the following:
telnet www.dhaneeel.com 80
[ Note : Telnet Comes along with Windows. It’s a program which can be used to connect to any machine on any port. Like you want to connect to SMTP server of Google. Then use this
command.telnet smtp.gmail.com 25]
Figure 1.0 shows usage of telnet to connect to webserver [ Port 80 – Default ].
Once you are connected to the webserver, then you need to talk to the webserver in a language which it can understand and those are called protocols. Webserver supports mainly two protocols:
GET protocol is generally used to request for a page and
POST protocol is used to post the data to the webserver. We will discuss the
What webserver expects is a
GET followed by the page it want to fetch.
GET “page url”
So after connecting to webserver, you need to enter the following thing:
And mainly press Enter twice. That’s how the protocol is designed. That’s it. Now you will have the HTML code coming back from the server.
If you save all this data in a file with .html extension and open it in browser, you will see the same content which you will see when you visit http://www.dhaneel.com/msbuild-for-silverlight/.
The entire HTML comes up to the client side as a DOM document needs to be replaced each time a new request goes to the server. Let me give one example. Suppose you want to delete one mail in your inbox. Then one new request will be sending it to the server and then the entire response HTML without that deleted mail should come back. Then we need to refresh the entire screen.
Hope now we are clear with Web Browser and Web Server. Let’s move ahead and find out how Silverlight is working.
For Silverlight, Microsoft has developed a Plug-In which can be called as Light .NET CLR. This can be installed on the browser (currently it can be installed on Internet Explorer, Firefox, Chrome). The Plug-in is nothing but a stripped of version of the FAT .NET CLR.
You can use this to program in C#. You can make use of almost all basic data types which are present in .NET CLR.
Points of Interest
Microsoft is trying to put some lightweight CLR on the client side. I think it's kind of desktop application, but we are making use of web browser to put the necessary components in it.
- 26th May, 2009: Initial post