Reading Object Model Diagrams
In last post we learned about UML - Class types. If anyone missed please refer the below link :
In this post we will discuss about UML Properties and Methods.
UML Property symbols:
Read and write property -
All classes have properties on then shown with the barbell symbol as shown above. Chicken class has 3 properties like Age, Color and Name.
Read only property -
Some of the properties have a left-sided barbell, means we can only get this value, we cannot change it to something else (read only). Here, for chicken we could get reference to its wing, but we could not give it a different wing.
Write only property -
Some of the properties have a right-side barbell. we can edit the value, but we can never find out what it is. Here, for chicken we could change the password, but we never know what the current password setting is.
Property Values -
To the right of each property are a colon and then a type. This is the value type that the property holds. Age holds an integer value like 1,2,3... Some properties holds objects or reference of objects. So, here, the wing property would give us a reference to a wing object.
UML Method symbols:
Classes also have methods. Methods are shown with an arrow symbol. Methods are like the actions that an object can perform.
Some methods returns the values, some don't. Fly does not return any value. It carries out its operation and that't it. LayEgg, on the other hand, carries out it's operation and returns an Egg object for us. This is how chicken creates egg with LayEgg method.
No comments:
Post a Comment