Wednesday, May 16, 2007

devscovery 2007 5/9 - 5/11

this was a great conference run by Wintellect, a training/consulting company that works very closely with msft on product development. the speakers were Wintellect’s technical leads (jeff richter, john robbins, jeff prosise, etc.), who are the authors of some of the Microsoft Press books we read, and all were excellent. topics covered included some of what’s in store for us in the near future (wpf, wcf, silverlight) and some stuff we can start taking advantage of right now (asp.net ajax extensions, asynchronous programming, debugging). the c# 3.0 language enhancements are very interesting; lots of syntactic shortcuts to reduce what you have to type that end up making things look very javascript-looking.

wpf (part of .NET 3.0)

  • does not replace Winforms; for quick development of standard GUI, not-so-flashy desktop apps, Winforms will still have a place
  • page layout defined in XAML
    o easy to exploit graphics and animation compabilities
    o nearly every property of every object is animatable
    o binding allows the property of an object to change as the property of another object changes
  • similar structure to ASP.NET in that .xaml page containing markup has .xaml.cs code-behind page containing coding logic

BETA - silverlight (formerly WPF/E)

  • cross-platform browser plugin
  • "silverlight CLR" provides sandboxed capabilities (limited access to file system, networking, etc.)
  • allows you to write almost-identical xaml pages as wpf apps
  • v1.0 currently in beta
    o requires you to interact with xaml objects via javascript
    o v1.1 (currently in alpha) allows
    o allows you to interact with xaml object using C#
    o will likely displace Flash in Microsoft development shops

CTP - c# 3.0 (next version of the c# language)

  • in general, the language is becoming more functional looking (LISP-like), and most new constructs are easy-to-write shortcuts to the actual operations that are rewritten at compile-time
    § implicitly typed local variables - allow you to say:

    var x = new String("hi");

    instead of:

    string x = new string("hi");

    which is particularly useful when you are instantiating a complex type
  • extension methods - you can define a static method in a static class with new "this" keyword in parameters as follows:

    public static int StringToIntFunction(this string s) {...do something...}

    and then this function is available in instance-syntax to any String object, so you can say:

    string s = "hi";int i = s.StringToIntFunction();
  • anonymous types - compiler will generate a type name for you, with specified property accessors:

    var someEmployee = new { Name = "MyName", Title = "Developer" }

    and you can then call someEmployee.Name and someEmployee.Title as if you had created an Employee class and specified these properties
  • LINQ (Language INtegrated Queries) - new constructs allow for T-SQL-like syntax for IEnumerable interactions:int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };var lowNums = from n in numbers where n < products =" GetProductList();var" productinfos =" from" price =" p.UnitPrice};" href="http://download.microsoft.com/download/5/8/6/5868081c-68aa-40de-9a45-a3803d8134b8/csharp_3.0_specification.doc">http://download.microsoft.com/download/5/8/6/5868081c-68aa-40de-9a45-a3803d8134b8/csharp_3.0_specification.doc

asp.net ajax extensions - http://ajax.asp.net/

  • we can and should start using this NOW! if you see something that will speed development time or provide richer user experience, use it!
  • the asp.net ajax control toolkit contains lots of widgets that use the ajax extensions and is open-sourced
  • tag allows you to specify path the your webservice; this generates a javascript-callable wrapper for your webservice methods, so you get real nice webservice.methodName() syntax on webservice calls
  • JSON (JavaScript Object Notation), which is a much less-verbose SOAP alternative we should also be using already

threading and asynchronous programming model

  • as much as possible, use beginread()/endread() instead of read(), etc.
  • can create UI issues and is a bit more difficult model to program using (since everything is done with callbacks), but keeps threadpool lean and mean
  • use Interlocked class for thread-safe variable increment/decrement

debugging, unit testing, and perf tuning

  • VSTS provides almost all the necessary tools
  • UI automation testing in .NET 3.0 provides APIs for driving Winform and wpf apps
  • developers average 1 bug for every 10 lines of code; with unit testing and code-coverage averaging 80-90% coverage, ratio moves toward 1/1000
  • beware of finalizers (cause objects to be moved to GC finalizer queue, which is not cleaned until next GC run)

tools

  • BETA - Blend (formerly Expressions)
    o Flash-like IDE for creating xaml for animations
    o release versions due later this year
  • CTP – “Orcas” (next version of Visual Studio)
    o project types for Silverlight apps
    o intellisense for xaml and javascript
    o release versions due later this year
    o reflector – FREE - see c# code for .NET library
    o http://www.aisto.com/roeder/dotnet/
  • web development helper – FREE - firebug-like plugin for IE
    o http://projects.nikhilk.net/Projects/WebDevHelper.aspx
  • .net memory profiler - awesome tool to analyze .net memory usage
    o http://www.memprofiler.com/

No comments: