r/AskComputerScience • • Nov 15 '20

What do software architects use to plan in advance? (UML tools?)

I'm a self taught Python dude (Biotech pivoting to bioinformatics) and I've been learning through building a procedurally generated video game. As the game gets larger, progress gets slower. I spend (imo) too much time drawing out class architecture and the flow of data, only to have things change the next time I add a feature. There's got to be (free) tools out there to make this easier, but I really don't know what those would be. My googling usually leads me to "3d modeling tools" or "software tools for architects/civil engineers". Even looking at the "best UML tools 2020" I don't know if that's actually what I want, or what the difference between a good and bad one is. I feel like I'm suffering from "I don't know what I don't know" syndrome since I've never taken actual classes or had a mentor. Any help is appreciated.

28 Upvotes

10 comments sorted by

17

u/theobromus Nov 15 '20

I've been a professional software engineer for 12 years now.

I would say that it's not super common to use UML class diagrams in big software companies. As you note, these things change frequently. It's just a fact of life - you can rarely plan the entire system from the beginning. Often you don't even know what you really want until you build it. For your example with a procedurally generated game, maybe you start with just a collection of objects in the world. But then you realize that's too slow, so you need some tiling system to generate new tiles as the player nears them. Then you need a way to unload old tiles (and maybe save enough state to regenerate them the same later). Experience will help you get better at planning ahead for these things, but there will always be surprises.

In general, such diagrams are most useful to communicate designs between different members of a development team. Usually the class structure shouldn't be super complex, so it can be documented in comments or design documents (usually explaining what the code is trying to accomplish and why is the more important task).

I will say that state machine diagrams or sequence drawings can be pretty helpful. For state diagrams, it can be really helpful to list and explain all of the possible states and show what the transitions are. For example, in a multiplayer game, you might have states for players waiting to join a game, in active gameplay, waiting for respawn, etc. This is particularly useful since many different systems might need to deal with the state.

1

u/theobromus Nov 16 '20

One more thing: In terms of tools to use, if you're doing something complicated where the visuals matter, then something like Google Slides (or PowerPoint) or Inkscape works well.

For simpler things where I don't care about it looking so nice, then using something like a (DOT graph)[(https://en.wikipedia.org/wiki/DOT_(graph_description_language)], or (js-sequence-diagrams)[https://bramp.github.io/js-sequence-diagrams/] is usually what I'd do.

2

u/codemasonry Nov 16 '20

Why do you need to draw UML charts in the first place? I've been a professional SW engineer for a decade and I haven't drawn a single UML chart since I've graduated. I don't feel like I have missed anything.

2

u/[deleted] Nov 17 '20

You only have to make UML if you want to help to your PO with a presentation.

I also had to work for a company a few years ago where they used UML to generate workflow with a weird custom framework. I hated it and it had a really bad design. (It saved code to db and every time it needed to do something, it fetched from there and executed. Good luck with debug and performance!)

3

u/combuchan Nov 15 '20

I've been programming for most of my life, mostly self taught as well. What you talk about rarely gets easier.

Few bits of advice tho:

  • with OOP and various frameworks you should be able to spend more time on the design rather than the implementation. If you're not using passes for "not implemented," you're probably overcomplicating things at this stage.

  • there's a lot of difference between the MVP (minimum viable product) and 1.0 and 2.0. It sounds like you're suffering from feature creep which constantly plagues development.

  • you mentioned having to change the class architecture everytime you add a feature...that doesn't seem right. Interfaces and libraries should be a thing, like, accessing a database shouldn't be dependent on the database you use.

  • unless you're designing by committee, ignore the pseudocode and diagrams.

TBQH, it just doesn't seem like you're focused enough on what you want to do what you want.

2

u/roman_fyseek Nov 15 '20

I use draw.io because it's free.

2

u/moieoeoeoist Nov 15 '20

I don't see much UML, but moreso something that feels like the pseudocode version of UML. The diagram just needs to get the point across and be useful for the case at hand - it doesn't really need to be formal in any sense. Whatever software you prefer to make lines and boxes, or just whiteboarding by hand, is most of what I've seen.

1

u/[deleted] Nov 15 '20

I've been building large systems for financial clients in London for over 10 years. Very rate to see UML formally used though where it is used it would be for the following diagram types i) ERD ii) class diagram iii) sequencing iv) use case. I've not seen a UML centric tool be used in all that time. Architects and designers usually mock up in whatever software they're allowed including online free ones. Most commonly I've seen Confluence / gliffy used. Which aren't specialist tools, but support the needed shapes and connections enough and integrate to other project management tools.

1

u/Poddster Nov 15 '20

I rarely use UML, but when I do, I use https://plantuml.com. And even then I'm not making real UML diagrams, I'm just making diagrams, because I really don't care about the meaning of 50 different arrow heads. I mainly do sequence, activity (aka flow charts) and state ones, because I find those are the most meaningful and descriptive ones. I don't care about object/class diagrams, as it's basically just a crap rendition of code that something like Doxygen could generate for me.

I only really use UML it to describe things, rather than design. I use pseudo-code and ad-hoc diagrams to figure out what should happen.

spend (imo) too much time drawing out class architecture and the flow of data, only to have things change the next time I add a feature.

Why are you having to continually draw a class diagram? What are you using these visualisations for, exactly? Why do you make them? Do they actually help you?