VS live brain dump

VSLiveI had a pleasure attending VS live in Orlando between 5-11 December. I particularly enjoyed the small size of the conference in comparison to the bigger ones such as Build or TechEd. Meeting people and networking seemed easier and more natural.
I left with the impression that developers at most large companies are facing similar problems. They are frustrated with the slow pace of new technologies adoption such as smartphones, tablets, and even upgrades to Windows 7 (Boeing 787 was designed on Win XP).
Job market is hot as if it was 1999 according to a keynote speaker. This may be true in some areas, but definitely not in Orlando in my opinion. Many companies around the country cannot find qualified developers. In order to attract potential candidates they have been broadening job descriptions and keeping the job openings unfilled for months. Many big companies such as RIM, Microsoft, Yellow pages, and smaller ones such as Appcelerator, Sencha, Apigee are desperately trying to lure developers to create apps for their platforms and utilize their APIs. They are “throwing” money, tablets, phones and other prizes at developers hoping to bring them to their platform. It is great (prosperous) to be a developer. It may even be the best time ever to be a developer.
The conference had 8 tracks and I attended at least one talk in each track except for Windows Phone (WP). All the WP talks were introductory level which was a little bit disappointing.

Following are the tracks that were offered:

  • Silverlight / WPF (touch, xaml, mvvm)
  • Web / HTML5 (javascript)
  • Developing Services (WCF)
  • Windows Phone
  • Cloud Computing (Azure)
  • Data Management (LINQ)
  • Programming Practices (MEF)
  • Visual Studio 2010 / .NET4
  • The conference kicked off with a keynote in form of a interview of Mary Jo Foley. Below are some of her and other peoples’ comments.

    What is the future of Silverlight?

    Silverlight 5 was shipped few days ago. That is all we know. I have heard rumors that there will be SL6.

    Will Windows 8 be a success?

    At the keynote the audience full of Microsoft fanboys was asked if they believed that Win8 can beat iPad. Only about 1% people believed it could. Right after that the audience was asked to raise the hand if they had an iPad. Around 95% of people raised their hands. It is clear that Win8 tablet will have a tough competitor to beat next year.

    Where is Skype?

    After the keynote I asked Mary Jo Foley if she had any news on Skype that was promised to arrive on WP in fall. The last thing she has heard was that the WP team went back to the drawing board. Another developer who overheard the conversation mentioned that he had spoken to the WP team week before and they told him that they had been working on Skype-Apollo (next major WP release) integration.

    What has Scott Guthrie done with Azure since he took over?

    He has simplified the install which is now a single package. He has also simplified the deployment.

    User interface design

    I attended two sessions by Billy Hollis who is an amazing UX expert. He reminds me of a professor from “Back to the future” movie. His passion and content delivery were memorable. The content of his presentations deserves a post for itself. Expect one very soon.

    Silverlight / WPF

    Touch
    There are different touch technologies:

    • CapacitiveBest of all. Used by iPhone and Windows Phone
    • Optical Suitable for big screens. Has optical sensor on top of the screen which makes it very imprecise. Plagued by poor performance.
    • Resistive The worst of all. Used by Palm pilot.

    Win7 has native touch support which one can experience in Paint or IE8. Touch is available on all XAML platforms but not equally supported. Surface 2 SDK has the most support whereas Silverlight has the least.
    Manipulation API is more sophisticated than Gestures API. It provides velocity and bounce.
    Multitouch is supported by exposing a touchpoint unique ID.
    XAML & MVVM

    • Use ListBox for horizontal menu design.
    • Use Grid when overlaying elements.
    • Use converters to show/hide or positions elements.
    • Adding a converter to XAML is much easier in Blend.
    • Use ViewPort3D or ViewBox control for zooming effect.
    • Set the page DataContext at the highest level possible.
    • To make an object property bindable, the property needs to be a dependency property. It will have UI thread affinity.

    Binding is one of the most important features of Silverlight. Binding controls to properties is trivial. Binding controls behavior requires a little bit more work. Button controls need to be bound to Commands which are implemented in the ViewModel. Other types of controls need to be bound to Behaviors such as InvokeCommandAction or EventToCommand because they cannot be bound to Commands.
    The following design tip was provided by John Papa. When designing an app and you run into a decision point how to implement a feature, it is a good opportunity to create a service and an interface. This prevents tight coupling. Once we have an interface, we can pass it to the constructor of the ViewModel. This will prove helpful if we implement design time data in order to be able to modify UI in Blend. All our services should derive from a base class which would be responsible for determining whether to use the design time data.

    Web / HTML5

    When talking about HTML5, we are really referring to CSS3, HTML5, and ecmascript. HTML5 has not been completely standardized. It is a work in progress getting adopted at different levels by different companies. HTML5 has stable features that have been ratified and there are also in progress features which are still going through standardization process. Even though they have not been ratified, they are supported by some browsers, but not all. A prime examples of these are WebGL, Web sockets, HTML forms.
    How do we adopt HTML5?

    • Progressive enhancement – Design for the smallest supported set of features across all browsers. Add special code that enhances the app running on browsers which support “in-progress” features.
    • Graceful degradation – Design for the browser which has the highest HTML5 support. Have the special handling for browsers lacking the specific HTML5 feature.
    • Vertical targeting – Use only features supported by all browsers.

    How do we handle the partial browser support? In CSS3 we can use browser prefix for early feature implementation.
    Few good resources:

    JavaScript tips

    Global variables are bad. Names may collide without a warning with same names in another file. Plugins would be prime examples where we could experience name collision.
    JavaScript does not have a concept of a class. We need to compensate for this deficiency using design patterns such as:

    • Revealing module pattern – makes reading code easier and allows it to be organized in a more structured manner. Provides a simple way to expose public members to consumers.
    • Prototype pattern – can be broken out into two main sections including a constructor section and a prototype section. only one set of functions/properties exists across all objects resulting in less memory consumption. Functions and properties are defined once per prototype rather than once per object.
    • Revealing prototype pattern – combination of the Prototype Pattern and Revealing Module Pattern. It offers the benefits of the Revealing Module Pattern but also provides a way to share function implementations across object instances through prototyping.

    Use “use strict” keyword. Strict mode helps out in a couple ways:

    • It catches some common coding bloopers, throwing exceptions.
    • It prevents, or throws errors, when relatively “unsafe” actions are taken (such as gaining access to the global object).
    • It disables features that are confusing or poorly thought out.

    Resources for testing the code:

    Developing Services

    Here are few tips that I have picked up in the two talks I attended.

    • We can share class files between projects using the Add new class –> Add As Link option in Visual Studio. This is applicable to any project type. Interestingly, for C++ project types, this is a default behavior.
    • WCF Web API is a RESTful web service that allows developers to expose their applications, data and services to the web directly over HTTP. If you plan to consume webservices of any social networks this is the approach to take. See the codeplex project for more details.
    • WCF supports SOAP, ATOM, JSON. It is the client who specifies the response format in the request header.
    • WCF allows you to send messages over HTTP, TCP, named pipes, or MSMQ.
    • WCF 4 and IIS support Gzip compression which reduces the message size up to 30%.
    • WCF does not support class inheritance because it has CLR type to XML mapping.

    Cloud Computing

    I attended two talks on Azure. The first one was more general which introduced the Azure platform. I learned that Azure has Web, Worker, and Virtual Machine roles. We should choose the roles based on our application need. VM role is suitable if we need to deploy a complex system that requires special expertise to setup. In that case we would configure the system on a VM and deploy it to Azure.
    SQL Azure has introduced SQL Azure Reporting Services which is still in beta phase.
    The second talk was specific to Azure DataMarket. Microsoft provides data marketplace where data can be purchased or provided for sale. The benefit to a consumer is one consistent interface for data consumption, single billing method, data integrity and validity. The benefit to the data provider is the global reach, single billing method, data availability regardless of the number of clients. A prime example of a data provider is Zillow which provides housing data. Clients can create interesting application meshups consuming different data sources through DataMarket.

    Data Management

    LINQ is very powerful. If you do not use it, start using it. If you do not know it, start learning it. There are many types: LINQ2SQL, LINQ2XML, LINQ2DataSet, LINQ2Entities, etc.
    Using LINQ2XML we can very easy transform a node based XML document to attribute based. We can load an XML document using XElement.Load(“mydoc.xml”);
    LINQ defers the execution until the data access. It also allows for creating complex queries which even support the JOIN keyword similar to TSQL.
    Using parallel LINQ we can significantly improve the performance. This can be easily done by using a single method AsParallel(). In the background the system creates number of Tasks based on the number of processors available and distributes them across processors appropriately. This approach eliminates the complexities of concurrent programming.

    Programming Practices

    Choosing the talks to attend is tough. There are too many good choices. You never know what you will get out of a talk. When I decided to check out “Using MEF to develop composable applications” I did not have high expectations. I was so wrong. This was one of the best talks.
    Microsoft Extensibility Framework is part of .NET 4. It allows dynamic (lazy) loading of assemblies. In our application code we need to specify the path to the assembly we want to load during runtime and the assembly would get loaded when the particular line of the code is executed. This is great for extending application capabilities without the need for referencing any assemblies. It also keeps the application memory requirements low since it does not need to load the assemblies it is not using.
    Microsoft has used MEF to implement Extension manager in Visual Studio.

    Visual Studio 2010 / .NET4

    The only talk I attended in this track was disappointing. However, I did learn the difference between a Tier and a Layer.

    • Tier determines machine or network boundaries. Server-client architecture can be 2 tier architecture.
    • Layer describes application code structure. Application can have a single tier and multiple layers (presentation, business, data access, etc.).

    Conclusion

    Visual Studio Live was a great event that I would love to attend in the future. It has provided opportunity to network as well as acquire a lot of technical information.