0

I'm trying to figure out what design pattern this web application would be described as using, if any:

https://dl.dropboxusercontent.com/u/37346336/design-pattern.png

It seems MVC-ish to me, with the Model being the top three sections, the View being the HTML rendered for the user, and the Controller being the JavaScript for the single screen that both deals with user input and gets/sets data with the REST API.

The 'single page application' code continues to listen for URI changes and contains functions that continue to be used application-wide, which is why I've indicated that all user input goes through it (rather than directly to the screen-specific JavaScript). But the screen-specific JavaScript deals with any events, etc within a particular screen. Unless a screen is loaded nothing is shown to the user except the header.

Maybe I'm trying too hard to make this fit the term 'MVC', but then is it something else? Or is 'SPA' just used for anything like this? I mean it is clearly an SPA, I'm just wondering if there's anything more specific and suitable.

tereško
  • 58,060
  • 25
  • 98
  • 150
Ryan Williams
  • 695
  • 5
  • 11

2 Answers2

1

It's not MVC, although I do not know what it's called. It could be the basis for an MVC setup using something like emberJS, AngularJS, GWT, etc, but this setup is too generic to draw that conclusion.

It is however a very nice setup that I use a lot. First calling in the static HTML as a one pager that contains all the templates and then pulling in the data using JavaScript calls. I personally prefer to not include any user specific content in the initial HTML so it is highly cashable (even in a CDN if needed) and only pull in user data through AJAX calls.

Koen Peters
  • 12,798
  • 6
  • 36
  • 59
0

I myself prefer not to calling it an MVC, I can not figure out any controller object here.

In MVC there should be a master controller which receives all requests, control them (like user data validation, page navigation, session management.... all should be done in the controller).

So the controller in my view should be developed with a server side technology so it can do all the controller duties.

Alireza Fattahi
  • 42,517
  • 14
  • 123
  • 173
  • seems you've not worked with javascript frameworks that manage all those same controller duties client side...and models are retrieved from any number of API's on any number of non related servers. – charlietfl Dec 01 '13 at 20:38
  • Well, I am not familiar with js Frameworks. But as far as I know you can not manager user session (create session) via client. Session is a server side per-user-data-stores, the server must accept user request and assign a session key to it. Please let mw know if I am wrong? – Alireza Fattahi Dec 02 '13 at 06:10
  • 1
    get used to it...more and more moving to the client using nothing but javascript and cloud API's – charlietfl Dec 02 '13 at 06:16