My Silverlight Adventure

Published on : Feb 25, 2010

Category : General

Saravana

Author

My latest technology adventure area is Silverlight (3 and 4), WCF RIA Services, PRISM, MEF and Unity. We are using them internally to build a rich portal across our Business Application on top of BizTalk BAM data. For the past few months I’m going through tons of reading materials to familiarise myself with all these stuff. Lot of times I’ve done circles, coming back to the same material again and again to clarify few things. Things have changed drastically in the last few years, if you have done some UI development say 5 years ago, and you are coming back to that area, the learning curve is pretty steep. There are various things evolved in the last few years, example Ioc dependency injection, Composite application framework, MVC, MVP, MVVM patterns, external services calls, the whole notion of asynchronous programming model for UI, Rich internet applications etc etc. All these changes are absolutely great, but be prepared to learn them. It took me at least a month to decide on what technologies we are going use, and what patterns and building blocks (PRISM – MEF) we are going to use, when to use what etc. To be fair, I’m still not 100% sure, its going to be a cyclic process, we may need to revisit some of them during the course of the project. Things are changed on learning side as well, video is the most preferred choice. Only problem with this is, you don’t know the quality of content until you have gone through the full video. If its a white paper, you can normally browse through the headings quickly and figure out if its of interest to you. For videos, most of the times you can apply the 5 minute rule, where you can make the decisions within the first 5 minutes to judge the quality of the video. I’ve used this in the past while attending conferences :-). It’s not always accurate. The reason for this post is mainly to put a note for the videos I’m going to watch from now onwards (I missed out the ones I’ve watched already). Its for my own reference, so I can come back and get an idea of the video content, and hopefully it should be good for others as well. It’s not going to be postscript of video, instead just few hints like the concept the author is trying to convey, rating in general, is it worth the time, some tips picked up. I’m going to start with “Taking sketch code towards Unity” http://channel9.msdn.com/posts/mtaulty/Prism–Silverlight-Part-1-Taking-Sketched-Code-Towards-Unity/ Author: Mike Taulty, Microsoft UK Rating: 5 out of 5 Worth my Time: 5 out of 5 There is nothing fancy in this video, Mike basically sets the tone for why we need a dependency injection framework for your application. Main point here is he explains with a very simple example. Dependency injection is not just for UI it could be used for anything, it could be a class library. It’s all about decoupling your code from tight implementation. In this video, he starts with simple console based Calculator application from single Program.cs file and move on stripping it to multiple classes, then to multiple libraries and then to have a separate interface library, which helps to decouple your implementation. In IOC terms this is called poor mans dependency injection framework, but something is better than nothing. Some of the cool things he used in the video: TIP 1: Function Pointers static void Main(string[] args) { int x = 1; int y = 2;             int result = func[0](x,y); //Add }         static int Add(int x, int y){ return x + y;   } static int Sub(int x, int y){ return x – y;   } static Func<int,int,int>[] func =  {Add,Sub}; TIP 2: Mike also used Visual Studio Refactoring capabilities throughout the video. Example: Create a switch statement from an enum Keystrokes: sw + tab + tab will get you to this screen image Type Oper + tab + down arrow will complete the switch image Shortcuts for constructor and properties: Keystrokes ct + tab + enter image similarly for properties pro + tab + enter TIP 3: You can use Expression Encoder 3 to do screen casts. Nandri Saravana