The Register® — Biting the hand that feeds IT

Feeds

Get stuck in to Visual Studio 2008

LINQ big, better teamwork needed

Customer Success Testimonial: Recovery is Everything

Review Visual Studio is more than an integrated development environment. It is a strategic tool intended to promote the Microsoft platform.

As such, the latest version of this IDE - released to MSDN subscribers late last month and due for widespread availability next February - draws together several different themes. One is Windows Vista. This is the first release of Microsoft’s developer tools suite since the arrival of Vista more than a year ago, and is therefore the first truly Vista-ready edition.

Visual Studio 2008 adds designer support for three new frameworks released simultaneously with Vista in November 2006: Windows Presentation Foundation (WPF), Windows Communication Foundation (WCF) and Workflow Foundation (WF). These include two of the original “three pillars of Longhorn” touted by Bill Gates when he announced Vista - then codenamed Longhorn - even further back, in 2003.

Why has it taken Microsoft more than a year since the launch of Vista to deliver full developer support for the premier features of its latest operating system, whose features were unveiled four years ago?

It’s a good question, and one that exposes the split today that exists in Windows between the vision and the reality. According one view, WPF is the new graphical user interface (GUI) for Windows, replacing the old Win32 API, and WCF is the replacement for every communication API from DCOM to MSMQ.

On one level, it is easy to see how WPF improves on Win32. It scales nicely, it is designer-friendly, it runs both within and outside the browser, and it uses DirectX for rendering, enabling fast 2D and 3D graphics. In terms of tools, WPF - with the XAML language that defines a WPF GUI - is a bridge between Visual Studio and a companion product from Microsoft called Expression Blend.

Blend is a design tool for WPF, complete with an Adobe Flash-like timeline, and supports the same solution files used by Visual Studio. Designers and developers can work on the very same files, breaking the common cycle where an application is mocked up in Photoshop, then handed over to developers to implement in a different tool. Since WPF forms use a code-behind model similar to that in ASP.NET, there is a clean separation between code and design, though a determined designer could still break the code by deleting or renaming objects.

WPF designer

Get fancy with the XAML designer

Unfortunately - and here’s where reality kicks in - there are problems with WPF. It is part of .NET Framework 3.0, now updated to version 3.5 with the release of Visual Studio 2008, and although it is supported on Windows XP, deployment of the runtime is limited and the download is huge.

Regcast training : Hyper-V 3.0, VM high availability and disaster recovery

Latest Comments

@var madness

Re: "var at the top of the class"

The compiler would be happy to tell you that:

"The contextual keyword 'var' may only appear within a local variable declaration"

I would recommend downloading the compiler and actually trying out the new features. It's easier, and more accurate, than pure speculation.

0
0

@var madness

Anon, Robert: the most important thing about the var keyword in C# is that it can only be used when declaring and initializing in a single statement. So you can't say

var x;

x = 1;

You have to say

var x = 1;

which will declare x as an int for the life of the variable: you can't assign a string value to it later. As Keith says, it's not particularly useful when dealing with ints, strings and so on, and in my code I still use the type name for those. And when you're creating a new instance, it's still easier (IMO) to specify the type and let Intellisense fill in the "new" bit.

But it is necessary for the anonymous types and LINQ stuff, and it's also pretty useful when you're getting an object back from a method and you don't want to type the whole namespace-qualified class name. I really like being able to say

var cn = Server.GetConnection();

var cmd = cn.CreateCommand();

...

var dr = cmd.ExecuteReader();

It's also important to note that Intellisense knows what type the variable is and provides the methods/properties just as if you'd specified the type name.

HTH.

0
0

@var madness

Don't make the mistake of equating C#3's "var" keyword with Javascript's "var". The two are entirely different, even if they are (unfortunately) named the same.

The var foo = "bar" example is very simplistic. Consider the keystroke savings in:

var q = Customer c => db.Customers.Where(cust => cust.ID == c.ID).Select(new Foo(c));

versus

Expression<Function<Customer, IQueryable<Foo>>> q = ...;

It is plainly obvious that naming expressions of lambdas involving nested generic types is onerous. It is also something that shows up frequently in LINQ.

Incidentally, the var keyword is *required* for use with anonymous types. Since the identity of the type is not knowable except by the compiler itself, this allows the programmer to still write the following strongly-typed code:

// must use var, because there is no name for the type

var q = db.Customers.Select(c => new { c.LastName, c.FirstName, HalfAge = c.Age / 2 }).First();

q.LastName = "Eubanks";

// q.Age = "One"; // compiler error -- q.Age doesn't exist

// q.HalfAge = "One"; // compiler error -- q.HalfAge is strongly typed

// q = "Two"; // compiler error -- q is strongly typed

-- Keith J. Farmer [MSFT], ex-LINQ to SQL/now-Silverlight

0
0

More from The Register

SCO vs. IBM battle resumes over ownership of Unix
Zombie lawsuit back and wants to suck the brains out of Linux
Bjarne Again: Hallelujah for C++
Plus: Now officially OK to admit you never used STL algorithms
Interwebs taunt Sir Jony over Apple eye candy makeover
Hey Ive, Ive... add more unicorns, willya?
Apple: iOS7 dayglo Barbie makeover is UNFINISHED - report
Plus: You don't like the icons? Blame marketing
Red Hat to ditch MySQL for MariaDB in RHEL 7
So long, Oracle! Don't let the door hit you on the way out
Shy? Socially inadequate? Fiddling with your phone could help
App 'tells the brutal truth' about social inadequates' chatup lines
Java EE 7 melds HTML5 with enterprise apps
New release arrives with GlassFish, NetBeans support
 breaking news
'Office Facebook' firm Tibbr wants you to PAY for mobe-meetings app
Great idea. Punters won't cough for it though
 breaking news
The only Waze is Google: Ad giant tipped to gobble map app 'for $1.3bn'
Pac-Man-satnav-ish upstart in bidding war with Apple, Facebook
 breaking news
PM Cameron calls for modern, programmable computers! (We think)
IT education musings to G8 chiefs to mystify IT industry