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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Java.next() - The Groovy Programming Language

60 点作者 bozhidar大约 14 年前
A brief analysis of the Groovy Programming Language

11 条评论

johnwatson11218大约 14 年前
I used groovy to build an internal app that worked with subversion, jira, and a local sqlite db this week and it was so much fun. It was so productive that I decided to put a web ui on top of the core app. Rather than use grails I used groovlets with the built in HTML builder. My favorite line of code had to be:<p>table{ myMap.each{k,v-&#62; tr{ td k; td v;}}}<p>that turned myMap into a HTML table.
评论 #2523679 未加载
stephen大约 14 年前
(Also posted as a comment on the blog:) Groovy would have won the "Java.next" title by now if they weren't so stubborn about being a dynamic language. If they invested half the effort they've put into "IDE-time" static type inference/type checking in Eclipse/IntelliJ (so that programmers can still get the warm fuzzies of auto completion) into building static type inference/checking into the language itself, I think they'd have seen much wider adoption.<p>This is basically what the guy behind groovy++ has done, but, from what I've heard, they basically told him several years ago that they had no interest in taking the language in a static direction.<p>This sucks because, in IMO, 90%+ of the calls in a Groovy program can be statically dispatched just like regular Java. Sure, duck typing is useful in a few places, but those few places shouldn't mean my entire program has to be dynamic.<p>Groovy has an awesome syntax, awesome compile-time AST transformations, etc.--but a dynamic language, in enterprise environments at least, will not be Java.next. Scala is maturing, and Groovy's window of opportunity is quickly closing (or already gone).
Spines11大约 14 年前
I've been building the web app I'm working on completely in Groovy, and running it on Google App Engine. I'm quite happy with my choice to switch over to Groovy from Java. There are 3 main features of Groovy that greatly speed up my productivity as compared to coding with Java.<p>1. Closures - items.find { it.name == 'groovy' } is much easier than looping.<p>2. Language support for collections - Maps can be declared like: [key:'value'], and lists can be declared like: [1,2,3].<p>3. Easier handling of nulls - The "Elvis Operator" can be used to specify defaults like: (item ?: "defaultvalue") and the safe navigation operator will return null rather than throwing a NullPointerException when doing something like this: (item?.address?.street).
i386大约 14 年前
As much as I've enjoyed writing Grails apps and Groovy scripts, what I don't like about groovy is that it comes with a large runtime jar and its binaries are not really usable from java projects without API uglyness.<p>I wish Java had been designed with the same multi-language philosophy that .NET has had from the get go. Binaries produced in any language in .NET don't give any clues to what the language the binary was implemented in. For example, if your writing something using VB.NET and working with a library that was implemented in C# there really isn't any evidence that this is the case and the signatures look the same.
评论 #2523332 未加载
评论 #2523435 未加载
kefs大约 14 年前
Unrelated, but something is up with the encoding on your site (or the quotes used), and it makes it terribly hard to read and comprehend anything. (win7/ff4)<p>Screenshot: <a href="http://i.imgur.com/6lKfw.png" rel="nofollow">http://i.imgur.com/6lKfw.png</a>
评论 #2523362 未加载
BonoboBoner大约 14 年前
If only there was a language at Java's tooling and speed with Groovy's syntax and the perceived startup-time of Ruby and Python.
评论 #2523391 未加载
dillona大约 14 年前
I can't help but be weary of anything advertised as "Enterprise ready"
ggchappell大约 14 年前
&#62; There is also the fact that the JVM(currently) doesn’t have support for dynamic memory dispatching which is feature vital for dynamically typed languages to get a decent performance.<p>Can someone explain what "dynamic memory dispatching" is? Is it perhaps better known under a different name? (Google is no help.)
评论 #2523376 未加载
评论 #2523555 未加载
msluyter大约 14 年前
The company I work for tried incorporating Groovy into several of our projects, but we started getting random permgen JVM crashes as a result. I believe this is due to the large number of classes it creates behind the scenes. This left a bad taste in peoples' mouths and unfortunately groovy will now be a hard sell.<p>Edit: Yes, we increased the permgen size and whatnot, but the outages it caused just left people with an unfavorable view of groovy. Which, as I said, is unfortunate, because I think it's pretty cool.
评论 #2523746 未加载
评论 #2523714 未加载
udoprog大约 14 年前
My favorite approach to using groovy in projects is with the groovy compiler plugin for maven. Compile and bundle the resulting byte code. All you have to remember is too bundle the groovy runtime and remember how groovy interacts with Java natively.<p>The one thing that disturbs me about groovy is that overloaded methods seems to only be signature checked at runtime, which results in an exception when invoked with the wrong parameters - not a compiler error.
drivebyacct2大约 14 年前
I'm sorry if this is ignorant, but why Groovy and not sure other language that can run in the JVM? (Also, how much longer will the name "JVM" stick?)
评论 #2523604 未加载
评论 #2523324 未加载
评论 #2523904 未加载
评论 #2523335 未加载