my dog learned polymorphism*
The moose likes OO, Patterns, UML and Refactoring and the fly likes (How) do you use UML? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "(How) do you use UML?" Watch "(How) do you use UML?" New topic
Author

(How) do you use UML?

Michael Herrmann
Ranch Hand

Joined: Dec 06, 2003
Posts: 60
Hi,

I would be interested in how (often) and for what tasks (of which size) you use UML, and which types of diagrams you use. Do you model absolutely everything before coding it or do you model only the tricky parts?
How often does it occur that you can't stick to your diagrams and what's the reason if this happens? It is clear to me, that using UML when working in a team is quite essential, so all those questions are aimed at programs you do alone(feel free to post your experiences with a team, though).

Many questions by a curious student who is about to learn and apply UML
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I use UML very rarely these days. In practice, I manage to communicate most of my stuff using informal sketches and sort of quasi-UML diagrams (remotely looking like UML's class diagrams and collaboration diagrams).

I never put more details on the "boxes" than an occasional method name here or there. That is, I'm not trying to build the software on paper first. I'm using UML sketches as a tool for communicating -- to others and myself -- about the more essential things, whatever those are at the time.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Sathya Srinivasan
Ranch Hand

Joined: Jan 29, 2002
Posts: 379
I agree.

I use 'informal' UML diagrams like Lasse mentioned - sketches on the board that give you a good visual idea about the associations. I find this especially helpful when some association just does not feel right or gel with other objects.

One advice I would give to wanna-be users is not to consider UML as the only way or even the right way to represent a model. Insistence of UML for modeling (as opposed to informal diagrams that convey the same information) will result in spending too much time on getting a pretty picture but will make the developer lose focus.

As UML notations are fairly commonplace and the terms in UML (class diagrams, etc.) are now at least recognized by most developers, the notations themselves can be very helpful in communicating ideas to team members.

But care has to be taken not to get carried away. Don't try to model each and every attribute or each and every method. MDA (Model Driven Architecture) still has a long way to go and tools are not that equipped to generate perfect code from UML diagrams. Till then, if a diagram on the napkin works, take a picture and paste in your design document.


Cheers, Sathya Srinivasan - SCJP 1.2, SCWCD 1.2, SCMAD 1.0
Co-Author of Whizlabs SCMAD Certification Exam Simulator and SCMAD Exam Guide Book
Daniel Mayer
Ranch Hand

Joined: Sep 09, 2004
Posts: 103
Full agreement.

When I use UML, I use it to communicate a specific concept of existing code, or (more seldom) to brainstorm possible rough designs. If I do the latter, I haven't yet once implemented such a design as-is - I always learned something additional about it while coding it and were able to incorporate that earning into the code. I tend to think of this as a good thing.

You might also want to take a look at http://www.agilemodeling.com/
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
By the way, my current project (in which I have a sort of managerish role so I don't get to code nearly as much as I'd like to) we have a big whiteboard in the middle of the floor. The whiteboard is two-sided and flips around. The other side of the whiteboard is for tracking tasks (features, defects, that sort of stuff) and the other is for "model storming" sessions. Beyond what happens on the whiteboard, the team has only one formal model -- a domain model maintained with Rational Rose.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Ditto to the above.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Svend Rost
Ranch Hand

Joined: Oct 23, 2002
Posts: 904
Hi,

The reason that im responding to this post is due to the
fact that you write
Many questions by a curious student who is about to learn and apply UML

If your a student (as in taking a class about OO UML or something similar) then I would recommend you to follow the UML specifications - I'd like to
recommend Martin Fowlers UML Distilled which is very good. You can,
ofcause, also take a look at www.uml.org.

If your a software developer then it doesn't realy matter how you "draw"
your models of the system your building - what's essential is that others
understand what's happening (which is why UML is great, as it gives developers
a common vocabulary).


Apart from that remark, then I'll "simply" concur with what the other respondents write. The diagrams
that I make are often rather informal because what matter is the meaning
and the structure of the system.
When I use UML I normaly make class diagrams and
interaction diagarms (for essential parts of the system). If your working on a big project you might find that mixing UML with pattern labels (called pattern:role annotation as proposed by Gamma) makes the class diagram more readable and informative.

As another side note, I find CRC cards usefull in the design fase.

/Svend Rost
[ September 20, 2004: Message edited by: Svend Rost ]
Scott Ambler
author
Ranch Hand

Joined: Dec 12, 2003
Posts: 608
You might find www.agilemodeling.com/essays/umlDiagrams.htm to be of interest as well as www.agilemodeling.com/style/

As far as sketching goes, my observation is that roughly 90% of all modeling is done on a whiteboard. I really wish people would talk about this more and start to hammer on the academics and the book writers who seem to miss this fact. How many modeling books can you point to which include whiteboard sketches in them, for example? Something is seriously wrong in this industry, IMHO.

- Scott


<a href="http://www-306.ibm.com/software/rational/bios/ambler.html" target="_blank" rel="nofollow">Scott W. Ambler</a><br />Practice Leader Agile Development, IBM Rational<br /> <br />Now available: <a href="http://www.ambysoft.com/books/refactoringDatabases.html" target="_blank" rel="nofollow">Refactoring Databases: Evolutionary Database Design</a>
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Scott Ambler:
How many modeling books can you point to which include whiteboard sketches in them, for example?


Well, Robert Martin's "UML for Java Programmers" at least has 7 references to the term "white board" in the index. It also discusses what diagrams to make persistent and which to throw away; as well as some tips on how to make UML more white board friendly (ever tried to write in italics or to draw dashed lines?).


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Most of our modeling is just whiteboarded boxes and arrows, but we've had a number of discussions get complex enough that sequence diagrams of some detail were useful. I fire up Rose for those because it's a pretty fair diagram editor and I can play with different ideas quickly. I do quick & dirty diagrams, no attempt to maintain a master model over time.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: (How) do you use UML?
 
Similar Threads
UML to generated Java (and sql)? Does this work? Good tools?
Current UML
* Winners: Java/J2EE Job Interview Companion
UML 2.0 Certification topics, coverage, prices and links
perspectives for UML diagrams