My professor asked us to generate UML for next homework. We are using Visual studio 2010 for c++ programming. I tried to work on it but I could not figure out, I went to Architecture-> Windows -> UML Model Explorer but don't understand where to go next.开发者_运维技巧 Is UML generator creates UML automatically or it will just give bunch of boxes to fill all the information about class and objects (Manually)?
Your question confuses me, particularly when you mention using Visual Basic 2010 for C++. I assume you meant Visual Studio 2010.
As to doing UML... are you using Visual Studio Ultimate? If so, you can create some UML diagrams in Visual Studio, but there is no support for reverse engineering UML from existing code; you'll have to generate the UML diagrams by hand.
What you should do is generate the UML before you code, then code against the model you built. But that's something you'll hopefully learn over time.
That said... there's a feature of all versions of Visual Studio called a "Class Diagram" which is tightly coupled to and propagates data to and from the code -- modifying the diagram will modify the code, and vice versa. It should be stressed that a VS Class Diagram is not completely UML, although it looks similar. Additionally, Class Diagram for C++ doesn't work for me, however, so I don't know how much mileage you'll get from it if you're using C++/CLI rather than VB.NET. If you're using native C++ it will not work, period.
Ultimately, your best bet is to do the UML by hand. If you have the UML tools with Visual Studio, use them since they're available, but they're not the best UML tool on the market by a long shot. For that, I recommend Visual Paradigm for UML, which has a free version that adds watermarks to the diagrams and also has a Visual Studio plugin available.
Visual Studio 2010, regardless which edition, can NOT, I repeat, can NOT generate UML class diagrams from C++ code. Anyone who claims this, hasn't tried it :D See here: http://social.msdn.microsoft.com/Forums/en-US/vsarch/thread/2c16410e-9986-49b2-a07c-882b1e5e2b3c
Visual Studio 2010 (also Professional edition and beyond) can generate "class diagrams", but not UML class diagrams. Instead, the format of what they call "class diagram" remains unknown to me. It looks similar to UML diagrams, but it really isn't. To get these diagrams, just right-click a project, select "show class diagram" and wait for it to appear (this does work for me also for C++ projects, but I've seen others reporting that it didn't work for them... no idea). The big down-side of these diagrams is
- that you have to manually turn associations to other classes into association-arrows (by right-clicking the member variable and choosing the first item in the list)
- this conversion is not possible if you have a MSVS solution that consists of several sub-projects, and the generated diagram contains classes that have associations to classes that are in a different sub-project
However, for C# you should be able to generate a new Modeling project in your solution, create an empty UML class diagram inside it, and then drag any class from any project into that class diagram (haven't tested it, though). The requirement for this is at least to have the MSVS 2010 Ultimate version, and to have the MSVS Feature Pack 2 (this includes, from what I understand, Feature Pack (1) and the visualization and modeling tools).
For C++ however, using this Feature Pack 2, you can create dependency graphs that shows dependency arrows between .cpp and .hpp files, which is also quite useful! See http://msdn.microsoft.com/library/ff657798.aspx
Download StarUML. It's one of the better ones out there IMHO. There's also DIA, ArgoUML, and Eclipse (with some plugins). The latter two generally force you to do it exactly correct, which almost nobody actually knows how to do (including myself). The former two let you just draw the damn diagram.
A bit late on answering here as I can across the question while search for something else.
As you have read already, Visual Studio does not create UML diagrams, it creates Class Diagrams which may, at first appearance, look similar, but they do not model dependencies, or any other relationships, such as aggregation, composition, specialization, or generalization.
If you want to create actual UML diagrams, use aforementioned StarUML(free), Visual Paradigm(Community Edition, or paid for prof ed'), or if you have are a student and can get it for free through Dreamspark(or whatever they call it nowadays), You could try Microsoft Visio, which is a standalone UML editor, which can generate code in any MS Visual Studio supported language from a Diagram.
Opinions will vary in which one is better, so best advice is to investigate them yourself, and preferably (if you plan to program professionally), become familiar with all of them.
精彩评论