views:

38

answers:

2

I have a program I made in C++ that does not use classes, just simply functions and main(). I want to know what kind of diagrams I can draw for it. Here are a couple of things I have in mind.

  1. Activity diagram
  2. Sequence diagram
  3. class diagram - obviously can't draw this because I didn't use classes
  4. system architecture
  5. state diagrams
  6. use case diagrams

Out of these what can I draw?

+2  A: 

I'm guessing from the diagrams that you are aligned to a * Unified Process approach.

IMHO:

  • Use Case - definitely - eliciting business and system level requirements is implementation agnostic
  • System Architecture - definitely - layers, processes, network, db and modules / packages.
  • Activity Diagrams - definitely - use this to describe process flows for key processes
  • State Diagrams - applicable, although usually associated with the state and lifespan of a single object instance, but it is still conceptually useful if you are maintaining state through other means
  • Sequence Diagram - applicable, although you will probably need to provide an arbitrary class name to attach your functions (if you are using namespaces, then possibly aggregate to these these instead?)

However, you might hit issues if you want to generate and round-trip code from your diagrams e.g. from a CASE tool such as Rational Rose - most will assume an OO implementation language (noting that the three Amigos are strongly associated with OO!)

I guess this begs the question as to why you would need to develop a procedural app using an OO language and document it with OO techniques?

HTH

nonnb
+1  A: 

As a generalization: You can use all types except the class diagrams. If you could draw a class diagram, you should ask yourself, why you did not use classes in this case.

For all other diagrams, you can use parts of your app as "actors" or "components". It seems like you have not researched yet what these diagrams are used for and what you express with them. If you do that you should be able to determine which diagram makes sense for you.

Remember that each diagram should have a purpose. If you do it just for the sake of being there, then don't do it.

Patrick Cornelissen