开发者

Your experience with Scala+Wicket [closed]

开发者 https://www.devze.com 2022-12-18 02:36 出处:网络
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing
Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed last year.

Improve this question

Could you share your experience of using Scal开发者_StackOverflow中文版a 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?


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

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:

  • 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 !

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

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.


I've used Scala + Wicket a little bit -- it's a good point to introduce some Scala. Closures with can help to reduce the lines of of code in a Wicket controller, given a few implicit conversions or utility methods. Even Dave Pollak once suggested this combination, if you prefer Wicket to Lift or have an existing Wicket application you want to retrofit Scala with.

Just be careful about the datatypes you use in any stateful Wicket components as they must be serializable. You can sometimes do without this, and use stateless Wicket components.


They work really well together. Not to mention all the bonuses of using Scala as your language.

Along my way I took out bits I made that I found useful and created the Scala Wicket Extensions stuff project: http://www.mail-archive.com/users@wicket.apache.org/msg40899.html Haven't used it for a while, but it should still be good. I'd be really keen to get more people contributing to the project.

The repo is here: https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/scala-extensions-parent/

It's a shame wicket-stuff (and wicket) is/are not in Github :/


I just would like to point new ways, in Scala 2.8, to do scala to java conversions and back, since it was pointed out as an issue in Peter Thomas's answer. The new stuff is described there:Conversions between Java and Scala collections

It should resolve the scala <=> java collections issue I guess

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号