Juval Lowy – some session!
We kicked off with a look at the under-used WinCV.exe class viewer (something that Delphi has enjoyed for some time now…). Juval compared a search for ‘object’ using the WinCV class viewer and a search on the MSDN. He referred to the class viewer as “intellisense on steroids”.
WinCV at work – it has incremental search too
WinCV is available today, you can find it here:
C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin
However, if you are looking at Visual Studio 2005 betas, you’ll find it’s built in to the product. Take a look at the View –> Code Definition Window menu option:
Tied in with this, Visual Studio 2005 has a right-click menu option “Go To Definition”. This works very much like Delphi’s ability to turn methods and properties into URLs when the control key is pressed…in which case it has been a Delphi feature for a long time now!
Conditionals via the System.Diagnostics namespace
// I must change my WordPress theme such that it respects code a little better :-(
#define MySpecialCondition //usually DEBUG
public class MyClass
{
public MyClass()
{}
[Conditional("MySpecialCondition")]
public void MyMethod()
{}
}
//Client side code
MyClass obj = new MyClass();
//This line is conditional
obj.MyMethod();
Link File
Interestingly, and this is something that I’ve preached about during my TDD presentations, Juval went on to remind us about the little drop-down menu that is attached to the Open menu:
Open –> Link File is useful
If you’re anything like me, you’ll hate having to copy classes/files between projects. Indeed if you download any of the TDD examples, you’ll see I make copious use of the Link File option to share a class between more than one project. In Juval’s words: [Link File] “References the file for compilation purpose, but does not copy it”.
Starting more than one project
One thing that did catch my eye was Juval demonstrating “multiple start up projects”. It’s tiresome when building client/server applications that we find ourselves starting the server, then running the client. The screenshot below can be reached via right-clicking on the Solution item inside the Solution Explorer, then choose Properties (Visual Studio 2003/2005):
Multiple startup projects…very handy
Beware of the false Finds!
Personally, I love Visual Studio’s folding editor: the ability to mark sections or regions of code and hide them away is long overdue! However, when a piece of code is folded away, pressing Control-F to perform a Find operation can lead to surprising results. Code that is folded can be included or excluded from the Find dialog’s operation, i.e. Find operations that you expect to be successful, aren’t. By default in Visual Studio 2003, the Find dialog ‘Search hidden text’ check box is unchecked…therefore you may not find what you are looking for, even though you know it’s there! In Visual Studio 2005, the checkbox is checked.
Name those threads!
Presented as being useful during debugging, naming threads is remarkably simple (apologies for the VB code):
Imports System.Threading
Dim currentThread As Thread = Thread.CurrentThread
Dim threadName As String = "Main UI Thread"
currentThread.Name = threadName
Peculiar Selections
Oh, and rectangular text/code selections? You need to hold the ALT key down whilst dragging (works in both Visual Studio 2003 and 2005). This is a feature you either love or hate, but as Juval says: “Very useful in removing namespaces and repeated definitions “.
This and That
Visual Basic has been blessed with the My class that provides access to a multitude of things, such as Audio, Keyboard, Mouse, Network, etc. Perhaps because C# developers are deemed smarter than Visual Basic programmers (I’m already ducking!), C# doesn’t have the My class. Until now at least. Juval has spent some time working on an implementation and he was keen to demonstrate it to us. So, given that Visual Basic has “Me” and “My”, C# now has “This and That“, I jest you not:
Download this and that.
And finally…
This was a really good session that presented a lot of the differences between Visual Studio 2003 and 2005 and did so by means of lots of demonstrations. Juval was a little quick at flicking between the PowerPoint slides and the Visual Studio IDEs for my liking, something I found he did in another session too – don’t let that put you off, he’s a good speaker and won’t let you down technically. You’ll find Juval blogging about Lornhorn.
Juval left us with a pointer to his coding standard, available via www.idesign.net.
He also mentioned that his book is undergoing a revision and should be with us this month, Programming .NET components, 2nd Edition, Juval Lowy, O’Reilly 2005: