Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coding using sequence diagrams

When I was at university a lecturer said how some people managed to code using sequence diagrams, this to me seems a good way of programming but of course the devil is in the details. I have a few questions.

  • Does this actually happen or was I misinterpreting what he said?
  • Has anyone here actually done this?
  • Is it more productive?
  • What are the disadvantages?
  • What tools would be needed when using Java?
like image 279
Bob Avatar asked Dec 31 '22 08:12

Bob


2 Answers

I've found that "normal" sequence diagrams are almost always more of a pain than they're worth (although I have found them useful for showing data flow in LINQ). Doing a "rough and ready" diagram and explaining it (preferably in person, but with plenty of words either way) works better in my experience.

I think it's a good idea to have a diagram (or several) showing a sort of "vertical slice" of your application - how each layer talks to another, and perhaps showing the course of a request/response in suitable cases. However, this doesn't need to be at the "individual method call and always 100% accurate" level - making sure that you convey the right general impression is more important, assuming the reader can then dive into the real code.

Having said all of this, my views on UML in general are much the same, so if you're a big fan of precise diagrams always being kept meticulously in sync with reality etc, take it all with a pinch of salt :)

like image 143
Jon Skeet Avatar answered Jan 02 '23 09:01

Jon Skeet


I think that sequence diagrams are one of the best ways to visualize complex, multithreaded programs with lots of messages being passed between threads. I don't use them much in design, but sometimes they are the best way to debug.

like image 20
David Norman Avatar answered Jan 02 '23 08:01

David Norman