Thursday, August 7, 2008

Visual Studio 2005 Class Designer

Now that Visual Studio 2008 has been around for a few months I figured it was time to post an update about Visual Studio 2005.  That's right, I've finally gotten around to doing most development in the Last Version of Visual Studio.  Be that as it may...

 

Things that I truly love about Visual Studio 2005:


  • Refactoring - Rename alone would have been plenty but Extract Method, Encapsulate Field and Extract Interface have proven to be enormously useful.  I especially like the Alt-Shift-F10 keyboard shortcut for automatically generating a method based on a name and parameters typed in source.  So if I'm at a point where I know I'll need a method that does something then I'll just type DoSomething(formalParam1, formalParam2); then hit Alt-Shift-F10 and the method is automatically generated!!!!

    • Refactoring + Keyboard Shortcuts has made it so that I can almost design methods entirely within visual studio.  During the early part of a project I still prefer to write psuedocode/PDL describing the steps but I've noticed that I do this less and less frequently now that visual studio supports auto-generating methods.

  • Class Designer.  I've only recently gotten acquainted with the class designer but I totally love it.  It's the OO analog of the Table Designer for databases.  It not only makes creating the in-memory data model a lot easier it also makes it easy to figure out where data *should* live based on the existing data.  I find that the representing certain properties as association and collection association links helps a LOT with figuring out where to put information.

    • I've taken to creating a class, adding the fields that I think I'll need then using refactor to encapsulate all those fields.  I then change the display for key properties to association links.  After a few classes have been created the central/key classes tend to emerge because they're connected to many other classes by association links.
    • Since refactoring works from the designer I tend to use both when laying out the initial data model AND when changing it.
    • The details window is where I spend most of my time; adding fields, methods and the like.  The keyboard shortcuts again come in handy here - using them I can create 5 - 10 fields without my fingers ever leaving the keyboard.  The details window evidences very good design.

  • Debugging.  The managed debugging assistants are nice but I especially like the improved display of non-scalar data types.  Hovering over a class brings up a context menu that allows browsing its properties and values!!!

    • The debugger also seems to be more stable.  Perhaps its the use of the hosting process but the debugger crashes noticeably less often in VS2005 versus previous versions.

  • Anonymous methods.  OK this is more a 2.0 framework thing than a visual studio thing but I am TRULY loving anonymous methods.  Updating the UI from a background thread (I know, I know, I should be using background worker for this but I haven't gotten around to it yet) is so much easier when you don't have to create a new method at every point where you want to update the UI.  Just Form.Invoke(new MethodInvoker(delegate(){ Form.UpdateTheUI(); })) and the call is marshalled onto the UI creator thread.  The syntax took a little getting used to but once I realized that these were anonymous METHODs (not anonymous delegates) then it made a lot more sense.
  • The new user settings/application settings model.  Again, more a 2.0 framework thing but the Visual Studio settings editor makes using this so simple that I can't believe I didn't start using it sooner.  All the little settings that were kind of a pain to deal before VS2005 are much more manageable under 2005.  For starters, the automatically generated Settings classes makes it easy to intercept/change defaults to reasonable values BEFORE they're used.  For another, you can define a new setting to back a property on the fly!

No comments :

Post a Comment