(Basic) UML
The Unified Modeling Language Links to an external site. is a general-purpose, developmental, modeling language in the field of software engineering, that is intended to provide a standard way to visualize the design of a system. Its a really cool thing.
We are not going to teach every detail of UML (maybe some real basics). But, we have taught and observed many students' learning experience. Object-oriented Programming (OOP) is sometimes challenging to grasp. (I did not really get it the first time I saw it.) What tends to help people learn OOP is to ignore the specifics and look at the high level. One way to look at the high level is to use UML. (The variant you will see in these modules to explain concepts are drastic simplifications of a much stronger spec.)
The basic hypothesis I contend - Coding is simpler to comprehend via pictures (or at least data visualization).
Take our car example:
OR - Would you rather look at this to see what is going on:
I like the pictures and boxes.
So when we introduce OOP concepts, or complicated coding frameworks we will accompany them with (poor) UML diagram that to express what is happening at a high level.
So think of your code in pictures/graphs - of boxes and lines. It makes it easier.
(You can actually design a system spec fully Links to an external site. this way or simulation framework Links to an external site..)
Basics of Class Diagrams
The class diagram is composed of three parts:
- Upper section - Name of the class - This section is always required whether you are talking about the classifier or an object.
- Middle Section - Attributes of the class - The attributes describe the variables that describe the qualities of the class. This is only required when describing a specific instance of a class.
- Bottom section - Class operations (methods) - Displayed in list format, each operation takes up its own line. The operations describe how a class can interact with data.
Member Access Modifier
All classes have different access levels depending on the access modifier (visiblity). Here are the following access levels with their corresponding symbols:
- Public (+)
- Private (-)
- Protected (#)
- Package (~)
- Derived (/)
- Static (underlined)