Thursday 4 September 2008

Microsoft Tech Ed Australia 2008 - Top Tech Ed Takeaways

The veritable tsunami of information that is Tech Ed 2008 is has been and gone. One of the things I've found about some conferences like Tech Ed is that they have a breadth of information but sometimes don't engage me or don't go into the depth of detail that I would like (apparently, PDC is meant to be more in depth). However, 5 of the presentations I went to DID keep me on the edge of my seat:

  1. ARC304 - "Building Loosely Coupled Applications with Unity" with Richard Banks
  2. DEV410 - "Debugging the world, starting with the CLR (or Debugging from the trenches)" by Corneliu on debugging (http://www.acorns.com.au/)
  3. SOA 311 - "Building Human Workflows with WF State Machines" with Kirk Evans
  4. WEB301 - "ASP.NET MVC – Should you care?", WEB302 - "ADO.NET Data Services – The Zen of RESTfulness and the Art of “Astoria”" - Scott Hanselman is truly an entertaining and informative presenter.
  5. WEB304 "Web Futures - the next 18 months"

My Top Takeaways

  1. MS wants you to utilize the "cloud" because it is getting in on the action
    Offerings like SQL Server Data services are now out in Beta so we can utilize the "infinitely scalable processing and storage" of the cloud.
  2. Get cracking with ADO.NET Entity Framework and LINQ to Entities as it solves some problems in LINQ to SQL such as doing Lazy Loading and dealing with the Database to Application Impedence Mismatch with support for inheritance in your EDMX data model. However is does NOT unfortunately solve the replay problems we have in LINQ to SQL (there are projects like http://code.msdn.microsoft.com/entitybag/ for this before Entity Framework 2.0 comes out)
  3. Use Unity for all your dependency injection needs from now on
    It is the Web Client Software Factory Object Builder gone on steriods.
  4. Try harder to use object oriented techniques with JavaScript
    The trend is towards more javascript in applications, not less (especially with some of the frameworks out there like jquery and improved design-time support) - you can simplify your code with prototypes and JavaScript inheritance.
  5. MVC is a no-go. Only consider using the MVC framework for extreme control of html output and testability. From a business viewpoint, the value benefits are minimal but the costs due to increased complexity and "plumbing work" are significant. This makes it a no-go for me. I don't believe that you should have unit tests for absolutely everything - just the core logic. Otherwise you get massively declining returns trying to increase your test coverage. In addition, the MVC Framework is not ready for prime-time (currently in Preview 5) - so don't even start any projects or frameworks that use it.
  6. Silverlight is a big question mark (for app UI development, not for streaming media apps) & you should follow the KISS principle. The Web Futures panel including presenters like Scott Hanselman came down to 2 significant truths:
    1. A complaint was made about the ongoing treadmill of new/old technologies like Xaml (Silverlight and WPF in particular). The answer from Mr Hanselman was that any technology you use now with look crap in 18 months. The golden rule to mitigate this problem is you should go with the "Simplest solution to meet the requirement, the simplest requirement to meet the need". In other words, "Complexity kills" any good project. In other words, "do the simplest possible thing that will work and refactor it tomorrow."

    2. JavaScript and Silverlight are competing models for UI development - but JavaScript has a massive upper hand in terms of industry support and object models like JQuery (http://jquery.com/). There are also no killer apps for Silverlight. I'm going to hold back on Silverlight development for non-streaming media apps for now...

Other Notes:

Some of the takeaways that I found from Tech Ed 2008 were (in no particular order):

  1. Tech Ed 2008 Keynote - This sets the tone for the rest of the conference - much the tone of the presentation was set around Loose Coupling of Software and Services (Software Plus Services (S+S)), focussing on a few key products like LiveMesh, SQL Server Data Services and the latest version of Exchange. Live Mesh was trumpeted as a peer-to-peer application platform. They also did a demo of a custom app called “Smart Asset” used by New Zealand Antarctic Base with Dr Neil Roodyn to showcase MS's Service part of the "S+S" equation mainly around Virtual Earth. They also did a demo of the web app "Street Advisor" – and what MS did to improve an existing site with these services including the VE map control, and the Web Messenger control to add immediacy to interaction with sites (you don’t need Messenger installed for this functionality).


  2. ARC 203 - Understanding Software Plus Services - Identified some of the key industry trends SOA (based on reuse and agility), SaaS – (based on flexible pricing and delivery), RIA (based on experience), and Cloud computing (based on service utility). Covered the fact that "S+S" - the Software part of S+S normally includes LoB apps. Established a grid for the tradeoffs of different architectural decisions (Control vs Economy of Scale, Buy vs Build), and a spectrum between "On-Premise" (aka On-Site), Hosted, Cloud and Vendor architectural solutions). Gave some general rules for S+S architectural deicisions - that you should typically host out any commodity services – SaaS (e.g. CRM and Email are commodity applications). In particular, a firm should spend money on key differentiators (non-commodity applications and services) and keep them in-house. Jungle Disk was given as an as an example of S+S.


  3. VB Session on VB 3.5 features - I didn't attend, but discussed with some other attendees and some of the best takeaways were around XML Literals (not a feature built into C#) - but there are ways around it with the "Paste as XML" addin.


  4. SOA 311 - Building Human Workflows with Windows Workflow Foundation State Machines - Kirk, the presenter indicated how confusing and verbose a lot of the documentation is on WF. This presentation used a windows forms application to host a windows workflow like most of the examples on the web - however, a new feature of 3.5 - "Workflow Services" was mentioned for hosting WF.

    It pointed out a few of the issues with the current iteration of WF e.g. there is no direct equivalent of a "flowchart" in WF (ie that loops back to previous decision points). Some in depth examples about the State machine workflow were given. Sequential workflows cannot return to a previous position – this is a key differentiator from State based flows. State Machines are more complicated (they are essentially a turing machine) but are very flexible in terms of flows. States can have child states (aka "Recursive States") - whereby you don't have to do the bubbling of a Cancel up yourself. An important concept in State Machines is in transitions of a State-based workflow - State e.g. Assigned has OnApproved/OnRejected transitions. WF will track possible state transitions and State history for you. A workflow has to to have an initial state and a completed state - these a properties of a workflow and point to one of the state objects on your diagram (via drop down in property explorer). To do a State transition, use a state transition object (just sets state from one to the other) . Simply set the target statename in proprties of the “SetState” Activity. The presenter did a walk through of a supply fulfillment workflow and how the SetState activity is used to to the transitions.

    You handle external events just by defining an interface and adding an [ExternalDataExchange()] attribute on class, with all events (thse show in the dropdown when the Interface type is set). Create eventargs which inherit from ExternalDataEventArgs to transfer information e.g. SupplyFulfillmentArgs – with InstanceId as Guide. Should be marked Serializable for persistent workflows. Then add a concreate Class – just implements our sample IEventService – so raises these events - E.g. RaiseAssignedEvent. In the form/the workflow hosting environment: i. Should have WorkflowRuntime declared in the form ii. Have a Guid to track the instance of the workflow you are showing/dealing with. In the form load, Add your ExternalDataExchangeService, then do wr.AddService (externalDataService)
    Then do a workflowRuntime.StartRuntime on the instantiated workflow object. With the persistence service – processes are no longer bound to processor/app domain. There are only 2 database tables with the persistence module for WF - "CompletedState" and "InstanceData"

    In the Windows form, you instantiate a SQLWorkflowPersistenceService which inherits from WorkflowPerstitenceService - so you can implement custom peristence if you need it.
    The LoadIntervalSeconds in the config file – allows you to control how often to load from the persistence store. Tracking Services – are use for monitoring reports and business process. This just serializes the BLOB.
    In tracking services, there are several different event types:
    a. Workflow Instance Eents - Completed, persisted, etc
    b. Activity Events - Closed/Executing, Initialized
    c. User Events – this.TrackData()Tracking Profile -> Tracking Service

    Tracking queries should be done through tracking service object model. To do a query you should Instantiate SqlTrackingQuery and SqlTrackingOptions (e.g. options could pass in WorkflowStatus.completed). The Result comes back as an IList and will have 1 of 3 types – workflow/activity/user events in the return list (just cast back to determine which type it is). You need the SharedWorkflowCommitWorkBatchService to allow sharing of connectionstring between Track and Persistence service.

    Samples at blogs.msdn.com/kaevans
  5. One of the chalk and talks and lunchtime were doing demos of what Silverlight can do sample sites were given -
    a) http://www.cookingwithxaml.com/meals/financials/default.html b) http://www.contosobnk.com/


  6. WEB311 - Designing Compelling Silverlight User Experiences With Expression Studio - Showed the use of the Expression suite of tools to create some of the data-driven silverlight animations used at Tech Ed itself. One of the tips was that you can't just copy and paste wireframes generated in visio or powerpoint into Expression Blend (they just show as bitmaps in Blend, not separate objects). However you can get them in easily by exporting the pdf to give it an "ai" extension - you can then drag the file to Blend and modify the objects in your wireframe separately. The presenter then showed some of the standard techniques - such as using slicing and using Windows movie maker to create basic timed transitions. The presenter also demoed use of overlays and converting slices to user controls - and the use of ease in/ease out. Some parts of the demo stopped working - but this was due to the inadequate visual indication that timeline recording is on or off in Blend. One important note from the presentation is that sometimes you cannot use silverlight canvases for more advanced functionality - in particular, Silverlight canvases don't support triggers - but WPF canvases do.


  7. DEV410 - "Debugging the world, starting with the CLR (or Debugging from the trenches)" - this presentation focussed on making debugging easier and the innards of debugging using windbg. One of the cool things was using a memory dump from another machine to extract the loaded dlls and stack trace and work out what happened on the production server.

    After discussing the use of the .NET Debugger Attributes, Cornlieu showed how the "Add ObjectId" in the debugger context menu in Visual Studio allows you to keep an object in scope even if the debugger falls out of scope.

    After a rundown on using windbg with .NET, we were shown a GUI tool that helps you to go through memory dump files without commandline tools such as adplus.exe - http://www.thinktecture.com/SOSAssist


  8. DEV380 - CRM Integration with External Applications
    Covered some of the basics of integrating CRM with other applications via SQL Filtered Views, .NET plugins and Web Services. Web Services are created for each CRM entity created. CRM was discussed as much more than a CRM product - a complete application platform based on meta data – similar to a 4GL language – CRM handles things like schema behind the scenes.


  9. WEB309 - Silverlight for Developers
    Went through doing Ioc and Testing operations in Silverlight 2 - http://jonas.follesoe.no/
    An interesting part was removing codebehind completely by using the ObservableCollection


  10. WEB301 - ASP.NET MVC – Should you care? - with Scott Hanselman. This presentation convinced me that MVC has it's place, but not for most projects. It is NOT ASP.NET web forms 4.0. It really just gives you more testability and control over the output Html. It also gives you more control over the format of the Url - something you can do with System.Web.Routing if you want to since it was pulled out of System.Web.Mvc.Routing and into System.Web.Routing in 3.5 SP1.

    Scott also outlined how the MVC framework basically has some hardcoded folders - /Models, /Views and /Controllers. He also went through the call stack for Hello world sample app to show differences between standard webforms model and how requests are processed. It is really just another http handler -"MvcHandler". Also notes was that views are searched for in a specific order by System.Web.Mvc - it looks for aspx, then ascx etc. There is no viewstate or postbacks as it doesn't use the normal http handler. One killer issue is that there are no ASP.NET MVC controls yet.

    MVC is hooked in by modifying the global.asax Application_Start, ad a call that does a RouteTable.Routes.MapRoute().

    For the purposes of testing, you can use Mock tools such as Moq/RhinoMocks/TypeMock.

    MVC requests all return a particular result - such as ActionResult, ViewResult, JsonResult, DownloadResult.

    Scott also used a tool called HttpWatch Pro which is similar to YSlow in Firefox.
  11. ARC304 - "Building Loosely Coupled Applications with Unity"
    Richard Banks explains how the Microsoft IoC/Dependency Injection framework called "Unity" makes interface-based programmin easier.

    He outlined some of the real benefits of using interfaces that makes your code much more modular and interchangeable with minimal effort. In a tightly coupled application, you typically have concrete classes within other classes and statics. These direct dependencies mean that it is very hard to swap different functionality into your code. Loosely coupled applications use Facades and Interfaces.

    The main difference between Unity and the Object builder in the Web Client Software Factory from MS patterns and practices is that it is more configuration based - ie all the dependencies of your application can be defined in your web.config which allows you to simply swap in different functionality. e.g. if you have an ISaleLineService, you define what concrete class should be instantiated in place of the interface in the config file.

    e.g. you would call ISaleLineService salesLineService = ServiceLocator.Resolve … calls Container.Resolve which finds the Default mapped concrete class as per the config file that implements the ISaleLineService interface (e.g. ConfigurationManager.GetSection()).

    Some demos on the web use Attribute and Programmatic-based dependencies - but this loses some of the configurable swap-in/out benefits of defining dependencies in your config file.

    Unit testing becomes simpler with Dependency injection. There are also some cool things that can be used like Object per session/request - see UnityContrib project for details on this.

    Unity doesn’t do Aspect Oriented Programming yet – but this is coming in version 1.2.
  12. ARC401 – Aspect Oriented Architecture meets SOA with WCF and Ent. Library

    Aspect oriented technology is about – separating cross cutting concerns from the core business logic. Enabling technologies for this include the new Enterprise Library 4.0 Policy Injection App. Block, PostSharp and the Aspect# language.

    Examples of cross cutting concerns that can be applied with aspects include Validation, Exception Mgt, Caching, Logging and Authentication/Authorization.

    Some parts of this presentation were similar to the Unity presentation I mentioned above - Similar to Unity presentation – covering policy injection e.g. the calls to PolicyInjectionCreate();

    Even with version 4.0 of the Enterprise Library, it can affect performance significantly in some situations – need to test.

    There was also the demo of the usage of the Validation Application Block for version 4.0 - which supports declarative validation logic for your applications - adding the [ValidationBehaviour] attribute on class and adding a RangeValidator on a parameter to a method call will allow you to raise a validation exception.

    You can set up Policy Injection with the Enterprise Configuration Tool (which is a VS 2008 add-in as well now - you don't have to go to a separate tool at all).
  13. WEB302 ADO.NET Data Services – The Zen of RESTfulness and the Art of “Astoria” - In this presentation, Scott Hanselman shows the experimental data access technologies that allow access to data stores over an intranet or the web via Urls (aka REST). More details are at http://astoria.mslivelabs.com/. ATOM (the schema based version of RSS) underlies the structure of data services. When installed, you create an "ADO.NET data service item" from the VS 2008 project types.

    You can basically query information in a datasource via Urls -
    /Northwind.svc/Products(1)/Category – can navigate through information very easily. This is useful for rich internet applications.

    With LINQ to REST, you can then query a remote database - the LINQ expression tree evaluator converts to url rather than SQL. To me the Astoria architecture is not great – as this is encouraging you to put your logic and other code behind the LINQ layer.e.g. so can be consumed by a SmartClient app directly. It is however, an awesome way of wrapping other dbs such as AS400 in a web-consumable form.

    Using the [WebGet] attribute you can even define the Astoria equivalent of stored procedures on the data.
  14. DEV325 LINQ to SQL vs LINQ to Enity Framework
    Discussed the use of the Edmx file, Navigation Properties with Many to Many Relationships, and some of the first-hit performance issues with LINQ to Entities. Also showed some of the differences with LINQ to Entities (e.g. .AddDays won't work with this provider as it is not really going to SQL Server).
  15. WEB315 Object Oriented MS AJAX
    Ran through some ways of improving the typical procedural-based approaches to JavaScript taken in most application development. JavaScript has many object oriented features but it's not perfect. e.g. there are no real private properties in JavaScript. Instead – use get_Property() convention.

    You can use inheritance, prototypes, interfaces, events and delegates in JavaScript. Prototypes are similar to extension methods in .NET. For 0bject inheritance – need to do a registernamesspace(MyNs) to get them recognised by the javscript runtime. You'd typically declare interfaces like "MyNamespace.INameOfInterface = function{}"
    You must implement interfaces on registerclass call.

    Just like in C#, delegates are just a method pointer that you can pass around - such as passing in a delegate to a common method where the delegate does addition/subtraction. Also demoed raising events using This._events = new Sys.EventHandler list and This.raiseEvent().

    Samples from the demos can be found at www.Codeplex.com/ScottCateAjax.
  16. WEB304 – Web Futures – the next 18 months. Was a panel that dealt with some of the hot questions about what is coming up in the forseeable development future. It involved discussions of topics such as:

    1. The battle over where your data lives, and where processing is done. Browsers as an operating system (e.g. Google Chrome). Competing viewpoints of Google (in the cloud) vs Microsoft (S+S)
    2. The battle of standard browsers vs plugins like Silverlight.
    3. The web and whether it should work offline
    4. Scott talked about JavaScript and its popularity going through the roof, especially with technologies like Bubbles, Prism and Google Gears and other supporting frameworks such as http://developer.yahoo.com/yui/
    5. The push of consumer focuses technologies – into enterprises.
    6. JavaScript as the Intermediate Language (IL) of the web
    7. If starting something now, how do you hedge your bets? For any technology decision: Complexity kills, Do the simplest possible thing that will work and refactor it tomorrow, use the minimal amount of technology and minimal requirements to meed a need.
  17. DEV420 Hardcore LINQ to Entities
    Wasn't really hardcore - but was more of a nuts and bolts of LINQ to Entities, attribute mappings and inheritance. You can have conditional inheritance in entities (via "Where" conditions). Complex types are not supported in the designer - but you can update the xml directly to do it e.g. Common Address entity used by other classes. The designer has "regenerate from database" functionality built-in. Under the hood, there are 3 files that support LINQ to entities - the CSDL file (conceptual), the MDL file (the mapping file for field to field mappings and support mappings to more friendly names), and the Schema file.

    You cannot use normal methods such as AddDays() on LINQ to entities as not supported by provider. LINQ to Entities doesn't support lazy loading - you need to use the .Include syntax.

    You can query via generics such as in Context.Products.OfType(). A suggestion was made by Adam Cogan to embed the 3 metatdata files into the project - but this would cause problems when doing deployments to different environments as you cannot just update the schema file to point to the correct database.
  18. SOA209 The Road to "Oslo" : The Microsoft Services and Modeling Platform
    This product isn't even available for demo yet (not even alpha) - but it is a new environment for keeping track of exactly what is deployed (in terms of applications, hardware etc) and where in your organization. It is still 12-18 months away. It is both a repository of company assets and even a deployment mechanism that allows the build up (e.g. deploy applications and open ports) and pull down of complete environments. It will have the "Oslo Visual Designer" component which even allows you to modify WF workflows via the UI designer, the "Oslo Repository" which stores data against schemas about practically anything in your IT environment, and the “Oslo Process server” which will host WF and Biztalk transformations.

That's it for now. Till next time. DDK