Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Microsoft Programming Books Media Book Reviews IT Technology

Visual Studio Hacks 437

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.
This discussion has been archived. No new comments can be posted.

Visual Studio Hacks

Comments Filter:
  • by brxndxn ( 461473 ) on Thursday August 04, 2005 @05:22PM (#13244700)
    After my brief dabble in programming for Windows, it seemed to me that any functions worthwhile were only 'figured-out' and nondocumented by Microsoft. Maybe I'm biased, actually.. of course I am, but it seems pretty blatant that Microsoft doesn't adequately document the functions so that their crappy Windows software looks advantagious in comparison.

    I'll check out the book. :P

  • by Catamaran ( 106796 ) on Thursday August 04, 2005 @05:23PM (#13244716)
    VS has some very esoteric features, but I love the integrated browse info. It's better than ctags/etags because it uses the compiler to generate the info. Has anyone here thought about doing something similar with g++/gdb? There are a couple of ways it could be done.
    • have g++ generate tags
    • have an application to build tags from gdb-enabled binaries.
  • by oniony ( 228405 ) on Thursday August 04, 2005 @05:32PM (#13244793) Homepage
    Yup, let's just pretend Eclipse doesn't exist.
  • by oGMo ( 379 ) on Thursday August 04, 2005 @05:34PM (#13244818)
    I don't think a GUI platform can call itself complete until it's got an IDE that's worthy for programming.

    I disagree... I'm not a fan of your monolithic IDEs at all. My GUI is an IDE:

    • ROX-Filer [sf.net], which is highly customizable and integrated with the shell
    • XEmacs [xemacs.org] or vim [vim.org] as your preference goes, which are two highly advanced programmable editors
    • bash, zsh, csh, or your other favorite shell
    • autotools for building

    These tools combine into an "IDE" that is my desktop. I have the best-in-class for every component. Beats a jack-of-all-trades IDE that lacks in any number of regards and takes huge resources.

  • by AxemRed ( 755470 ) on Thursday August 04, 2005 @05:38PM (#13244855)
    World of Warcraft is my killer app. //Read into that whatever you want.
  • by DrXym ( 126579 ) on Thursday August 04, 2005 @05:40PM (#13244875)
    Is the the help system. I don't program Windows CE, but it's infested with stupid bloody WinCE specific help. Search for a Win32 function such as CreateWindow and often you're lead to the WinCE implementation. And the same for ATL & MFC classes. Worse is if you chose not to install the WinCE help at all since it still includes the index to the WinCE help. So double clicking on a help item prompts you to insert a CD. Filtering helps a bit but not a great deal since often you want to search anywhere, especially if your app spans Win32 and .NET for instance.

    Even with this annoyance it's still better than help in XCode on the Mac. XCode 2.x is a big improvement but it's still hopeless compared to MSDE.

    A second annoyance to DevStudio is the sheer mess of dockable windows. VC98 had it just about under control but since DevStudio 2002 it has become a disaster zone of tabs, splitters, pushpins, floaters and toolbars. Just trying to get all the relevant information onto the screen is hard enough. The pushpin model just works badly - either you pin a window to a frame or it annoys you by floating in and out at just the wrong point in time such as when you're mousing around.

    A final irritation is that DevStudio is extremely primitive compared to a lot of Java suites. Eclipse is hopeless for visual design but it kicks DevStudio around the shop for sheer coding. Being able to hit Shift+Ctrl+R and rename all references to a class or variable everywhere in Eclipse is mindbogglingly useful. While I expect the next incarnation of DevStudio will allow you to rename a class, it's notable by its absence in the current releases. It's not like Eclipse just introduced this feature since JBuilder has had it for years.

  • by RLiegh ( 247921 ) * on Thursday August 04, 2005 @05:46PM (#13244940) Homepage Journal
    Until Linux gets an IDE at least 75% as good as MSDev,
    You haven't tried kdevelop or anjuta then, I assume? Not being familiar with VS (too poor, lol) I am not sure how they stack up feature wise, but I bet that both meet your "75%" criteria.

    top-notch large scale applications for Linux will remain few and far between.
    You mean like Open Office, Mozilla or Blender3d? We have the apps; it's the mindshare we're lacking (if we're lacking anything, which I doubt now that we have corporate sponsorship from novell and ibm).
  • by yamla ( 136560 ) <chris@@@hypocrite...org> on Thursday August 04, 2005 @05:55PM (#13245012)
    That's interesting, I approach things exactly in the opposite direction. I am developing for Windows but use Linux as my primary operating system. I use KDevelop and prefer it over Visual Studio (disclaimer: haven't tried VS2005). I just find too many things are missing from VS for my liking. Good svn integration, doxygen, good command-line tools like find and grep, sloccount, etc. etc. etc. Additionally, compiles are SLOW using Visual C++. Much much slower than in Linux when I use ccache and also distcc (though I'm not using distcc at the moment). Even without ccache and distcc, Linux still wins pretty handily because nmake STILL doesn't support parallel builds to take advantage of hyperthreading and multiple CPUs (though I'm not using those at the moment, either).

    To each their own.
  • by Castar ( 67188 ) on Thursday August 04, 2005 @06:01PM (#13245075)
    Eclipse is great for Java development, but setting it up for C++ is a pain - especially compared to VS.
  • by Timesprout ( 579035 ) on Thursday August 04, 2005 @06:03PM (#13245103)
    Only on /. would someone be dumb enough to cite sourceforge as a good example of a fully integrated help/documentation/examples/technical discussion/articles/books/advise system. Sourceforge is many things but if you look at 95% of the projects on it they have nothing whatsoever to do with quality code or documentation.
  • by digidave ( 259925 ) on Thursday August 04, 2005 @06:12PM (#13245171)
    No, it's just that every little lesser-known thing gets called a hack nowadays.

    In this case, most of the "hacks" look like normal VS features that many people are unaware of. These sorts of things are better described as "tips", but that hardly draws any attention now, does it?

    If it was called How To Boot Your Walkman With Emacs, now that would be a hack.
  • by AuMatar ( 183847 ) on Thursday August 04, 2005 @06:23PM (#13245268)
    I find intellisense the single most annoying feature of any program I've ever used. I'd turn clippy on before using it.
  • by Anonymous Coward on Thursday August 04, 2005 @06:25PM (#13245278)
    "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. "
  • by JamesAvery ( 641368 ) on Thursday August 04, 2005 @06:47PM (#13245448) Homepage
    You can download an add-in to provide scroll wheel functionality in VS6.

    http://support.microsoft.com/Default.aspx?id=83791 0 [microsoft.com]
  • by justasecond ( 789358 ) on Thursday August 04, 2005 @06:50PM (#13245476)
    Yah. Gotta love all that automatically-generated API crap that VS dumps into your source:

    // {AFX_DATA_MAP(BHatchBoundaryTab)

    etc. It gives you something to read while you're looking for your code.

    God help you if you accidentally delete one of those comments.

    Delphi (for example) keeps your source code as you wrote it. Like every freakin other IDE in the universe.

    Oh, and how many versions of msvcr71.dll are there? (Seriously, I'm asking...MSDN's dll help database claims the file doesn't exist.)

    By the way, does Visual Studio ship with the source to the runtime libraries so's you can step the debugger through them? No? (Delphi does.)

    VS isn't exactly bug-free either...Googling visual studio bug results in 760,000 hits; searching MSDN for PRB and Visual Studio results in *many* results (I got tired of clicking on "next", but it's a lot).

    Oh, and VS's help...sucks. For example, with VB 6 (no, I *do not* develop in VB), asking for help on, e.g., Val() results in about 20 freaking pages of help to choose from. What idiot decided to integrate the entire MSDN knowledgebase into VS's help?

    VS bites.
  • by swissmonkey ( 535779 ) on Thursday August 04, 2005 @07:10PM (#13245615) Homepage
    There are similar ways to do it for XEmacs and other editors, all less practical and efficient than the VS implementation.
    Not being context sensitive is simply unacceptable for example. When you start using namespaces, many classes, ... it's simply essential.

    Regarding This is the power of a programmable editor. If there's a feature you want, you can add it. If there's a feature you want to change, you can modify it. If there's a misfeature, you can get rid of it.

    Hint #2: You can write plugins for VStudio too.
  • by EvanED ( 569694 ) <{evaned} {at} {gmail.com}> on Thursday August 04, 2005 @08:30PM (#13246088)
    Some implementations of "Intellisense" (in quotes because the term is actually VS specific, but I'm using it generically) show you source comments.

    Besides, what if you know most of the signature, but can't remember which order the args come in? Don't really need the comments for that.

    Finally, it just speeds up typing. Instead of typing out a whole name -- and very easily making a typo -- you usually just have to type a few characters.
  • by Unoti ( 731964 ) on Thursday August 04, 2005 @09:26PM (#13246311) Journal
    its better to look up its definition in the source so I can see the comments on the inputs.

    Perhaps you should actually try intellisense before you talk out your ass. Intellisense does show you the comments associated with the method you're calling, as well as the return type, and the comments associated with each of the individual parameters. As you move through the parameters, intellisense updates the tooltop to show you the comments associated with each input parameter separately. People can blast Visual Studio all day, but I'd be willing to bet that almost none of them have actually used Visual Studio on a non-trivial project.
  • Re:Yeah, but.... (Score:3, Insightful)

    by Xyrus ( 755017 ) on Thursday August 04, 2005 @09:56PM (#13246451) Journal
    In a word, yes.

    I did something similar for Visula Studio 6 when I was working on a project for a couple of embedded platforms.

    VS .NET can be customized as well. Better yet, you coiuld write a plugin app that would take advantage of all the settings and translate them to their gcc equivalents.

    It just depends on how much time you want to take.

    ~X~
  • by Corngood ( 736783 ) on Thursday August 04, 2005 @10:35PM (#13246622)
    In visual studio you can attach to a running process on another machine and debug it exactly as if it were running locally. You can step from sql to C++ to .Net (lots of languages) to DirectX shaders... You can modify the code of said running process, recompile it, and patch it back into memory without restarting it. You can even do these things if the other machine happens to be an xbox. It's a massive set of tools, and the debugger is just one insanely awesome part of it.
  • by Calroth ( 310516 ) on Friday August 05, 2005 @12:29AM (#13247135)
    VS isn't exactly bug-free either...Googling visual studio bug results in 760,000 hits

    Google search for visual studio bug [google.com] - 840,000 results
    Google search for eclipse bug [google.com] - 1,480,000 results
    Google search for emacs bug [google.com] - 1,170,000 results
    Google search for slashdot bug [google.com] - 1,460,000 results
    Google search for bright purple elephant bug [google.com] - 131,000 results

    Congratulations! You have given us a meaningless statistic.
  • by Frankie70 ( 803801 ) on Friday August 05, 2005 @12:51AM (#13247213)

    By the way, does Visual Studio ship with the source to the runtime libraries so's you can step the debugger through them? No? (Delphi does.)


    Actually, VS also ships with sources for the Runtime Library - go check your install again.
  • by NDaxi ( 714013 ) on Friday August 05, 2005 @03:20AM (#13247706)
    For this issue, you can use Whole Tomato's Visual AssistX. It works on every version of VS that MS released. Link: http://www.wholetomato.com/ [wholetomato.com]
  • by nmg196 ( 184961 ) * on Friday August 05, 2005 @05:24AM (#13248027)
    > if I can't remember the signature, its better to look up
    > its definition in the source so I can see the comments on the inputs.

    Intellisense in VS *DOES* shows you the comments from the source. Why do you think that the source comments have to be entered in XML?? Why do think there's a whole thread of people saying how good it is even though it's an MS product? If you're not seeing the comments, then you haven't been following the templates or RTFM.

    I hate to say it but it's fucking amazing - especially in VS.NET 2005.

    The thread title is correct - it's Microsoft's Killer App.

    > Besides, if you divide up the work correctly, you won't be using more
    > than a few percent of the functions in a program,

    Not all companies are big enough to "divide up the work". I have to do the entire project on my own. Which after 6 months is a LOT of functions. I guarantee it would take nearly everyone except genius autistic programmers more time to write large projects if if VS.NET didn't have any intellisense.

    I can't see how it can be annoying. If you type quickly without pausing then it doesn't even appear. If you really do know what you're supposed to be typing then you probably won't pause because. The only reason I can think of to pause halfway though typing a function call is if you're having to go and find the function definition because you can't remember what the next argument is :)
  • Re:Ah, the pity... (Score:3, Insightful)

    by Tarwn ( 458323 ) on Friday August 05, 2005 @07:05AM (#13248251) Homepage
    I shake my head and marvel...poor, closed-minded souls who se nothing but an MS product and think they are on the top of the world for ridiculing it.

    *sigh* The trolls do rush to these threads. Meanwhile we who actually try things before denigrating them have found an extremely capable IDE, enjoying the capability to code in/edit Ada, APL, ASml, Caml, Cobol, Delphi, Forth, Eiffel, Fortran, Haskell, Lisp, Lua, Mercury, Mixal, ML, Mondrian, Nemerle, Oberon, Pascal, Perl, PHP, Prolog, Python, RPG, Ruby, Scheme, Smalltalk, C#, C++, J#, VB.Net, XML, HTML, ASP, ASP.Net, ...

    And what do people say to this? Dismiss it all with a handwave - MS Bah! - and stick to their advanced text editors because they know it. And it's easier.

    Well, no arguments there! But I chose not to stck to any one language or editor. Knowing only one editor and having only one toolset was fine on the Commodore Vic-20, and unfortunatly Emacs was never as good as vi :). And when I decide to write an application that will only ever run on Windows...or in a web browser...or in mono...I realized that it would actually take a little work to learn a new IDE. I asked myself if I was man or mouse.

    I picked man. I decided to take the brave step and actually learn how to use something beyond a text editor. To learn how to make the editor fill my needs instead of assuming it would limit me to only a small subset of projects. After all, I reasoned, if my sole criteria were "easy to use" and "I already know it", then by the same logic I should have never learned how to use even the best text editor (vi).

    Anyway, it's no skin off my nose. So go on, Anti-Microsoft serfs, enjoy your little bag of tricks for your script typewriter! Have your fun. Nobody said that we all had to be professionals! And at least you have one thing to brag about - you didn't bother to expand your skillset because it was MS! And continue to dream those fond dreams of catching Virii in the wild, of creating single script solutions to strip them out of messages, of your own advantages over virus writers who clearly can't know more than VB. An example does not define a set, which is why professionals try to understand what they are talking about before they open their mouths.

Happiness is twin floppies.

Working...