OpenPonk / openponk

The OpenPonk modeling platform
https://openponk.github.io/
MIT License
43 stars 9 forks source link

[Bug] Error when listing elements by type when Note is present #82

Closed sdasda7777 closed 1 year ago

sdasda7777 commented 1 year ago

image

image

image

sdasda7777 commented 1 year ago

@JanBliznicenko I tried looking into this as well, but I'm not completely sure how to approach it. It would definitely be possible to just add these methods to Note, but I don't think that's exactly a good idea from object design perspective. Another solution might be to not show Notes on there at all, but someone might want to be able to hide them, so it's also probably not the best. Last option I can think of would be to add all elements something like a "displayName" method, and return umlClassName in UML elements and "Note" for Notes.

sdasda7777 commented 1 year ago

Two more things:

I noticed that OPNote and OPUMLElement actually don't share any class in the hierarchy besides Object - that means that for the third approach the hierarchy would probably also have to be reworked (having two completely unrelated classes have methods sharing name and calling the two unrelated methods based on the object at hand just screams bad OOP, imo).

I also noticed that OPNote doesn't have option to hide it, unlike most of the objects. That means the second approach might actually be the correct one?

JanBliznicenko commented 1 year ago

Yes, the Note (and Boundary) are a little special. While all the other elements are parts of the model (root UML package in this case), Note and Boundary are completely outside of the model (even though they have model classes OPNote and OPBoundary). And as you correctly say, they should not even support the hiding and showing, because "show" basically means "create diagram representation of the model element" and "hide" means "remove diagram representation of the model element, but keep the model element itself". Since note and boundary are not model elements, hide = remove and show makes no sense.