What is the difference of the MVC web for MVC desktop / mobile?

9

Apparently the MVC template as it is used in web (RubyOnRails, CakePHP, etc.) is different from MVC as an employee in desktop (Delphi, Android, etc.). In the desktop it seems to be more coupled to the interface than in the web .

  • What's the difference between the two variants?
  • Theoretically, you can use MVC as it is used in web on the desktop (creating separate model classes, drivers, and windows). Is this recommended?
asked by anonymous 07.07.2014 / 12:56

1 answer

9

Consider the image:

ItdescribestherelationshipbetweenthepartsintheMVCmodel.

Noticethenotificationarrow.

MVCfordesktop/mobile

Inthedesktop/mobileversionthatworkswhereModel,VisionandControllerareinthesameenvironment,itispossiblefortheModeltoeasilynotifytheChangeView.

Yes,itisadvisabletofollowthisdivision.Infact,itisoftenadisciplineprocesstouselayeringindesktopapplicationsbecauseyoucaneasilycircumventanylayerwithoutmanyimmediateconsequences,aswellasthechaosthatthecodebecomesovertime.

Forexample,notusingaControllertoproperlymanagetheactionsperformedbytheuserandtheupdatesintheVisiongenerallyleadsto"spaghetti logic", that is, one where you never know properly what the state of the system is and what can happen if the user takes an "unexpected" action.

I will not discuss the implementation details because it is not my specialty and would greatly lengthen the response.

MVC for web

In the web version, because of the non-persistent connection feature of the HTTP protocol and most web servers, the Model can not generally notify the View unless a new request is made by the user or any agent on the client.

This scenario may change when using technologies such as Websockets or some equivalent mechanism, such as in the case of OS notifications, but it is something that, say, still goes beyond the rule.

    
07.07.2014 / 15:56