Visualizing inheritance hierarchies
HelloJ! My name is Yu Xiao. I am a Software Design Engineer/Test working on Visual Studio Class Designer team. This time I am going to demonstrate how to visualize inheritance hierarchies using Class Designer.
When I was reading existing code, even with well documented one, I always spent a lot of time jumping from one file to another file, one location to another location, back and forth, and then, guess what? I lost. The bookmarks were set everywhere, and I really don’t know where to go back. Then I have to start all over again. This story happened everyday, …, until I started using Class Designer.
Let me use a simple example to show the idea. I have a project to simulate a car racing organization. From the Driver class, I want to find out its base type information. There are several options here - use class view to check its base class, or go to the code editor to find its base class code. But I will show you something else.
Right click the Driver class shape to invoke context menu, and then select “Show Base Class” command.
The Class Designer will find its base class and show it in the diagram with appropriate relationship. In this case, you will see the inheritance line pointing from derived class to base class.
And keep on repeating this operation, you will be able to trace its root down to object class. By this way, it will help you traverse to any base type you want in this class hierarchy.
Now we have the base class. Probably you want to see if there is any other class derived from this CrewMember class. Without Class Designer, you have to do a search and find them one by one. But with Class Designer’s help, this work is trivial – simply right click the CrewMember class shape, and select “Show Derived Classes”.
As expected, another class, Mechanic, will be brought onto the diagram and positioned properly along with current types in the diagram.
Now you can traverse the inheritance hierarchies in a single diagram. Whenever you find something interesting and want to see how it got implemented, just right click the type or member, selection “View Code” command. This will bring you right to the code element in the code editor.
A picture is worth a thousand wordsJ, I won’t say too much here about how easy it would be to understand existing code with Class Designer. Please try it and let us know what you think.
Yu Xiao
Software Design Engineer/Test
Visual Studio Class Designer Team
Comments
- Anonymous
March 09, 2005
Visualizing inheritance hierarchies - Anonymous
March 09, 2005
Visualizing inheritance hierarchies - Anonymous
June 16, 2009
PingBack from http://topalternativedating.info/story.php?id=11133