When specifying class fields in class diagram you can provide their types, e.g.:
- name : string
- age : int
Same with methods:
+ getName() : string
You can also omit the type if the method doesn't have/return one:
+ ClassName() // constructor
+ performCleanup() // returns void
But what if the diagram only presents some example fields (i.e. presenting the design pattern idea) and the concrete type is unimportant? Do I pick any type at random for the field or should I omit the type?
- sampleField1 : int // arbitrary type
- sampleField2 // no type specified
- Also, is providing field types obligatory in general? Should I always do it?