Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

example Model-View-Presenter app in nodejs

Tags:

.net

node.js

mvp

I am exploring different MV* patterns and noticed that MVP is used very heavily in .Net applications but almost no where else.
The only other big framework that seems to incorporate it is GWT but only in some parts.

  1. Why is MVP such a microsoft thing (why is it not nearly as popular in other languages)?
  2. Is there a nodejs app/project that uses MVP (preferably with source i can look at)?
like image 695
mkoryak Avatar asked Jun 17 '13 14:06

mkoryak


2 Answers

To speak about the reason of it looking like a Microsoft thing, can be rooted to the design decisions of at least 2 large companies and their respective frameworks. Microsoft incorporated MVP into .NET. While Apple opted for MVC in Cocoa.

As for JavaScript, take a look at the recent framework Riot.js https://moot.it/blog/technology/riotjs-the-1kb-mvp-framework.html

Although it's not particularly a "node.js framework", it is an example of something moving towards this term of "Isomorphic JavaScript" (JavaScript layer ran on the client + server), and what can be brought to the table by attracting many engineers from many different experiences and backgrounds.

From that article:

Riot models define your application. It's your business logic exposed to outer world with a well-thought API. A completely isolated, testable unit that can be run in browser and server (node.js).

From my experience, and please pardon my forthcoming general blanket statement, the reason why MVP isn't seen that much in this technology is because many people either haven't heard about it, forgotten it, or simply don't see much difference from what a "Controller" is and what a "Presenter" is. This doesn't mean that there isn't a difference, and Tero Piirainen has outlined things fairly well in the Riot.js article for people coming from other JavaScript MVC frameworks.

like image 67
drkibitz Avatar answered Sep 30 '22 02:09

drkibitz


There weren't any great examples of MVP in nodejs. We did a bunch of research and implemented the TODO app using the MVP pattern in nodejs and .net.

Its not perfect yet, but I think it fills a gap. Pull requests are welcome.

https://github.com/EchoGlobalLogistics/mvp

like image 26
mkoryak Avatar answered Sep 30 '22 01:09

mkoryak