您对 Scala+Wicket 的体验 [英] Your experience with Scala+Wicket

查看:39
本文介绍了您对 Scala+Wicket 的体验的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您能分享一下您一起使用 Scala 和 Wicket 的经验吗?它们是否自然地相互契合?与使用 Java 相比,您在 Wicket 中使用 Scala(和 FP)是否有优势?为什么(会)你更喜欢 Wicket 而不是 Lift?

Could you share your experience of using Scala and Wicket together? Do they fit naturally to each other? Do you get advantage of using Scala (and FP) with Wicket over using Java? Why did (would) you prefer Wicket over Lift?

推荐答案

对于那些对代码感兴趣的人,我 重新实现 Scala + Wicket 中的Seam酒店预订"演示:浏览 |SVN - Java + Wicket 版本在这里:浏览 |SVN

For those interested in looking at code, I re-implemented the Seam "Hotel Booking" demo in Scala + Wicket here: Browse | SVN - the Java + Wicket version is here: Browse | SVN

我使用了(尚未最终确定的)Scala 2.8 和 NetBeans 插件.打算详细介绍它(甚至有一个 Groovy + Wicket 实现),但下面有一些高级印象;例如,这是 Java |斯卡拉.观察:

I used the (not yet final) Scala 2.8 and the NetBeans plugin. Was meaning to blog in detail about it (there's even a Groovy + Wicket implementation in place) but a few high-level impressions below; as an example, here's the same UI code in Java | Scala. Observations:

  • 当然少了很多样板和更少的噪音"
  • 在嵌套组件方面,Scala 感觉非常适合 Wicket
  • 例如定义内部类/构造函数的工作/代码行更少,因此可以大部分内联进行并保持嵌套而不会造成太多混乱
  • 同时将框架方法覆盖为单行程序.不错!
  • Scala 似乎与 Wicket 泛型配合得很好,有时编译器似乎更严格,也许这是一件好事.NetBeans 插件有所帮助,但有时仍会出错且速度缓慢.
  • 不是一个非常复杂的应用,所以没有机会应用闭包和 FP
  • 您需要注意一些问题:对抗 Scala - Scala 到 Java 列表的转换 - 目前我使用 Java 集合管理域对象属性.
  • certainly a lot less boilerplate and less 'noise'
  • Scala feels like a very good fit for Wicket when it comes to nesting components
  • for e.g. less work / lines of code to define inner classes / constructors, so can do it mostly in-line and keep nesting without much clutter
  • and at the same time override framework methods as one-liners. nice !
  • Scala seemed to work well with Wicket Generics, compiler seemed to be a lot more stricter at times, maybe this is a good thing. NetBeans plugin helps, but still buggy and slow at times.
  • Not a very complex app, so did not get a chance to apply closures and FP much
  • There are some gotchas you need to be aware of like this: Fighting Scala – Scala to Java List Conversion - for the time being I managed using Java collections for domain object properties.

尚未运行性能测试/比较.请继续关注 :) 当我有时间发布有关此的详细博客条目时,请告诉我您是否有任何想知道的信息.哦,如果您有机会查看代码并告诉我可以改进的地方,那就太好了!

Haven't run a performance test / comparison yet. Stay tuned :) Do let me know if there's anything you want to know when I get around to posting a detailed blog entry on this. Oh and if you get a chance to look through the code and let me know what can be improved, that would be great !

我还没有看过 Lift,但这里有一篇博文可能对 OP 有所帮助:Lift从 Wicket 开发者的角度来看

I haven't looked at Lift yet but here's a blog post that may help the OP: Lift from a Wicket Developer's Perspective

不得不说,如果与 Wicket 混合使用,我会选择 Scala 而不是 Groovy.组织导入"IDE 功能本身解决了这个问题.新的 Groovy 内部类支持在使用 Wicket 时有一些严重阻碍的问题.还遇到了groovy.lang.Reference not Serializable等问题

Have to say that I would choose Scala over Groovy by a mile if mixing with Wicket. The "organize imports" IDE feature itself settles the question. The new Groovy inner class support has some gotchas that seriously get in the way when using Wicket. Also experienced some problems like groovy.lang.Reference not Serializable etc.

这篇关于您对 Scala+Wicket 的体验的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆