3

I am currently working on a Web Application. One of the objectives is to use the MVP (Model View Presentation) Design Pattern. We would like to use WebSockets to communicate between client and the server.

My question is: Do I have to put the code for WebSocket handling in the Presentation, or would it be better to put it in the Model? Or none of these propositions?

Since WebSockets are about communication I would tend to put it in Presentation but would like to know your opinion.

I know this question is kind of opinion based, but using design pattern and "smelling" when we have to use them is all about opinion and judgement, that is why I would like to ask you this question.

7
  • 1
    Possible duplicate (about MVC, but MVP is alike): softwareengineering.stackexchange.com/q/293288/173647
    – Glorfindel
    Jul 6, 2017 at 14:23
  • One of the objectives is to use the MVP (Model View Presentation) Design Pattern. -- Why? Design patterns are not objectives. The problems you're trying to solve with them are. What problems are you trying to solve by using MVP? Jul 6, 2017 at 15:48
  • I knew I should have explain why ... :) It's because my colleague who lead the project know few about design pattern and so do all of my colleagues. I am the only one knowing about it. So my "chief" asked me do some researches to approve or not the use of design pattern ( MVP). This Project has a double objective : Satisfy the client of course and introduce design pattern to my colleague (that's why I said it's an objective)
    – Freddykong
    Jul 6, 2017 at 15:55
  • Where do you usually put repositories? Or DAOs? The websocket is a DataSource (more or less)
    – Laiv
    Jul 6, 2017 at 18:29
  • 1
    Why does the message have to go through the Presentation? The MV* patterns only concern themselves with user-interaction and it is kinda implicit that the Model can change its state autonomously due to triggers that are not initiated by the user. Jul 13, 2017 at 10:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.