Live data from Hacker News

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

blog.paralleluniverse.co

161–168 of 168 posts

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

#161
post #157
post #154

Earlier quoted context omitted.

Non-standard build/deploy/run. Classloader per verticle type makes dependency injection painful. "I don't know what a Spring "ApplicationContext" is" -- Tim Fox Uses multiple classloaders so you can "run multiple versions of the same module at the same time". Not something I have ever done or would do. Uses Hazelcast for clustering but uses tons of classloaders so using anything other than simple types in Hazelcast i…

> Encourages polyglot programming. Some of these "problems" aren't problems at all, e.g. what's wrong with polyglot programming? > Writing Vertx apps with Groovy makes me feel like I could add a whole chapter to 'How to Write Unmaintainable Code'. Vert.x enables many JVM languages to program it. Perhaps the real problem's with the language you've chosen. Groovy's business purpose is to ensure jobs (i.e. consulting co…

> Vert.x enables many JVM languages to program it. Perhaps the real problem's with the language you've chosen. Groovy's business purpose is to ensure jobs (i.e. consulting contracts and conference seat sales) for life for its promoters at SpringSource. Choose a language with another mission and that could make all the difference.

The framework and the language are both problems in my opinion. If it was up to me I would have chosen a different framework, messaging system, language, and more. Wasn't my decision to make though.

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

#162
post #158
post #154

Earlier quoted context omitted.

Non-standard build/deploy/run. Classloader per verticle type makes dependency injection painful. "I don't know what a Spring "ApplicationContext" is" -- Tim Fox Uses multiple classloaders so you can "run multiple versions of the same module at the same time". Not something I have ever done or would do. Uses Hazelcast for clustering but uses tons of classloaders so using anything other than simple types in Hazelcast i…

Wow - thanks for taking the time to put those down. Some of those I consider advantages - polyglot is the whole reason I looked into it, Groovy is the main language the app I'd be integrating it into is written in, callbacks are the mainstay of many other frameworks (try writing anything in Node.js without a callback!). That the clustering is poorly designed is probably not an issue in itself since in my case it's a…

You're most welcome.

> try writing anything in Node.js without a callback!

I wouldn't even try writing anything in Node. Server side javascript is not an option I would consider. http://www.youtube.com/watch?v=bzkRVzciAZg

Hazelcast on it's own is pretty useful if you need a distributed data grid in Java although it's not without its quirks. Unfortunately it's much less useful in Vertx because of the classloaders.

Callbacks as an antipattern is one of the main points of this HN post.

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

#163
post #27

It'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't possible. 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 program…

You can actually make a good Spring MVC-based webapp (with Thymeleaf, AngularJS and etc.); check out the JHipster Yeoman generator: https://jhipster.github.io/

Man, I wish that would have existed 2 years ago.

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

#164
post #132
post #123

Earlier quoted context omitted.

When I learned to program (back in the 80s), I learned that if you want to tell the computer to do operation X and when that's done, do operation Y, you just write both statements one after the other. If you're comfortable using for comprehensions to achieve that same goal -- that's great. To me it seems that your code simply replicates what a thread does. If you have a problem with your thread's implementation -- fi…

I wanted to ask you, what about running multiple operations in parallel? I've long been contemplating async/futures vs lightweight threads and yet to have come to a conclusion. With futures I can say, start operation 1 and operation 2 in parallel, then chain a callback to execute using both pieces of data, saving me some latency of doing the operations serially. How do you do this using quasar? Now that's a trivial e…

Seriously, just use scala Futures. Here's one of many super easy ways to do parallel computations in scala: val list = getItemsToProcess() //List[SomeObj] list.map(so => Future { processorHeavyMethod(obj) }) //happening in parallel now val finished = Future.sequence(list) //Future[List] finished.await

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

#165
post #159
post #152

Earlier quoted context omitted.

this in general leads to an even worse practice: creating one huge standalone app instead of several specialized web apps. when you develop a service with an embedded server, your endpoint will have an unique port (as each app will have to allocate its own unique port number) and all the idea of restful URI gets broken.

You lost me. How does embedding the app server break URIs?

in the embedded mode you have one application server per app, so you have one app at port 80, another at 81, etc... so you can't just have a nice URL pattern for your applications, becase each one will have different port number. Unless you set up additional reverse proxy...

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

#166
post #165
post #159

Earlier quoted context omitted.

You lost me. How does embedding the app server break URIs?

in the embedded mode you have one application server per app, so you have one app at port 80, another at 81, etc... so you can't just have a nice URL pattern for your applications, becase each one will have different port number. Unless you set up additional reverse proxy...

you put nginx in front of it, which you should do anyways for most things.

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

#167
post #166
post #165

Earlier quoted context omitted.

in the embedded mode you have one application server per app, so you have one app at port 80, another at 81, etc... so you can't just have a nice URL pattern for your applications, becase each one will have different port number. Unless you set up additional reverse proxy...

you put nginx in front of it, which you should do anyways for most things.

Yep agreed, it's called reverse proxying, I do this with Tomcat as well.

http://en.wikipedia.org/wiki/Reverse_proxy

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

#168

I am especially fond of his view on database layers. There'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. 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…

I think myBatis does something similar, abstracts JDBC and lets you write SQL easily.
Post reply on HN