UML Diagrams

Many times, people go into projects without much planning before-hand which can cause many problems to arise. UML class diagrams can come to be your saving grace. With these diagrams you are able to plan out how the code will be set up down in a neat organized diagram. In these diagrams, the top section depicts the name of the class, the middle section depicts the attributes and the bottom portion is what lists the methods of the class. The top section will be bolded to indicate that it is the class name. This top section however can say whether or not the class is abstract, concrete or an interface. If the name is simply just bolded, the class is concrete. If the title is italicized, then the class is abstract. If the class is an interface, the top section will have the class name bolded and <<Interface>> listed above the name.  In these middle sections you are able to specify a lot about the attributes of the class. Any variable will be listed with a minus sign beforehand and the data type following. If any of these variables are static, then they must be underlined. This allows for someone to seamlessly set-up the class without having to worry about including the correct variables and data types. As stated before, the bottom section will contain the methods of this class. These methods will contain the name of the parameter (if applicable) and the data type of that method. If the method returns a data type, this will be listed after the parameters. UML diagrams don’t stop there though. What I was describing was one box/class, while UML diagrams can contain many, with indicators to show the relationships between them. Arrows are used to show relations between classes. An arrow going from one class to another with a hollow white tip stands for inheritance. When an arrow is going from one class to another with a dotted line, that represents implementation. A solid black arrow means there is a reference from one of those classes to another. By using UML diagrams, you are able to set up one’s entire program before writing any actual code. This allows for anyone else to be able to read and understand the code by simply going through the diagram. UML diagrams gives the coder the ability to write clean flowing code. Below is an article which goes in depth more with UML diagrams and also gives examples.

http://agilemodeling.com/artifacts/classDiagram.htm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website at WordPress.com
Get started
%d bloggers like this: