

Ask YC:  Does anybody actually use UML? - dhimes

My own experience is that class diagrams are good for organizing my thoughts about the structure of the code, but I almost never do a complete class diagram and I don't pay too much attention to the syntax.  I just use whatever notation seems reasonable.<p>I find activity diagrams are far less useful:  when I'm done I find that the act of building forces me to considerably redesign the methods.<p>And I find use cases nearly pointless.<p>So, I really have two questions:  1).  Do you use UML in the design process (if so, how)? and 2).  Do you use UML to document--that is, do you find others can understand the code more easily using UML?
======
Xichekolas
No and no.

I'll address your questions in reverse order.

2) My biggest complaint about UML is that it gets out of sync with the code,
unless you honestly take the time to outline every little change in the UML
docs alongside the code changes. (Which is great in an idealized world, but
when I'm in the zone on something, I don't want to pull away to update the
docs right that moment, so I'm bound to forget something when I do it later.)

Most IDEs have an 'outline' view, which will show roughly the same information
pulled directly from the code. Short of that, you can just use the languages
reflection features or docs to get a current view of what's available to a
class, etc.

1) As for actually using it to design things, I think it just generally goes
against my style of coding. I do things one tiny feature at a time, and
refactor when I find myself doing the same thing twice. If I took the time to
plan every method signature and relationship between classes in advance, I'd
most likely be wrong, and it would take the fun out of coding. Once you have
already gone to the trouble of thinking out every detail, actually coding it
is going to seem boring.

------
jsjenkins168
UML, or any other sort of high-level design planning, is a bit against the
hacker spirit so my guess is you wont find many here who use it. Hacking is
more bottom up, start with something simple and just keep iterating it into
something larger.

The only instances I've seen UML being useful is in very large software
projects with many people involved. Having an abstract way to convey program
structure can be useful there. But for anything less it will probably slow you
down and restrict your freedom, IMO.

~~~
dhimes
I find I need some sort of plan for all but the simplest of projects. I've
even found it valuable to return to the diagrams (class only, the others don't
work for me) to try to remember what the heck I did a few months back.

------
noodle
for my own personal work? no, i find it to be a waste of time. however, i do
diagram and plan and such. its just not structured, like UML, its more free-
form to help me plot my ideas.

for my real job? as a software engineer, yes, some, because artifacts are
required by the company (and often written into contracts), and things are
often designed by one person and coded by another. documents are required to
communicate how it "should" work, and UML is a good standard so that a
specific document can be understood by everyone.

having said all that, i can see the need for planning and structure documents
if your ideas need to be coded by others. however, if you're creating the
documents and cutting code yourself, i think they're a waste of time.

------
rincewind
I sometimes use FMC Block Diagrams and Petri Nets in order to communicate my
ideas. FMC is even more high-level than UML, but designed to be easier to grok
for non-hackers.

<http://www.fmc-modeling.org/quick-intro>

------
bayareaguy
Occasionally I work with someone who uses it (in which case I'll play along
for a little while) but otherwise no.

------
Allocator2008
From the point of view of designing unit tests, I think class diagrams in UML
are very helpful. For example, if I need a test suite in JUnit to cover
classes A,B, and C, then looking at the class diagrams for these, I can make
sure I have a unit test for each public method in A,B,and C. Obviously one
could just look at the code being tested as well, but when one has lots of
classes, each with lots of unit tests associated with it, keeping track of
these with some kind of diagram structure is helpful.

~~~
dhimes
OK, so you find them more helpful as a system-overview tool _after_ it's
designed than you do in the actual design process? (I am inferring that you
build a bit, then test, rather than the XP method of write a test--then build
to the test.)

~~~
Allocator2008
right - after the thing is built, then uml helps to write unit tests i find -
i haven't worked anywhere where people actually do the write tests first
approach - sounds good in theory but in the fast world of iterative
development it probably is too slow/inflexible in some cases

~~~
dhimes
I agree with you on the testing bit. I tried, and it seemed foolish to waste
time writing simple tests for simple things.

