Professional Visual Studio
Tips, Tricks, and Best Practices for professional .net developers

A few minutes ago Visual Studio Ecosystem team introduced a new blog named VSX FAQ Blog.

This blog, which is hosted on MSDN blogs, acts as the FAQ of the Visual Studio Extensibility for developers.

As Ken has written in the announcement, this blog (or FAQ) is very useful for scenario-based references where people are looking for answers to common scenarios.

This is another good step forward to the Microsoft’s big plans for VSX in 2008. Such a rich FAQ can help developers a lot.

Brad Abrams has the Silverlight v2 Poster that was so popular at Mix08 available for download.

Silverlight MIX08 (Controls 5_1)

If you are following Silverlight or other technologies that were hot topics at Mix08 then make sure you checkout the recorded sessions.

Wrox Professional Visual Studio Extensibility

As I wrote on my main blog, my book, Professional Visual Studio Extensibility, officially released today and you can order it on Wiley or Wrox sites. There are already sample PDF files and code downloads for the book available on these sites.

It should be also available on Amazon and Barnes and Novel shortly and those who have pre-ordered it should receive it in next couple of weeks.

I’ve written more details about the book on my blog that you can read there. It’s a pleasure to finally see the book getting out to markets and finding its way to bookshelves. Readers of this blog who had left comments to receive free copies of my book and got my confirmation should receive their copies in a few days because they will be sent today or tomorrow.

I’m looking forward for feedbacks from readers. Some reviews will be published on .NET communities and blogs in next couple of months that can help others to decide whether they want to order my book.

I have to thank Nick and Dave for helping me on book promotion on this blog. We will be able to get our hands on Professional Visual Studio 2008 in a few months which is a great complementary for my book.

Last week the beginning of the official Visual Studio 2008 launch wave began.  Combined with the launch of Windows Server 2008 (and Vista SP1) and SQL Server 2008 (although not due for release until late this year), this series of events should really encourage developers to take a look at the new product.

Across in New Zealand Microsoft has partnered with local website Geekzone for a limited time Visual Studio 2008 blog.  For the month of March there will be a number of permanent posts that will discuss various aspects of Visual Studio 2008.  Whilst we will attempt to keep an index of these topics, I suggest that you head over to the Visual Studio 2008 Geekzone blog and add it to your favorite RSS reader.

Today Visual Studio Ecosystem team announced the availability of PowerCommands for Visual Studio 2008 as a free set of extensions that brings lots of helpful features to Visual Studio IDE. These commands are available with source code to let you learn how to develop new commands or modify them. Some of these features are a part of some editions of Visual Studio 2008 and you can bring them to other editions via these commands.

You need to have Visual Studio 2008 SDK 1.0 installed to be able to open the source code for these commands.

A short list of features that are provided by this project are:

  • Collapse Projects
  • Copy Class
  • Paste Class
  • Copy References
  • Paste References
  • Copy As Project Reference
  • Edit Project File
  • Open Containing Folder
  • Open Command Prompt
  • Unload Projects
  • Reload Projects
  • Remove and Sort Usings
  • Extract Constant
  • Clear Recent File List
  • Clear Recent Project List
  • Transform Templates
  • Close All

You can download the package that contains the source code of PowerCommands from the announcement post.

Have you ever wondered exactly what the C# or VB.NET specifications say?  Well here are a couple of links where you can get hold of them and take a look for yourself:

C# 3.0

VB.NET

(What’s interesting is that only the C# specification ships with Visual Studio 2008 – check out C:\Program Files\Microsoft Visual Studio 9.0\VC#\Specifications\1033)

Protect your Assets

I’m not talking about insurance, although I guess in a way it’s a kinda of insurance.  I’m referring to protecting your organisations IP that so often gets buried in the code we write.  One of the dilemmas often faced by .NET developers is how to protect their IP, how to manage licenses and activation, and how to track product usage.  Introducing the Microsoft Software Licensing and Protecting Service

image

This was announced last year and there really hasn’t been much fanfare around the extent of the functionality around this service.  If you are still trying to work out how best to security your product I would recommend watching the introductory video that walks you through the core functionality of both the online portal (also available as the SLPS Server 2008) and the Code Protector application.

If you are a web developer using Visual Studio 2008 and have hit performance issues with the HTML source view, design view, or web site project builds, you might want to consider installing this hot-fix rollup (you will need to sign in with your Live Id and register for Microsoft Connect if you have not done so previously).

Scott Guthrie has posted a list of the problems these hot-fixes solve, and the instructions of how it install.

Visual Studio Gallery

Visual Studio Gallery A few days ago Microsoft launched a new site around Visual Studio Extensibility and that is Visual Studio Gallery.

Visual Studio Gallery is a site which lists add-ins and extensions for Visual Studio whether they’re created by Microsoft or by third party vendors. There are also both free and commercial extensions listed.

On the site, you can find these add-ins and extensions by category. Each extension has its own description and a link to get access to more information and/or download it.

As the saying goes, a picture is worth a thousand words. Does that mean a class diagram is worth a thousand lines of code?

Don’t answer that just yet…I bet you’ve had a bad experience with modeling tools in the past.

Confessions of an ivory tower architect

Now you may have used a modeling tool in the past, or been involved in a project where some SOA-preaching, RUP-spouting, ivory-tower architect tried to drown you in UML diagrams. In years gone by, we (being the SOA-preaching, RUP-spouting, ivory-tower architects) would plead with the Project Manager to buy us a real modeling tool such as Enterprise Architect. “Please sir, it’s only $199, and I have this 10% discount code that a friend of my friend got from TechEd.”

Invariably the Project Manager would say “I’m sorry, I spent the tools budget on buying this second-hand PC from eBay so that you could have one of those continuous integration servers you’ve been harping on about.” He points to a dusty P-II sitting on the floor. “Anyway,” he says, “My Project Manager buddy says that we’ve got a perfectly good modeling tool in MSDN called Visio.”

So we sigh and resign ourselves to the fact that we will be producing UML documentation at the start of the project that will quickly become inaccurate, misleading, and even downright dangerous to read as the coding progresses. There’s just no way it can possibly be kept up to date, especially since we’ll be wasting so much of our time trying to keep that damn continuous integration server up and running!

Even if we do get access to Enterprise Architect with its nifty Forward and Reverse Code Engineering feature, us architects will be constantly trying to play catch-up with the developers as the code quickly evolves. In the end we’ll probably decide that it’s too much work and we’ll just come back to it at the end of the project. Of course by the time the project is finished, 7 months late and way over budget, we’ll be so happy to see the end of it that we won’t want to spend another nanosecond of our time trying to get the documentation back up to scratch.

Isn’t that the way it goes down on every development project you’ve been involved in?

The code is the model, and the model is the code

The real problem here of course, is that in most modeling tools, the model and the code are two separate entities. It doesn’t matter how sophisticated a tool is at interpreting and generating code, you will eventually run into problems if the code and model are separate.

Solving this issue has given the Visual Studio Class Designer a trump card. The functions that it provides are somewhat limited when compared to other tools, however that’s not too surprising given it’s free (well not actually free, but included with Visual Studio). However the fact that the model is simply an alternate view of the source code immediately gives the Class Designer an edge over other external modeling tools.

Of the developers, by the developers, for the developers

The other key advantage of the Class Designer is that it’s right there in Visual Studio, even Standard Edition. You don’t need to have forked out the big bucks for Team System. As an unappreciated developer, who had to promise your boss naming rights to your first-born child just so you could get a second monitor, you don’t have to spend time trying to coming up with a plausible business case to purchase a modeling tool.

That’s one of the great things about Visual Studio. With each new edition comes new functionality that we previously had to find some money for, or try to locate a free equivalent, or simply went without. Tools that were previously only within the domain of the architect are now available for all developers.

Now if only Microsoft could move some of the other design tools into the Professional Edition, or drop the price of Team System.

Getting the most out of the class designer

I’m not going to spend much more time on this blog post, describing the features of the class designer. This post is already quite long, and my main aim was to highlight its existence and explain why it is more useful than other modeling tools you may have used in the past, despite its smaller feature set. Also you should buy our upcoming book, which has got a whole chapter devoted to the class designer ;-)

However I am going to finish off with a few tips and recommendations for getting the most out of the class designer.

  • Install the PowerToys for the Class Designer. Actually don’t install it just yet, because there is a new version that supports VS 2008 coming out very soon. The PowerToys is a really useful add-in that provides a whole bunch of useful little extensions to the designer. This is really one of those instances where the sum is greater than the parts. It’s such a useful set of extensions that I’ll be devoting a post to it sometime in the future.
  • Use the class designer to generate a class diagram any time you are given a new project – whether that be for the purposes of bug fixing, enhancement, refactoring, peer code review, or anything else. This is probably the single best use of the class designer that I’ve discovered – using it to bootstrap your understanding of the code’s structure. Even if you just create the class diagram temporarily and thrown it away afterwards. You always can create another diagram later if you want to actually do some refactoring or visual development.
  • If you don’t have any associations shown as lines, then the layout tool won’t do too much. When I create a new diagram I do the following to quickly lay it out (Note this requires the PowerToys for the Class Designer):
    1. Ctrl-A to select all types on the diagram
    2. + on the number keypad to expand and show all members
    3. Select “Class Diagram-Filter Lines->Show All Associations” from the menu
    4. Select “Class Diagram->Layout Diagram”
    5. Select “Class Diagram->Zoom->Fit”
    6. For the bigger classes I typically collapse the Fields (the term used for private properties)
  • Don’t forget that if you show associations as lines they will not be listed as members anymore on the class. This also applies to collection associations. This is quite different to the way many other modeling tools work and can be a rather annoying if you’re not used to it.
  • The refactoring support in the class designer is pretty good, but for the most part you can do this in the code editor just as easily. However the cut, copy, and paste refactoring is great. This lets you move or copy methods or properties from one class to another. Very useful if you are modeling the public interfaces of a set of classes early on in a project and you want to get a feel for an alternative class design.
« Previous PageNext Page »


About this site

Professional Visual Studio aims to provide tips and tricks, traps to avoid, and industry best practices from experienced .NET developers on using Visual Studio in the most effective way possible.

Copyright © 2007-2012 David Gardner, Keyvan Nayyeri, and Nick Randolph. All rights reserved.
Blog | Archives | Books | About | Contact