0
|
Bruno Brant · 技术社区 · 14 年前 |
![]() |
1
2
在图表工具中,形状的X/Y位置是域数据的一部分(形状的位置是图表的一部分-没有它就不能绘制图表),使用这些X/Y坐标并在屏幕上绘制形状的代码是表示层的一部分。 我知道有些人认为只用于显示的数据应该单独保存,但在我曾经处理过的每个项目中,单独保存的数据都是一个巨大的维护和支持噩梦。 在一个简单的图表工具中(如果工具只是绘制和编辑图表,而没有基于图表进行任何花哨的处理),没有业务逻辑,只有绘制和编辑图表的代码(属于表示层)和图表数据(即域模型)。 If there is no business logic, by using a separate set of objects for domain and presentation you'll have to duplicate all your model data twice (once in the model objects and once in the presentation objects) and you won't get any advantages from separating the business logic from the presentation (because there isn't any). 另一方面,如果您确实有一些对数据运行的算法,那么通过将图形数据与绘图代码分离,您确实可以获得一些东西——您可以在工具之外运行算法,您可以有更好的自动化测试等。 另外,如果编写另一个对相同数据进行操作的系统,则至少可以共享模型定义,如果将其与图形代码分开,则可以保存/加载代码。 So, let's summarize:
|
![]() |
2
1
I think you need to make sure you're keeping the what and the how separate. What you are displaying is abstract, sets of coordinates, shape types. How you're displaying it is very specific. I'd make sure the domain model dealt purely with the what and the view layer dealt uniquely with the how. It's hard to get into specifics though without knowing more about your app. |
![]() |
3
0
Maybe this helps a bit, |
![]() |
KollegeBo · 触发更新的POST或GET 3 年前 |
![]() |
mariolototo · 无法获取“/”express以外的路线 3 年前 |
![]() |
nnmmss · 根据查询字符串值激活li 3 年前 |
![]() |
Ezaldeen Ezaldeen · pdo包装器最后一个id返回0 3 年前 |
![]() |
Bruno Vavretchek · JSON模型建议 7 年前 |
![]() |
Pasha · 如何在@RequestBody中传递2个对象? 7 年前 |