JavaScript的MVC VS ASP.NET MVC(方式的差异) [英] JavaScript MVC vs ASP.NET MVC (Pattern Differences)

查看:106
本文介绍了JavaScript的MVC VS ASP.NET MVC(方式的差异)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以最近我的几个采访,问题被不断地想出在所有四个是'哪里点¯x驻留在MVC应用程序?

So recently I was on a few interviews and the question that was continually coming up on all four was 'Where does X reside in an MVC app?'

问题是,我是面试的公司每次都不同。两个是predominantly ASP.NET MVC /微软商店和其他两个用Ext.js,Ember.js,Angular.js,或其他一些JavaScript MVC框架。

The problem was that the company that I was interviewing with was different each time. Two were predominantly ASP.NET MVC / Microsoft shops and the other two were using Ext.js, Ember.js, Angular.js, or some other JavaScript MVC frameworks.

哪里的业务逻辑驻留?

ASP.NET MVC

在服务器上的一个单独的层

In a separate layer on the server

的JavaScript MVC

从理论上说,上或周围控制器... 但后来它并不安全...

Theoretically, on or around the controllers... But then it's not secure...

在哪里居住验证?

ASP.NET MVC

在模型和视图使用它只是警惕的问题,控制器尝试提交之前验证模型的状态。

In the model, and the view uses it to simply alert to problems, controller validates model state before attempting to commit.

的JavaScript MVC

那么,在模型中,但...嗯还挺视图,但控制器足见...

Well, in the model but... Well kinda in the view, but the controller serves it to...

我的问题是什么是被支持的事实,而不是在下面的基本功能需要的地方相比,ASP.NET MVC时的JavaScript MVC将应用于意见分歧 -

My question is what are the differences that are supportable by facts and not opinions in where the following basic functions need to be applied in JavaScript MVC when compared to ASP.NET MVC -

哪里的业务逻辑驻留?

哪里验证需要应用?

哪里验证需要确认?

还有什么其他问题,你有没有借钱给这一个?

What other questions do you have to lend to this one?

推荐答案

这是根据我的经验我看来,我目前工作的一个angularjs / servicestack应用,所以在这里我们去:

This is my opinion based on my experience, currently I'm working on a angularjs/servicestack app, so here we go:

有对这些问题没有正确的答案,但我想最好的更多的常识胜:)

There's no correct answers for these questions but I guess the best with more common sense wins :)

哪里的业务逻辑驻留?
这基本上可以申请使用MVC / PHP / Rails的Ø任何其他服务器端编程语言,因为我使用的服务堆栈我在我所称为商业服务分开的所有业务运营的MVC它可能是一样的,还记得控制器不管你用什么框架是协调的意见和模型之间的通信的人,我不明白为什么任何你需要把任何类型的逻辑到控制器。

Where does business logic reside? This basically could apply using MVC/php/Rails o any other server side programming language, since I'm using Service stack I've separated all the business operations in what I've called business services in MVC it could be the same, remember the controller no matter what framework you're using is the one that orchestrate the communication between the views and the model, I don't see why any you'll need to put any kind of logic into the controllers.

关于向关系的Javascript /服务器架构我看到JS MVC作为调用我的REST服务的客户端(或与JS库/网页API一个MVC应用程序等),JS的客户端只是发送/从获取信息该服务,你可以在那里进行小的客户端操作,但并不严格与您的系统模型的操作,MVC的JS框架更分离关注引领TDD和DI的一种方式(至少AngularJS)

regarding to the relationship Javascript/Server framework I see the JS MVC as a client that calls my REST service (or a MVC app with a js library/ Web API, etc), the js client just sends/gets the information from the service, you can perform small client operations there but not the operations that are strictly tied to your system model, the MVC for the Js framework is more a way of separating concerns to lead TDD and DI (at least AngularJS)

哪里验证需要应用?
每到一处,客户端验证适合好的,因为它们给用户即时反馈,但你必须仔细检查所有输入的服务器上。

Where does validation need to be applied? Everywhere, the client validations suits nice since they gives instant feedback to the user, but you have to double check all the inputs in the server as well.

有关我所有的架构可以留在你将如何组织层和层方面非常相似,在什么它改变了你到底是要如何present的信息给客户端,如果它与一个奇特的无回传客户端框架或只是简单的看法。

For me all the architecture could remain very similar in terms of how you're going to organize the layers and tiers, at the end what it changes is how you're going to present the information to the client if it's with a fancy no postback client framework or just plain views.

只是我的两分钱在这里,
我希望这是有意义的。

Just my two cents here, I hope this make sense.

这篇关于JavaScript的MVC VS ASP.NET MVC(方式的差异)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆