Editor's note: The following post was written by Visual C# MVP Peter Bromberg
The Visual Studio Code Map feature is designed to help developers visualize relationships in code. The need for code maps will become clear when you are writing or debugging code and need to understand code relationships, particularly when getting involved in a new or unfamiliar codebase.
Channel 9 has an excellent streaming video that covers Code Maps here: http://channel9.msdn.com/Series/Visual-Studio-2012-Premium-and-Ultimate-Overview/Visual-Studio-Ultimate-2012-Understanding-complex-code-with-Code-Map-ENU
To start out with Code Maps, I chose to index Dapper .Net 4.5, a popular micro-ORM developed by the folks at StackOverflow.com. Simply right-click on the project in Solution Explorer, and choose “Show on Code Map.”
This is the main view of the map from Dapper:
You can see that relationships between the classes become instantly clear. This can be very useful, for example, when first getting into a new codebase to get a “bird’s eye” view of how everything is related.
Below, I have expanded my utility helper class, SqlMapperUtil:
All of the methods and their interrelationships become available. When you click on a particular method a detail view including the code is shown:
When I execute my test program in Debug mode, I can click the “CodeMap” Icon right under the Main menu “help” item, and I can have a synchronized debug session with my code and the code map together:
Before this feature, we would step though our code and hope to remember how we got to a particular class and method. Now we can turn on the Code Map feature while debugging and see a synchronized view of what is happening. There are also context menus available that allow you to perform common tasks:
Of course, we still have the Dependency Graph feature from the ARCHITECTURE menu, which will generate a dependency graph of our entire solution:
The enhanced Code Map feature in Visual Studio 2013 (Ultimate) is a welcome new addition for developers. As with many advanced features, we don’t discover it’s usefulness until we actually start to use it.
About the author
Peter Bromberg is a Microsoft C# MVP since 2004, author, and UnEducator based in the Orlando Florida area. He writes mostly about .NET, formerly for eggheadcafe.com and currently at his programming blog at peterbromberg.net. Peter is an ex-jazz musician and stockbroker who dreams of being a philanthropist. Research in microeconomics has given Peter an avid interest in the study of economic and climate change trends and the design of computer algorithms to process historical data sets utilizing neural networks, including some pioneering work with historical solar output data. As a computer programmer with over 25 years of hands-on experience in designing and developing large-scale enterprise applications, he am an expert at solving business problems. In addition to blogging,Peter has participated in Code Camps and has given presentations at local .NET User Group meetings. His motto is a quote from Thelonius Monk: “Wrong is Right”.
Too bad this functionality is hidden behind a $15,000 paywall for the Ultimate edition. Hardly anyone will actually be able to use this.
One of the best features added to Visual Studio. It shows code/app in a much clearer way. I have been looking for a tool like this since 2002. It would be nice if it was available in all editions of Visuals studio from Express to Ultimate.
Agree with Bradley. All members of my team have MSDN sub for VS Premium...no way will I get $15K per dev approved in today's budgets.
The tool seems to be very nifty and would be a big help especially when one comes aboard new to a project/group to quickly get a grasp of the code. But I agree with others in that in this economy and belt tightening no company or individual would want to invest $15K to have the features. Wish Microsoft makes it available as included with all versions.
No offence, but if you had started the article with "ultimate" only i wont even bother reading it. Nice feature though
yeah I second what sqlpro said... the MSDN video even seems to indicate this is available in VS Premium, but it certainly is not
I wish Microsoft had more elastic pricing models because I would love to buy Visual Studio Ultimate for personal development, but instead they're only concerned with B2B which is why they will never win over the consumer market until they adapt to a leaner business model (by Microsoft I mean everything but the XBox division). Instead, they have inflated prices and offer deep discounts to partners who buy in bulk.. the problem is that by doing that they don't win over the innovative start-ups many of which are creating the ideas of tomorrow.