应用程序中的“业务逻辑”究竟由什么组成? [英] What exactly consists of 'Business Logic' in an application?

查看:505
本文介绍了应用程序中的“业务逻辑”究竟由什么组成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听过无数次我们不应该将业务逻辑与其他代码或类似的语句混在一起。我认为我编写的每个代码(我指的是处理步骤)都由与业务需求相关的逻辑组成。

I have heard umpteen times that we 'should not mix business logic with other code' or statements like that. I think every single code I write (processing steps I mean) consists of logic that is related to the business requirements..

有人可以告诉我究竟由业务逻辑组成的是什么?如何将其与其他代码区分开?有一些简单的测试可以确定什么是业务逻辑,什么不是业务逻辑?

Can anyone tell me what exactly consists of business logic? How can it be distinguished from other code? Is there some simple test to determine what is business logic and what is not?

推荐答案

用简单的英语简单地定义您正在做的事情。当您以商业眼光谈论事情时,例如让那些人受苦,窃取金钱,摧毁这部分土地,您所谈论的是商业层面。为了明确起见,让您兴奋的事情就在这里。

Simply define what you are doing in plain English. When you are saying things businesswise, like "make those suffer", "steal that money", "destroy this portion of earth" you are talking about business layer. To make it clear, things that get you excited go here.

当您说在这里显示,不要显示,使其更美丽时您正在谈论的是表示层。这些都是使您的设计师兴奋的事情。

When you are saying "show this here", "do not show that", "make it more beautiful" you are talking about the presentation layer. These are the things that get your designers excited.

当您说保存,从数据库中获取,更新,删除之类的内容时,等等。您正在谈论数据层。这些都是告诉您不惜一切代价永久保留的东西。

When you are saying things like "save this", "get this from database", "update", "delete", etc. you are talking about the data layer. These are the things that tell you what to keep forever at all costs.

这篇关于应用程序中的“业务逻辑”究竟由什么组成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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