-1

So, I'm trying to get better with labeling my class diagrams and wanted to know if I have laid out the class diagrams here in the correct fashion. I've tried adding in an abstract class for Blood Pressure as both classes have similar methods which both can implement.

image

Edit: After a few changes the current design of the diagram is as following:

image

  • 1
    What do you mean by "correct"? According to which rules? I mean, it's pretty obvious that you are doing an unnecessarily complex connector layout. – qwerty_so Mar 26 '19 at 08:10
  • Not too sure what a connector layout is but How would it be unnecessary however? – Julius Velvet Mar 26 '19 at 08:12
  • Actually I don't get what you are asking. Reading once again you seem to mix things. Your diagram is a mess. You can not associate abstract classes. And `<>` is an arbitrary stereotype, not an abstract class. – qwerty_so Mar 26 '19 at 08:52
  • 2
    @ThomasKilian while I agree that the diagram is a mess, I don't get one thing. Why do you say you couldn't associate abstract classes? I would say this is absolutely possible and normal. – Ister Mar 26 '19 at 09:49
  • @Ister You can associate only those classes that can be instantiated. Abstract classes can not be instantiated. You can associate a class that has inherited from an abstract class, though. – qwerty_so Mar 26 '19 at 12:09
  • 2
    @ThomasKilian still I don't see why so. At the abstract level you know that a Vehicle has to have a Propulsion without presupposing any details about that. Both Vehicle and Propulsion are abstract. Now when you get into details you'll have various types of Vehicles, e.g. SailBoat will have Sail as propulsion while JetPlane will have JetEngine. You then specialise the association that was on the abstract level when going to a detail but still there is no reason not to associate them in the first place. I'm pretty sure you'll find this kind of examples in the specification. – Ister Mar 26 '19 at 12:43
  • @Ister I agree with you, of course this is possible – bruno Mar 26 '19 at 13:11
  • @ThomasKilian why are you saying that ? where is the quiproquo ? The UML meta model itself has a lot of associations with abstract classes, randomly _Classifier_ is an abstract metaclass and _Class_ has the association `nestedClassifier : Classifier [0..*]` – bruno Mar 26 '19 at 13:18
  • 1
    @Ister Hmm. Yeah, I'm probably on the wrong boat. An association to an abstract class means that it relates to an instance which had inherited from the abstract class. My bad. – qwerty_so Mar 26 '19 at 15:42
  • @bruno quiproquo? If you meant _quid pro quo_ I wouldn't understand the question either. – qwerty_so Mar 26 '19 at 15:46
  • @ThomasKilian yes _quid pro quo_ (in french we attach the words in one), I was just surprised by a so false remark from you and looking at a possible misunderstanding between you and us – bruno Mar 26 '19 at 15:50

1 Answers1

2

abstract class for Blood Pressure as both classes have similar methods which both can implement.

in that case you have that :

enter image description here

or that :

enter image description here

(I hidden class compartments to not have to enter the members)

There is no standard/normalized stereotype AbstractClass (nor abstract), the class have the attribute isAbstract and if it is true the name is drawn in italic as you did

bruno
  • 32,421
  • 7
  • 25
  • 37
  • Thank you, I've cleaned it up a bit now in a way that you did but i'm just wondering - since monitor vitals is trying to get the details from the blood pressure and other vital sign measurements wouldn't it be better to get the details from the classes inheriting the abstract class? So far it looks like this: https://gyazo.com/e025bbc315b99241fe576ec5a9aaa6e6 – Julius Velvet Mar 26 '19 at 17:25
  • @JuliusVelvet it is difficult to answer, all depends on the way the details are given by the classes, they can be generic or not, you may have to know the real type of the BloodPressure or not – bruno Mar 26 '19 at 17:31
  • I'm not quite sure what you mean by real type of bloodpressure, do you mean the methods inside? – Julius Velvet Mar 26 '19 at 17:49
  • @JuliusVelvet no, to know if it is a InvasiveBloodPressure or a NonInvasiveBloodPressure to call method who only exist in one of them – bruno Mar 26 '19 at 18:42
  • So how it's going to be selected which one is being used? Well the nurse/doctor will be operating the monitor to decide which one will be called. I think i'll need a class that handles input which decides which out of the two are used if that's what you mean. – Julius Velvet Mar 26 '19 at 19:27
  • @JuliusVelvet no, this is not what I wanted to say. For instance If the method is defined abstract (e.g. pure virtual in C++) on _BloodPressure_ it has to be is defined on the 2 sub classes so the right effective method will be called without having to do something special. I was speaking about *possible* very specific cases where a method is only defined on one of the two sub classes. – bruno Mar 26 '19 at 19:34
  • Ah I understand now. So the Blood pressure has all the base properties which i'm wanting to be of real type but the methods inside Non invasive blood pressure and invasive blood pressure are the ones which differ the two classes. Would I need to move these up into the abstract class and then define them re-define them in the classes extending the abstract class? – Julius Velvet Mar 26 '19 at 21:11
  • @JuliusVelvet depends on the case, some method can be only defined on BloodPressure, while some others are specialized on one (and return just error indication on the other) or the two sub classes and in that last case are abstract on BloodPressure. The problem is I can only speak in theory because I know nothing about the subject you model – bruno Mar 26 '19 at 21:31
  • To provide some clarification, The monitoring system is gathering all the vital signs and generating a report. Blood pressure is one of them. So, the monitor vitals is a class that will gather the vital signs from the vital sign classes and then generate a report. there's 2 types of blood pressures, one which has a delayed time interval and takes readings every 10 mins whilst the other has a default of 50 seconds. Another difference is that one has to display a waveform whilst the other doesn't. That's the brief but here's what i've done so far based on the feedback I've gotten here: – Julius Velvet Mar 26 '19 at 22:41
  • Though, I've added in 2 abstract classes for limit and wavelength. I'm not quite sure if that is correct. – Julius Velvet Mar 26 '19 at 22:48