您在 Scala/Lift 中开发的经验是什么?

发布于 2024-09-18 06:52:08 字数 562 浏览 21 评论 0 原文

我听到了很多关于 Scala最近提升了网络框架,尤其是来自Foursquare 的人员 因此,我可能会在下一个项目中使用这项技术。

  • 你们中有人是 Scala/Lift 开发人员吗?
  • 您在此平台上进行开发的经验是什么?它相对于 Ruby On Rails 或 Python/Django 有何优势?
  • 您认为它是一项可行的技术并且是未来几年“值得关注的事情”吗?

值得吗? 分享您在 Scala/Lift 上的经验平台。

I heard a lot of good things about Scala and the Lift Web framework recently, especially from Foursquare's guys hence, I might use this technology in my next projects.

  • Are any of you Scala/Lift Developers?
  • What have your experiences been for developing on this platform and what are its advantages over Ruby On Rails or Python/Django?
  • Do you see it as a viable technology and "something to keep an eye on" for the next couple of years?

Is it worth it? Share your experiences on the Scala/Lift Platform.

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

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

发布评论

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

评论(3

晨光如昨 2024-09-25 06:52:16

我在 Lift 开发企业财务应用程序超过 6 个月,我以前是 JAVA 程序员。我注意到了几点,这可以帮助你:

  1. 我写的代码行明显减少了(很好的例子

  2. Lift 周围有一个非常友善的人 社区。他们总是试图提供实质性的答案。我没有任何不好的经历。甚至他们也愿意接受有关 Lift 新功能的新建议。他们批准了我的两条建议!

  3. Lift 的新稳定次要版本大约每 6 - 8 周发布一次。新的里程碑定期每两周发布一次。

  4. Lift 是一个很棒的 Web 应用程序框架。您可以了解 Lift 的七个主要功能

  5. 提升默认 ORM 模块 - Mapper 不适用于具有大量外键和约束的大型高级数据库模型。我们必须使用 Squeryl。

我无法想象我现在必须回到JAVA代码。但我的小建议是尝试编写一些简单的应用程序,您就会看到。

I'm developing enterprise financial application in Lift for more than 6 months and I was JAVA programmer former. I have noticed a few points, which could help you:

  1. I write noticeable less lines of codes (great example)

  2. Around Lift there is strong a very kindly community. They always try to provide a substantive answer. I haven't any bad experience. Even they are open for new suggestions for new features in Lift. They approved two of my suggestions!

  3. New stable minor version of Lift is announced about every 6 - 8 weeks. New milestone is regular every two weeks.

  4. Lift is great framework for web applications. You can read about seven main features of Lift.

  5. Lift default ORM module - Mapper is not for big and advanced database models with lot of foreign keys and constraints. We had to use Squeryl.

I can't imagine that I have to return to JAVA code now. But my little advice is to try to code some simple application and you will see.

韬韬不绝 2024-09-25 06:52:14

我目前正在开发我的第二个 Lift 应用程序 - 它非常符合 Lift 的最佳点 - 非常实时,具有大量并发性。

第一个我们在与数据库层搏斗了几天后失败了(我相信现在更好了),然后转而使用 Play/Scala。这最大限度地利用了我们团队的现有知识,并使得按时完成任务成为可能。但是,一旦我们的项目变得相当大(持续耗尽 PermGen - 这几乎在任何地方都是 Scala 编译的一个持续问题),热代码重新加载就几乎不再发生,并且手动处理不同地方的方法调用参数和位置安全等问题在网站上变得相当麻烦。当它完成时我们很高兴 - 就像我倾向于发现 Rails 1 一样,随着项目规模的增加,速度的增加会缩小,到最后它就像在 Velocity/ 中工作一样乏味且容易出错。 Spring/XML++ 等等)。

这一次,我们致力于研究 Lift 如何做它所做的事情,以及做事的正确方法。这意味着要经常浏览邮件列表(几个版本的旧讨论通常仍然相关),最重要的是团队的新精神。有必要非常强烈地内化这句座右铭:

“这感觉很难而且重复。我敢打赌他们做了一个更简单的方法来做到这一点。”

到目前为止,Lift从未让我们失望过。顺便说一句,我不是在谈论像 Sitemap 和列表串联语法这样的东西 - 您必须对功能性 Scala 有很好的掌握,否则您将无法阅读源代码,甚至无法配置您的应用程序。

也就是说,这不是疯狂的 IO monad 或其他什么东西,只是一些你在 Scala 几周内就能学到的常见习惯用法。

对我们来说最大的问题是编译周期缓慢。 jetty:run 我们的项目大约需要 20 秒,这与 Play 不同,Play 会(当它工作时)热编译你的所有东西。另一方面,我们实际上计时了有一天,当我们的一位开发人员抱怨这个问题时,结果发现,尽管 Play 在技术上热编译了它,但该页面在开发模式下加载仍然需要 12 秒。所以并没有太大的损失,只是感觉跳到命令行有点慢。

Lift 可以让您做很多事情,并且在我们的应用程序中有很多地方(因为它可用),我们说过“是的,我们真的希望立即向该页面的所有查看者而不是他们实时更新后来发现它们已经过时了(想想你在 SO 上同时向某人发布的所有时间,到处都是相同的答案,事实证明 - 这不是一个专业的用例,这就是事情的方式)。 Lift 让它变得非常简单,

我们也喜欢强大的、可编程配置的安全模型 - 一旦我们将思维方式转变为“我们必须将每个位置列入白名单,并指定必要的入口条件”,我们就再也没有遇到过另一个会话问题。 - 你知道,那些你假设用户会遍历某个路径,因此会知道一大堆参数?比如,有效的用户名和感兴趣的区域或其他什么(我故意含糊不清? )这可能是有状态框架的尴尬之一,当用户点击页面时,您将希望拥有可用的状态,而不是(例如)仅仅要求每个页面都保留所有状态。要求。

我从 Lift 的这次更新中得到的收获是:

这是值得的。不仅构建您正在尝试构建的应用程序,而且构建您不知道自己需要的应用程序。

有很多令人头疼的地方,但代码并不多。当它起作用时,它确实起作用了。它快速、干净,尽管它在浏览器和服务器之间工作的所有奇迹,我从未见过它感到困惑。

I'm working on my second Lift app at the moment - it's very strongly in Lift's sweet spot - very realtime, lots of concurrency.

The first one we wimped out after a few days of wrestling with the DB layer (it's better now, I am led to believe), and went to Play/Scala instead. That maximized the existing knowledge of our team and made it possible to make deadline. But the hot code reloading pretty much stopped happening once our project got moderately large (kept running out of PermGen - it's an ongoing problem with Scala compilation pretty much anywhere), and the manual juggling of things like method call parameters and location security in different places in the website got quite cumbersome. We were glad when it was done - in the same way as I tended to find Rails 1, the speed increases shrank as the project size increased, and by the end it was every bit as tedious and error-prone as working in a Velocity/Spring/XML++ whatever).

This time we've been committed to just working out how Lift does what it does, and the right ways to do things. This has meant a lot of casual browsing through the mailing list (discussions that are several versions old are often still relevant), and most importantly a new ethos for the team. It's been necessary to internalize very strongly the motto:

"This is feeling hard and repetitive. I bet they made an easier way to do this."

So far Lift has never disappointed us. I'm not talking, by the way, about stuff like the Sitemap and list concatenation syntax - you MUST have a pretty good handle on functional Scala, or you just won't be able to read the source code or even configure your app.

That said it's not crazy IO monads or anything, just some common idioms that you'd pick up in a few weeks of Scala anyway.

The biggest problem for us has been a slow compile cycle. It takes about 20 seconds to jetty:run our project, which is a different feeling to Play which (when it's working) hot compiles all your stuff. On the other hand, we actually timed that the other day when one of our devs complained about it, and it worked out that although Play technically hot compiled it, the page still took 12 seconds to load in Dev mode. So there's not a huge loss, it just feels a bit slow to have to hop out to the command line.

Lift lets you do a great deal, and there are many places in our app where (because it's available), we've said "Yeah, we really WOULD prefer to have that live updated immediately to all viewers of that page, instead of them discovering later that they're out of date (think of all the times you've posted simultaneously to someone on SO, with the same answer). COMET is everywhere, it turns out - it's not a specialist use case, it's the way things should work. And Lift makes it really easy.

We also love the strong, programatically configurable, security model - once we switched our mindsets to "We have to whitelist every location, and specify the necessary entrance conditions", we never saw another session problem - you know, those ones where you assumed that the user would have traversed a certain path, and thus would know a whole bunch of parameters? Like, a valid username, and an area of interest or whatever? (I'm being intentionally vague). That can be one of the awkward things about a stateful framework, that you're going to want to have usable state when the user hits a page, instead of (for instance) just demanding that all the state gets carried along at each request.

My takeaway from this renewed shot at Lift:

It's worth it. Not just to build the app that you're trying to build, but to build the app that you didn't know you needed.

There's a lot of head scratching, but not a lot of code. And when it works it really works. It's fast, and clean, and for all of the miracles that it's working between the browser and the server, I've never yet seen it get confused.

绝不服输 2024-09-25 06:52:13
  1. 我目前的大部分工作都是在 Scala 中完成的。 (我应该提一下,我认为 Scala 是自不久前发明轮子以来最好的东西。:-D )

    以我的拙见,它是唯一真正允许人们选择最佳任务方法的语言,而不会在(更多)面向对象和(更多)函数式方法之间产生不必要的分歧。

    看看以前声称类似的语言,我基本上可以看到两个相互竞争的语言设计阵营:

    • 来自面向对象方面的人看到函数式编程最近获得了一些关注,并认为“好吧,我们并不真正理解函数式的东西,但让我们在我们的语言中添加一些奇特的语法糖,所以我们可以说它也有功能!” (示例:Java、Python)

    • 然后是来自功能方面的人,他们认为“好吧,我们的功能方法远远优于其他任何方法,面向对象的废话很烦人,但是让我们在我们的语言中添加一些额外的关键字,这将使我们的语言肯定逃离了学术界!” (示例:F#、OCaml)

    Scala 的设计者统一了双方的许多方法,并创建了一些设计良好的语言,以我的愚见,这是与其他语言最大的区别,它决定采用“弗兰肯斯坦”的方法来进行编程语言设计。< /p>

  2. 我只用 Lift 做过一些较小的事情,对 Rails 和 Django 也只有肤浅的经验,我不得不承认,大多数时候,当我想知道为什么 Lift 中的某些内容与我的预期不同时,这是因为以下事实:我的期望是有缺陷的,而 Lift 的方法更优越。

    Lift 当然不是“简单的 Scala 入门”,但学习 Lift 的工作原理几乎与学习之前的 Scala 一样有价值。

    拥有一个没有任何逻辑的“干净”视图的能力对于其他声称具有相同功能但未能实现的框架来说是一个巨大的改进。 Scala 的 XML 文字支持可以验证您的响应的格式正确性:编译器将在编译时证明您只向客户端发出格式正确的 XML。

  3. Lift 是可行的技术,如果您想构建外观、感觉和行为都像“真正的”桌面应用程序的 Web 应用程序,而无需自己编写大量代码,Lift 是目前唯一真正的方法。

  1. I'm currently doing most of my things in Scala right now. (I should mention that I think that Scala is the best thing since the invention of the wheel some time ago. :-D )

    In my humble opinion it is the only language which truly allows people to choose the best approach to a task without some unnecessary divide between (more) object-oriented and (more) functional approaches.

    Looking at the languages which claimed something like this before, I can basically see two competing language design camps:

    • The ones from the object-oriented side which saw that functional programming gained some traction lately and thought "Well, we don't really understand that functional thingie, but let's add some fancy syntactical sugar to our language, so we can claim it is functional too!" (examples: Java, Python)

    • Then the ones from the functional side, who thought "Well, our functional approach is far superior to anything else and that object-oriented nonsense is annoying, but let's put some additional keywords into our language, that will make our language escape academia for sure!" (examples: F#, OCaml)

    Scala's designers unified many approaches coming from both sides and created some well-designed language, which is - in my humble opinion - the biggest difference to other languages, which decided to take the "Frankenstein" approach to programming language design.

  2. Having done only smaller things with Lift yet and only superficial experience with Rails and Django, I have to admit that most of the time when I wondered why something in Lift worked differently from what I expected, this was due to the fact that my expectations were flawed and Lift's approach superior.

    Lift is certainly no "easy introduction to Scala" but learning how Lift works was almost as rewarding as learning Scala before it.

    The ability to have a "clean" view without any logic in it is a great improvement to other frameworks which claimed the same, but fell short of it. Scala's XML literal support makes it possible to verify the well-formedness of your response: The compiler will prove at compile time that you only emit well-formed XML to a client.

  3. Lift is viable technology and at the moment the only real approach if you want to build web applications which look, feel and behave like "real" desktop applications without writing insane amounts of code yourself.

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