Main类在MVC模式中的位置和职责

发布于 2024-12-23 12:55:57 字数 174 浏览 2 评论 0原文

我正在尝试使用 SWING 和 MVC 构建一个简单的货币转换器。我的问题是:在 MVC 模式中,Main 类通常应该位于哪里?它应该在一个单独的包中初始化模型、视图、控制器并设置连接等吗?或者 Main 类应该在 View 包中?换句话说,谁的责任是构建整个系统?

I am trying to build a simple currency converter using SWING and MVC. My question is: in an MVC pattern where should be the Main class generally located? Should it be in a separate package initializing the model, view, controller and setting up the connections etc.? or should the Main class be in the View package? In other words, whose responsibility is to build the whole system?

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

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

发布评论

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

评论(1

痞味浪人 2024-12-30 12:55:57

Main 类一般应该位于哪里?

Main 类应该只充当应用程序的初始化程序,您可以将其放置在名为

com.yourcompany.currencyconverter.app.main

的包中

是否应该在一个单独的包中初始化模型、视图、控制器并设置连接等?

是的,如果能将它与其他部分分开就好了。

where should be the Main class generally located ?

Main class should just act as initilizer of the app, you can place it in a package called

com.yourcompany.currencyconverter.app.main

Should it be in a separate package initializing the model, view, controller and setting up the connections etc. ?

Yes, it would be nice to have it separated from the rest.

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