0

Given this scenario: "Clinicians can record their own notes for each patient, viewable only by them." I would model it like this:

Clinician ----> Patient

and "Notes" as an association class between clinician and patient. However, does this mean that the "Notes" class is viewable by both clinicians and patients? If so, how do I indicate that Notes can only be viewed by clinician?

1
  • what kind of uml arrow does your ascii represent?
    – Ewan
    Commented Mar 26, 2019 at 16:39

1 Answer 1

0

Better don't. (Not saying it cannot be tweaked somehow into there, but I think it is not a good idea).

Class diagrams show properties of the actual classes, like access modifiers "private", "public" and "protected", not restrictions on the use cases for the users of your system. A view restriction of clinicians on notes is something which needs to be encoded into the application by certain features, non-features or access rights, and maybe by utilizing database access rights as well. This is a very different level of abstraction than the level a class diagram typically shows. (And don't intermix a class Clinician with the real person which sits in front of a workstation and uses the system.)

A sensible place where you can put such restrictions in UML is a use case diagram, inside the textual description of a use case "View Notes" or "Manage Notes", for example.

6
  • "Don't intermix a class Clinician with the real person which sits in front of a workstation and uses the system". This is going to leave me chuckling for many hours. The whole point of OO was that it was supposed to model "real world objects" as objects in code. That Clinician class exactly should be the only object able to access Notes as that mirrors the real world. Priceless. :-D
    – David Arno
    Commented Mar 26, 2019 at 14:47
  • @DavidArno: so what? Do you agree, disagree, or have a better answer?
    – Doc Brown
    Commented Mar 26, 2019 at 15:06
  • None of the above. It simply reinforces my view that UML is a total joke and it's a travesty that people are still being taught it.
    – David Arno
    Commented Mar 26, 2019 at 15:11
  • @DavidArno: I think you are missing the point, since the OPs problem is not really an UML problem. In a typical real-world system, Clinician, Patient, and Note will probably domain classes, maybe persisted in some DB. I doubt it will be a good idea to map the view restriction of clinicians to notes (from the described use case) directly to access restrictions on the class level. My gut tells me, these things are happening on a very different level of abstraction. Thus I think one should not try to abuse an UML class diagram for things which belong into a use case description.
    – Doc Brown
    Commented Mar 26, 2019 at 15:49
  • I think you can do it in uml but you need a extra box showing that Notes is internal to Clinician
    – Ewan
    Commented Mar 26, 2019 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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