English 中文(简体)
我如何避免后端和前端的逻辑重复?
原标题:How can I avoid of logic duplication on backend and frontend?

我有一个网络应用程序,在“强势”PHP后端 < /强'和“强势”前端 < /强'上有一些逻辑计算重复,我无法完全将逻辑定位为后端并每次提出AJAX请求,即使有有效的缓存,因为高性能要求和应用程序反应灵敏。

你能建议一个解决这个问题的方法吗?

最佳回答

如果结果不再被进一步使用,我会把计算逻辑移到前端。

例如:如果您正在做简单的按揭计算,而终端用户在输入付款等之后想要简单的答案。然后使用前端。

另一方面,如果计算的结果必须用网格、电子邮件或数据库等物体在线下进一步使用,那么在后端保持逻辑。

问题回答

暂无回答




相关问题
SQL Server - How many users do I *really* need?

I m setting up an application, and I m looking into purchasing a license for SQL Server. My question is pretty simple (though may have a complicated answer...) How many users accounts do I really ...

Object Graph / Persistence Question

I m currently working with an online application that requires multiple screens/steps in order to complete. The application domain is modeled using an object graph. Persistence to and from a database ...

Why does stack get truncated in Exception.StackTrace?

Why does the high part of the stack (in Exception.StackTrace) gets truncated? Let s see a simple example: public void ExternalMethod() { InternalMethod(); } public void InternalMethod() { try ...

ASP.NET MVC and Service Oriented Architecture

I would like to know how do i incorporate a feature like wcf within and MVC application. My current idea of the architecture is as follows: EntityFramework -> ASP.NET MVC (Views) ...

热门标签