Tag Archives: visual studio 2010

Visual Studio 2010 nine months on: how good has it proved?

Visual Studio 2010 was released on April 12th 2010. Nine months on, how good has it proved to be?

image

I researched deeply into Visual Studio 2010 at the time, and was impressed overall. It was a huge release, partly because the IDE was rebuilt using Windows Presentation Foundation, and partly because of a large number of new features including the F# language. Performance was always going to be an issue with the move to a .NET-based IDE, but on my machines I found it satisfactory.

Others have been less pleased with the performance. The comments to Jason Zander’s announcement of the Service Pack 1 beta last month make interesting reading. Here is the negative:

I am a professional .NET developer and I am really upset with VS 2010. It crashes more often than VS 2008. It is slow as hell. It even crashes when debugging. VS 2010 is built with WPF which is causing all these problems.

and here is the positive:

I don’t know what y’all complaining about – VS2010 is blazingly fast… at least on my machine.

I am not sure whether the performance issues are more dependent on the the type of work you are doing, or the size of the projects, or some other factor. One issue may be graphics performance, since this will make a big difference to WPF whereas not so much with Visual Studio 2008 and earlier.

Thinking back to this time last year, I also recall how Visual Studio 2010 seems so focused on .NET, including Silverlight. Later on we got the announcement of Visual Studio LightSwitch, a RAD database application tool which builds Silverlight clients. It now seems obvious, especially following the PDC (Professional Developers) conference in November, that the vision of the developer team at Microsoft did not align with the vision of the Windows team; and that the Windows team seemed to win that argument internally. It is odd, because Silverlight has the potential to solve problems for the company. It is a technology that extends from the desktop to Windows Phone 7, which is well-suited to app store deployment thanks to the way apps are isolated, and which potentially can run on multiple platforms. Now with Silverlight 5, promised for release this year, Microsoft is adding more Windows-specific features and allowing more fragmentation between versions. Silverlight on Windows Phone 7 is based on version 3, the Mac version has more limited capabilities than the Windows version, and so on.

Microsoft said at PDC that “HTML 5” is its broad-reach platform. That suggests that what Visual Studio needs is HTML 5 designers and JavaScript libraries that integrate with Microsoft’s server technologies and which make it easier to develop HTML application for multiple form factors including small devices.

It is a confusing story, and I would love to know if the subject came up in CEO Steve Ballmer’s discussions with Bob Muglia, VP of Server and Tools, recently. The outcome of those discussions is that Muglia will be leaving Microsoft in the summer.

We will have to wait for Visual Studio 2012, maybe, to discover any change in its direction. In the meantime, SP1 adds a new help viewer, in response to many complaints, as well as a few new features for testing and debugging. There is also a list of bug-fixes, some of which look significant:

and so on. Let me add that while the list looks bad, it is no more than you would expect for a tool of this complexity and in my own testing Visual Studio 2010 has worked well.

I agree though with some of the commenters who note that Microsoft is slow to react when bugs are reported. It will be more than a year after the initial release when SP1 is finished, though you can use the beta for production code if you dare.

I would be interested in hearing from users of Visual Studio 2010. How are you finding it, or did you try it and go back to Visual Studio 2008? I realise that adoption of a new IDE for production work tends to be slow, because developers are reluctant to switch mid-project.

Don Syme on F#

I’ve posted a lengthy interview with Don Syme, designer of Microsoft’s functional programming language F#. It covers:

  • The genesis of F#
  • Why it is in Visual Studio 2010
  • How it differs from other ML languages
  • Who should use it
  • What it brings to parallel and asynchronous programming
  • Unit testing F#
  • Future plans for F#
  • Book recommendations

One of the questions is: if I’m a C# or C++ developer, what practical, business-benefit reason is there to look at F#? Worth a read if you’ve wondered about that.

DevExpress merges its Silverlight and WPF UI controls, says VS 2010 is light years ahead

Developer Express is a component vendor with add-ons for Visual Studio and Delphi. It has offered a library of components for Silverlight for some time, and a separate set for WPF (Windows Presentation Foundation), but now says that Silverlight and WPF are close enough that it can merge the two into a single codebase to be called XPF (Express Presentation Framework). CTO Julian Bucknall says:

Silverlight in v4 has the ability to create desktop applications that aren’t sandboxed into triviality. In fact, Silverlight, more than ever, resembles a WPF-lite on the desktop side, to the extent of pundits considering their eventual merging. At long last it is possible to write one set of non-trivial code and compile it both for Silverlight and for WPF without having to reinvent so many wheels on the Silverlight side (and to a much lesser extent on the WPF side).

Even though Visual Studio 2010 is only just released, DevExpress is focusing all its new Silverlight and WPF development on the new platform and IDE:

The Silverlight and WPF controls in DXperience v2010.1 will require .NET 4 and VS2010. In particular, you must use the new Silverlight 4 and WPF 4; the controls will not function with the previous versions of WPF and Silverlight, such as Silverlight 3. Similarly, you cannot use VS2008 or earlier, but must use VS2010. To my mind this isn’t that much of a downside: VS2010 is light years ahead of its earlier brethren in terms of user experience and its use is de rigueur if you are creating applications with either Silverlight or WPF.

Of course it’s in Bucknall’s interests to move developers on; he’s keen to sell upgrades. I still find this interesting. Like him, I find Visual Studio 2010 a major advance on earlier versions. More significant though is the idea of a common WPF and Silverlight codebase, though presumably still with added capabilities when running on WPF. I don’t think Windows-only development is dead; the success of Windows 7 may even stimulate the market for applications that take advantage of its new features. That said, for the large subset of applications where cross-platform is desirable, Silverlight seems to me a better choice than WPF.

Silverlight 4.0 released to the web; tools still not final

Microsoft released the Silverlight 4.0 runtime yesterday. Developers can also download the Silverlight 4 Tools; but they are not yet done:

Note that this is a second Release Candidate (RC2) for the tools; the final release will be announced in the coming weeks.

Although it is not stated explicitly, I assume it is fine to use these tools for production work.

Another product needed for Silverlight development but still not final is Expression Blend 4.0. This is the designer-focused IDE for Silverlight and Windows Presentation Foundation. Microsoft has made the release candidate available, but it looks as if the final version will be even later than that for Silverlight 4 Tools.

Disappointing in the context of the launch of Visual Studio 2010; but bear in mind that Silverlight has been developed remarkably fast overall. There are huge new features in version 4, which was first announced at the PDC last November; and that followed only a few months after the release of version 3 last summer.

Why all this energy behind Silverlight? It’s partly Adobe Flash catch-up, I guess, with Silverlight 4 competing more closely with Adobe AIR; and partly a realisation that Silverlight can be the unifying technology that brings together web and client, mobile and desktop for Microsoft. It’s a patchy story of course – not only is the appearance of Silverlight on Apple iPhone or iPad vanishingly unlikely, but more worrying for Microsoft, I hear few people even asking for it.

Even so, Silverlight 4.0 plus Visual Studio 2010 is a capable platform; it will be interesting to see how well it is taken up by developers. If version 4.0 is still not enough to drive mainstream adoption, then I doubt whether any version will do it.

That also raises the question: how can we measure Silverlight take-up? The riastats charts tell us about browser deployment, but while that is important, it only tells us how many have hit some Silverlight content and allowed the plug-in to install. I look at things like activity in the Silverlight forums:

Our forums have 217,426 threads and 247,562 posts, contributed by 77,034 members from around the world. In the past day, we had 108 new threads, 529 new posts, and 70 new users.

it says currently – substantial, but not yet indicative of a major platform shift. Or job stats – 309 UK vacancies right now, according to itjobswatch, putting it behind WPF at 662 vacancies and Adobe Flash at 740. C# on the other hand has 5349; Java 6023.

Book Reviews: Programming F# and Beginning F#

I’ve been working with Microsoft’s new language F# recently and enjoying it. If it catches your interest, you might turn to a book in order to familiarise yourself with the basics. Here are two which I’ve looked at. They are both aimed at experienced developers who are new to F#.

Programming F# by Chris Smith

Programming F# comes from O’Reilly. It kicks off with Hello World and an introduction to the interactive console in Visual Studio 2010 – a great way to try out F#. Next we get a summary of types, and a brief explanation of how to write an F# program – stuff you have to know.

Chapter 3 is an introduction to functional programming, and also mentions type inference, an important F# feature. The following chapter explains mutable programming in F# – yes, you can do it; it is just not the default behaviour – and also covers exceptions. Chapter 5 turns to object-oriented programming in F#, another distinctive feature, while chapter 6 covers aspects specific to .NET such as garbage collection. That’s about half the book, and gets you up and running with the language.

The second half of the book is more interesting, looking at ways of using F#. Smith looks at applied functional programming, including pattern matching, recursion, continuations and closures. Next, there’s a look at applied object orientation. Chapter 9 covers scripting with F# – an interesting use case – and includes welcome examples for things like copying files and automating Microsoft Office. Chapter 10 is a key one, explaining computation expressions that let you create workflows and all-but extend the language. It’s “a very advanced concept that even expert developers can have a hard time grasping,” admits the author, though he presents it clearly.

Next we get a section on a likely reason for picking up F#: asynchronous and parallel programming. There’s a wide-ranging chapter explaining both .NET and F# asynchronous techniques, including the .NET Parallel Extensions. It’s a little confusing, especially since Smith observes that F# asynchronous workflows are sub-optimal for CPU parallelism; he recommends the .NET Parallel Extensions because of the better thread management it offers.

The last chapters cover .NET Reflection, code analysis and generation with Quotations – “deep wizardry”, says the author. An appendix summarises .NET Libraries and F# interop with COM and native code.

While this is an excellent language introduction, and thorough within the topics it covers, some aspects disappointed me. I cannot find any mention of F# agents, based on the MailboxProcessor class (nothing to do with email), which is a surprising omission; F# designer Don Syme sees it as a critical feature for scalable web development. Nor is there anything on graphics processing, another common usage, or any hint about how you might use F# for financial analysis. I also found it rather dry overall – hard to avoid with so much plumbing to cover, but I feel the author could have conveyed a little more excitement about what F# enables. Don’t make this the only F# book you read.

Beginning F# by Robert Pickering

This Apress title covers similar ground as the O’Reilly book, but with a slightly more hands-on and informal style, which on the whole I enjoyed. It starts with an introduction including a quote from Ralf Herbrich at Microsoft Research describing how he converted 1000 lines of C# into 100 lines of F# which performed just as well – this is the kind of real-world touch that makes you want to read on. The second chapter explains how to install F#, including different versions of Visual Studio, the open source SharpDevelop, and Mono on Linux – excellent diversity. Chapter 3 introduces functional programming, in effect a brisk overview of the core of F#. Read it slowly!

The author goes on to look at imperative programming and mutability in F#, and then object orientation, just as Smith did in his book. Chapter 6 is useful overview of how code is organised into modules and namespaces, and also covers comment annotations. Next, Pickering looks at F# libraries, including a brief look at math programming. Chapter 8 covers user interface coding – completely lacking in Smith’s book – complete with a quick look at GTK#, which works on Linux. There’s also a quick look at ASP.NET, Microsoft’s web server platform. Although this little introductions are too brief to be really useful, they do spark ideas about how you might use F#.

Data Access is next, another important real-world topic, covering XML, LINQ (Language Integrated Query) and ADO.NET.

Chapter 10 is when we get to parallel programming and reactive programming – code that waits for an external event before running. Pickering introduces F# agents and the MailboxProcessor class. Next comes a look at distributed applications using sockets, HTTP requests, web services, and Windows Communication Foundation.

Chapter 12 has the intriguing title Language-Oriented Programming, and should be taken together with the next chapter on parsing text. This is where we look at using data structures as little languages, parsing and interpreting text, and extending F# syntax. Finally, chapter 14 is the interop chapter, covering interop with C# as well as platform invocation for COM and native code.

Of the two books, this is the more lively and wide-ranging read, and more likely to enthuse you about the possibilities F# offers, though it skims the surface in places; many topics receive only shallow coverage.

View on Amazon.com

 

View on Amazon.co.uk

 

Anders Hejlsberg on functional programming, programming futures

At TechDays in Belgium Micrososft’s C# designer and Technical Fellow Anders Hejlsberg spoke on trends in programming languages; you can watch the video here.

I recommend it highly, not so much because of any new or surprising content, but because in his low-key way Hejlsberg is a great communicator. The talk is mostly not about the far future, and much of what he covers relates directly to C# 4.0 and F# as found in Visual Studio 2010. Despite his personal investment in C#, Hejlsberg talks cheerfully about the benefits of F# and gives perhaps the best overview of functional programming I have heard, explaining what it is and why it is well suited to concurrency.

image

I will not try and summarise the whole talk here; but will bring out its unifying thought, which is that programming is moving towards a style that emphasises the “what” rather than the “how” of the tasks it encodes. This fits with a number of other ideas: greater abstraction, more declarative, more use of DSLs (domain-specific languages).

The example he gives early on describes how to get a count of groups in a set of data. You can do this using a somewhat manual approach, iterating through the data, identifying the groups, storing them somewhere, and incrementing the count as items belonging to each group are discovered.

Alternatively you can code it in one shot using the count keyword in LINQ or SQL (though Hejlsberg talked about LINQ). This is an example of using a DSL (Domain Specific Language), and also demonstrates a “what” rather than “how” approach to code. It is easier for another programmer to see your intention, as there is no need to analyse a set of loops and variables to discover what they do.

There is another reason to prefer this approach. Since the implementation is not specified, the compiler can more easily optimise your code; you do not care provided the result is correct. This becomes hugely important when it comes to concurrency, where we want the compiler or runtime to utilise many CPU cores if they are available. He has a screenshot of Task Manager running on a 128-core machine which apparently exists in Redmond (I can’t quite read the figure for total RAM but think it may be 128GB):

image

Hejlsberg says there was a language doldrums between 1995 and 2005, when many assumed that Java was the be-all and end-all. I wonder if this is a tacit admission that C#, which he was working on during that period, is not that different in philosophy from Java? The doldrums are over and we now have an explosion of new and revived languages: Ruby, Groovy, Python, Clojure, Boo, Erlang, F#, PowerShell and more. However, Hejlsberg says it makes sense for these to run on an existing framework – in practice either the Java or .NET runtime – since the benefits are so great.

Hejsberg also predicts that distinctions such as dynamic versus static languages will disappear as each language absorbs the best features from other languages. “Traditional taxonomies of languages are breaking down as languages pick paradigms from each other,” he says. The new language paradigm is multi-paradigm.

Just as C# has now acquired dynamic features, we can expect it to get better support for immutability in future (borrowed from functional languages).

Visual Studio software factories to emerge from Microsoft deep freeze

Last night at the Microsoft Mix party in Las Vegas I happened across Michael Lehman, a senior architect, who told me he had been working for the last six years on a Visual Studio add-on called Feature Builder. This turns out to be the evolution of the very same project which Microsoft’s Jack Greenfield told me about back in March 2007, at an architecture conference in the UK, though back then it had a more exalted status (in Greenfield’s eyes at least) – he described it as a platform rather than merely an add-on. Now Feature Builder is to appear as an extension in the Visual Studio 2010 Gallery, only discoverable by those who seek it out. If enough developers find it and like it, it may end up as part of a future Visual Studio release.

It’s all part of Microsoft’s desperately confused architecture and modelling story. Note that Greenfield in 2007 denigrated the UML:

The UML is a collection of useful abstractions. Unfortunately it’s been peddled as a universal modelling language, but the U never stood for Universal. We subscribe to Michael Jackson, author of Problem Frames, who says that there is no such thing as a universal solution. It’s a childish approach. This is where the Universal Modelling Language marketing pitch fails. UML was never properly extensible. It also has the problem that it was designed by a committee.

So what do we have actually shipping with Visual Studio 2010? Standard UML modelling, the best Microsoft has yet come up with.

Reading between the lines, this likely means that the UML faction within Microsoft outvoted the non-UML faction. However, each release of Visual Studio seems to have its own unique approach to modelling and architecture tools, so it would be no great surprise if Visual Studio 2012, say, replaced them with something different.

As for Feature Builder, it does sound interesting – read the Greenfield interview referenced above for why it has potential. Lehman says it is a simpler approach than previous software factory tools from Microsoft, and named Feature Builder to avoid association with past efforts.

Update: Lehman has blogged about the project here, and you can download the preview here.

Microsoft .NET gotchas revealed by Visual Studio team

The Visual Studio Blog makes great reading for .NET developers, and not only because of the product it describes. Visual Studio 2010 is one of the few Microsoft products that has made a transition from native C++ code to .NET managed code – the transition is partial, in that parts of Visual Studio remain in native code, but this is true of the shell and the editor, two of the core components. Visual Studio is also a complex application, and one that is extensible by third parties. Overall the development team stressed the .NET platform, which is good for the rest of us because the developers are in a strong position both to understand problems, and to get them fixed even if it means changes to the .NET Framework.

Two recent posts interested me. One is Marshal.ReleaseComObject Considered Dangerous. I have some familiarity with this obscure-sounding topic, thanks to work on embedding Internet Explorer components. It relates to a fundamental feature of .NET: the ability to interact with the older COM component model, which is still widely used. In fact, Microsoft still uses COM for new Windows 7 APIs; but I digress. A strong feature of .NET from its first release is that it can easily consume COM objects, and also expose .NET objects to COM.

The .NET platform manages memory using garbage collection, where the runtime detects objects that are no longer referenced by active code and deletes them. COM on the other hand uses reference counting, maintaining a count of the number of references to an object and deleting the object when it reaches zero.

Visual Studio 2008 and earlier has lots of COM APIs. Some of these were called from .NET code, and for the same of efficiency called the method mentioned above, Marshal.ReleaseComObject, to reduce the reference count immediately so that the COM object would be deleted.

Now here comes Visual Studio 2010, and some of those COM APIs are re-implemented as .NET code. For compatibility with existing code, the new .NET code is also exposed as a COM API. Some of that existing code is actually .NET code which wraps the COM API as .NET code. Yes, we have .NET to COM to .NET, a double wrapper. Everything still works though, until you call Marshal.ReleaseComObject on the doubly-wrapped object. At this point the .NET runtime throws up its hands and says it cannot decrement the reference count, because it isn’t really a COM object. Oops.

The post goes on to observe that Marshal.ReleaseComObject is dangerous in any cause, because it leaves you with an invalid .NET wrapper. This means you should only call it when the .NET instance is definitely not going to be used again. Obvious, really.

Once you’ve digested that, try this illuminating post on WPF in Visual Studio 2010 – Part 2 : Performance tuning. WPF, or Windows Presentation Foundation, is the .NET API for rich graphical user interfaces on desktop Windows applications. Here is an example of why you should read the post, if you work with WPF. Many of us frequently use Remote Desktop to run applications on remote PCs or PCs that do not have a screen and keyboard attached. This is really a bad scenario for WPF, which is designed to take advantage of local accelerated graphics. Here’s the key statement:

Over a remote desktop connection, all WPF content is rendered as a bitmap. This is in contrast to GDI rendering, where primitives such as rectangles and text are sent over the wire for reconstruction on the client.

It’s a bad scenario, but mitigated if you use graphics that are amenable to compression, like solid colours. There are also some tweaks introduced in WPF 4.0, like the ability to scroll an area on the remote client, which saves having to re-send the entire bitmap if it has moved.

Visual Studio 2010 testers unhappy with help

Visual Studio 2010 comes with a brand new help system, based on a local help server rather than a database plus viewer as in the past. There is also an option to use Internet-based help for the most up to date content.

Sounds good, but developers are not happy. The problem: the new help appears to have no index of contents. You are meant to navigate by search, then perhaps navigate forward and back using the table of contents tree that appears on the left.

image

In the old one, you could use the index to find keywords quickly:

image

It turns out that many users prefer the old approach:

This is terrible. Productivity will go to zero without an index. Online help is junk, even on a fast connection — it can never be as fast as my local PC and when I am programming, I need instant answers.

says one commenter.

Microsoft says:

We realize the importance of delivering a keyword index, but we were unable to deliver it in our first release. In this V1.0 release of help system, we first implemented an improved search capability in order to deliver a more familiar, consistent online and offline experience. We then implemented a keyword index feature based on our search catalog. Unfortunately, the results did not meet our quality bar and we determined that this feature would require more work than the Beta 2 timeline allowed. We are looking at implementing it for at future release.

The odd thing is, there is a third-party viewer called H3Viewer which was apparently put together in a short time using Delphi and the new APIs. It turns out that Visual Studio’s Help is actually an early example of a new Windows Help System called Help 3, and is designed with a comprehensive API for developers. If you set the default help viewer in Visual Studio 2010 to H3Viewer, it works more like the old one, complete with index:

image

I can’t actually recommend H3Viewer in the current  beta. It takes ages to read 440,000 index entries every time you start it up and view the index pane – a message notes that “a late fix in the RC release has slowed down the reading of index items dramatically”. In addition, it does not cope well if you set your help preference to online. Still, H3Viewer will likely improve.

Speaking personally, I don’t mind the idea of search-based help, provided that the search works really well. In practice, it is often easier to Google for what you want to know, bypassing the official help completely, though that may mean getting to the same place by another route. Nevertheless, a reliable online reference is important and it seems that a lot of developers do in fact use the local index.

Visual Studio 2010 RC arrives with go-live license

Microsoft has made the Release Candidate of Visual Studio 2010 available for download to MSDN subscribers. From tomorrow (10th February) the same release will be available to everyone. There is a go-live license so you can use this in production if you wish, though if the full release comes in April as planned, it hardly seems worth it in most scenarios.

What’s new since the beta? Jason Zander says mainly performance. Note that the Chief Architect of Visual Studio is Rico Mariani, formerly Microsoft’s .NET performance guru, which is encouraging in this respect.

The blow-by-blow account of issues with the RC is here.

Whatever your views on the direction and future of Microsoft’s platform, there’s no doubting the huge scope of this release, though in my view the company has not communicated this particularly well, saying too much about things like SharePoint development, top of its list of walkthroughs but still an ugly business, and not enough about features such as IntelliTrace debugging, or the new ability to float windows out of the IDE and onto a second display, which will have a more immediate impact on developers. Note that the Visual Studio IDE has been re-built using WPF (Windows Presentation Foundation), and that it comes with a the first completely new version of the .NET Framework since 2005.

Silverlight 4.0 is another area of interest, though I understand that it will not be complete in time for this release. Visual Studio 2010 will have Silverlight 3.0 out of the box, with the ability to install the 4.0 preview release and eventually the final release as an add-on. I’ve also heard that Silverlight 4.0 is not yet supported at all in the RC, so be cautious if this is your area of work – you may need to stick with the last beta for the moment.

New is not always better, of course. I’m interested in hearing from developers working with Visual Studio 2010 – whether performance and stability issues have been overcome, and what you think of it overall.