Visual C++ 2005 IDE Enhancements, Part 2, Page 2
Class View Filtering
The Visual Studio 2005 Class Viewer features two panes: one for types and namespaces, and the other for properties, members, and methods. The CommentedClass example from last month's article is shown in Figure 6 (displayed in the Class View window).
Figure 6: New Class View Window
Class View now can filter the types and namespaces that are displayed. In Figure 6, "Commented*" has been used to filter the view to display only those types whose names started with "Commented", which in this case is only a single class. As the number of types within a solution grows, the usefulness of this features increases exponentially.
The addition of a built-in, UML-like modeling tool to Visual C++ is an addition that many developers will welcome with open arms. This section does not deliberate why the modeling is UML-like rather than pure UML, except to say that the most common answer from Microsoft seems to be that UML is not powerful enough to model the features of .NET in a neat and convenient form.
For developers who have endured the pain of round-trip engineering through tools like Rational Rose, the fact that Visual Studio class diagrams offer trip-less modeling will be a welcome relief. The models are trip-less in the sense that code and diagrams are automatically kept up to date with each other, and there is no notion of one artifact being out of date with the other. Class diagrams are actually separate project files that allow the classes that are relevant to a particular view of the system to be added to a diagram. New classes can be dragged onto a diagram from the toolbox shown on the left of Figure 7, and existing classes can be dragged onto the design surface from the class view. A class can be shown in summary form, like frmStatus in Figure 7, or in an expanded form, like frmMain and frmAbout. A grid control called class details shows the methods, properties, and fields of a class in a hierarchical table. The class details grid is the most convenient way to alter a method, field, or property, though this can also be accomplished directly in the diagram.
Figure 7: Class Diagram
As you can see from the context menu in Figure 7, the class diagram surface supports many of the features traditionally associated with the class view and text editor windows, such as the abilities to add various code elements to a type and refactor a class (the refactoring support in Visual Studio 2005 will be covered in an upcoming article), and support for overriding inherited methods.
More to Come
Next month, the tour of new IDE features will continue with coverage on refactoring support within the IDE and the new build system.
About the Author
Nick Wienholt is an independent Windows and .NET consultant based in Sydney, Australia. He is the author of Maximizing .NET Performance from Apress, and specializes in system-level software architecture and development with a particular focus on performance, security, interoperability, and debugging. Nick can be reached at NickW@dotnetperformance.com.