views:

552

answers:

10
+6  Q: 

How is UML useful?

Possible Duplicate:
Is UML practical?

I am doing UML in my University and I do not understand why we must do it. It looks like a model for OO databases but I think I can write Java without UML.

I want to know the technical reasons why UML is used in the professional world; why it is important. Not just learn it because the professor says so.

+10  A: 

You may be able to write java pretty well but UML is language agnostic. When it comes to communicating your design to colleagues you need a common "language". UML is the best way, I think, for doing so.

I am right now preparing for a meeting with a colleague to discuss api design given some scenarios he has come up with. A couple of sequence diagrams unambiguously shows how we are proposing to accommodate his needs. He doesn't need to be a java programmer to understand the design.

Paul McKenzie
I think I understand what you mean. It is like a powerpoint for programmers if you permit the comparison, right?
loriser
+1 for that comparison :-)
Martin Wickman
No, it's an actual language for communicating. I studied design patterns (and some Java) at university. As soon as I started my first job (.NET) I found I had a common language with which I could communicate with my colleagues. Without being able to sketch UML and talk in OO design abstractions (which you can't really describe efficiently without UML) I could not have got started as quickly as I did. It's important stuff.
Joe
+13  A: 

We find that UML is useful as an exchange medium, for sketching out for other people what the design will look like before committing it to code or for visualising what existing code looks like.

We're not particularly concerned about our UML matching the spec, both because none of us are entirely sure which fiddly bits we're supposed to use and because the diagrams usually don't last very long. I'd say we probably draw more UML using a pencil than using software.

Practical uses include trying to nail down where a new class fits into an existing hierarchy, working out where things are in the hierarchy to refactor interfaces, sketching potential designs for discussion before starting new features.

Andrew Aylett
Can you explain more?
loriser
Thank very much to all, I now understand what was the meaning. We do not program in groups and so I did not understood. I like other things like function specification but uml seemed useless.
loriser
A: 

Gives you a visual design of the project

Sri Kumar
+2  A: 

UML can be used for different purposes:

1) before writing code you (with your team) want to come to agreement about component (or even project) architecture to avoid misunderstanding and that's why you can draw class diagram

2) you want to create use-cases diagram and put it at some place which you see often to remember which main functions should your application do (and on which tasks you should concentrate more)

3) class diagram can serve as a documentation of projects macro-architecture. It's vitally important to have such class diagram if you want to invite new developers to your project.

Roman
+1  A: 

As a programmer, you might get a job to build a small web site for a small shop. It might be very simple. You might have no design documents, no UML, no tests, and it might work just fine.

But you might get a job to work on air traffic control systems, or an antilock braking system for a car, or a trading system for one of the world's largest banks. In cases like this, you won't be writing code yourself. You'll have to convince several other people that your code is really going to do the right thing - not just your colleagues, but independent auditors. To help them understand the code quickly, they'll want some diagrams. What could be better than a standard notation to help them get a picture of your code? (Of course, you'll need your design documentation and tests as well!)

John
+1  A: 

Edited this to add make another point. UML is used for design which is like creating blueprint for your software. A simple analogy will be like designing and reviewing the architecture diagram for a house/building before actually constructing it. It acts as a medium for communicating, thinking through and challenging the design. When finalized it then becomes the blueprint - reference point for then building your software.


UML isnt used for OO database design. It is used to model different design of the software. For example you will use Use Case to capture system boundary or actors/users interaction with the system. This design helps to capture user requirements. You use static diagrams to model class and their relationship. You may model interaction using sequence diagram and it is extremely useful in IMHO.

Ok, now back to answering your specific question. If you are working on small assignment and single person project, yes you can argue that the UML isn't going to add much values. In real life where you have bigger team and different roles (architect, designer, BA, developer and etc) UML is used to capture and communicate architecture, requirements and design information in a consistent and standard manner. For example I may design a banking model based on requirement information and use case diagrams supplied by the designer/BA and I will transform into technical design of class diagram and capture their interaction and message flow using sequence diagram and passed on to 4 other members in my team to implement that.

Fadrian Sudaman
A: 

I have over 10 yrs experience hands on coding, C/C++/C# in the financial sector and not once have I ever used UML.
It could be a reflection on my jobs haha, but I have never seen it in use either. Design documents tend to be based on written descriptions and/or storyboarding.
The crux seems to be that by the time you have written an accurate and comprehensive UML diagram that is to be turned into code, you may as well have written the code.
There is the argument that if you need to convey a design to others it can be useful... but I guess you'd need to know:

  • how often do you need to do such a design (from scratch presumably)? Not many systems are so greenfield as to need such a full on design.
  • will the people you're telling it to actually understand it as fully as you, who has put the time in to make it? Business people are unlikely to.
  • will flow diagrams/storyboards/talking be sufficient? Generally a lot more intuitive and reaches a wider audience.
  • will business people want you to start implementing it before you can properly complete it due to competition/prototype needs? Is such a formal diagram going to matter if by the time you've done it, the requirements change so much you have to remake it?

    I guess if you're writing real software eg aircraft control systems, it needs to be a rock design but I don't know if this is the method.
A: 

As a developper, you will hardly have to make uml schemas, but you will have to read a lot of them.

Class diagram is cool, but always out of date, so not really important.

On the other hand, a specification without use case and activity diagram is a whole lot harder to read and translate into code.

Maxime ARNSTAMM
A: 

One of the adavantage I found with UML is that it helps one to communicate the design and the intent in a platform agnostic manner.

Let us say you are writing a code using API methods provided by some other team. If you have a UML diagram (class diagram) of the API classes and if proper naming conventions are adhered to, then you can easily figure out what are all API methods you can expect to be available for a particular class. For example, if the class diagram indicates relation between two classes to be aggregation and the cardinality is 1..* you can reasonably assume that the container class might provide an iterator to access the constituent elements. In the present case, developer using the API classes can get high level overview of the API classes quickly when compared to going through API documentation and figuring out methods he wants to use.

sateesh
+2  A: 

Don't make the mistake of thinking UML is only class diagrams. Use-case diagrams are a communication bridge between developers and managers, sequence diagrams allow the exact algorithm to be described visually, etc.

Using these together, UML does two things:

  1. As someone writing an application it forces you to map out how your software fits together before you start churning out code
  2. As someone joining as team, it can let you get an overview of the code-base more quickly than trawling through all the code.
John
I see. I like point 2.
loriser