C++和多层架构

发布于 2024-10-18 13:50:26 字数 265 浏览 7 评论 0原文

为了在最近的课程作业中获得最高分,我被要求使用 C++ 和多层编程开发一个特定的应用程序。

我了解多层架构背后的理论以及该应用程序的哪些部分属于哪一层,但我没有实际实现“n 层”应用程序的经验。

层必须完全分离吗?例如,一个进程运行数据库,一个进程运行 UI,第三个进程管理两者之间的交互?

或者只是像将应用程序分成代码层一样简单,以便 GUI 不会直接访问数据库等。

您对 C++ 多层编程的任何建议将不胜感激: )

To attain the highest grade in a recent piece of coursework I'm asked to develop a specific application using c++ and multi-tier programming.

I understand the theory behind multi-tier architecture and exactly which parts of this application belong to which layer but i have no experience actually implementing "n-tier" applications.

Do the tier have to be fully separated? for example one process running a database, one process running a UI and a third managing interactions between the two?

Or is it just as simple as separating the application into layers of code so that the GUI does not directly access the database etc..

Any tips you have for multi-tier programming in C++ will be greatly appreciated :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

肩上的翅膀 2024-10-25 13:50:26

通常,当您听到“n 层”应用程序框架(在大学中)时,它们指的是逻辑分组的功能。它可以在单独的进程中,但不一定如此。模型-控制-视图体系结构或MFC 的文档-视图体系结构都是分层的。您只想将存储/读取应用程序业务规则中的数据的代码与该信息的显示方式分开。

注意:有些人认为“n 层”是客户端-服务器设置,但由于这是课程作业,我严重怀疑你的教授是否希望将其作为他的解决方案)。

Usually, when you hear "n-tier" application framework (in college), they are referring to logically grouped functionality. It can be in separate processes, but is not necessarily the case. The Model-Control-View architecture or MFC's Document-View architecture are both layered. You simply want to separate code that stores/reads data from business rules of your application from how that information is displayed.

NOTE: There are some that consider "n-tier" to be a client-server setup, but as this is coursework, I doubt seriously your professor wants that as his solution).

音栖息无 2024-10-25 13:50:26

进程之间通信的一种方法是使用管道。另一个是共享内存。还有一个是 boost 的 IPC(无论如何肯定它有一个)。

有很多。 IPC(进程间通信)是关键搜索术语。

One method of communication between processes is to use pipes. Another is shared memory. Yet another is boost's IPC (pretty sure it has one anyway).

There's lots. IPC (interprocess communication) is the key search term.

江心雾 2024-10-25 13:50:26

大学教授的要求常常与现实世界并不相符。由于你的成绩取决于它,我强烈建议你询问你的教授他的意思。

在现实世界中,您不必将各层物理地分离到它们自己的进程中才能将其称为多层架构,但如果需要的话,更改它应该不难。例如,如果您从使用本地数据库更改为远程数据库,则只需更改数据库层实现即可。

College professors often have requirements that don't really match up with the real world. As your grade depends on it, I highly recommend asking your professor what he means.

In the real world, you don't have to physically separate the tiers into their own processes to call it a multitier architecture, but if it is ever required, it shouldn't be difficult to change it to do so. For example, if you change from using a local database to a remote database, only the database layer implementation should have to change.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文