Silverlight and Multi Touch Tablets
If you follow gadget or tech sites, you probably have seen some buzz around Tablet PCs in the last couple of days. Yesterday Mike Arrington from TechCrunch posted a request to the community to help build a low-cost web tablet device with TechCrunch.
The goals of the project are simple:
low cost...about $200.00 (runs Linux)
Runs Firefox in kiosk/ATM mode. Basically, it by passes the OS and turns on directly into Firefox
i-Phone like input; touch screen
Just as the story I just mentioned was getting buzz, there were rumors posted on Gizmodo that there might be a MacBook Touch coming out in October. Obviously, these are just rumors so there are little details...but that story is real interesting as well as the timing of the story especially the day after the TechCrunch story got posted and got HUGE attention/buzz.
In the last couple of days we have a lot of buzz about two tablet products. Table PCs are nothing new; in fact, I used one back in 2003. Furthermore, Dell offers a Tablet PC as well. However, back in 2003 the multi-touch technology simply was not there (had to use a stupid stylus). The Tablet PCs were slow, handwriting recognition was poor and it loaded XP. Furthermore, the presentation technology was nonexistent. Basically, you were running an OS with a stylus on a big screen in a clunky machine. The new Dell product is basically a laptop that has a touch screen LCD panel that can rotate at a greater angle. Tablet technology up to this point has not succeeded in the mainstream. However, I think these two upcoming products can succeed. Think of it as Tablet 2.0 technology or even a Tablet relaunch :)
Apple has these things in their corner:
they are the gold standard in multi-touch & input technology
they proved they can master sleek, innovative, thin design
the current technology with longer battery life, solid state drives, improved graphics & presentation work
I think these sleek, thin web tablets are going to be the next hot thing in the next 6 months. How does this fit in with Silverlight? If you read the articles, you are probably asking yourself where you missed the Silverlight references. Both of these products obviously are not going to be formally supporting Silverlight in their plans. However, this is where as a .NET developer or company you can get a piece of the pie. Silverlight is supported on a MAC/Safari. So once the MacBook Touch launches, Silverlight will just work. The TechCrunch Tablet is a little harder because it runs on Linux. Hopefully the Moonlight project can get going again and give better support for Linux or maybe Microsoft will shock us and release a Linux plug-in. However, since the TechCrunch web tablet was just announced yesterday, I would be shocked if anything was ready in the next 6-8 months. October with the MacBook Touch (if the rumors are true) will be around the corner much faster.
Applications on the iPhone have a fluid user experience. What do I mean by that? The user has little interaction with the keyboard. It is all about scrolling, sliding, flipping, dragging while keeping things SIMPLE. Effective applications for these tablets lacking a keyboard will have to do just that and mimic the user experience from the iPhone or Microsoft Surface. Silverlight will allow you to do just that. By designing applications in Silverlight, it will allow you to bring the user experience to life. Silverlight allows you to present the layout of your application spatially and through animations/effects you can bring real time interactivity to the user. Do you think a user of an iPhone who is used to the iPhone interface would want to load an application from 2 years ago that is a step back? Of course not. This is where Silverlight compiled code rocks because it is ultra responsive and nothing out on the web can compete with it.
Silverlight is a web technology and it is distributed through a plug-in. This is a perfect way for Silverlight applications to sneak onto the tablets and get some of the attention of the user base. This is why I am such a big advocate of Silverlight technology; because of how well it can complement the user experience in this example and others. You know users will demand high quality and responsive interfaces (the iPhone generation is spoiled) and Silverlight is one way to spoil them even more. Silverlight: learn it, use it and abuse it. Hopefully, this article gave everyone a glimpse into the future on why it is a good idea to invest time in learning Silverlight. It would be even better if the article gave you some ideas of applications/tools to write for the upcoming web tablets!
Silverlight 2.0 - Concepts To Become A Silverlight Master (Series Part 2 - WCF)
Series update: I changed the name of the series as the name was slightly confusing.
Silverlight 2.0 technology is based on a web plug-in that runs on the client's computer. Writing applications/tools/games that don't depend on data is straightforward and doesn't require the Silverlight developer to think much beyond the client's domain. However, what if the developer wants to introduce external data into their Silverlight 2.0 application?
First, the bad news:
- Silverlight 2.0 currently runs on a small subset of the .NET 3.5 Framework. This means some of the "direct" data channels/communication libraries are not available to you (i.e., remoting, COM, database, etc.)
- Silverlight hosts its app domain on the client's workstation. This means that even though it is a web technology hosted on a web server, it can't leverage resources on the web server that do not cross the web server domain (i.e., database calls, local dll files that call a database, local dll files that consume a service)
- Another limitation is that because Silverlight utilizes a minimal/secure plug-in architecture, you cannot access local workstation data channels easily. For example, a fat client windows application can call a database, windows/web services, make remote calls, etc. Most of these (as you guessed it) are not available to you.
So HOW can I consume some data from an external data source? Silverlight 2.0 Beta 2 currently supports these communication channels:
As a developer, what is the best way to design services that a Silverlight plug-in client can consume? Luckily, this is where WCF comes in (Finally, the meat of the article).
WCF is an acronym for the Windows Communication Foundation, which was introduced in .NET 3.0. WCF (like LINQ/.NET) is one of these technologies that is hard to summarize in one good definition. Some developers simply say WCF is web services or a way to design SOA. My definition of WCF is actually not mine. This definition is from Juwal Lowy's forward from his great book Programming WCF Services:
"WCF is a fundamental technology that provides an easy and clean way to generate services and applications in compliance with what I regard as sound design principles."
WCF (without going into too much detail) allows you to architect applications by applying best practice guidelines automatically. Security, throttling, opt-in serialization, logging, etc., are handled for you just by creating a service inside the WCF framework and setting config/attribute values. Juwal Lowy (in web casts/book/classes) says you can spend time writing plumbing code and trying to adhere to best practices or use WCF and allow it to do the majority of the work for you.
Silverlight runs on a subset of the .NET 3.5 framework, so it does not support all of the WCF bindings and can't consume every type of WCF binding/endpoint. However, from the list above utilizing WCF (as your service engine) you can design: SOAP 1.1 Services, Duplex Services, AJAX Enabled Services & REST Services. All of these can be consumed by the Silverlight 2.0 client.
A great aspect of WCF is that it allows you to write your application and expose it using various binding endpoints supported by Silverlight. Furthermore, existing WCF services can simply be "Silverlight enabled" by providing a compatible Silverlight endpoint. Depending on the functional requirement, of course, this might not be possible.
The diagram below demonstrates the same services being consumed by different clients using different endpoints:
Quickly doing a search on services+Silverlight, you will notice that WCF comes up a majority of the time. Microsoft is pushing WCF heavily as a best practice for writing services for Silverlight. In fact, after installing the Silverlight 2.0 SDK, you have a new template called "Silverlight-enabled WCFService" for quickly creating WCF services that can be consumed with Silverlight.
Silverlight 2.0 Beta 2.0 allows the developer to configure the WCF service inside a ClientConfig file. This is a real nice add for additional configuration of WCF services, especially if you are a software vendor that needs to change connections/tweak settings for different deployments declaratively.
WCF (in .NET 3.5) has great support for creating RESTful services. RESTful services are used all over the place: Flickr, MySpace, Amazon, etc. WCF allows you to quickly create low/high REST services that can use XML, JSON or RSS encoding. Silverlight can consume these easily. In fact, many examples online show this by communicating with external REST services and manipulating the data on the client (i.e., using LINQ).
Summary of benefits using WCF to consume data in Silverlight:
- All the different Silverlight service types can be designed with the single WCF technology. Basically, anything you can do with other service design you can do with WCF. However, with WCF you are doing it with a single technology
- Allows the developer to design services focusing less on implementing best practices and plumbing code (WCF's biggest selling point, since it does a lot for you out of the box)
- WCF endpoint abstraction allows the developer to create service endpoints for both Silverlight and non-Silverlight consumers (while sharing the same code)
- Microsoft recommended best practice. WCF includes first class support in Silverlight: online examples, Silverlight-enabled WCF service template and clientConfig XML configuration file
- Best practice for the future. As Microsoft adds additional support to the Silverlight service stack, developers can be assured that probability-wise this will be done via WCF. For example, Duplex services (introduced in Beta 2)
In summary, Silverlight and WCF technologies complement each other very well. WCF is a single technology that provides you a single design mechanism to create a variety of solutions for exposing your data to a Silverlight client. WCF is not a requirement in order to consume data inside Silverlight (lots of examples online with 3rd party REST services). However, because of how well it works with Silverlight and deprecates other SOA design (at least in the MS world), it is a no-brainer that WCF is recommended by Microsoft. In my opinion, WCF is a technology every developer needs to master in order to be effective with consuming data inside Silverlight.
Silverlight 2.0 - Concepts to become a master series (Part 1 - .NET/C#)
Silverlight is THE next generation rich web technology to learn if you are a programmer focusing on delivering web content. There are many articles out there on how to get started or how to write your first Silverlight program. However, many of these articles fail to address the specific knowledge you need to master to be a truly effective Silverlight programmer.
Silverlight, just like any technology, has a concrete matrix of concepts a programmer should focus on in order to be able to call himself a master of the technology. Fifteen to twenty years ago (before the web, before mobile technology, before networks were prevalant, etc.), you could have an almost complete grasp of software engineering by focusing just on a few skills. As software engineering started to mature and the web blew the door off the amount of new technology/processes/patterns available, it became impossible to be an expert in every single facet of software development. Silverlight is just a small thing right now in the bag of technologies available for developers to learn. However, the Silverlight technology demands that you are productive with certain concepts in order to become an effective developer with the technology. Learning a new technology like Silverlight can be a daunting task with the limited R&D time developers are afforded. Furthermore, not knowing which technologies Silverlight relies on to deliver complete solutions can definitely pose a challenge in trying to learn on your own blindly.
I have been working with Silverlight since Alpha 1.1 -> Beta 2 (on and off; mostly on since Beta 1) and there are certain subject matters that demanded my deep understanding in order to use them effectively in Silverlight. Instead of creating a massive post, I decided to create a series of posts about the core concepts a Silverlight developer needs to focus on. The goal of the article is to help developers getting started with Silverlight 2.0 understand what technologies they should get familiar with or which technologies to brush up on in order to learn Silverlight in the most efficient way.
Silverlight 2.0 is a Microsoft technology platform. Like all new Microsoft platforms, in order to develop on it, you have to know .NET. That's a given. Silverlight 2.0 runs on a subset of the .NET 3.5 framework which has a very small footprint. However, the Silverlight team managed to add a great deal of libraries (even lots of .NET 3.5 items) inside this sub system. Obviously, I don't think this comes as a shock to anyone that in order to program in Silverlight 2, you will be developing on .NET. Since you will be coding in .NET, it also makes sense that you will be coding inside Microsoft's flagship IDE Visual Studio. Visual Studio 2008 has great integration with Silverlight 2.0 with debugging/design/projects, etc. This is one of Microsoft's strong points. Architects/Sr. Developers debate platforms/languages (dynamic/functional/OOP), etc. all the time. However, what is not debatable is the fact that Microsoft Visual Studio is one of the best programming environments out there. Visual Studio/.NET are pretty much a requirement...no shockers here.
What is controversial is my opinion that your .NET language of choice should clearly be C#. Silverlight 2 is currently in Beta 2 release. For the most part, I find that the early adopters of any new technology are usually advanced developers. Like it or not, that trend usually applies to C# development over VB.NET. Let's take some examples:
If you right now want to find an article about Silverlight and a code example, the chances are 85%+ that this example will be exclusively in C#. Does that mean VB.NET developers can't learn Silverlight? No, I am simply saying that you have a MUCH easier time as a C# developer if you are reading examples in your native/favorite language.
The absolute best resource when learning a beta technology is blogs. Bar none. The Silverlight 2 books are just starting to come out in "beta" and Microsoft's own libraries are just starting to be populated and are not a great resource yet. However, blogs are great for beta technology as they allow you to overcome bugs/issues/undocumented concepts, etc. that plague beta releases. Most advanced bloggers blog in C#. This ties into my previous assertion that more advanced programmers prefer C#. Furthermore, C# has many shortcuts that allow bloggers to post clear/concise code while getting the point across. This is yet another advantage C# bloggers use when posting about Silverlight. Check out some samples on Jesse Liberty's blog
, Tim Heuer's blog
Magazine articles are your next best friends. They are dominated by C# syntax as well. I subscribe to ASP.NET and Code magazine (I used to get MSDN Mag when I had a MSDN Sub) and a majority of the code is in C#. Note: The only time I have seen a real master coder write in VB.NET almost exclusively was Dino Esposito
. I do think though after he went to idesign, Juwal Lowy straightened him out, as he has now been posting in C# :)
Microsoft documentation is 50/50 C# and VB.NET. Obviously, this case is a draw.
I am not saying that you cannot learn Silverlight without C#; just that I have found that it makes my life a lot easier. Imagine you are a VB.NET developer working on an issue and you are ready to throw something and you try to enter your problem into Google. The search engine pops up with a solution and then you see the delegate word being thrown around (anon methods) or the => symbol. Obviously you will have to decipher the syntax first before proceeding. Furthermore, I think as you become more senior with the C# advanced syntax, it actually becomes HARDER to read VB.NET. I completely disagree with MS's position that it doesn't matter. As the RTM approaches, this might change as more books appear (this tends to still favor C#, but less percentage-wise).
If you are just getting started in .NET by being drawn to Silverlight, I think you will have a much easier time learning Silverlight if you learn C#. Doing so will give you access to many more current samples/projects online in a native language.