Dancer 与 Catalyst [Perl Web 框架]
您对两者有何看法? 我开始阅读一本关于 Catalyst 的书,发现它与 Dancer 相比相当复杂。 所以现在我正在尝试 Dancer,它看起来更容易学习并且更“人性化”。
What do you think about both?
I began reading a book about Catalyst, and found it pretty complex as compared to Dancer.
so now I'm giving Dancer a try, and it looks easier to learn and more "human friendly".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为大卫的评论非常准确和出色。然而,作为一个在这两个领域都进行过开发但不是其中任何一个的开发人员的人,也许我可以在差异方面更加客观(和技术性)。
这两个框架都提供了 Web MVC 范例的变体。
Catalyst 的主要抽象级别是控制器。 Catalyst 希望您以某种逻辑方式将单独的逻辑分解为单独的包(登录代码位于此处,注册代码位于此处,搜索功能位于此处 >)。如果您有一个程序员团队,那么这种方法非常有效,因为每个人都可以处理单独的文件,而不会在合并过程中互相干扰。 Catalyst 提供了很多工具来使控制器逻辑可扩展且灵活,我认为最重要的例子是链式操作,它可以让您针对任何给定的请求拆分并构建复杂的流程。缺点是,将业务逻辑放入控制器中变得非常诱人,并且最终会在控制器中得到非常丰富的逻辑,而它(理论上)属于模型。
Dancer 的主要抽象层次是路线。我对 Dancer 的经验是,这会导致应用程序变得更小。我的经验部分与这样的事实有关:我已经在 Catalyst 中处理了数千行应用程序,但我还没有编写一个超过 200 行的 Dancer 应用程序(范围要小得多)。但我认为这个经验是正确的。 Dancer 的推动力在于保持控制器逻辑非常精简,因为它没有与 Catalyst 相同的工具来管理复杂行为。
老实说,我很享受在这两家公司工作。他们对于如何编写 Web 应用程序提出了不同的看法。考虑到时间和意愿,我建议最终学习两者。
I think David's comment is very accurate and excellent. However, as someone who has done development in both but is not a developer on either perhaps I can be slightly more objective (and technical) in what the differences are.
Both frameworks provide a variation on the Web MVC paradigm.
Catalyst's main level of abstraction is the Controller. Catalyst expects you to break separate logic out into separate packages in some logical fashion (Login code goes here, Registration code goes there, Search functionality over here). This works incredibly well if you have a team of programmers since each of you can work on separate files and not step all over each other during merges. Catalyst provides a lot of tools for making the Controller logic extensible and flexible, I think the premier example of this is Chained actions which let you split up and build a complex flow for any given request. The downside is that it becomes very seductive to put your business logic into the Controllers and you end up with very fat logic in the Controllers where it (theoretically) belongs in the Model.
Dancer's main level of abstraction is the Route. My experience with Dancer is this leads to much smaller applications. Partly my experience here is tinged with the fact that I have dealt with several thousand line applications in Catalyst but I have yet to write a Dancer app that is longer than 200 lines (with a much smaller scope). I think however that this experience holds true. The push in Dancer is in keeping the Controller logic very thin because it doesn't have the same tools for managing complex behaviors there that Catalyst does.
Honestly I've enjoyed working in both of them. They both provide different opinions on what writing a web application is supposed to be. I would, given the time and inclination, recommend learning both ultimately.
这是一个有点主观的问题,但我会尽力客观地给你答案。首先,免责声明:我是 Dancer 开发团队的一员,所以我的观点当然应该被认为有些偏见:)
Catalyst 比 Dancer 使用更广泛,因此它背后有更多的社区支持 - 如果您要寻找具有使用任一框架经验的承包商,比如说,您会更愿意可能会找到使用过 Catalyst 的开发人员。因此,如果您正在寻求商业支持,那么这将是选择 Catalyst 的一个很好的理由。
Dancer 是一个较年轻的项目,更多地针对较小的项目,使启动和运行快速而轻松,并尝试不妨碍你。但这并不是说 Dancer 不适合大型项目。同样不妨碍你的习惯意味着你可以以适合你的方式组织你的项目。
然而,它已经获得了很多支持,并且 IRC 和邮件列表上有帮助的用户和开发人员社区不断增长,并且一直在发布越来越多有用的插件。与 Catalyst 一样,Dancer 的设计使您可以选择自己喜欢的模板引擎、会话存储后端等,并且如果需要,可以通过编写自己的插件轻松扩展框架。
要了解用户评价,了解人们对 Dancer 的评价,请参阅新网站主页底部的部分:http:// /www.perldancer.org/
为了展示其他选项,还有 Mojolicious,另一个现代 Perl Web 框架最近越来越受欢迎。
This is a somewhat subjective question, but I'll try to give you an answer in an objective way. First things first, a disclaimer: I'm part of the Dancer development team, so my opinion should of course be considered somewhat biased :)
Catalyst is more widely used than Dancer, and so there's more community support behind it - if you were to look for contractors with experience working with either framework, say, you'd be more likely to find developers who've used Catalyst. So, if you're looking for commercial support, that would be a good reason to choose Catalyst.
Dancer is a younger project, and targeted more towards smaller projects, making getting up and running quick and easy, and trying to stay out of your way. That's not to say that Dancer isn't suitable for larger projects, however; the same habit of staying out of your way means you can organise your project in the way that suits you.
However, it has picked up a lot of support, and there's a growing community of helpful users and developers on IRC and the mailing list, and more and more useful plugins being released all the time. As with Catalyst, Dancer is designed so that you can pick and choose your preferred template engine, session storage backend etc, and it's easy to extend the framework by writing your own plugins if you need to.
For user testimonials to see what people say about Dancer, see the section at the bottom of the homepage on the new website: http://www.perldancer.org/
In the interests of showing other options, there's also Mojolicious, another modern Perl web framework which has been gaining in popularity lately.
Catalyst 提供了与 Dancer 相同的抽象,Dancer 的优势或者说 Catalyst 的弱点或者更确切地说 Dancer 的弱点在于 Catalyst 如何迫使开发人员遵守 Perl OO 最佳实践和 MVC 设计模式。做webapp一段时间后,这一切都会变得显而易见。
Catalyst provides the same abstraction that Dancer does, Dancer's strength or rather Catalyst's weakness or rather Dancer's weakness is in how Catalyst forces the developer to adhere to Perl OO best practices and the MVC design pattern. After doing webapps for a while, this will all become apparent.