简体   繁体   中英

Where to place view specific logic in a project structure?

I'm adding some code to my project that allows drag and drop.

The Form used for the actual dropping is obviously part of the view/presentation layer. However, there's a question mark on a TransferHandler class that contains the actual logic which detects and validates objects dropped on the window.

Considering I have presentation, logic and data layers, where could this class be placed in the structure?

If it is totally related to presentation layer, then at presentation layer.

or if the same thing is needed when your presentation changes than at logic (service) layer.

我建议使用一个表示层,但要创建一些包,例如util ,它将包含您用来帮助查看功能的所有类,例如drag-adnd-drop。

Which class is the information expert, meaning the class with the most information pertaining to the operation? It seems like the presentation layer contains the class that is the information expert, thus it would be reasonable to place the code there. Should this action affect domain objects though you may want to look at implementing a use case controller which would be called from the presentation layer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM