TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Consuming Web APIs with Groovy

2 点作者 rmangi超过 12 年前

1 comment

vorg超过 12 年前
&#62; We use Groovy a lot at SPUN and we love it. Our CMS is written in grails and our feed consumption “sponge” is Groovy + Jetty and GPars with a frontend written in KnockoutJS. What I like most about groovy is that it builds on the existing Java ecosystem and, being so close to Java, new developers can learn it in no time. Once you get into the new features that Groovy brings to the table it really makes coding a lot more fun, but you can learn those features over time while still being productive with your existing Java chops.<p>What new features are these? Static compilation is hardly production ready, as seen by this bug in Groovy 2.1.0 reported only last week... <a href="http://stackoverflow.com/questions/14774709/groovy-2-1-0-weird-behaviour-of-switch-case-break-statement-with-compilestatic" rel="nofollow">http://stackoverflow.com/questions/14774709/groovy-2-1-0-wei...</a><p>Groovy's static compilation came with Groovy 2.0. Although officially released in June 2012, it <i>really wasn't released for production use until it was bundled as part of Grails</i> 2.2 in Dec 2012. The 6 months from June to December was unofficially <i>just more beta-testing</i> with a larger base of users, those who download standalone releases of Groovy. Grails, however, doesn't use any of the static compilation features in Groovy 2.0. All the testing of Groovy 2.0 was just to make sure the inclusion of static compilation in Groovy <i>didn't break any of its dynamic compilation use in Grails</i>.<p>Maybe the new feature in Groovy 2 you're talking about is invoke-dynamic. In both Groovy 2.0 and 2.1, the code using invoke-dynamic is bundled in a separate jar-file which only runs on Java 7. Grails and Gradle don't bundle this other invoke-dynamic jar file, and don't intend to for Grails 2.3 and Groovy 2.1 either. Whereas the legacy stream of Groovy can be tested to see that the static compilation doesn't break the preexisting dynamic compilation, the invoke-dynamic jar needs far more testing because it would actually replace the existing dynamic-compilation codebase, so Grails and Gradle won't bundle it.<p>You're just a patsy of the Groovy/Grails project management pitching for Groovy 2.1 beta-testers for Grails 2.3 when you write in your blog: "Once you get into the new features that Groovy brings to the table it really makes coding a lot more fun, but you can learn those features over time while still being productive with your existing Java chops."<p>If you really want static compilation, use Scala which has been battle-tested far longer than Groovy's. If you really want invoke dynamic, use JRuby which bundled it even _before_ Java 7 was released. Groovy is really only useful if you use Grails, and for quick testing scripts - quick to write but slow to run, that is.
评论 #5213814 未加载