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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

An Opinionated Guide to Modern Java, Part 3: Web Development

226 点作者 dafnap大约 11 年前

16 条评论

mark242大约 11 年前
It&#x27;s funny. An &quot;Introduction to Modern Java Web Development&quot; sounds like a primer for the Play Framework, Scala, and Akka. Each of the examples looks like the starter documentation for Play, in that you&#x27;ve got your json manipulation, routing, connecting to a database, DI, actors, etc.<p>Java devs-- you seriously owe it to yourself to spend the time investigating and ramping up onto Scala and Play. This is where the future of Java web app development is being driven from, by Typesafe and the Play &#x2F; Spray &#x2F;Akka open source developers. You do yourself a great disservice by sticking with Spring, Hibernate, JBoss, and the old standbys.
评论 #7750768 未加载
评论 #7750583 未加载
评论 #7751311 未加载
评论 #7750676 未加载
评论 #7750480 未加载
评论 #7751395 未加载
评论 #7750877 未加载
评论 #7750539 未加载
评论 #7750463 未加载
评论 #7753375 未加载
评论 #7750814 未加载
评论 #7750560 未加载
评论 #7751342 未加载
评论 #7750587 未加载
评论 #7750705 未加载
tristanperry大约 11 年前
A very good article; well written and explained.<p>For Java web development, it is worth re-considering Spring Boot though * (<a href="http://projects.spring.io/spring-boot/" rel="nofollow">http:&#x2F;&#x2F;projects.spring.io&#x2F;spring-boot&#x2F;</a>)<p>Spring MVC and Data (et al) powered entirely by annotations, and (e.g.) Thymeleaf for templating, can lead to some fairly powerful yet concise apps.<p>We just started using this where I work, and it&#x27;s a great step forward compared to old style, XML driven Spring MVC and Hibernate.<p>Also Spring Boot does bring quite a lot of support for REST, via RestTemplate&#x2F;RestOperations, along with support for consuming and producing JSON and&#x2F;or XML at the controller levels.<p>* Edit: I say re-considering since the article only briefly mentions it.
评论 #7753074 未加载
hibikir大约 11 年前
I am especially fond of his view on database layers. There&#x27;s JDBC, which is extremely verbose and needs scaffolding to make it usable, and then ORMS, that will quickly fall apart the moment you actually need to do anything interesting with the database.<p>The Spring solution to this problem was always my favorite part of their stack: JDBC template removed most of the error prone boilerplate from JDBC, adds a couple of features, and still lets you write SQL directly, which is probably what you should be doing in almost all the cases where a relational database becomes valuable.<p>I can&#x27;t wait for shops to start to use Java 8. The removal of so much boilerplate when trying to build functional interfaces should make the Java toolsets move forward very quickly.
评论 #7753416 未加载
评论 #7753611 未加载
评论 #7767828 未加载
arielweisberg大约 11 年前
I think that thread scheduling is really not the high pole in the tent for large numbers of threads. It&#x27;s stacks. If you want to have a million stacks and each is allocated to the highest watermark that thread ever reached you will run out of memory.<p>I suspect that task size has to be smaller than the typical bit of web processing code for context switching overhead to really dominate, or even be expensive enough to matter. That says as much about how expensive common tools and frameworks are as it does about the cost of context switching.
评论 #7750881 未加载
haddr大约 11 年前
I don&#x27;t get the point of saying that application servers are dead and then... embedding application server within the application. If applications should be isolated they can be easily deployed on different application servers. The result will be the same, with the difference that we get all advantages of easy application deplyment using war files, and some nice tools supporting the whole process.
评论 #7751373 未加载
DCKing大约 11 年前
It&#x27;s great to see how Java web development has progressed. I tried to make a Spring MVC web app work like a decent, modern, readable and productive web application two years ago and it just wasn&#x27;t possible.<p>Anyone interested in modern JVM web development I would still advise to invest time in learning Scala (or Clojure). They can work with your legacy code and libraries, but my productivity and general joy in programming shot through the roof when I started using Scala.
评论 #7755472 未加载
评论 #7754312 未加载
java-lang大约 11 年前
As a modern java developer I was surprised to find no mention of Vert.X which to me seems like one of the most modern and forward-thinking java web frameworks. Not only does it support scaling your app out-of-the-box but also provides a simple way to deal with concurrency.
评论 #7751541 未加载
评论 #7750598 未加载
runT1ME大约 11 年前
How does asynchronous futures end up being more complicated or in any way worse than the blocking threaded approach?<p><pre><code> for { user &lt;- asyncGetUser(1) company &lt;- asyncGeCompany(user.companyid) longresult &lt;- asyncProcess(company.getSomething) } yield longresult</code></pre>
评论 #7751738 未加载
评论 #7751981 未加载
phillmv大约 11 年前
Man, am I ever fascinated with the complexity Java devs have to put up with.<p>Maybe it&#x27;s just been a long time since I had to deal with Java-land, but you need to know about <i>so many different things</i> just to get off the ground. Granted, this may be easier with newer frameworks, but still.
评论 #7750915 未加载
评论 #7750826 未加载
评论 #7750854 未加载
评论 #7751355 未加载
评论 #7750809 未加载
zinxq大约 11 年前
You had me until you said Asynchronous I&#x2F;O is faster than Synchronous I&#x2F;O in Java.<p><a href="http://www.mailinator.com/tymaPaulMultithreaded.pdf" rel="nofollow">http:&#x2F;&#x2F;www.mailinator.com&#x2F;tymaPaulMultithreaded.pdf</a>
评论 #7751553 未加载
评论 #7752392 未加载
评论 #7750728 未加载
评论 #7750721 未加载
rdtsc大约 11 年前
Great work Ron.These should be a small (or maybe a full) book some day.<p>Java is not my main language, but I liked the Advanced Topic: Blocking vs Non-blocking section and in general have been following Parallel Universe technology stack.<p>If anyone is interested more in the async vs actors, there is a nice new podcast with Ron Pressler, Fred Hebert (Learn You Some Erlang For Great Good author), Kevin Hamond and Zachary Kessin<p><a href="http://mostlyerlang.com/2014/05/15/037-parellel-universe-with-ron-pressler/" rel="nofollow">http:&#x2F;&#x2F;mostlyerlang.com&#x2F;2014&#x2F;05&#x2F;15&#x2F;037-parellel-universe-wit...</a><p>There is a discussion about concurrency, how Quasar works underneath (hint: there is an interesting bytecode transform that takes place during loading), shared state, Erlang, Clojure and Datomic. Anyway, highly recommend.
namelezz大约 11 年前
Thank you for sharing the amazing work. I do not know if there is a part 4 coming or not but do you have a good pattern for validating users&#x27; input?
zinxq大约 11 年前
I will say though, dismissing Rob Von Behren in the area of async vs. sync IO with an anecdotal paragraph is a ballsy move. (i.e. &quot;wrong approach&quot;)
评论 #7752065 未加载
elchief大约 11 年前
Do you really need to write a controller and all its actions for each resource with Jersey?
评论 #7753411 未加载
评论 #7753531 未加载
rch大约 11 年前
Is there a preferred way to submit typos other than in comments?
评论 #7751887 未加载
jaxytee大约 11 年前
&gt;Let me put this clearly: asynchronous APIs are always more complicated than blocking APIs..<p>IMO I would rather use a single threaded server and manage synchronicity explicitly with callbacks, composable promises, comprehensions, monads, and &quot;other functional shenanigans&quot; vs having to sync shared state across threads and manage thread pools.
评论 #7751562 未加载
评论 #7751326 未加载