can I use different two class diagrams for two different environments? [closed]

北城余情 提交于 2019-12-20 06:18:23

问题


I'm working on project for two different environment which are iOS and Android, and it's so hared for me to design one class diagram for two different systems, so can I use two class diagrams, one for android and the other for iOS ?

I mean it doesn't make any sense to use the same class diagram for two environments which use two different programming languages


回答1:


It doesn't matter how many diagrams you make. In general it is considered a best practice not to overload your diagram with too much classes, so you should have multiple class diagrams for anything but a trivial model.

But I'm guessing the real question is whether or not you want to use the same classes when targeting a different platform.

That depends on the level of abstraction you are modelling on. MDA defines three levels

  • CIM -> Computation Independent Model
  • PIM -> Platform Independent Model
  • PSM -> Platform Specific Model

Which more or less is equivalent to the Conceptual/Logical/Physical layers defined in Zachman or IAF.

So if you are modeling on a CIM or PIM level then you should use the same classes. If you are modeling on a PSM level then should to use different classes for the parts of your system that depend on any of the specifics of your platform.

Look into the Adapter Pattern for a possible way to deal with multiple platforms while still keeping the core business logic of your application platform independent.




回答2:


UML diagrams weren't made for specific languages or APIs. If both languages are object oriented, I don't see any why you would need two different class diagrams.

The problem I think is that you are putting in "too much" details in the UML, which should not be the case. Let the UML communicate the structure, behavior or nature of interaction between the classes not the nity-gritty details.

It would only make more sense when the languages are significantly different like javascript is event-driven, while LISP is functional.



来源:https://stackoverflow.com/questions/34163034/can-i-use-different-two-class-diagrams-for-two-different-environments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!