Shining the Light on Silverlightcs.uccs.edu/~cs525/studentproj/projS2010/bstroud/doc...the tool of...
Transcript of Shining the Light on Silverlightcs.uccs.edu/~cs525/studentproj/projS2010/bstroud/doc...the tool of...
Shining the Light on SilverlightExploring Microsoft's Attempt to Revolutionize the Web
Benjamin StroudCS525
Multimedia Computing and Communications
Spring [email protected]
Abstract Over the last several years Microsoft has attempted to bring Silverlight to the forefront of consumer driven multimedia technology on the web. Their hope is that Silverlight will become the tool of choice for developers and designers when creating dynamic and engaging content, whether it be video streaming, interactive applications, or more traditional web content. The goal of this paper is to explore Silverlight, its capabilities and its limitations. I will do this by comparing and contrasting Silverlight to existing alternative technologies as well as presenting some overall analysis of Silverlight's performance. I will touch on the history of Silverlight's development and also present some background Silverlight in general. There will be a section discussing how Silverlight is currently being used in the commercial market. I will also explore what new directions the creators and developers are hoping to take the technology. Finally there will be a discussion of additional ideas for features as well as a presentation of my overall conclusions.
Keywords – Silverlight, Multimedia, Microsoft, Flash Alternative, .NET, Moonlight
I. INTRODUCTION
A. What is Silverlight?
Silverlight is a multiplatform application framework which allows for rich interactive multimedia on the front end with a powerful traditional application or web oriented backend. The Silverlight platform is primarily designed for web based applications, but can support standalone desktop applications that run outside of a browser [21]. Its capabilities resemble those of Adobe's Flash product who is its most direct competitor. In later sections I present some comparison data contrasting both platforms.
B. History of Silverlight
Silverlight was first released in early 2007 by Microsoft[20]. It was originally called Windows presentation Foundation/Everywhere [8]. The first version was somewhat limited in capability and
only supported JavaScript to drive its user interfaces. It was a unique solution in that developers could make rich internet applications that were compatible with Microsoft's multimedia technologies (Windows Media Services)[8], but with the lack of a robust language to drive the back end, it had limited success.
Version 2 of Silverlight addressed this issue by vastly expanding the languages that could be used with Silverlight. The second version of Silverlight supported the .NET Framework and .NET compliant languages such as C#, Visual Basic, Python, and Ruby [8]. By moving in this direction Silverlight was able to further distinguish itself from similar technologies by offering the developer a very powerful backend application oriented framework that could accomplish very complex and data intensive tasks with a dynamic web oriented frontend GUI. Version 3 and 4 have built on this idea and have focused on improving the speed and power of the platform.
II. HOW SILVERLIGHT WORKS
A. Overview
A Silverlight web application is a compiled, client executed component that is downloaded when the web page with the embedded Silverlight application is accessed. The client user must have a Silverlight browser plugin installed to use the application. The server does not require any special software if no server side functions are included in the program [16].
B. Architecture
The Silverlight platform consists of two main components with an additional installer/updater module. These two components are the Core Presentation Framework and the .NET Framework for Silverlight [16].
The Core Presentation Framework consists of all the components and services that Silverlight needs to present the GUI of the application. This includes user input, interface interaction and manipulation, media control, Digital Rights Management (DRM), vector graphics, text, and images. This framework also includes the specialized XML used to specify the application's GUI layout XAML (Extensible Application Markup Language) [16].
The .NET Framework for Silverlight is a subset of Microsoft's full .NET Framework which allows for the use of .NET compatible languages as mentioned above. This module includes base class libraries, networking, data integration, and the Common Language Runtime (CLR). The CLR is the heart of the .NET solution. It provides the execution environment for .NET applications including memory management, garbage collection, type checking, exception handling and more[16]. At compile time the .NET compatible languages are converted into a Common Intermediate Language which is then Just In Time compiled at runtime. This abstraction allows for multiple languages to be used within the same application[2].
The installer/updater module simply provides a mechanism for the Silverlight application to be installed on the client's system the first time the application is accessed and provides an avenue for
subsequent updates.
Figure 1 is a graphical representation of the Silverlight architecture. I will explore some of the details of the components in the following paragraphs.
Figure 1 Silverlight Architecture [16]
1) Components of the Presentation Core: The Presentation Core includes the UI core, which manages the UI rendering of vector graphics, images, animations, and text. The Media component allows for the management and playback of various formats, most notably for users of Windows Media Services (which is a component of Windows Server) the WMA or windows media formats [16]. This allows for greater flexibility for those who are already using Windows Server for their server platform.
The Presentation Core also provides modules that handle the Digital Rights Management of media, the linking of data objects to UI components, and a XAML parser which is used to interpret the XAML based layout specification of the UI. The XAML code is also the primary way that the .NET framework interacts with the Presentation Layer. It allows for the programmatic manipulation of the UI via .NET compatible languages [16].
2)Components of the .NET Framework: The .NET Framework component of Silverlight is what
gives it the vital ability to support true application level development using languages and tools that many developers are already familiar with. The CLR or Common Runtime Language execution engine is the key component that give the Framework its power. The .NET component also includes a Dynamic Language Runtime or DLR which allows for the execution of scripting languages such as JavaScript, Iron Ruby or Iron Python. This component also includes a plug in interface to allow the use of other scripting languages with Silverlight [16].
One of the other tools laid out in the above diagram include the BCL or Base Class Library which provides useful programming modules such as threading, string handling, collections and even some cryptography libraries [16].
The .NET Framework also includes the WPF (Windows Presentation Foundation) controls which include GUI oriented buttons and interfaces designed to simplify the development of GUI driving applications [16].
The WCF or Window Communication Foundation gives the developer tools to manage remote data and services. It includes HTTP request and reply objects, an embedded browser object, support for RSS/Atom feeds, as well as support for JSON (JavaScript Object Notation)[7], POX (Plain Old XML)[13], and SOAP (Simple Object Access Protocol) [9] services. This module also includes support for cross domain HTTP requests [16].
The Silverlight .NET Framework also includes a Data module which attempts to simplify the process of working with different sets of data from different sources. It also allows data to be handled via XML and serialization classes[16].
The GUI elements of the Silverlight application are programmatically managed by the .NET Framework portion of the application, but they can also be managed via an external tool also created by Microsoft called Expression Blend which allows for a visual manipulation of the GUI elements and animations used in building an application[16]. The next section explores in more detail how applications are created using tools such as Expression Blend in combination with tools such as Visual Studios.
III. BUILDING AN APPLICATION WITH SILVERLIGHT
A) Development Environments
A developer has several options when considering which development environment to use to build a Silverlight application. This paper explores the three most prominent options, the free, open source solution from Eclipse, or the closed source pay version of Microsoft's Visual Studios 2010 and Microsoft's Expression Blend. A exploration of both solutions is presented in the following paragraphs.
1) Eclipse4SL: The open source solution is called eclipse4sl (Eclipse for Silverlight). It is built on top of the existing Java based IDE Eclipse which is very popular in the open source world, especially in the Linux community. This plugin however, is only available for Windows and Mac users so this implementation does not allow for Linux based development. The goal of this project is to not only
provide a free open source IDE for developing Silverlight applications, but to also improve the way that data is exchanged between Java based web services and Silverlight. The plugin does not add Java as a supported language for Silverlight development, but it does make exchanging data with existing external Java based applications easier [4].
The major advantages of this IDE for Silverlight development is that it is free and open source. The biggest disadvantage is that it will always be a bit behind in the versions of Silverlight that it supports. Currently it only supports Silverlight Version 2 (version 4 was recently released). Silverlight 3 support is still in development. It also does not support all of the .NET languages that can be used to develop Silverlight applications, it mainly supports C# and JavaScript [4].
2)Visual Studios: Visual Studios is Microsoft's flagship IDE. It is, not surprisingly, the recommended development environment for Silverlight applications. Like Eclipse4SL it is primarily intended for writing the programmatic elements of the application. It supports all the .NET languages that can be used by Silverlight and its debugging capabilities support Silverlight applications[17].
I have found in my experiments with the newest version of Silverlight, that the previous version of Visual Studios (VS 2008) is not supported for use with the latest version of Silverlight which was recently released. Apparently only Visual Studios 2010 can be used for Silverlight 4 development. Lack of backwards compatibility is a major disadvantage to developers who are unwilling or unable to upgrade their development environments whenever a new version of either Silverlight or Visual Studios is released. Microsoft does offer a less expensive, less powerful development environment that supports Silverlight 4. It is called Visual Web Developer 2008 [11].
3) Expression Blend: Expression Blend is a Microsoft product that is a primarily GUI oriented development environment that allows UI elements to be dragged onto the workspace, manipulated, and given basic functionality without any textual code being written by the developer. It also allows for animation creation and design done purely with the graphical tools available in the IDE. This development environment is meant for GUI development and is not well suited for developing the .NET framework portion of the application[1].
B) Languages
Silverlight lets developers use multiple powerful languages to create the programmatic portions of their applications. The .NET languages that are compatible with Silverlight include Visual Basic.NET, C#, as well as dynamic languages such as Ruby, Python, and JavaScript. These languages are used to create the “backend” portion that does intensive calculations and data management. The “frontend” UI is managed by XAML code which is also used to interface with the backend of the application [21].
C) Deployment
Deploying a Silverlight application to a web server is a fairly simple procedure. When the developer has finished designing and testing the application using the IDEs discussed above, it can be compiled into a releasable XAP application file[11]. The XAP file and its support files are then uploaded to the web server to be downloaded and executed when the client navigates to the appropriate
page [15].
IV. HOW SILVERLIGHT IS CURRENTLY BEING USED
A) Video Rendering
A popular use for Silverlight is to render streaming video content. Microsoft touts it as one of the areas that Silverlight improves over its competition by offering more codecs and a less processor intensive rendering of HD video. One prominent example of this is NetFlix Instant View which is a service offered by the online DVD rental company that allows subscribers to watch thousands of full length high quality movies on their computer using a Silverlight based player. The videos are encoded using Microsoft's alternative to H.264, VC1[6]. Silverlight is also being used to render videos from NBC's Sunday night football online[19].
B) Site Content
Microsoft's primary intension behind Silverlight seems to be for developers to create interactive Silverlight driven websites that are built around one or more Silverlight applications. Besides most Microsoft sites there seem to be few entirely Silverlight driven websites. Most sites that do use Silverlight use it for a particular application within the site, and use more traditional web technologies for other site content and navigation. This trend is likely to continue, since for basic navigation and presentation of static content, Silverlight doesn't seem to be a viable alternative to more established web technologies such as basic HTML, CSS or even AJAX.
C) Mobile Devices
Microsoft has recently announced that Silverlight will be the primary way that developers will create applications on their Windows Phone 7 operating system. This is not a specialized version of Silverlight, but the full framework [10]. At the time that this paper is being written the implications of this development are still unknown, but this could be a very important step in increasing developer interest in the platform. The success or failure of this strategy could also affect eventual iPad competitors that choose to use the Windows phone OS.
D) Install Base
One key drawback to Silverlight often mentioned is that users who have never encountered a Silverlight application will have to go through the additional step of installing Silverlight itself, before running the Silverlight application. Many people argue that people are very wary of installing new applications due to security concerns. There is also a chance that a user does not have administrative access to the computer they are using and will be unable to install a new application.
Silverlight's closest competitor is Flash. Flash's install base is around 97% of web users[14]. It is safe to say that most casual web browsers will not have to install Flash before they are able to use your Flash based application. Silverlight's install base is currently at 57%[14]. While much better than in previous years, there is still a good chance that a visitor to your Silverlight enabled site will be prompted to install. However, this gap is closing year by year and if the trend continues then within a few years Silverlight's install base should be comparable to that of Flash.
V. PERFORMANCE COMPARISONS
This section compares Silverlight primarily to its direct competitor Flash. The two experiments conducted are with basic rendering capability and raw computational power. There is also a brief discussion dealing with how a C# based Silverlight application compares in speed to a traditional C# console application built with Visual Studios.
A) Rendering
For this experiment I used a tool created for the express purpose of comparing Silverlight to Flash. It is comprised of two simple applications which accomplish the same task, one written in Flash and one written in Silverlight using C# and Silverlight's UI technology. The web based application works as follows: the user clicks to start the animation. Three images are then shown rotating in a circle, each image continually facing the user, but changing size and position to mimic a three dimensional effect. Each time the user clicks the application another image is added to the rotation. The application measures the frames per second performance (fps), capped at 100fps [5].
For both Silverlight and Flash I began by adding 47 additional images for a total of 50. I used a freshly started instance of Firefox version 3.5.9 and the latest version of Flash and Silverlight. The test computer I used had Windows 7 installed with 8 Gbs of RAM and an AMD Phenonm II X4 quad core processor running at 3 GHz. The system GPU was an ATI Radeon HD 4770. Using this test environment Flash was able to display the 50 images at about 64fps using about 60% CPU. Silverlight however was able to display the 50 images using only 45% CPU and did not drop below the 100fps cap. I continued adding images until Silverlight's rendering reached 64fps. I reached 80 images before Silverlight's frame rate dropped to that of Flash. Clearly Silverlight is the superior technology in this experiment.
An example of what the application looks like during the experiment can be seen in Figure 2. This screen capture was done on the Flash application. The framerate is lower than that of the reported results because the application was run while the Firefox browser had multiple tabs open, running both Flash and Silverlight applications.
B) Computational
This experiment uses the same environment described above. The methodology is also similar. Two simple applications are written which accomplish the same task. One in Flash and one in Silverlight. The application for this experiment calculated prime numbers for the value input by the user. The rendering and display done for both applications is extremely minimal. Both applications track execution time using clock functions native to their respective languages. The time is saved just before the calculation begins and then is subtracted from the current time when the calculation finishes[3]. For both applications I calculated the primes of 1,000,000.
Flash returned a result in 1.259 seconds, while Silverlight finished in 0.564 seconds. Silverlight was almost three times faster in returning the result. I wanted to also compare Silverlight's capabilities to that of a simple C# application written in Visual Studios which accomplishes the same task. I used the same test environment described above and based the structure of the program on the C# source code used in the Silverlight web application. The C# based console application calculated the same values in 0.576 seconds, slightly slower than the Silverlight application. This was a very surprising result. I discuss some ideas as to why this may have happened in the conclusion section of this paper.
VI. OPEN SOURCE IMPLEMENTATION
Moonlight is the open source implementation of Silverlight that is designed to run on Linux platforms. Its release cycle is behind that of Microsoft's Silverlight since it is reflective of the design decisions made by the Microsoft team. Currently the Moonlight team is working on a version compatible with applications that use features from Silverlight 3. The gap between Silverlight and Moonlight is expected to close due to the fact that Microsoft has begun supporting the Moonlight team [12].
VII. FUTURE DIRECTIONS
In this section I present some of the most requested improvements to the Silverlight platform
Figure 2: Rendering Test – 3 images | 50 images
being made by its current developers. I also give some of my own ideas for directions the technology could take.
A) Implementation on More Platforms
Many developers would like to see their Silverlight applications run in many more environments than is currently possible. Some of the most requested platforms have been Linux, Android (Google's mobile platform), Windows embedded, and the iPhone OS [18]. While Silverlight may never come to the iPhone, the Silverlight team has been moving in the direction of more platform deployment, first by supporting the Linux implementation, and most recently by announcing that it will be a key component of their new mobile platform as mentioned above.
B) Take More Advantage of GPUs
There is a growing trend in software taking advantage of the computing power of the Graphics Processing Unit not only for rendering tasks, but also for heavily floating point oriented non graphics tasks such as physics calculations. Many developers are requesting tools to tap into this resource using Silverlight[18].
C) More Comprehensive Networking Capabilities
Silverlight is able to utilize the power of languages originally intended for traditional application building to create dynamic and efficient web based applications. One area where Silverlight does not match traditional development platforms is in broad networking capability. Right now Silverlight is limited to specific protocols and ports that it can use for network communications, but developers want to be able to do everything they can do with a normal .NET language based desktop application in Silverlight. This includes low level, or at least unrestricted networking [18].
D) Support Java Driven Silverlight Applications
This is a direction that I would like to see Silverlight move in. Silverlight already uses an abstraction layer between the language the developer uses to write the programmatic portion of the application and the GUI. There is also a layer of abstraction between the code written and the executable binary that is generated. It is possible that the JVM could be used in place of the .NET framework and the CLR. This is likely a more difficult direction to move in than the ideas presented above and it may also diverge from Microsoft's hope to promote the .NET Framework as a viable rich internet application tool. This direction would likely attract more developers to the platform however, and encourage companies to convert their Java applets into Silverlight applications.
VIII CONCLUSION
In this paper I have explored Microsoft's Silverlight technology. I have described what it is, discussed its history, its architecture, how to use it to create applications and compared it to its closest alternative Flash. I have discussed an open source version and presented some possible future improvements to the platform. I have found that Silverlight outperforms Flash in both rendering and
pure computation speed in the testing environments I setup. Even though Silverlight may have a way to go to catchup to Flash in terms of adoption rate and utilization, I have found it to be a superior technology and with Microsoft's backing I believe that it will eventually displace Flash as the dominant rich application framework on the web.
IX FUTURE RESEARCH
I would like to do further experiments into why the C# based console application actually ran slower than the same basic code implemented using Silverlight. I would attempt to eliminate different development environments and optimizations by rebuilding and deploying the test Silverlight application in the same environment that the C# console application was created. It is my theory that by using the newer 2010 development environment to build the console based application I will be able to see my expected result of equal, if not better performance than the Silverlight based application. I would also like to create similar applications in all the major development languages and compare the results. I am also interested in comparing Silverlight's quality of video rendering to that of Flash. It has been my experience working in the digital video streaming industry that Silverlight rendering will add artifacts that can't be seen in the same video file using desktop based video players.
X. REFERENCES
[1] “Blend / WPF Tutorials” Kirupa. Last Accessed 1 May 2010. http://www.kirupa.com/blend_wpf/index.htm
[2] “Common Language Runtime Overview”. MSDN. Last Accessed 30 April 2010 http://msdn.microsoft.com/enus/library/ddk909ch.aspx
[3] “Counting Primes in Flash and Silverlight”. ITWriting. Last Accessed 30 April 2010. http://www.itwriting.com/primetest/index.html
[4] “Eclipse4sl” Eclipse4sl.org. Last Accessed 1 May 2010. http://www.eclipse4sl.org/
[5] “Flash vs Silverlight: FPS Meter & Stress Test”. Shine Draw. Last Accessed 1 May 2010. http://www.shinedraw.com/mathematics/flashvssilverlightfpsmeterstresstest/
[6] Hunt, N. “Encoding for Streaming” Official Netflix Blog (2008). Last Accessed 1 May 2010. http://blog.netflix.com/2008/11/encodingforstreaming.html
[7] “Introducing JSON”. JSON.org. Last Accessed 1 May 2010. http://www.json.org/
[8] Key F. “Microsoft goes crossplatform with Silverlight (formerly WPF/Everywhere)" Tim Anderson's ITWriting. Last Accessed 1 May 2010. http://www.itwriting.com/wpfe.php
[9] “Latest SOAP versions” W3C. (2004) Last Accessed 30 April 2010. http://www.w3.org/TR/soap/
[10] McLaughlin, K. “Calling All Developers To Windows Phone 7”. Channel Web. (2010) Last Accessed 1 May 2010. http://www.crn.com/mobile/224200643
[11] “Microsoft / Web Homepage” Microsoft / Web. Last Accessed 30 April 2010. http://microsoft.com/web
[12] “Moonlight Homepage”. Mono. Last Accessed 30 April 2010. http://www.monoproject.com/Moonlight
[13] “REST and POX”. MSDN. Last Accessed 30 April 2010. http://msdn.microsoft.com/enus/library/aa395208.aspx
[14] “Rich Internet Application Statistics” RIAS Stats. Last Accessed 5 May 2010. http://riastats.com/#
[15] “Silverlight Application Structure” MSDN. Last Accessed 1 May 2010. http://msdn.microsoft.com/enus/library/cc838120(v=VS.95).aspx
[16] “Silverlight Architecture" MSDN. Last Accessed 1 May 2010. http://msdn.microsoft.com/enus/library/bb404713(VS.95).aspx
[17] “Silverlight Designer for Visual Studio 2010” MSDN. Last Accessed 1 May 2010. http://msdn.microsoft.com/enus/library/ff356887(v=VS.95).aspx
[18] ”Silverlight Feature Suggestions" Silverlight Development Community. Last Accessed 2 May 2010. http://dotnet.uservoice.com/forums/4325silverlightfeaturesuggestions
[19] “The Silverlight Team Blog Homepage” Silverlight Team Blog. Last Accessed 30 April 2010. http://team.silverlight.net/
[20] “Silverlight Tutorial” Webucator. Last Accessed 30 April 2010 http://www.learnsilverlighttutorial.com/
[21] Swersky D. “Silverlight Research Summary” {get; set;} : CODE Last Accessed 1 May 2010 http://daveswersky.com/2009/09/29/silverlightresearchsummary/