1

For the following UML Class diagram, I have a reference data type Nurse, and I am using it in Hospital Class, is it needed all the time to describe the reference data types in UML Class diagram? Is this diagram created correctly? Also, is it needed for the methods that don't return anything to mention: void?

enter image description here

2

Assuming you mean 'reference data type' rather than an association to a data type which is realised in the implementation language as a reference, then

is it needed all the time to describe the reference data types in UML Class diagram?

The vast majority of software isn't described using UML, so no. If you find it is useful to describe something in UML or you believe whoever is reading your diagram will find it useful, include it.

Most UML classifiers are assumed to represent reference types, a stereotype is usually used if they are not.

Is this diagram created correctly?

Syntactically, yes. It shows a number of operations and properties of two types, and a composition association between Hospital (whole end) and Nurse (part end). Whether this matches the semantics of your problem domain is not something anyone can answer.

Also, is it needed for the methods that don't return anything to mention: void?

Partly this is a convention of the implementation language, and partly of your processes. If the return type is not specified, then your process might be to mark that as a missing detail in the model, and it might be that your team has the convention that it is treated as void. It depends how detailed you want your model to be whether this matters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.