PDC2008 Seminar Video, Slides, and Code

November 5, 2008

Just a quick note on a posting I found with a very comprehensive list of all video, slides, and code examples from PDC 2008.  Find the information here:

http://blogs.msdn.com/mswanson/pages/PDC2008Sessions.aspx


PDC2008: Future of C#

October 30, 2008

I saw a really good presentation on the future of C# by Anders Hejlsberg, the lead architect of the team developing the C# programming language.  This was a popular talk as he got to present it twice this week.

Anders outlined the history of major advances in C# as this:

  • 1.0 - Introduction of Managed Code
  • 2.0 - Generics (and everything else we wanted in 1.0 but didn’t have time to do)
  • 3.0 - Language Integrated Query

He observed that the trends in Programming Languages today were towards languages that were: Declarative, Dynamic, and Concurrent.

Declarative vs. Imperative

Declarative (vs Imperative) are languages with mutations, variables. The need may be on WHAT we need done but the focus is primarily on HOW we want it done. The JIT compiler can’t really determine the WHAT. The Declarative style allows for better interpretation by the language infrastructure at compile time. Think of it like this:

Declarative Imperative
Dynamic Static
Simple & Succinct Robust
Implicitly Typed Performant
Meta-Programming Intelligent Tools
No Compilation Better Scaling

Both of these types have something to contribute - but we really need a combination. Be as static as possible and dynamic where needed.

Concurrent

What exactly is Concurrency? Lots of people seem to have their own definition.  Anders described it in these terms: Multi-cpu systems are a reality. We need to know how to program to use the cores effectively.  How do you break a logical unit of work and run it on multiple cores?

C# 4.0

OK - so on to what to expect with C# 4.0:

  • Main focus is on Dynamic Programming
  • Dynamically Typed Objects
  • Optional and Named Parameters
  • Improved COM Interop
  • Co and Contra Invariance
  • Dynamic Language Run-time - (Part of .NET 4.0)
  • Expression Trees
  • Dynamic Dispatch
  • Call Site Caching

Note that VB.NET will also be getting this support.

C# will also be introducing Object Binders. For example: Javascript Binders for Silverlight, COM Binders for Office, others as well (for Ruby and Python).

Dynamic Language Support

Dynamic Languages today require different syntax or very complex syntax if the type is unknown. The new “Dynamic” Keyword changes all this. This is essentially System.Object with a “Dynamic” attribute. Cloud computing increases the need to do this significantly.

When Operands are dynamic, the member selection is deferred to run-time. At run-time, the actual types are substituted for the dynamic placeholder. Method Overloads can also be done with Dynamic instead. Just changes where the replacement occurs.

A new extension method AsDynamic allows static types to be able to invoke dynamic dispatch.  So existing types can take advantage of the new functionality.

The functionality provides an Idyllic Interface. You can write your own dynamic objects.  Then you buildup your own interpretation of how the dynamic replacement will work at runtime.

Other Features

Optional and Named Parameters are now supported.  This has been in VB.NET for a while.  Named arguments must always be last in an invocation.

There is improved COM Interoperability.  No longer need to specify “System.Reflection.Missing.Value” parameters.  This helps geatly with Office calls which have many named and optional parameters.  Interop Type Embedding (the reducing of the size of DLLs needed by encapsulating only the functionality being used), provides a much smaller footprint. It also removes the need for casting as well.

Anders also talked a bit about Co- and Contra-variance. However this part went right over my head :) I’ll have to follow up on that later.

C# 5.0 and Beyond

Future C# work will focus on the compiler as a service.  C# merely becomes a callable object. An example of this is Jascripts EVAL function - only you will be able to do it now directly in C#.  Programmers can even define functions within it.


PDC2008: T-SQL Futures

October 30, 2008

The only SQL session I am taking this week took place yesterday and was all about T-SQL futures by Michael Wang.  To my delight it was all about SQL 2008, so I got information that I will be able to use fairly soon.

Michael detailed the following SQL 2008 areas relevant to T-SQL:

  • DataTime Data types
  • SQL Language
  • Procedural programming

DataTime Data Types

Data types start with the splitting out of date and time as individual types.  This allows a recording of only date information and only time information.  The DATE datatype now provides for a historic day prior to 1753 as well as a larger precision. The new DATE data type is 60% smaller than the existing DATETIME.  The TIME datatype has a precision of 100ns, but that can be changed to save storage space.  A new DATETIME2 datatype was created with greater precision and the idea being it will break legacy datetime applications dependent on the current precision.  Last is the DATETIMEOFFSET: this is a time zone aware value that includes date and time and offset.  It directly matches a new .NET type in the 3.0 framework.

New functions are also available to support the new date & time data types.  Some examples of these are SYSTEMDATATIMEOFFSET and TODATETIMEOFFSTE, as well as extensions into the existing DATEPART and DATENAME functions.

SQL Language

Under the SQL language area, we now get a MERGE statement.  This is a new SQL 2006 compliant syntax that can do an insert, update and delete all within the same statement.  This is useful in OLTP databases to merge from an external source.  It is useful in data warehouses to do an incremental update of fact tables.  Note the OUTPUT clause of this statement will show you exactly what it did.

Grouping sets are another part of the language improvements.  It allows you to define multiple groups in the same query.  You could do this before with the duplicate query and UNION ALL statement, but the new syntax will allow for significantly improved performance.

Table value constants are now supported as well.  This looked similar to how the generics are used today in C# to initialize values.

The TABLE datatype was also created to support the tables value as well as for allowing table information to be passed as a parameter (yay!).

One last thing in this area Michael called SQL Delighters: we finally get compound assignments - +=, -=, etc

Procedural Programming

Object dependency start this off.  You can now see who references what the a new system stored procedures.  For example, see everything that references the table in the database.  Note this functionality currently does not cross the database boundary.

Here are a new hierarchical data types with built in functions to support them.  This functionality is currently provided by common table expressions, that the new data types and functions will give you better performance.

Michael also talked briefly about sparse columns. These allowed for optimized spacing by using filtered indices. You define indices over subsets of data.

Summary

I had always viewed SQL 2008 to be primarily a DBA-oriented, rather than developer-oriented release.  Nice to see we still get some things to play with. I look forward to working with the new features and can see immediate applications for several of my clients.  While the T-SQL updates alone are probably not enough of a reason to update to SQL 2008, when taken with other DBA features I am definately reccomending it to my clients.