如何将 Catalyst 的各个部分集成到旧版 Web 应用程序中?

发布于 2024-08-04 11:04:37 字数 259 浏览 6 评论 0原文

我正在努力解决一个经典的遗留项目:手动 URL 解析和组合、手动路由等。了解一点 Catalyst 我渴望至少其中一些概念,例如正确的(又名透明的)URL 路由和参数解析。理想情况下,我只是使用 Catalyst 并完成它,但考虑到它是一个遗留项目,我想我只有两个选择:

  1. 以某种方式在我的项目中使用 Catalyst 的一部分 - 我不确定这是否可行。是吗?
  2. 使用单个模块实现 Catalyst 框架的一部分——您有什么经验,可以推荐哪些模块?

I'm struggling with a classic legacy project: manual URL parsing and composition, manual routing etc. Knowing a bit of Catalyst I long for at least some of the concepts, for example proper (a.k.a. transparent) URL routing and parameter parsing for example. Ideally, I'd just use Catalyst and be done with it, but given it's a legacy project, I guess I only have two options:

  1. Somehow use parts of Catalyst in my project -- which I'm not sure is possible. Is it?
  2. Use single modules implementing parts of Catalyst's framework -- what are you experiences, which modules can be recommended?

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

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

发布评论

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

评论(1

勿忘初心 2024-08-11 11:04:37

我还没有尝试过这个,但从我的尝试来看,我认为采用遗留项目并半途“催化”它并不是一个真正可行的选择。我不认为 Catalyst 应该以这种方式使用,并且尝试这样做可能会比它值得付出更多的努力,特别是因为你会遇到其他人不熟悉的边缘情况与(因为他们不知道您的遗留代码)。

仅仅让遗留项目适应 MVC 就已经够困难的了,甚至不考虑使用哪个框架。因此,恕我直言,如果您打算这样做,请寻求一个完整的解决方案:

  • 如果您可以分离遗留代码库中的关注点,那么从那时起就可以将项目完全置于 Catalyst 下是值得的。
  • 如果您无法在 MVC 意义上分离关注点,那么您将不会从使用 Catalyst 或其一部分中获得任何实质性的好处。您的精力最好花在简单的老式重构上。

I have not tried this, but from what I have tried I don't think that it's really a viable option to take a legacy project and "Catalyze" it halfway. I don't think Catalyst is meant to be used in that way, and trying to do so will probably be far more effort than it is worth, especially since you'll be hitting edge cases all over the place that nobody else has any familiarity with (since they don't know about your legacy code).

It's hard enough just getting a legacy project to fit into MVC, without even considering which framework to use. So, IMHO, if you're going to do it, go for a full-assed solution:

  • If you can separate concerns in the legacy codebase, the effort from that point to getting the project fully under Catalyst is worth it.
  • If you can't separate concerns in the MVC sense, you aren't going to get any substantial benefit from using Catalyst or parts of it. Your efforts will be better spent on plain ole-fashioned refactoring.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文