UML (Unified Modeling Language) is not a programming language by any means, but it does assist programmers before programming. By the name you can guess that is just a modeling platform, meaning there isn't any real programming going on. UML is mostly just used for modeling classes, databases, etc. It is not necessary to use it but can really help to get your thoughts together. Most developers don't even know UML but spending 1 hour to learn a whole new skill is definitely worth the time.
Let's learn some UML!
Here is a generic class just for demonstrating purposes only.
The UML diagram would of this class would be.
|
|
If you know or are familiar with Algol, then you know that the UML uses Algol-style naming for method input parameters.
Fields:
Plus(+) | public |
Hash(#) | protected |
Minus(-) | private |
Underline(_) | static variables |
Methods:
#bar(x:type, y:type):method type
Guillemet (<< >>) = Metadata (ex. Constructors, interfaces)
Relationships:
Relization | Relization/dependency
B depends on A. Is used to realize an interface. (A is the interface) |
Generalization | B is a subclass of A. Or
B sends a message to A. This is a direct communication path. |
Aggeration | B is made up of A.
A is the part and B is the whole. B has fields of type A.
|
Composition | B aggregates A,
If B is destroyed then A is destroyed. |
General Diagrams:
This is the mere basics of UML to understand/draw a simple diagram.
UML is used as a communication tool to give a high level overview of architecture of a project. Details are not represented in UML diagrams. In class A we have `private static double c = 23.34;` but no where in the diagram we show that the value is 23.34.
It is not necessary to use UML diagrams, most developers who work on personal projects usually just use pen and paper. When working in a professional environment, UML is preferred over hand drawn diagrams.
Here are some free resources to try UML:
http://www.umlet.com/ (download)
https://www.gliffy.com (browser based)