Tech.Ed Day 5 Roundup

Posted 07 December 2008, 21:19 | by | Perma-link

TLA311: The Future of C#

The story for C# so far has been: Managed code (1.x), Generics (2.0) LINQ (3.0), however the trends in languages at the moment is towards:

  • Declarative: Less how you want to do something, but more what you want to do - this is supported by LINQ and PLINQ.
  • Dynamic: Not just dynamic languages, but objects whose type we don't know about at compile time.
  • Concurrency: No one's got this completely right for the last 30 years or so, mainly because it means many things to many people. As computers gain more cores, we need to work out how to make our sequential processes run in parallel.
  • Within Microsoft, there's a trend for VB.Net and C# to steal ideas: Going forward they are going to stop adding features separately to each language - many of the new things in C# 4.0 are already in VB, and the same goes for VB10.

So, what is coming in C# 4.0?

  • Dynamic Programming: The Dynamic Language Runtime, sits in the middle, offering Expression Trees, Dynamic Dispatch and Call Site caching, the languages sit on top of the DLR (IronPython, IronRuby, C#, VB.Net, etc), and under the DLR are binders to objects, etc.
    To access a dynamic object, you use the dynamic type, so member selection is deferred to runtime, when the actual types are substituted. Obviously, there's no IntelliSense for dynamic types.
    You will also be able to implement IDynamicObject, which will allow you to dynamically create properties on the object, which are stored in an internal dictionary - this gives you a kind of Duck Typing ("It looks like a duck, it acts like a duck, it sounds like a duck, let's just call it a duck").
    The ultimate proof of this was when Vishal Joshi copied some JavaScript from an aspx file into a cs file, and it all pretty much just worked.
  • Optional and Named Parameters: You can declare default values for parameters, and these will be used if no value is passed in. Positional arguments are processed first and then named arguments are processed. This is obviously of most benefit when it comes to COM interop. The ref modifier on interop calls is now optional, and the Primary Interop Assemblies are no longer needed - only the calls you actually use will be generated.
  • Co- and Contra-variance: See Eric Lippart's Fabulous Adventures In Coding series on the Future of C# for more on this, but my main notes were that the Out modifier will promise that you won't add to or modify the contents of the objects passed to you, and an In modifier states you only take input (e.g. Compare).

And what about after C# 4.0? There was a demonstration of the compiler being exposed as part of the API, allowing complete Meta-programming, dynamic languages that change at runtime, etc.

WUX402: ASP.Net AJAX Tips and Tricks

Something I probably should know about - the preventDefault method will disable the default url action on a link - quite handy.

AddHistoryPoint

This allows you to store Key-Value pairs, along with a title in a state bag, that then enables Back and Forward  navigation, along with Bookmarking support. Within the Script Manger you need to Enable History, set On Navigate, and set EnableSecureHistory to false. This can be done and accessed either server side or, when using sys.Application.AddHistoryPoint on the client side.

jQuery

This now ships with ASP.Net MVC and will be included in VS2010, Jeff King has lots of content on jQuery integration - some quite neat selectors are available:

$("#id") // basic select element by id.
$(":text") // select all elements of type=text.
$(".class_name") // basic select by css class name.
$("#grd tr:even") // find element id "#grd" then select every even row within it.

Script Combining

Although modern browsers are getting better, the HTTP spec recommends only two active connections from a client to the server - so consider combining your scripts together to reduce roundtrips - or you can look into using the ToolKitScriptManager to assist with that.

AJAX with ASP.Net MVC

Handy additions - Ajax.BeginForm - wrap this in a using statement, and you automatically get the closing form tag as well.

There is a client only AJAX toolkit, and helper methods to go with it.

PDC01-IS: Cloud Services: The Story Behind the PDC Keynote Demos

Interesting interactive session on the work being done for the RNLI that has already saved lives, and BlueHoo, who rather frivalously use Azure platform to make little grey and blue blobs (or Hoos) dance. Oh, and enable you to network via BlueTooth and a data service.

WUX02-IS: Top 10 Web Mistakes and How to Avoid Them

A packed session (in fact, a repeat of a previously packed session).

10: Lousy and Out of Date Content

For best results, remove out of date content - at the very least, ensure you have a date on the content, so users can see when it was posted, and ignore it if they wish.

9: Errors in Code

Make sure your mark-up is valid.

8: No Easy Navigation

Sitemaps, breadcrumb trails, search all help.

7: Inconsistent Site Design

On larger sites, ensure that the site layout and design is consistent - especially the overall navigation.

6: Bad User Workflow

An example here was twitter: On the first page, the focus is in the text area at the top - this is good, because you probably went there to post a tweet, however, once you're browsing later pages, this is less important - you're more likely scrolling around, reading tweets, etc - lose the focus on those pages.

5: Only Providing Rich Media

4: Obtrusive Ads

Try and come up with a way to make them less obtrusive, more relevant, targeted, etc.

3: Not Optimising for Search

URLs, HTML markup (see 9 above), etc.

2: Non-Designers Designing

Again, 7, inconsistent designs, poor colour choices, etc - there are plenty of free or affordable templates and colour schemes out there, use them.

1: Not Planning for the Future

Locking people out because they have a later build than your browser sniffer, failing to work on browsers like Chrome or IE8, etc.

Filed under: Conferences, Tech.Ed