AbdalAlsal
AbdalAlsal

Reputation: 77

Implementing UML Sequence and Class Diagram

I've recently came across this question and I'm just curious if my work is correct, and if not, where I made a mistake.

My Task:

a) Officials are appointed on a temporary or permanent basis. Professors are civil servants who may be appointed for a fixed term or for life. Professors are also either teaching professors or heads of study. Employees of a scientific institute are civil servants or employees. Professors are subordinate to the Minister of Science, employees of the scientific institute are subordinate to the professors. Both professors and employees of the scientific institute work at the scientific institute. The institute can call meetings with professors and staff.

Create the appropriate UML Class Diagram.

My answer:

enter image description here


b) A professor can inform the secretariat that he or she would like to have an appointment with staff of the scientific institute. The secretariat will then send a list of proposed appointments to all the staff concerned. As soon as the secretariat has received feedback from all staff members, it will send the final appointment to each of them.

Create the corresponding UML Sequence Diagram.

My answer:

enter image description here

c) Implement the process from (b) in Java (method bodies are sufficient!). In doing so, adhere to the classes, abstract classes, and interfaces defined in (a).

My answer:

I tried to solve this problem, but I didn't get any further, especially that it is about solving the task with abstract classes and interfaces. I think this subtask can be solved without abstract classes and interfaces, right?

should the scientific institute be implemented as an abstract class?

Can someone please explain it to me? Thanks so much :)

Upvotes: 2

Views: 446

Answers (1)

Christophe
Christophe

Reputation: 73366

Class diagram

There is a mistake since professor are civil-servant who are co-worker who are subordinate to professor: in your narrative a professor is subordinate of the ministry and not of another professor.

What I understand from the narrative is that employees who work in a scientific institute and are subordinate to a professor can only be employee.

In your diagram, a part of the narrative disappeared :

  • there are only fulltime_employee. It's not clear how these relate to temporary and permanent employee.
  • there is no meeting which would relate to staff and professors.
  • where is the staff ?

In your diagram there is also a rigidity that does not exist in the real world: a professor may start career and one day be promoted to director of studies. It's still the same professor. It's just the role that changed. Here I suggest to think about preferring composition over inheritance.

Sequence

Seems reasonable to me, except that:

  • you should really show separate execution activity as separate: the secretariat send activity then it's over. Aoother activity starts when the feedback is received. And in some cases (last feed back received), it's followed by another distinct activity to send the final confirmation.
  • you should take care about the arrows. Most of the requests are asynchronous and have an open arrow head.
  • The send final is a normal asynchronous message when sent to the staff (plain line, open head), but it's an answer to the professor (here you can keep the dotted line.

Implementation

This is a complex question on its own. Better ask this as a separate question. But you need to be more specific.

Hint: an abstract class, is a class that cannot be instantiated: classes inheriting from it must implement its abstract methods so that objects can be instantiated.

Upvotes: 2

Related Questions