Live data from Hacker News

Sequence diagrams, the only good thing UML brought to software development

mermaidchart.com

311–320 of 427 posts

Re: Sequence diagrams, the only good thing UML brought to software development

#311

Earlier quoted context omitted.

> The only reason the other diagram types fell out of favor is because of the development methodology change starting in the early 2000s. The industry started rejecting Waterfall, early design and system architects, in favor of Agile, just-in-time design and empowering developers. I dunno, whenever I heard people say they're doing Agile all I see is them doing Waterfall without documentation.

How is that worse than waterfall with outdated documentation which is what we had before.

"we are lazy assholes who can't keep docs up to date, therefore docs are useless"

Is essentially the argument i see over and over again. And every time i start a new project and that project has docs or uml or whatever I appreciate it. Even if it is a bit out of date, it's way better than nothing.

In my opinion, every project should have a readme file with instructions for running the project locally, and ideally also a high level visual representation of the system.

It should be separated into sub systems/modules for separate functionality and each module could have it's own set of readme and high level visuals. In addition, modules should have small coupling points, typically interfaces and these should have documentation comments describing what they do, inputs, outputs etc. APIs should have something like a swagger doc.

Re: Sequence diagrams, the only good thing UML brought to software development

#312
I've use sequence diagrams a few times. I find any kind of diagram tooling to be a tedious time sink. The resulting output is a talking point at best. Some window dressing for a presentation or internal document. Fluff you add to impress some easily impressed managers or clients. I always feel slightly dirty doing stuff like this. I have UML distilled on my shelf. A signed copy even. Haven't opened it in over two decades. It's obsolete.

Diagrams are communication and marketing assets at best. They are not creative tools. You create them for other people; not for yourself. And it takes a lot of effort to create them. If you measure the value of your time in dollars per hour (as your clients/employer should be doing), a good diagram can be several hours of work. So, it's expensive. A few hundred dollars is nothing.

Next time you see a diagram, ask yourself the question "would I pay 300$ for this thing?". In my case, the answer predictably is "hell no" 100% of the time. Asking the question is kind of answering it. Diagrams are rarely helpful. Either they are way to simple to add much value or way to detailed and hard to understand. There seems no middle ground here. So, you have three or four things with some arrows and labels. Well, yay! Tell me something I didn't know already.

Diagrams are low value window dressing. A literal waste of time and money. I do them rarely, reluctantly, and only when people really insist on them (and I'll push back a little). I find tools in this space tedious and frustratingly slow to use. I have more interesting things to do typically. If I do them at all, they are going to be a quick and dirty job.

It's not just me. Objectively, diagrams are very uncommon in software development these days. They are not part of regular software development processes, clients don't ask for them anymore, the vast majority of projects (and close to 100% of OSS projects) don't have them, etc.

Re: Sequence diagrams, the only good thing UML brought to software development

#313
post #303

Earlier quoted context omitted.

What's wrong with describing some classes first with a UML diagram?

Nothing wrong, but code is already formal enough that you don't need a formal visual language (UML is not just a bunch of diagrams, it's a formal language). So yeah, a bit of drawing might help to understand, a few ideas from UML might help, but it's not like it is super necessary. As said, the sequence diagram is a real plus because sequence information is not very well expressed by code, so that diagram has much ad…

> code is already formal enough that you don't need a formal visual language

Code can be formal enough but in reality it is almost never formal enough. Many constraints can be expressed imperatively (eg. someone validates the number of related objects in the create view) and in unexpected places (across repositories and libraries and maybe not even in code but in some stored procedure). And then it is all in flux and can go away the moment you change your stack.

I don't know if UML is perfectly flexible (maybe?) but its sure benefit is a source of truth that does not depend on your implementation.

Re: Sequence diagrams, the only good thing UML brought to software development

#314
UML is great to clarify situations that are harder to grasp with other communication tools. And by communication, I don’t mean only with other, but also with oneself.

Cerntainly UML is not always the best tool, but I see no point to pretend it’s a garbage toolbox no one should care about except for the only tool that ever helped for the work you had to do.

Re: Sequence diagrams, the only good thing UML brought to software development

#315

Earlier quoted context omitted.

The nice thing about visual stuff is that it is self-explanatory. Instead of needing to read a book about UML first, maybe just use some prose in addition to your diagrams, and you don't need UML at all then. That's also more flexibel.

> it is self-explanatory It most certainly is not.

[deleted]

Re: Sequence diagrams, the only good thing UML brought to software development

#316
post #31

I also find sequence diagrams to be the most useful, but disagree that the rest of UML is useless. Class, component, package, activity and state machine diagrams are all useful ways to model the structure and behavior of a system visually. The only reason the other diagram types fell out of favor is because of the development methodology change starting in the early 2000s. The industry started rejecting Waterfall, ea…

> Class, component, package, activity and state machine diagrams are all useful ways to model the structure and behavior of a system visually

They're not bad, but the C4 model is a much better approach to high level modelling (while you can still use class diagrams on the lowest level). https://c4model.com/

Re: Sequence diagrams, the only good thing UML brought to software development

#317
I actually used a sequence diagram today. I put it together for a meeting, to provide some visual guidance while descussing the architecture of a component, and the expected inputs and outputs of it. Helpful for aligning expectations and to spark more dialog.

I also use hierarchy diagrams, but a lot less often. Those are used for documenting the architecure of classes that can be annoying to navigate their code through.

Re: Sequence diagrams, the only good thing UML brought to software development

#318

Earlier quoted context omitted.

How was it supposed to keep up? The most popular programming languages did not introduce concepts that are too hard to reflect with UML. Or do you mean the problem of maintaining documentation?

Maintaining documentation. UML cannot go even one developer-week without being updated, but the developer will often not do that. By the time your UML is a month out of date it is useless at best, and misleading at worst.

This has nothing to do with UML. Ad-hoc diagrams or plain text descriptions become outdated at the same speed, which depends only on the level of detail that you put in documentation and not on the format if it. If you cannot keep up with the changes in the code, you are choosing the wrong level of detail, that’s it.

Re: Sequence diagrams, the only good thing UML brought to software development

#319

Earlier quoted context omitted.

Design patterns are missing language features. http://norvig.com/design-patterns/

People who say that don't understand design patterns and have never worked on a very large project with code dating back a few decades. Design patterns are what let you deal with the mess that results from that.

Even GoF says that class and interface are part of language for C++ or Java can be a design pattern for languages like C.

I think in some ways AspectJ can make the observer design pattern obsolete in Java. I have arguments against doing it in aspect way, but it was revelation nonetheless.

Re: Sequence diagrams, the only good thing UML brought to software development

#320

I've use sequence diagrams a few times. I find any kind of diagram tooling to be a tedious time sink. The resulting output is a talking point at best. Some window dressing for a presentation or internal document. Fluff you add to impress some easily impressed managers or clients. I always feel slightly dirty doing stuff like this. I have UML distilled on my shelf. A signed copy even. Haven't opened it in over two dec…

> And it takes a lot of effort to create them.

Have you tried mermaidjs? It's probably related to mermaidchart.com -- I don't know. The first sequence diagram in the article boils down to this:

    sequenceDiagram
      Customer->>Bank: Login request
      Bank-->>Customer: Login approval
with a fancier image for the customer than a box. Try it out at https://mermaid.live (linked from https://mermaid.js.org/)

Or this one, from a service I worked on a couple of years ago:

    sequenceDiagram
      Title: Service Signup
      autonumber
      User ->> App: User enters email address and password
      App ->> Server: Makes API call to register the user
      alt is not registered or already registered
        Server ->> App: Sends a token for authenticated API calls
        App ->> App: Generates unique ID
        App ->> Server: Makes API call to link user's account with unique ID
      else some other error
        Server ->> App: Returns [TODO: add error cases here] error
        App ->> User: Display error
      end

I hated drawing diagrams with a mouse, but when I found mermaid, I started using sequence diagrams everywhere.

> Diagrams are low value window dressing.

It's about communication, as the article said. The people who needs the diagrams the most are often not tech-savvy.

Post reply on HN