NodeJS 与大型项目的 Play 框架

发布于 2024-12-07 17:32:24 字数 663 浏览 1 评论 0原文

我真的在构建大型应用程序的两个不同堆栈之间左右为难。一方面有这个选项:

  • Node.js
    • 快递
    • 咖啡脚本
    • 喝咖啡
    • 猫鼬/mongodb 或
    • presistencejs/mysql


  • 使用 Scala 的 Play 框架
    • 使用 mysql 进行异常
    • 或 mongodb

Node.js 路径对我很有吸引力,因为我可以在我已经知道的 CoffeeScript 中编写所有服务器端代码、视图和客户端代码。如果我走这条路,我仍然不能 100% 确定我会采用哪条数据库路径。 mongoose 使得存储数据变得快速而简单,但是考虑到我所考虑的数据模型(非常 SQLish),缺乏真正的关系可能会更难以处理。

Play Framework 路径也很有吸引力,因为我在使用 Java 时很了解该框架,但我对 Scala 不太了解,所以当我学习该语言时,生产力会受到影响。 Anorm 数据库访问层很有吸引力,因为我可以手动编写我喜欢的 SQL,并将结果自动映射到对象,这节省了很多精力。

我一直倾向于 Node.js,但我并不认同最好的数据库访问层。任何人都有这方面的经验并可以分享一些见解吗?

I am really torn between two different stacks with which to build a large application. One the one hand there is this option:

  • Node.js
    • express
    • coffee script
    • coffeekup
    • mongoose/mongodb
      or
    • presistencejs/mysql

  • Play Framework w/ Scala
    • Anorm w/ mysql
    • or mongodb

The node.js path is appealing to me because i can write all of the server side code, views and client side code in coffeescript, which i already know. If i go down this road i am still not 100% sure which db path i would take. mongoose makes storing data quick and easy, but the lack of true relationships might be more difficult to work with given the data model i have in mind (very SQLish).

The Play Framework path is also appealing because i know the framework well when using Java, but i don't know much about Scala, so there would be a hit to productivity as i work through learning that language. The Anorm database access layer is appealing because i can write the SQL by hand which i would prefer, and have the results mapped to objects automatically, which saves a lot of effort.

I keep leaning towards node.js, but i'm not sold on the best db access layer to use. Anyone have any experience with any of this and can share some insight?

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

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

发布评论

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

评论(2

江南月 2024-12-14 17:32:24

您选择的堆栈应取决于应用程序的需求。让我们看看 Play 与 Node 的优势:

Node

  • 实时应用程序(聊天、提要)
  • 事件驱动架构
  • 可以执行客户端-服务器职责(例如提供文件),但不太适合此
  • 数据库管理、测试工具、等,作为附加包提供

玩吧!

  • 客户端-服务器应用程序(网站、服务)
  • 无共享架构
  • 可以执行实时任务(例如 Websockets),但不太适合此
  • 数据库管理(包括迁移!)、测试工具等内置于核心

如果您的应用程序Play 更接近传统的基于网络的模型,可能是您的最佳选择。如果您需要即时反馈和实时动态消息传递,Node 是更好的选择。

对于大型传统应用程序,请认真考虑 Play!框架由于内置的​​单元和功能测试以及数据库迁移。如果将其纳入开发过程中,这些对于最终产品按预期工作、稳定且无错误大有帮助。

The stack you choose should depend upon the needs of your application. Let's look at Play vs. Node for their strengths:

Node

  • Real-time applications (chat, feeds)
  • Event-driven architecture
  • Can perform client-server duties (e.g. serve files), but not well-suited for this
  • Database management, testing tools, etc, available as additional packages

Play!

  • Client-server applications (website, services)
  • Share-nothing architecture
  • Can perform real-time duties (e.g. Websockets), but not well-suited for this
  • Database management (including migrations!), testing tools, etc, built into core

If your application more closely matches a traditional web-based model, Play is probably your best choice. If you need immediate feedback and real-time dynamic messaging, Node is the better choice.

For large traditional applications, seriously consider the Play! Framework because of the built-in unit and functional testing along with database migrations. If incorporated into the development process, these go a long way toward an end product that works as expected and is stable and error-free.

故事与诗 2024-12-14 17:32:24

在比较 Web 框架时,您应该考虑 10 个主要类别:

  1. 学习:入门、提升、总体学习曲线。
  2. 开发:路由、模板、i18n、表单、json、xml、数据存储访问、实时网络。
  3. 测试:单元测试、功能测试、集成测试、测试覆盖率。
  4. 安全:CSRF、XSS、代码注入、标头、身份验证、安全建议。
  5. 构建:编译、运行测试、预处理静态内容(sass/less/CoffeScript)、打包。
  6. 部署:托管、监控、配置。
  7. 调试:逐步调试器、分析器、日志记录,
  8. 规模:吞吐量、延迟、并发性。
  9. 维护:代码重用、稳定性、成熟度、类型安全、IDE。
  10. 分享:开源活动、邮件列表、受欢迎程度、插件、商业支持、工作。

请查看我的演讲 Node.js 与 Play 框架,详细了解如何使用这两个框架在这 10 个维度上进行比较。

There are 10 major categories you should consider when comparing web frameworks:

  1. Learn: getting started, ramp up, overall learning curve.
  2. Develop: routing, templates, i18n, forms, json, xml, data store access, real time web.
  3. Test: unit tests, functional tests, integration tests, test coverage.
  4. Secure: CSRF, XSS, code injection, headers, authentication, security advisories.
  5. Build: compile, run tests, preprocess static content (sass/less/CoffeScript), package.
  6. Deploy: hosting, monitoring, configuration.
  7. Debug: step by step debugger, profilers, logging,
  8. Scale: throughput, latency, concurrency.
  9. Maintain: code reuse, stability, maturity, type safety, IDEs.
  10. Share: open source activity, mailing lists, popularity, plugins, commercial support, jobs.

Check out my talk Node.js vs Play Framework for a detailed breakdown of how these two frameworks compare across these 10 dimensions.

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