Slashdot Mirror


Visual Studio Hacks

Jim Holmes writes "Microsoft's Visual Studio is an elephant of an IDE. It's got tremendous power and adaptability, but it's difficult to dig through all the less-than-helpful documentation. It's also very tough to figure out which of the many available add-on tools are worthwhile to add. Visual Studio Hacks by James Avery is a terrific reference for helping get the most out of Visual Studio." Read on for the rest of Holmes' review. Visual Studio Hacks author James Avery pages 512 publisher O'Reilly rating Outstanding reviewer Jim Holmes ISBN 0596008473 summary Get the most out of Microsoft's Visual Studio

Disclaimer: James is a friend who's helped me with starting a developers group, and I'm also working on an open source project with him. The possibility exists that I may work on a paying project with him at some time in the future; however, I haven't had any financial dealings with him so far. (Other than I still owe him a beer for coming to speak at one of our group's meetings.) For what it's worth, I spent my own money to buy this book from Amazon. End Disclaimer.

Avery's book is great both for new users of Visual Studio as well as the more experienced developer. Also, readers won't have to worry about buying a book which will be outdated when Microsoft releases its next version of Visual Studio in November. Tips and tricks are included for Visual Studio versions 2002, 2003, and 2005.

VS Hacks spreads 100 "hacks" across 13 sensibly delineated chapters. Each hack is clearly marked with its number in a blue box at the upper, outer corner of each page. Hacks are also marked with a thermometer icon representing the hack's relative complexity. One of my few complaints about the book is that the moderate and expert icons look too similar - but frankly I ignore these icons anyway, so the criticism's most likely wasted.

The introductory chapters on projects and solutions, navigation, and editor usage aren't introductory in skill level. Avery covers these topics in great depth, diving down to some useful, but less-than-obvious settings in VS's environment. Examples of this would include Hack #2: Master Assembly and Project References, where Avery shows how to add additional assemblies to the Add Reference dialog's list of .NET assemblies. This is a timesaver if you've got custom libraries you make frequent use of; adding the assemblies to the default list saves having to use the Browse button to search for the files every time you need to add them.

Some of the most uninteresting drudgework in development involves writing code for basic software elements such as business entities or data access layers. It's repetitive, it's template-like material, and it's boring. Documenting such work is every bit as tedious.

Hack #50 covers using CodeSmith to generate code via templates. Other hacks detail tying UML into the development process. Hack #81 covers using Visio for Enterprise Architects to generate code from UML diagrams. Hack #82 covers the opposite of that process: generating class diagrams via Visio's reverse engineering support. (UML's capable of much, much more than the simple drudgework of business entities or data access layers, and these hacks shouldn't be confused with anything more than a cursory introduction of how to tie UML via Visio into Visual Studio.)

One of the most useful sections is Chapter 5: "Debugging." This chapter focuses on getting the most out of Visual Studio's debugger capabilities. These hacks are critical helpers to good developers effectively use Visual Studio's debugger.

Avery covers the basics of setting up breakpoints, diving down to various options such as setting how often to break on specific break points, or setting conditional break points. He then moves on to troubleshooting breakpoints in Hack #37, and there's also great coverage on using Visual Studio to debug scripting code inside a browser session, working with SQL server, and attaching to a running process or one that's just about to crash.

I found the best content of this book in hacks focusing on making the most of tools both inside and out of Visual Studio. Hack #79 is a great section detailing how to stress test web applications using Visual Studio Enterprise Architect's Application Center Test. This hack makes it easy for readers to understand how to get detailed stress testing on a web application. Along this same line, Hack #80 shows how to make use of the Dotfuscator tool to obfuscate .NET assemblies to protect them from modest efforts at reverse engineering. (Like Java, .NET assemblies can be disassembled, revealing all your hard work and intellectual property.)

Other gems in this same arena include tools for running and debugging unit tests inside Visual Studio (#93), testing regular expressions (#100), and using tools which automatically generate documentation based on naming conventions in the source code (#69).

The mechanics of this book are great. The Table of Contents breaks down each chapter by its individual hacks, and the index is very detailed and clear. I also like how hacks are listed on the top of each page, making it quick to find something if you know the hack's number or name and don't want to fuss with the table of contents.

My sole complaint about the book (aside from the annoying thermometer icons I've already mentioned) is that it's not always clear which add on tools work with which version of Visual Studio.

The author maintains a website specifically for this book, complete with code and tool downloads. RSS feeds are also available to monitor any updates the author makes.

This book is a critical addition to the bookshelf for any developer who spends any amount of time working in Visual Studio. You'll become much more productive by using tips in the book, and you'll find tips to help you decide which add-on tools you'll want to make use of. More importantly, you'll understand how to get the most out of Visual Studio's capabilities.

You can purchase Visual Studio Hacks from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

21 of 437 comments (clear)

  1. The "Hack" Culture by yellowbkpk · · Score: 3, Interesting

    Is it just me or is a "hacking" culture growing out of the internet? People are getting fed up with the limitations put on them by business' slowness, so they push the limits of current technology to meet their needs.

    Is this because people's needs are growing faster than industry's ability to provide them?

  2. Re:Ultimate Killer App by ciroknight · · Score: 3, Interesting

    Totally Agreed. XCode's just the same way for the Mac.

    I don't think a GUI platform can call itself complete until it's got an IDE that's worthy for programming.

    The only one I've seen so far for Linux that's up to par (and just barely) is KDevelop, which is entirely useless to you if you don't use Qt, like myself.
    And yes, I know about a lot of the alternatives, they just all suck so bad they aren't worthy of mentioning by name. Eclipse is better than most, but is java, and slow....

    --
    "Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
  3. Re:Ultimate Killer App by Tim+C · · Score: 1, Interesting

    It's just the single best tool for software development.

    I have to disagree there. My experience is mainly in Java development, but I have done some VC++ and VC#. In my experience, VS.NET 2003 simply doesn't compare to the likes of JBuilder and Eclipse in terms of features (and neither of them are perfect by any means). I'm not saying that it's a *bad* IDE, but every time I use it the lack of refactoring and code inspection tools drives me batshit insane in pretty short order.

    To be perfectly honest, if you truly consider it to be "the single best tool for software development", then I have to seriously question the quality of the other tools that you've used. (But then, I've done my share of using make and gdb, so I can see where you're coming from if that's your level of comparison)

  4. Re:Your number one IDE by DaHat · · Score: 2, Interesting

    I tend to work on code in Visual Studio 6 at least once a month that still works just fine here, ~10 years after its release.

    But even when it comes to VS2003, last time I checked C# and .NET for example were based on EMCA standards, standards which have been implemented for use under Linux, MacOS and others, all making it possible for you to build an application in VS2003 and have it run on other systems.

  5. Re:Ultimate Killer App by swissmonkey · · Score: 5, Interesting

    One hint :

    Go take a look at what Visual Studio can do, you will see many features(incredibly powerful Intellisense being only one of them) that will save you time and sweat.

    This message provided courtesy of a programmer who used to be big fan of XEmacs et. all until he discovered what Visual Studio(and other good IDEs) can do.

  6. Portability by Anonymous+Brave+Guy · · Score: 4, Interesting
    For making non-standards-compliant, non portable, code that wont work in 4 years.

    Erm... We write highly portable libraries in C and C++ at work. They have to compile on Windows, Linux, Solaris, HP-UX, AIX, MacOS X, and often under several different toolsets on each OS.

    Our whole dev team is free to develop using whatever software we find helpful. We have GUI guys and CLI guys, Windows guys and Linux guys, emacs guys and vi guys, etc.

    The one thing almost everyone has in common is that they use Visual C++ as their primary IDE. That's not because we're ill-informed or haven't tried the alternatives, it's because most of us think it's the best IDE available to help us do our jobs.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  7. Is it all about other tools? by Anonymous+Brave+Guy · · Score: 3, Interesting

    A book on Visual Studio hacks has a lot going for it, but the examples in the review mostly sound like discussion of add-in tools, rather than VS itself.

    Many people don't take advantage of even simple things like customising autoexp.dat for debugging, and don't know about undocumented UI tweaks like displaying a marker line at column N. Many of these little touches are what makes VS better than the alternatives for a lot of jobs, and why Microsoft never makes more of them I don't understand. Are things like the two examples above covered in the book?

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  8. Hacking add-ins in perl by MeerCat · · Score: 2, Interesting

    So I normally prefer to use emacs as my IDE, especially for anything complex, but for those times when I need to use Visual Studio I've been getting a little bored with the standard tools so hacked together an add-in (not just the tools or macros, but the proper add-in mechanism) framework entirely in perl... suddenly I can knock up simple reg-exp based editor tools and I don't need to descend to some crappy VB/C# level coding to do so...

    But has anyone noticed what a complete mess the Visual Studio add-in API is ? A hybrid mixture of DLL export functions and nearly-COM like objects... very 1993... I think it must count as the biggest hack in Visual Studio.

    --
    I spent a lot of money on booze, birds and fast cars. The rest I just squandered. - George Best
  9. Related book. by MythMoth · · Score: 2, Interesting

    This is more in-depth than you might expect:
    http://www.amazon.com/exec/obidos/tg/detail/-/0596 003609/

    --
    --- These are not words: wierd, genious, rediculous
  10. Re:Ultimate Killer App by EvanED · · Score: 2, Interesting

    It's not so much that I like VS's implementation of Intellisense. (It was reasonably poor in VS6, often not showing up. I've had little problem with VS.NET though.) I just used that term because it exactly describes what I'm talking about. (Something like 'code completion' doesn't, because I've seen other things that could be called that.)

    I've done a lot of Java work recently in Eclipse for instance, and think that the Intellisense in Eclipse is fantastic.

  11. Re:The biggest annoyance with DevStudio by Tim+Browse · · Score: 2, Interesting
    Thank Bjarne Stroustroup for the fact that there's no refactoring support for C++.

    While we're there, we should probably thank him for designing and creating one of the most popular and successful programming languages on the planet.

    If we're being fair ;-)

  12. Re:Ultimate Killer App by hikerhat · · Score: 4, Interesting

    If you ever work on a big application where you can't memorize the thousands of function and method signatures, or you have to quickly use code you've never seen before, intellisense will become more valuable to you.

  13. Re:What does Microsoft use? by ninja_assault_kitten · · Score: 2, Interesting

    Who the hell told you that?

    I've done my time at MS and that statement is completely false. While different people have different preferences (even at MS), VS is still the IDE of choice for most of us. At least when we're writing code for MS-based operating environments.

  14. Re:The biggest annoyance with DevStudio by cpu_fusion · · Score: 3, Interesting
    >"Eclipse is hopeless for visual design"

    Ever try the Visual Editor for Eclipse?
    http://www.eclipse.org/ve/

    It's quite nice.
  15. Re:The biggest annoyance with DevStudio by AaronBrethorst · · Score: 5, Interesting
    I just talked with the program manager who owns our help system and he promised me that we've fixed the first issue you describe in VS 2005. You can filter out specific blocks of content now, which will enable you to get rid of the WinCE-specific help.

    Also, you can now get content via the Internet or through the Local Help system, which means that you shouldn't ever run into "please insert a cd" messages again.

    As far as our Tool Window situation goes, we have a way to go on improving this. I think we're doing better in terms of window management in Whidbey (VS 2005) than we did in previous releases. One cool new feature, the IDE Navigator (Ctrl+Tab) lets you navigate between every open document and tool window in the IDE in a fairly reasonable manner.

    Also, we've added in either 5 or 6 refactorings to VS: you can perform operations like Extract Method or Rename Symbol now through that interface.

    Finally, if you have feature requests or bug reports please post them on our Product Feedback Center. I happened to run across this post, but there's no guarantee that a Slashdot post will ever be seen by the team that owns a specific part of VS. The MSDN Product Feedback Center will let you submit issues or suggestions to us directly and will guarantee they're routed to the right people.

    Cheers -- Aaron

    Oh yeah, and I feel like I owe a VS "hack" now. When you're in the editor you can enable incremental search by pressing Ctrl+i and then typing a string to search for. The next instance can be jumped to by pressing Ctrl+i again.

    --
    No, but I used to work for Microsoft.
  16. The one VS.Net 2003 plug-in I cannot live without by SpryGuy · · Score: 2, Interesting

    Resharper.

    It adds real-time syntax highlighting, additional keyword coloring, superb code navigation features, and code refactoring features, among many other very useful items.

    If you are using Visual Studio and doing any C# coding at all, you need to check out Resharper, from JetBrains... http://www.jetbrains.com/resharper/. I frankly don't know how anyone lives without it (or at least something similar).

    Version 2.0 (due out late this year) will also support 2005, Visual Basic, and ASP.Net coding

    --

    - Spryguy
    There are three kinds of people in this world: those that can count and those that can't
  17. Re:The Delphi parser by Mornelithe · · Score: 2, Interesting

    Javac is written in java, so compiling anything requires firing up a jvm first, which can take a while.

    However, since Eclipse is written in java, the jvm is already running, so it can just call up the appropriate javac classes and run the compiler in-process, removing the latency of starting up a new jvm. That's most likely why Eclipse is much more snappy at compiles (off the top of my head; I haven't written any Java in a while).

    Alternatively they could be using IBM's jikes compiler, which is written in C or C++, so it also doesn't have the startup requirement of loading a jvm.

    --

    I've come for the woman, and your head.

  18. Re:Browse info for g++? by Catamaran · · Score: 3, Interesting

    Eclipse is very nice. It looks like the C++ plug-in (CDT) uses a C/C++ parser written in Java. The parser is mostly, but not completely, compatible with gcc. See http://download.eclipse.org/tools/cdt/docs/specs/D esign_Specs/Parser/Parser-2.0-Design.pdf.

    --
    Test 1 2 3 4
  19. Re:The biggest annoyance with DevStudio by Malc · · Score: 2, Interesting

    Ever tried using TweakUI with its X-Mouse enabled? VID was the first app that misbehaved with it. That's okay, I didn't have to use it. VS.Net picked up the bad habits and forced me to go back to Windows' normal mouse behaviour. Why? Everytime the mouse goes over the app window it pops to the front, making things extremely frustrating.

  20. Re:The Delphi parser by Anonymous Coward · · Score: 1, Interesting

    From what I can tell, Eclipse uses its own compiler written in Java (and running within the existing JVM). It seems to be contained in org.eclipse.jdt.core_[version].jar

  21. Re:The one VS.Net 2003 plug-in I cannot live witho by The+Grassy+Knoll · · Score: 2, Interesting

    Agreed, it's great.

    But if you're working on more than one project at a time, the "load time" is very annoying. (It seems to build a big cache of methods, etc., when it loads)

    > Version 2.0 (due out late this year) will also support 2005, Visual Basic, and ASP.Net coding

    What do you mean by "will support ASP.NET"? That's what I use it for already.

    .

    --
    They will never know the simple pleasure of a monkey knife fight