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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

An Opinionated Guide to Modern Java, Part 2

313 点作者 dafnap大约 11 年前

17 条评论

cmicali大约 11 年前
Nice article - Many of the suggestions (single-jar deployment, metrics, slf4j logging, etc) are all wrapped up for you in Dropwizard <a href="http://dropwizard.io" rel="nofollow">http:&#x2F;&#x2F;dropwizard.io</a>, which we use and love.
评论 #7716951 未加载
评论 #7717090 未加载
评论 #7716856 未加载
badlogic大约 11 年前
I&#x27;m glad someone took the time to write this, it&#x27;s actually a very nice resource to get new coworkers up to speed. Shouldn&#x27;t be tought as dogma of course (e.g. Gradle vs. Maven).<p>Also, thanks for mentioning Packr even though noone has used it in production yet. It&#x27;s only a week old.<p>Assuming OP is the original author: are you by any chance following JGO? I see Quasar is actually using Matthias Mann&#x27;s green thread lib which i don&#x27;t think was advertised anywhere outside JGO.
评论 #7717101 未加载
benjaminpv大约 11 年前
&quot;Java application servers are dead&quot; and since there&#x27;s no alternative to Java application servers here&#x27;s a solution I cooked up myself.<p>Like I mentioned last time I appreciate an overview of modern Java practices but boy howdy I can&#x27;t discern if this is clever trolling or a cheap way to make me read Part 3.
评论 #7716672 未加载
评论 #7716367 未加载
评论 #7716361 未加载
评论 #7716321 未加载
pjmlp大约 11 年前
I like the overview given to JVM tooling, many developers are fully unaware of what JVMs (not only the official one from Oracle) offer in terms of monitoring.<p>If you want to go really low level, a few of them even show the generated assembly code by the JIT.
评论 #7717202 未加载
eeperson大约 11 年前
As a Java developer, I thought this article had some interesting information about logging and monitoring. However, the deployment section had my scratching my head a little.<p>I&#x27;ve never totally understood why people want to make fat jars. It seems like a process full of headaches since you can&#x27;t have jars in jars. Wouldn&#x27;t it be much easier to create a regular zip file with a small script to set the classpath and and run the project?<p>I&#x27;m not sure I understand the motivation for embedded instead of standalone servlet container. The article linked to some slides but they mostly seemed be demonstrating that you can function using an embedded container rather than providing clear benefits. Maybe it would have made more sense with the associated talk.<p>Can anyone provide more insight to these?
评论 #7717082 未加载
评论 #7718427 未加载
评论 #7717319 未加载
eshvk大约 11 年前
&gt; While I personally prefer Gradle’s nice DSL and the ability to use imperative code for non-common build operations, I can understand the preference for the fully declarative Maven, even if it requires lots of plugins. The modern Java developer, then, might prefer Maven to Gradle.<p>I find Maven&#x27;s abstractions surprisingly hard to understand. It is a major part of my annoyance with Java as a dev setup. I miss Make&#x2F;Ant. Not sure if Gradle will be a good replacement or not but would be curious to try.
评论 #7718592 未加载
评论 #7731264 未加载
评论 #7716676 未加载
评论 #7718391 未加载
vorg大约 11 年前
&gt; I personally prefer Gradle’s nice DSL [...] in order to use Gradle one does not need to know Groovy, even if one wishes to do some non-standard stuff [...] I just learned a few useful Groovy expressions that I found in Gradle examples online<p>The DSL is Groovy syntax from Groovy&#x27;s antiquated Antlr 2.7 grammar, so simply by using Gradle you&#x27;re using Groovy along with all its warts. Underneath, Gradle isn&#x27;t so much a DSL as an API shipping with a programming language. You could just as easily write the first Gradle example from the article in most other JVM languages. If it was in Clojure...<p><pre><code> (require gradle :as g) (g&#x2F;apply :plugin &quot;java&quot;) (g&#x2F;apply :plugin &quot;application&quot;) (g&#x2F;source-compatibility &quot;1.8&quot;) (g&#x2F;main-class-name &quot;jmodern.Main&quot;) (g&#x2F;repositories (g&#x2F;maven-central)) (g&#x2F;configurations g&#x2F;quasar) (g&#x2F;dependencies (g&#x2F;compile &quot;co.paralleluniverse:quasar-core:0.5.0:jdk8&quot;) (g&#x2F;compile &quot;co.paralleluniverse:quasar-actors:0.5.0&quot;) (g&#x2F;quasar &quot;co.paralleluniverse:quasar-core:0.5.0:jdk8&quot;) (g&#x2F;test-compile &quot;junit:junit:4.11&quot;)) (g&#x2F;run (g&#x2F;jvm-args (str &quot;-javaagent:&quot; (-&gt; (configurations.quasar.iterator) next))))</code></pre>
vidar大约 11 年前
This feels like a different universe.
评论 #7716161 未加载
评论 #7716796 未加载
lmm大约 11 年前
Does anyone actually swap out their log backend? To me slf4j felt like an overcomplicated, enterprisey step with no clear advantage over log4j.
评论 #7718703 未加载
评论 #7731273 未加载
评论 #7718739 未加载
评论 #7719408 未加载
评论 #7724762 未加载
评论 #7718805 未加载
jebblue大约 11 年前
I&#x27;m a fan of simplifying the server side, one I&#x27;d recommend for the latter part of the slideshow he referenced:<p><a href="http://www.sparkjava.com/" rel="nofollow">http:&#x2F;&#x2F;www.sparkjava.com&#x2F;</a>
评论 #7716634 未加载
anjanb大约 11 年前
cool article. I wish if someone can give a Java update like this once every year!
gsmethells大约 11 年前
As far as packaging and deployment of a native executable goes, I thought it odd to not mention Excelsior JET (<a href="http://www.excelsiorjet.com" rel="nofollow">http:&#x2F;&#x2F;www.excelsiorjet.com</a>) as I believe that&#x27;s the only Java compiler that can handle all of the JDK (gcj isn&#x27;t there yet).
评论 #7718142 未加载
评论 #7717313 未加载
derengel大约 11 年前
As someone not very familiar with Java can someone expand on what he means by this: &quot;Every library is usually packaged into its own JAR, and merging all dependencies into a single JAR, might cause collisions, especially with packaged resources (non-class files).&quot;
评论 #7716324 未加载
评论 #7716336 未加载
评论 #7716326 未加载
评论 #7716320 未加载
dave3773大约 11 年前
Very nice article. Capsule looks promising in regards to packaging. I&#x27;m going to have give &#x27;er a try. One could also use the fatjar[1] or application[2] plugins (within the context of gradle).<p>[1] <a href="https://github.com/musketyr/gradle-fatjar-plugin" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;musketyr&#x2F;gradle-fatjar-plugin</a> [2] <a href="http://www.gradle.org/docs/current/userguide/application_plugin.html" rel="nofollow">http:&#x2F;&#x2F;www.gradle.org&#x2F;docs&#x2F;current&#x2F;userguide&#x2F;application_plu...</a>
12345678123大约 11 年前
This article does not mention OSGI or Jigsaw with one word but claims to guide to modern Java development. Seems they never run any large scale EE projects yet :)
评论 #7717506 未加载
kbcv大约 11 年前
How does profiling Java applications work with JIT. Should you wait until the code has been optimized before profiling, or these tools smart enough to realize that the performance of code changes as the application runs?
评论 #7731277 未加载
skybrian大约 11 年前
The article mentions a tool called Flight Recorder for profiling, but it appears this is commercial and not available in the openjdk?