TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

All the UML you need to know

176 pointsby CaRDiaKover 9 years ago

18 comments

m_fayerover 9 years ago
My first real-world job in the industry was in a large-ish shop that worked as follows:<p>Create a full-detail schematic of the system in version-controlled UML.<p>At some point, &quot;deploy&quot; the UML by printing it into a 4 cm-thick binder of paper, then distribute these binders to the head architects.<p>Iterate on the UML until the architects are happy. (The architects spent many years trying to auto-generate code from the UML diagrams and have the results &quot;fleshed out&quot; by lowest-bidder consultants, though this never really worked. Their stated goal was to no longer have to write any code in house, but rather nothing but UML.)<p>Begin implementing the system in house with auto-generated code from the binder-of-UML as a baseline, after the lowest-bidder consultants had failed.<p>Quickly get into big fights between the coders-on-the-ground and management when it was found that the UML diagrams contained major architectural flaws and the UML-phase would not, actually, account for 80% of the project&#x27;s duration and budget. Needless to say, more than half of the projects failed entirely.<p>This experience nearly made me leave the industry, before I discovered that there was plenty of software being written in a saner way. This was more than a decade ago, but to this day, just seeing UML diagrams turns my stomach.
评论 #10379848 未加载
评论 #10380667 未加载
评论 #10379515 未加载
评论 #10379614 未加载
评论 #10381745 未加载
评论 #10380046 未加载
评论 #10379994 未加载
评论 #10379639 未加载
putzdownover 9 years ago
No, all the UML you need to know is this: (1) draw and label a box for each class; (2) draw an arrow from one class to another to show dependency; (3) draw a different kind of arrow from one class to another to show inheritance; (4) [bonus material, for super-geniuses like you] use regex-style symbols * , +, 1 and suchlike to mark the ends of dependency arrows in order to indicate when you have one-to-one or one-to-many relationships and so forth.<p>There. My 20+ years of experience in software architecture in various fields from games to networking tells me that you now know enough to work out the classes and their relationships in a large software system.<p>Don&#x27;t fuss around with &quot;aggregation&quot; or &quot;composition&quot; or whatever. Don&#x27;t spell out functions (though occasionally I&#x27;ll jot one below a line to remind myself what the salient feature of the dependency is). And by no means write the class properties, their types, or their access specifiers (public, protected...)—this is way too much detail. A UML diagram is useful in modeling broad object relationships in a system. If you want to work out what properties a class should have, write the damn class. Any software developer worth his salt can figure out the code from a high-level diagram; don&#x27;t write the code for him. Or do, but then don&#x27;t call it an architectural diagram.<p>I know there&#x27;s a whole culture of software development where architects design code but don&#x27;t dirty their hands with writing it, then hand it off to underlings who type it up for them, and so on down some kind of techno-bureaucracy Great Chain of Being. Rubbish. Code architecture <i>is</i> a thing and some kind of diagramming is helpful, but UML as such is the sort of busywork and IRS-style hierarchism that marks bloated government jobs, not real productivity or real teamwork.<p>Give UML a miss and use something very, very simple.
cjgover 9 years ago
I&#x27;ve generally found UML to be a complete waste of time.<p>I&#x27;d rather outline the major components of a system by drawing (on real paper) simple boxes and lines, or write the code that implements the system.<p>Not sure what code-as-picture achieves - it&#x27;s generally has worse tooling (less editable, less versionable, etc.) and tends to be used by &#x27;architects&#x27; who don&#x27;t write code, only for that UML to be essentially ignored by the coders on the ground.
评论 #10379466 未加载
评论 #10379944 未加载
评论 #10379571 未加载
评论 #10379708 未加载
评论 #10379747 未加载
评论 #10379568 未加载
评论 #10379540 未加载
评论 #10379508 未加载
评论 #10379465 未加载
评论 #10379797 未加载
评论 #10379478 未加载
评论 #10380106 未加载
评论 #10379609 未加载
评论 #10379451 未加载
jasodeover 9 years ago
Diagrams&#x2F;notation I&#x27;ve found useful:<p>++ <i>E-R (entity-relationship) diagrams</i>. I find it easier to look at boxses for each table follow the lines signifying relationships to other boxes. The &quot;crows feet&quot; can signify 1-to-many. The diagram is easier than reading a sequential list of SQL CREATE TABLE statements and making a mental note of &quot;FOREIGN KEY&quot; strings and mentally backtracking to the parent table.<p>++ <i>swim lanes</i> to show how the &quot;state&quot; of a system is supposed to change with &quot;time&quot;. This can succinctly show how data &quot;flows&quot; without having to actually run a program and watch variables in a debugger to manually recreate the &quot;swim lane&quot; in your head.<p>++ <i>truth tables</i> to summarize combinations of valid&#x2F;invalid business rules and associated side effects. A grid is easier than parsing a long (and often nested) list of if&#x2F;then&#x2F;else&#x2F;switch statements.<p>As for UML, the notation never seems to be that succinct or helpful to me. On the surface level, it seems that UML (for code) should have the same return-on-investment as E-R (for db tables) but it doesn&#x27;t in my experience.<p>I also wonder if there is a cultural component to UML usage. It doesn&#x27;t seem like tech companies (such as Microsoft&#x2F;Google&#x2F;Amazon&#x2F;Ubisoft&#x2F;etc) internally use UML as a prerequisite step for building systems. On the other hand, I could see more UML usage at non-tech companies (such as banks&#x2F;manufacturing&#x2F;government) building line-of-business CRUD apps. Grady Booch (Booch &amp; UML notation) did consulting about software methodology at non-tech companies so that may have been a factor.
DanielBMarkhamover 9 years ago
I love UML. UML is overused. More people need to know UML. The less UML you do, the better.<p>I believe all of these statements to be true.<p>I had a contract many years ago with a large insurer. Their development process basically consisted of drawing really complex UML diagrams, then hitting the Big Red Button and having the modeling tool generate 40,000 lines of framework code. The chief architect explained to me that really the only work required was just a tiny bit of business logic in the appropriate places.<p>Fortunately I was not part of the main dev team, which for some strange reason (at least in the lead architect&#x27;s mind) had the damnedest time with this system. My job was to create an internal permissions system. Given app X, user Y, and action Z, was the action allowed or not.<p>I looked at the problem for a while, and no matter how I thought about it, to me I had three lookup tables and one method. Boom, I&#x27;m done.<p>The lead architect wanted me to still draw a diagram with one class, push the button, and get the 40,000 lines of code. For some reason, this did not appeal to me.<p>Took me about 3 weeks to convince him that really 20 lines or so of code was all we needed. I still had to draw the diagram, though.<p>That&#x27;s the horror story -- one among dozens I have. But on the flip side, I&#x27;ve been with teams that interviewed the customer while sketching out a domain model. Since we all understood UML, a quick and lightweight sketch using the appropriate notation got agreement on a ton of detail just taking 30 minutes or so. That would have been very difficult using a conversation or word processor. Sketching without some common lightweight understanding could have led to rookie errors.<p>There is nothing in this world better for getting quick technical agreement on complex problems than group sketching using lightweight UML. The trick is sticking to the absolute minimum.
评论 #10382182 未加载
评论 #10381810 未加载
评论 #10380794 未加载
edpichlerover 9 years ago
Plot twist: this article doesn&#x27;t have all the UML you need to know, it&#x27;s just the class diagram.<p>Particularly, for my personal projects, I use the Use Cases diagram to map the requirements and the features my application will have, associated with my prototypes. Other diagrams, like Class diagram, usually I use just to map the Domain before develop the persistence. This is how all my projects start, even if I am working alone. It is good to me and it&#x27;s part of my creative process.
jmartinpetersenover 9 years ago
Key quote: &quot;Keep in mind that UML is a communication tool, and you can omit details that are not necessary for expressing your message.&quot;
评论 #10379544 未加载
评论 #10379475 未加载
skrebbelover 9 years ago
The complete overapplication of UML for many years gave UML an undeservedly bad name. The top comments in this thread are testament to that: many programmers are simply all too happy to go &quot;haha! UML! that&#x27;s for enterprise losers in suits who prefer paper over working code!&quot;<p>Thing is, the core elements of UML are very useful in communicating a design or an idea. Class diagrams are a <i>great</i> way to discuss an OO-ish codebase in front of a whiteboard (or any data model, really). When you do that, it <i>really helps</i> when everybody knows that an arrow in static UML diagram types means &quot;dependency&quot; and not &quot;the data flows from here to there&quot;.<p>Similarly, I still haven&#x27;t seen a better way to visualise state than with a UML state chart.<p>It&#x27;s also very nice if you can draw a UML object diagram that people understand (looks like a class diagram, except you basically draw a hypothetical runtime situation of instantiated classes and you underline the object identifier names). This works best when people understand that the picture on the left is a class diagram (design time) and the one on the right is an object diagram (runtime example) of the same classes. This is not complicated stuff, but it doesn&#x27;t really work as well when half the team thinks UML is for losers.<p>Now, bear with me, I&#x27;ll be the first to agree, UML is a bloated piece of shit. Package diagrams, wtf, who needs that? Use case diagrams that show <i>which use cases are specified</i>, instead of how the use cases go - seriously? Activity diagrams so you can draw a 5-line method on an entire sheet of paper, big fucking what the hell were you guys thinking?? Why do I even know what this stuff is? What a waste of time - even the decent diagram types have 60% bullshit syntax and only 40% useful stuff. And message sequence charts are nice enough for protocols but impossible to draw right.<p>But to dismiss UML just because some enterprise architects went a little overboard in 2002 is a bit like dismissing all of OOP because 15-level inheritance hierarchies used to be hip.<p>I wish we could agree on a tiny subset of UML that actually makes sense, and all learn that. This post makes a good start for class diagrams, although IMO even the ball-and-socket notation is overblown nonsense from a time long gone. Maybe we should do this, and give it a separate name.<p>On a mildly related note, one thing I like about OOP is that you can draw pictures of it easily. Does anyone here know of a good way to visualize functional code structure? You can draw a dependency chart of modules of functions but that only gets you so far.
评论 #10380943 未加载
mark_l_watsonover 9 years ago
Too bad he skipped sequence diagrams, saying that he had already covered them in class.<p>Years ago I co-authored a book on UML, but the only UML diagrams that I still use are sequence diagrams which I think are great for explaining interactions between objects or separate services.
omelletover 9 years ago
This should have linked to a blank page.
vorticoover 9 years ago
Yup, even if you never write OOP code, this is a somewhat common language you will encounter between colleagues, so it is worth knowing exactly what is on this page.
评论 #10379346 未加载
saikiover 9 years ago
Personally I use quite a lot sketch like UML and find it very helpful for clarifying complex environments or ideas that are not clear yet. Most of the time sketches are just boxes, circles and lines, but those communicates and clarifies the problem for others very well. I don&#x27;t use lot of time when sketching, system can be described graphically very quickly, just to get the idea out or it usually goes too detailed. We have also built a tool that helps sketching systems with remote teammates (<a href="https:&#x2F;&#x2F;sketchboard.me" rel="nofollow">https:&#x2F;&#x2F;sketchboard.me</a>).
评论 #10380451 未加载
lisperover 9 years ago
Graphical representations are useful for representing <i>spatial</i> relationships because then you can take advantage of the inverse-GPU in the human visual cortex to do a lot of computation for you. But software doesn&#x27;t have spatial relationships because it doesn&#x27;t exist in space. So trying to represent software concepts graphically is generally doomed to fail. There are a few exceptions, like code indentation, but there&#x27;s a reason that flowcharts aren&#x27;t used much any more.
cubanoover 9 years ago
I&#x27;ve never figured out how to use UML abstractions to fix client and&#x2F;or user production bugs, or met anyone else who could, so who the hell has the time?
agentgtover 9 years ago
I&#x27;m just curious and I&#x27;m not trying to be snide but is there any spec that OMG has produced that people actually like and use still? (they are also makers of CORBA)<p>I live in the Boston rt128 area and I pass OMG&#x27;s building all the time and I just have no idea how they are still in business (they are near Trip Advisors new complete awesome building).<p>I wonder how many massive companies continuously donate to OMG and do not realize it.
makecheckover 9 years ago
Just think of UML as the C++ of diagrams: it is sometimes the best way to produce the result that you need but you have to choose a sane subset.
crocalover 9 years ago
All the UML I need to know? Frankly? Nothing. I am surprised people would still consider this thing useful.
CrLfover 9 years ago
The general feeling about UML is that it&#x27;s overkill for most projects and actively harmful when used to generate code. On the other hand, most agree that parts of UML are useful as communication tools.<p>However, UML was designed as a standard, near-UML is not UML. Ergo, UML is useless.<p>I feel better already.