Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why are there complex MVC frameworks that run in the browser in the first place? I might get some flack for this, and I'm prepared for it, but why can't we use JS as just a view manipulator? Leave data processing and business logic to the back-end, on the server, and that can take care of needing a front-end framework and large app.


> Leave data processing and business logic to the back-end, on the server

In general, this is not good. Of course there are specific applications where it's useful but in the general space of applications it would be very limiting.

For example, go to http://square.github.io/crossfilter/ and do the filtering on the 5MB data such that you wait for the histograms to be updated from the server. Instead of the tens of milliseconds, it might be seconds or tens of seconds if the server is loaded, i.e. orders of magnitude slower, not to mention unpredictable.

You can think of the network as a data flow constraint. It constrains latency, throughput, privacy and security; the constraints can be unpredictable (network outage; DoS, MiM attack etc.). There can be many good reasons for wanting part of your domain specific logic to fall on the client side.

In particular, dynamic media e.g. interactive data visualization, games and most interactive things that use data or modeling are best partly in the browser.

We're past the point where the rule of thumb was to do business logic on the server and the client only did the presenting of the view and acted as a controller.


You will still have a large app--instead of having MVC in the browser you will likely have MVC in the server.

And MVC in the browser doesn't need to be complex. It can be tiny as seen in this MVC lib for React: https://github.com/rajeev-k/mvc-router


I guess it depends on the use case. Sometimes the thing can respond quicker to user inputs if everything is in the browser.


I'm not sure what you're advocating for. Most of what you're doing in React/Angular is exactly that -- grabbing data from the backend and displaying it in some view, then handling interactions. If you're building an application and not just a website there's not really any other option.


You certainly can. Plenty of people still do.

It's hard to build in an interactive user interface when you have to wait for full page loads to complete between actions. It can be done with thoughtful planning, but sooner or letter that JS you sprinkle in to do view manipulation is going to be unwieldy.


"Why waste energy doing stuff on your machines what you can get your users to do for you?"

...is the general reasoning. However, personally, I find that unless you're very well organised, you're not saving yourself much, if anything, in the long run.


That reasoning quickly falls apart when you throw a cache in front of your backend.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: