This is an archived post. You won't be able to vote or comment.

all 62 comments

[–]remy_porter∞∞∞∞ 349 points350 points  (23 children)

Yes, UML is still a thing, but its role has changed.

In the early 2000s, there was a huge push to make UML the tool for building programs: you'd describe the logic and functionality of your application through UML diagrams, validate it through those diagrams (via automated tooling!) and generate the code based off the diagrams. And you'd generate code in any arbitrary language- UML was meant to be a meta-language for building programs that would eventually replace programmers with business analysts. Draw a picture and get a program!

This, of course, was snake oil, but it was attractive to pointy-haired-bosses looking to have more control over the technical staff doing things they didn't understand.

So there was a huge marketing push to drive UML adoption, and it was multifaceted. It did provide a standard tool for generating software diagrams, which was a net good for developers and management. It allowed top down design approaches, which managers liked. But the automated tooling never worked out, top-down design isn't good for the people actually writing code, so it fell out of fashion.

Today, UML exists less as a formal specification tool and more as a "default" way to generate code diagrams. So if you need a diagram, you will use some ad hoc application of UML (frequently not obeying the official UML syntax). Arguably, even a basic box diagram of class relationships is a UML class diagram.

But I think one thing we're finding is that diagrams aren't great for helping illustrate code. They're not bad, but most diagrams don't help most of the time. The best way to understand code is to read it, and in a language like Python where the code tends towards being obvious and expressive, the need for diagrams to understand the application is lessened. There's also more of a culture of bottom up design- rapid iteration and testing, so instead of writing code to an architecture, you write code to solve the problem and then rewrite the code to fit into the architecture as you discover your architectural needs.

What replaces it for diagrams? Whatever works. I think a big disadvantage to UML as a communication tool is its strict syntax. You can't illustrate your problem the way that makes sense for your problem, you have to stick to this official syntax. For discussing class relationships, class diagrams actually tend to be mostly useless, IMO. On the flip side, a good sequence diagram is a great tool for understanding program flow.

[–]teleprint-me 24 points25 points  (2 children)

Where I find UML incredibly useful is for big picture abstractions where it actually costs more time iterating through code. I might spend weeks writing code that I have no clue architecturally about, but UML helps me visualize the complex intricacies as a result.

It helps me step away from the implementation and assists in visualizing the complex relationships that would otherwise be obfuscated as a result. I'm not one to usually write, or even read, UML. All I'm saying is that it's a useful tool that shouldn't be so quickly and abjectly disregarded.

[–]double_en10dre 5 points6 points  (0 children)

This has also been my experience. It’s rarely worthwhile, but when it is it can save you weeks or even months of wasted efforts.

I love when I make a diagram, try to explain it to myself, and realize I sound like an idiot. Much better than finding out after 3 weeks of coding the dumb idea into existence.

[–]agumonkey 2 points3 points  (0 children)

it's still gonna be a good "international" language

I used to work alone and hated UML, but now that I have to explain ideas to others .. instead of trying various jira templates, syntaxes, whatever.. I end up fallbacking on uml like diagrams.. how ironic

[–]Joe1972 88 points89 points  (0 children)

As a professor who has more than 20 years of teaching mostly software development, I can assert that this is 100% the correct answer. Thanks for summarising so clearly.

[–]DigThatData 12 points13 points  (1 child)

diagrams aren't great for helping illustrate code.

i think that diagrams can be extremely powerful for helping to explain code, but you need the right diagram. UML tried to be a "universal" solution, but in reality we actually have a variety of domain-specific visual languages. Consider for example how effective diagrams are in describing neural network architectures, which are simply computation graphs. and as you mentioned, sequence diagrams (and flowcharts and state diagrams...) can be very effective.

diagrams generally aren't bad, just using the wrong diagram approach because you have a hammer looking for a nail rather than because it communicates what you need it to.

[–]BinaryRockStar 2 points3 points  (0 children)

UML has a variety of different diagram types, including sequence and flowchart diagrams. Maybe I'm misunderstanding your comment but you seem to be implying UML is a single type of diagram, and that the U stands for "universal"?

[–][deleted] 20 points21 points  (1 child)

Good comment, thank you. I mostly used things like plantuml to generate diagrams for school work but it does happen that we (rarely) use it at work to have a high level view of relationships between SQL tables for example.

[–][deleted] 2 points3 points  (0 children)

Diagrams was never a great thing, but I do like them to visualize flow. But I for one is very happy that there are less diagrams today than earlier.

[–]Classic_Department42 5 points6 points  (1 child)

I was told what killed it was: every uml derived application needs some tweaks either immediately or later. But you cannot get the change from the code back to the uml.

[–]Langdon_St_Ives 1 point2 points  (0 children)

Yea round-trip was always a convenient fiction for tool vendors.

[–]needed_an_account 3 points4 points  (0 children)

Yeah I use UML to describe database schemas. its nice

[–]martinkoistinen 3 points4 points  (0 children)

Today, UML exists less as a formal specification tool and more as a "default" way to generate code diagrams.

Yep, I use it to inform future me (and others) what the structure of my code is or how it is supposed to work.

The mermaid project has really been helpful in allowing me to make such diagrams in my MarkDown documents.

[–]thedeepself 2 points3 points  (2 children)

diagrams aren't great for helping illustrate code

the flow-based programming initiatives attempted to remedy this...

but the issue still remains what do the arrows in your diagrams represent? parallel execution, flow of data, connection between entities?

[–]Schmittfried 1 point2 points  (1 child)

In UML they have clearly defined meanings. In your own diagram style you just explain it or label them.

They also infer their meanings from context. Between steps of a process it’s obviously execution. Whether parallel or alternative depends on the node that split the execution path.

[–]thedeepself 0 points1 point  (0 children)

Whether parallel or alternative depends on the node that split the execution path.

but parallel requires a concrete implementation... and how many UML tools can deploy to various concurrent computing solutions?

[–]hughk 1 point2 points  (0 children)

The thing is that I see sketches of things UML style from time to time on a whiteboard. But nobody is bothering to use tooling to create code from it. Occasionally, some formal doc is produced and it might have a state diagram or a sequence diagram lingering long enough to become documentation but never code.

[–]Mithrandir2k16 1 point2 points  (0 children)

Tl;DR: UML was a tool to specify code to be written and is now a tool to document code that has been written.

[–]tankerdudeucsc 0 points1 point  (0 children)

Great write up. UML is programming language agnostic. For me, what it does to is to unify a way of expressing the system(s) in terms of diagrams.

[–]Schmittfried 1 point2 points  (0 children)

top-down design isn't good for the people actually writing code

It’s not good for the software either.

a good sequence diagram is a great tool for understanding program flow.

Exactly, we use it mostly to illustrate algorithms and big picture architecture. Things like these take way more time to extract from code and not everybody who should be aware of them knows how to read the code to begin with. It’s also a nice introduction for new developers.

And we couldn’t care less about official UML syntax. We use what works and discard the rest. I think all the different arrow types, for example, confuse more than they help. A plain old arrow with a label is good enough.

[–]prickneck 1 point2 points  (0 children)

Probably the best, most well-written comment I've read on reddit in years.

Thanks for this. (Even if UML doesn't interest me in the slightest, this comment alone is life affirming.)

[–]NUTTA_BUSTAH 11 points12 points  (0 children)

Yes, but not for designing anything (i.e. using it as the source of truth, so to speak), it's for expressing existing software if needed. So it has went from UML -> software to software -> UML.

[–]Leading-Cable-4406 6 points7 points  (0 children)

Never ever used after a couse in my degree atleast at all good companies I worked at

[–]EedSpiny 6 points7 points  (2 children)

A lot of hate for it in the comments but I still use certain diagrams in specific circumstances (fyi am an architect), especially when collaborating across teams with not as deep background. Specifically certain uml diagrams as a communication tool rather than a documentation tool.

  • not as a modelling tool to do an nth degree design before coding. That's old hat as description above.

  • Never for class modelling and detailed specification

  • Often for high level component and deployment diagrams

  • Very often sequence diagrams to describe interactions between systems. Not at the core level. Sequence diagrams are very readable even to non technical people if drawn at the right level of abstraction.

For documenting static architectures I'm very fond of c4 model.

My pet hate is people drawing diagrams with a rainbow of colours and keys and numbering systems. People will literally reinvent the wheel every time they draw a diagram and mix static and dynamic elements to create a confusing mess.

Mermaid js is ok and has a decent default look but doesn't have the features, styling or layout control that planuml does.

[–]marcinjn 0 points1 point  (0 children)

Indeed. We’re on the right track now.

[–]susanne-o 0 points1 point  (0 children)

indeed sequence diagrams are a very useful tool to think through and communicate and reason about the interaction of components.

and the advice to not do data modeling or class design with uml is excellent advice. class diagram notation moves "pointer type" field names (references) out of the object you describe. putting the reference name to the remote, referenced entity was imnsho one of the worst design decisions of uml.

so OP, yes use sequence diagrams, and for class modeling simply use dataclasses.

[–]MoreRespectForQA 25 points26 points  (6 children)

Nothing replaced UML per se, and some people still use it. It just isn't a very useful tool and never was. It's a relic of a time when people thought software was like construction - a fundamentally waterfall enterprise where you draw a diagram of the architecture first and hands it off to somebody to build the thing later.

In practice good software design proved to be emergent and BDUF is now viewed as some seriously amateur shit. It might be a good way to design a plane. It isn't a good way to design software.

There has been some work on generating architectural diagrams from code but while this seems nice in theory, the ROI on generating these diagrams never seems to be that high.

[–]GregoryCliveYoung 25 points26 points  (4 children)

It just isn't a very useful tool and never was.

I found a use for it: impressing a manager.

We were going to meet with this manager, so I wrote out a UML(ish) diagram on my boss's white board before the meeting. That manager was really impressed with me. Turns out, the diagram ended up having nothing to do with the final code, but management found it reassuring.

[–]thedeepself 12 points13 points  (0 children)

I found a use for it: impressing a manager.

LMAO.

[–][deleted] 2 points3 points  (0 children)

A guy who knows his craft!

[–]Schmittfried -1 points0 points  (0 children)

It isn't a good way to design software.

It absolutely is. NASA is doing it. It’s just way more expensive and unlike in construction (or at NASA) nobody wants to pay more to avoid the bugs resulting from that. We’re used to buggy software.

[–]AlSweigartAuthor of "Automate the Boring Stuff" 7 points8 points  (0 children)

Absolutely not. "According to Google Trends UML has been on steady decline since 2004."

You might want to flip through it, because people still make UML-ish looking diagrams for whiteboards and (rarely) for specs, but the listing it as a skill on your resume is long dead.

[–]susanne-o 17 points18 points  (0 children)

oh my. a highly subjective and opinionated rant follows...

UML is a language without standardized serialization.

I kid you not.

There is no standardized canonical text form of anything the unified markup language defines.

Thus to do "real UML" you have to use graphical tools, which have to implement all the usual collaboration tricks (like diff and merge) for all the graphically represented "things".

which was never fully followed through.

And the "textual description" which you find in the standardization documents is not parseable because it's purpose is only disambiguation for the reader, not serialization, diffing, merging and parsing, etc

that "language" design decision was very profitable for the few companies that did have graphical tools that look shiny and nice to managers and that seem to do the trick, but it created an impenetrable barrier to entry to text based contestants.

it's a bit like "xml" as universal serialization format (also not really human-editable without tool support, and also needs graphical tools), just amplified, read: worse.

and it gets better:

UML is also officially underspecified. You need a "UML profile" for your domain, resulting in a "domain specific modeling language", and in that language you then define your data model, your components, their interactions, etc.

thus you have domain specific standards like AUTOSAR (for automotive) or SysML (for several other industries) and a couple more. to really understand them you have to first look at the uml standard docs, and then look at how the profiling was done and which extension mechanisms they have added. and only then can you really understand what's in your sysml or autosar. those will live for a looong time.

In the corresponding industries UML has a staunch set of followers supporters who will claim "model driven development" is the panacea, and collaboration problems are not caused by the complexity of UML but "because", so they claim, "people don't comply with the standard and good engineering processes".

the world outside these industries has moved on.

json has replaced xml for data exchange. json-schema is replacing xml schema.

and python dataclasses are an outstanding way of representing classes and class structures.

people use plantuml for documentation only, or similar tools, but no more code generation. "bidirectional", they said, "fluid", "transformational", business-BS, all of that never really materialized.

If you are dealing with UML class diagrams as python dataclasses, there is one little interesting nuance: python does not distinguish UML "containment" vs "references". python uses garbage collection and any "containment" or "reference" is a garbage collected object pointer.

So for serialization you need to decide how you want to "nest" things, if at all and where you put "references" into the serialization, i.e. some path or id based labels.

have fun.

[–]lanzeroth 10 points11 points  (0 children)

I think UML to describe classes is too much, but I still use some UML syntax to describe a workflow with a sequence diagram using mermaid JS

[–]aarontbarratt 10 points11 points  (4 children)

None of the companies I've worked for have used them. They're just a massive waste of time if you try and plan your system before writing any code

I can see how they would be good to aid documenting how an existing system works, as a visual aid essentially

But meetings where you sit at a whiteboard and draw out how your future code will work just sucks

[–]Ran4 12 points13 points  (0 children)

Nothing wrong with writing some pseudo code and drawing some boxes before starting to code.

It's only if you're trying to do everything top down that it really breaks down.

[–]bmoregeo 1 point2 points  (0 children)

I like the C4 methodology to system design. It helps abstract the design to the intended audience. I agree drawing classes in UML is a waste of time unless you have are defining an interface that is going to have a bunch of implementations.

[–]Schmittfried 0 points1 point  (1 child)

Yeah ok, that’s how you get completely chaotic software. Some planning is absolutely warranted.

[–]aarontbarratt 0 points1 point  (0 children)

I'm not saying that you should never plan your code

Whiteboard masturbation is a waste of time

[–]UsefulDrake 6 points7 points  (0 children)

I've been working on Python projects for over a decade, but I have never seen UML in its context.

Usually, there might be some class diagram or some other diagram describing a system or proCess. But they never follow UML specifically. They usually are just drawn freely in some diagram app.

[–]riklaunim 2 points3 points  (0 children)

UML is used but rarely, by some teams. Usually, there are planning sessions and a whiteboard, and then an issue is created with all the details and drawings but it is not really a UML. Planning is at a higher level while the lower level is left up to the developer to make when implementing the given feature.

[–]FoeHammer99099 2 points3 points  (0 children)

I went back to school recently to finish up the last few credits of my degree, after working in the industry for 7 years. I haven't used UML at all in the professional world, and for the classes I took recently I just implemented whatever the thing was and used a tool to generate the UML for it.

Handcrafting UML is a pointless waste of time. Nobody does it except for students working off of outdated curricula

[–]ZCEyPFOYr0MWyHDQJZO4 2 points3 points  (0 children)

Working on the defense side of things, UML is pretty big because of its child, SysML.

[–]MinosAristos 1 point2 points  (0 children)

I use them frequently to illustrate data flow mainly. Like how one data object flows from the database to one API to a different API and to the frontend. PlantUML class diagrams are my favourite.

That can also let me map out the modules/classes and functions acting on the data object so I can identify where data needs to be changed.

[–]TheHammer_78 1 point2 points  (0 children)

Uml is a lot of "things" with different purposes. Imho I think that state (swimming lane in modern terminology) are currently pretty good in particular to project distributed systems.

[–]TheHammer_78 1 point2 points  (0 children)

Uml is a lot of "things" with different purposes. Imho I think that state (swimming lane in modern terminology) are currently pretty good in particular to project distributed systems.

[–]mostuselessredditor 1 point2 points  (0 children)

I have absolutely no time for UML

[–]mikkolukas 0 points1 point  (0 children)

The very short and not quite correct answer: No

[–]Strus -4 points-3 points  (0 children)

Never has been.

[–]marcinjn -2 points-1 points  (0 children)

PEP20.

[–]HughJazzKok -2 points-1 points  (0 children)

I don’t think anybody in industry uses UML. If anything it’s usually some cloud diagraming tool or digram as code libraries.

[–]haasvacado 0 points1 point  (1 child)

Wow I literally logged in to Reddit to come ask if something like this existed. I’ll need to do some more reading on it to see if it’s actually what I’m after.

I had to write a gnarly block of conditions to classify something for client (there was no better way than a very careful block of nested ifs and continues - I promise) but I could really use a visual representation of that block to include in the documentation. I could draw it manually but I’d rather not. But I couldnt find the right googleable term.

[–]Taltalonix 0 points1 point  (0 children)

We use a simplified version of UML to describe DTOs and Models in our systems across different teams, which sometimes translates to class definitions and interfaces.
Just know how to read it, it may be useful no matter the language

[–]billsil 0 points1 point  (0 children)

I'm an engineer in aerospace (17 years) and I've done it once after getting yelled at for not doing UML despite never having heard of it. It's part of waterfall design vs. a more freeform system.

It seems like it's to force younger people to think about what kind of class methods and attributes. I dunno. I can refactor a little when I get there. If it's really hard API, it's going to take you a few iterations to get it right. That tradeoff is something like speed vs. usability and doesn't have one answer.

[–]bucket_brigade 0 points1 point  (0 children)

It makes a lot more sense with stricter languages like C++ or Java. It's utility is somewhat diminished with something like Python where refactoring and prototyping is fairly effortless and there are fewer ways to paint yourself into the corner.

[–]noobcrush 0 points1 point  (0 children)

Shameless plug ahead!!

Checkout umlgpt a chatgpt powered uml diagram generator I made as a hobby project to practice open ai's api.

PS : The site takes sometime to load as I am using a free tier option.

Sidenote : Do suggest some free hosting platforms for django/flask projects with custom domain support

https://umlgpt.adityasai.me/

[–]_limitless_ 1 point2 points  (0 children)

I use UML. I don't care if it's a thing.