Today I want to describe three most used basic diagrams that every developer should know:
# flow chart
The flow chart is easy to read and do not need any further explanation. It is important to know the symbolic (compare with example: start -> input -> output -> process -> case -> subprogram -> loop with process between -> end). The example is done with “PapDesigner”. I can recommend this one. 🙂
# Nassi–Shneiderman diagram
The Nassi-Shneiderman diagram is another way to visualize code. Comparing to the flow chart you can not go back if “Code is shit”. Instead you have to handle the this with a bottom-controlled-loop. As the flow chart does you read it form top to bot. Here is the an example that I did with this tool:
To model a database you always go with an entity-relationship-diagram (or entity-relationship-model). Here I want to describe the two most common notation.
# class diagram
A class diagram is one of the most used modeling-opportunities if we talk about object-orientated-programming. For this you will draw a rectangle for every class and write down the name of the class into the head of the rectangle. After this you you have to define variables and than the methods. All of them need a type, the parameter for methods and constructors and the a link to the live-time. For this we have 3 important:
- – for private things
- # for protected things
- + for public things
After doing this we have to describe the relations. for this we decide between the following types:
- association: This means that you have a relation between two tables. You mark this just with a line. Use this if you say: Table A has table B
- aggregation: This says that table A is part of table B. Use this if you can say: Table A consists of table B. For this draw a diamond into the relation at table A.
- composition: This is like an aggregation but in this case it is depending on existence. So if there is not entry of table A there is no entry in table B. For this fill the diamond black.
Anyway you always have to define the relation with 1, 0..1, 0..*, 1..*, 1, 1..6, …
For more check out Wikipedia.