我对表达3层架构的不同可能性感到困惑。
Data-Access-Layer
Business-Layer
Presentation Layer (User Interface)或
Database (aka Backend)
Business-Layer
Presentation Layer (User Interface)为什么可以跳过第一种方法中的数据库?两者都使用数据库!数据库是否属于分层?!
什么是错的,什么是对的?
你们谁能澄清这一点吗?
发布于 2010-04-14 19:57:47
Data-Access-Layer
Business-Layer
Presentation Layer (User Interface)数据访问层不一定是数据库。它可以是一个XML文件。它可能是一个RSS源。它可能是一个外部应用程序。它可以是您喜欢的任何东西,将数据放入您的应用程序中。
所以这真的是:
[Data-Source]
Data-Access-Layer
Business-Layer
Presentation Layer (User Interface)其中[Data-Source]是数据库、XML、RSS或其他任何东西。我更喜欢把数据源本身看作是一个驱动程序,而不是一个层。
这种方法的灵活性允许您在不接触应用程序的其余部分的情况下交换数据源。因此,如果开始时使用XML文件作为后端数据,然后希望将其更改为数据库,则只需接触DAL层-应用程序的其余部分并不关心,只要它仍然以相同的格式获取数据即可。
发布于 2010-04-14 19:53:53
您是否考虑过您的dal可能不使用数据库,它可以使用xml文件?
第一种方法是使用一个更抽象的概念,这就是3层。
每一层中的内容取决于各层的实现。你可能会发现你在GUI/DB/BizLogic‘程序’之间混合了你的层,但在抽象中,你仍然控制着这些层。
数据访问层
业务层
表示层(用户界面)
考虑到上述情况,你可以编写连接到你的数据库的代码。这是DAL还是逻辑?
我认为这是DAL,因为您正在编写代码来访问数据。
发布于 2010-04-14 19:55:06
表示层
This is the topmost level of the application. The presentation tier displays information related to such services as browsing merchandise, purchasing, and shopping cart contents. It communicates with other tiers by outputting results to the browser/client tier and all other tiers in the network. 应用层(业务逻辑/逻辑层/数据访问层/中间层)
The logic tier is pulled out from the presentation tier and, as its own layer, it controls an application’s functionality by performing detailed processing. 数据层
This tier consists of Database Servers. Here information is stored and retrieved. This tier keeps data neutral and independent from application servers or business logic. Giving data its own tier also improves scalability and performance. 有关更多详细信息,请参阅以下内容:
http://en.wikipedia.org/wiki/Multitier_architecture
https://stackoverflow.com/questions/2637054
复制相似问题