Get stuck in to Visual Studio 2008
LINQ big, better teamwork needed
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.
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.
Further, Microsoft itself has muddied the waters by declaring that WPF is not suitable for line-of-business applications. According to Microsoft technical product planner Glenn Block: “Win Forms is the recommended breadth solution for LOB application development for the foreseeable future.”
Issues include maturity, the range of available controls, and the difficulty in migrating from Windows Forums to WPF. Honesty is commendable in this business, especially from Microsoft, but - really - this is not a great way to sell your new technology.
Peter Lindsey, managing director of Infragistics Europe, a partner selling components for both WPF and Windows Forms, told me recently at TechEd Barcelona that Microsoft’s caution is slowing WPF adoption. “Microsoft, in trying to capture credibility within the media market, has poorly represented the value of WPF to business application developers.”
The risk is that with attention shifting to cross-platform, internet applications, WPF will never achieve mainstream adoption. Silverlight, a lightweight cross-platform implementation of WPF as a browser plug-in, is attracting more attention. Unfortunately with Silverlight we are back in the world of preview bits. The release of most interest to developers, which includes a cross-platform .NET runtime, is not expected until late 2008.
Still, now we have a proper XAML designer in Visual Studio and it is an impressive piece of work, especially when combined with Expression Blend.
Visual Studio 2008 also offers support for language innovations in C# and Visual Basic. The headline feature is LINQ - Language Integrated Query - but there are several other changes that are part of the plumbing behind LINQ and that are also more useful in general. One example is type inference, where the type of a variable is inferred from the value to which it is initialized.
In C#, you use the var keyword:
var s = "Reg Developer";
gets you a strongly-typed String variable.
The Visual Studio editor fully understands var, and gives you IntelliSense features like word completion and so on. Type inference is addictive, if only because it saves typing and de-clutters your code. Another neat feature is extension methods, which let you extend types with static methods that are called like instance methods. The value of the instance is passed to the static method, so it has some knowledge of the instance but does not break encapsulation. Other additions include anonymous types and Lambda Expressions, used heavily by LINQ.
LINQ itself is a large topic, surfaced in several ways within Visual Studio. There are a couple of ways to look at it. First, LINQ is exactly what its name suggests: query extensions built into .NET languages, reminiscent of dBase and FoxPro, except that LINQ is more flexible because it can target arbitrary data sources, such as an XML document, or any enumerable .NET object. Second, LINQ to SQL is what software architect Matt Warren describes in an illuminating blog post as “possibly Microsoft’s first ORM to actually ship in ten years of trying.”
Warren refers to ObjectSpaces, an object-relational mapper (ORM) for SQL Server that was absorbed into WinFS, then died when WinFS was abandoned.
In Visual Studio terms, LINQ to SQL transforms the way SQL Server database applications are written. Adding LINQ to SQL classes to a project enables the visual object-relational designer, where you can drag tables, queries or stored procedures. Building the solution generates classes to represent the data, and you then use LINQ to code against those classes. All going well, it relieves the developer of much of the plumbing code involved in typical database applications.
Finally - the ORM designer that died with WinFS
Lurking amidst all the .NET surroundings is a new Visual C++, now the sole Microsoft compiler that emits native code. This is not a big new release. The supplied libraries, including ATL and MFC, now properly support Vista, and there are improvements to managed code support.
Team System for Visual Studio 2005 was a revolution for those developer teams that prefer to stick closely to Microsoft’s own development tools. They got grown-up source control, a unit testing framework, load testing, code analysis, bug tracking and team management through work items, build management, documented process methodologies, and a project portal based on SharePoint.
Team System portal in action
The 2008 version has matured a little, but the changes are relatively small. Installation of Team Foundation Server remains arduous, thanks to its many dependencies. Microsoft has not addressed weaknesses such as the difficulty developers have in tracking work items spread across several projects.
Earlier this year Microsoft acquired DevBiz, makers of TeamPlain, which is a web-based alternative to Team Explorer. This is not yet integrated into Team System 2008, so I guess it may be an add-on for later.
Still, there are numerous small enhancements here, like improved performance, new code analysis rules, new features in the profiling tools, and the ability to get the latest version of a file automatically on check out. The Database Edition is now integrated into the main release. Microsoft is known to be working on significant new modeling tools, but there is no sign of them in this release.
The quality of Visual Studio 2008 reflects its strategic importance. It is a fine piece of work, and essential for developers interested in keeping up-to-date with Microsoft’s platform. This edition is the first to be able to target multiple versions of the .NET Framework, so it should be the only one you need.
There are annoyances, like the seemingly perpetual cycle whereby what you really want is not quite done yet and only available in preview. Silverlight 2.0 falls into that category, as is Project Astoria, the forthcoming REST API for ASP.NET.
Visual Studio is also suffering from feature-bloat, and the full versions may be overwhelming to newcomers, though the free Express editions do offer an easy entry point. And, good though it is, Team System is only slightly improved in this version, which is disappointing. Team System also suffers from a bewildering range of editions. I feel that a single Team Suite would do nicely.
The biggest take away from Visual Studio 2008, though, is LINQ. This is Visual Studio 2008’s most significant effort, and while these are early days, it looks promising.
For more on Visual Studio 2008, check out MSDN here.®