使用什么框架来引导我的第一个生产 scala 项目?

发布于 2024-09-06 14:19:11 字数 525 浏览 8 评论 0原文

我正在第一次涉足 scala 的生产应用程序。 该应用程序当前打包为 war 文件。 我的计划是创建 scala 编译工件的 jar 文件,并将其添加到 war 文件的 lib 文件夹中。 我的增强功能是通过 Jersey & 公开的 mysql 支持的应用程序。将通过 HttpClient 调用与第 3 方站点集成。我知道如何通过纯 java 来做到这一点。但是当在 scala 中执行此操作时,有几个决策点我需要谨慎对待。

  1. scala 2.7.7 或 2.8 RC ?
  2. 通过 querulous 的 JDBC 此 API 是否已准备好用于生产?
  3. sbt 与 maven。我对 Maven 很满意。
  4. 是否有 HttpClient 的 scala 惯用包装器(或者我应该像在 java 中一样使用它)?

我很想听听您对开始使用 scala 的评论和经验。

I am making my first foray into scala for a production app.
The app is currently packaged as a war file.
My plan is to create a jar file of the scala compiled artifacts and add that into the lib folder for the war file.
My enhancement is a mysql-backed app exposed via Jersey & will be integrated with a 3rd party site via HttpClient invocations. I know how to do this via plain java. But when doing it in scala, there are several decision points that I am pussyfooting on.

  1. scala 2.7.7 or 2.8 RC ?
  2. JDBC via querulous Is this API ready for production ?
  3. sbt vs maven. I am comfortable with maven.
  4. Is there a scala idiomatic wrapper for HttpClient (or should I use it just like in java) ?

I'd love to hear your comments and experiences on starting out with scala.

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

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

发布评论

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

评论(2

要走就滚别墨迹 2024-09-13 14:19:11
  1. 我会使用 2.8.0。 2.8 中有太多有用的功能。此外,2.8 即将发布最终版本。如果你刚刚开始,为什么不从这个开始呢? FWIW,自 Beta1 以来我一直在日常使用的各种工具和库中使用 2.8.0。虽然存在一些错误,但它们还不足以让我退回到 2.7.7。不过,YMMV。
  2. 这并不会让您的决定变得更容易,但是还有其他数据库访问的可能性。例如,我一直在使用 SQueryL;我喜欢它。 ORBroker 是另一种选择。
  3. 如果您对 Maven 感到满意,那么请务必使用它。就我个人而言,我更喜欢SBT。当我需要实现特殊的构建逻辑时,我可以获得真正的编程语言的全部功能。同样有用的是,我不必处理 XML 配置文件。 (XML 对于数据很有用,但对于人工编辑的配置文件来说,这是一种蹩脚的格式。)
  4. 您可以尝试 Databinder Dispatch。请参阅本文了解详细概述。
  1. I would use 2.8.0. There are just too many useful features in 2.8. Besides, 2.8 is closing in on a final release. If you're just starting out, why not start out with that? FWIW, I've been using 2.8.0 since Beta1, in various tools and libraries that I use daily. While there have been bugs, they haven't been enough to make me fall back to 2.7.7. YMMV, though.
  2. This isn't going to make your decision any easier, but there are other possibilities for database access. I've been using SQueryL, for instance; I like it. ORBroker is another option.
  3. If you're comfortable with Maven, then use it, by all means. Personally, I prefer SBT. I get the full power of a real programming language, when I need to implement special build logic. Just as useful, I don't have to deal with XML configuration files. (XML is good for data, but it's a crappy format for a human-edited configuration file.)
  4. You might try Databinder Dispatch. See this article for a nice overview.
当爱已成负担 2024-09-13 14:19:11
  1. 如果您只打算开始开发,Scala 2.8 GA 可能会在您投入生产时可用。即使不是,我也会选择最新的 2.8RC 包,而不是坚持使用 2.7.7。 2.8 不仅拥有许多出色的功能,还包含大量 2.7.7 的错误修复。
  2. 如今,为 Scala 设计的生产就绪型 ORM 并不多。我可能会选择 Lift Persistence,因为Lift Framework 背后的专业团队和友好社区的成员。但如果您不想冒险,您应该考虑使用经过验证的旧 Java ORM:Hibernate、JPA、iBatis(最近更名为 myBatis)等。
  3. 您应该尝试一下 SBT!它与 Maven POM 兼容,因此迁移到 SBT 对您来说应该不会太痛苦。使用 SBT 的好处:
    • 它是为 Scala 设计的,因此您将摆脱维护无数 Maven 插件的负担,使其与 Scala 一致工作
    • 您将能够在 Scala 中编写构建脚本(与 XML 相比,这是一种令人惊叹的体验)
    • SBT 有一个杀手级功能 - 连续进行(构建、测试、部署)。 SBT 监视您的代码,检测代码何时发生更改,并触发操作(测试、重新部署等)。
  1. If you're only going to start development, Scala 2.8 GA will probably be available by the time you go production. Even if it's not, I would choose the freshest 2.8RC pack rather than sticking to 2.7.7. 2.8 not only has a number of great features, but also contains lots of 2.7.7 bugfixes.
  2. There're not too many production-ready ORMs designed for Scala these days. I would probably choose Lift Persistence, because of the team of professionals and friendly community behind Lift Framework. But if you don't want to risk, you should consider using old good proven Java ORMs: Hibernate, JPA, iBatis (that was recently renamed to myBatis), etc.
  3. You should give SBT a try! It's compatible with maven POMs, so migration to SBT shouldn't be too painful for you. Benefits from using SBT:
    • It's designed for Scala, so you will be relieved from the burden of maintaining countless number of plugins for Maven to make it work with Scala consistently
    • You will be able to write build scripts in Scala (it's an amazing experience compared with XMLs)
    • SBT has a killer feature - continuous whatever (building, testing, deploying). SBT monitors your code, detects when its changed, and triggers an action (test, re-deployment, etc.).
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文