Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Separating client side logic from server side logic in a reusable way using MVC

Tags:

People also ask

Is MVC client side or server side?

ASP.Net MVC is a server side framework. (An alternative is ASP.Net WebForms: your events are posts to the same page, abstracted to seem like desktop application events.) If you want, you can output data as JSON or XML and use this with a client side JavaScript framework to update your views.

Is MVC server side technology?

ASP.NET Core MVC is a server-side MVC framework. In a server-side application the client's request to view a page depends on the server delivering the correct content for that specific page (HTML, CSS, files, etc.) to the client. The client then renders this content for the user.

What is the difference between client side and server side processing?

Client-side means that the action takes place on the user's (the client's) computer. Server-side means that the action takes place on a web server. Client-side means that the action takes place on the user's (the client's) computer. Server-side means that the action takes place on a web server.


Before you answer, this question is complicated:

  1. We are developing in asp.net / asp.net mvc / jQuery but I'm open to solutions on any platform using any framework
  2. I think logic like sorting / hiding columns / re-arranging columns / validation (where it makes sense) should be on the client-side
  3. I think logic like searching / updating the db / running workflows should be on the server side (just because of security / debugging reasons)

What we are trying to do is NOT CREATE A MESS in our UI by writing a bunch of JavaScript to deal with the same feature in different contexts. I understand that I can use a JavaScript file + object oriented JavaScript, I'm looking for the pattern that makes it all easier.

One solution proposed was to have an MVC model on both the client and server side, where we can encapsulate JavaScript functionality in client side controllers, then use them in different parts of the site. However, this means that we have 2 MVC implementations!

Is this overkill? How would you expand on this solution? What other solutions are there?