News for hackers. Stuff that matters.
Re:Java REST framework Dropwizard 1.0 released by alexbanks on Tuesday July 26, 2016 @05:18PM (#12168797)
My greatest gripe with Java was the amount of crap one had to go through just to build a simple Rest API. When I saw DropWizard I thought it solved that need. Maybe it's time to get back into Java development...
Re:Java REST framework Dropwizard 1.0 released by _pmf_ on Wednesday July 27, 2016 @03:30AM (#12171141)
Jetty has been around for a while; a response handler is a one liner (well, a Java one liner, which translates to 7 lines ...).

With Spark[0] (not to be confused with Apache Spark ...), you can get a Sinatra-like routing library on top of Jetty (while you still can deploy the webapp in a more heavyweight container if you need to).

I think Spark is in spirit much like Dropwizard, but a bit more lightweight.

[0] http://sparkjava.com/

Re:Java REST framework Dropwizard 1.0 released by CHY872 on Wednesday July 27, 2016 @03:54AM (#12171215)
(opinion: i've spent a year writing Dropwizard based apps, but only two evenings writing Spark based apps).

I think that Spark comes at the cost of customisability - 2-way SSL is a chore, you have to parse your own message bodies, you don't get straightforward logging out of the box - there's a base set of features and functionality that I couldn't find in Spark.

The thing that impressed me about Dropwizard is that you can get in perhaps 50 lines of boilerplate a really solid core behind an application - with Spark you can do that in perhaps 20, but you are somewhat limited beyond that.

Re:Java REST framework Dropwizard 1.0 released by _pmf_ on Wednesday July 27, 2016 @05:00AM (#12171403)
I've only used Spark in a very local context (small company internal projects), so I'll definitely take into account your experience when doing something bigger.
Re:Java REST framework Dropwizard 1.0 released by cle on Tuesday July 26, 2016 @05:47PM (#12168959)
If you love dealing with magic "comefrom" annotations, codegen that isn't debuggable, and foundational libraries that have to resort to bytecode manip to get stuff done, then go ahead.
Re:Java REST framework Dropwizard 1.0 released by asdf1234 on Tuesday July 26, 2016 @06:30PM (#12169226)
Yes. Most of the unnecessary complexity has just been moved from bad APIs with XML configuration to bad APIs with runtime scoped annotations, code generation and byte code manipulation. It's still a huge mess.
Re:Java REST framework Dropwizard 1.0 released by avita1 on Tuesday July 26, 2016 @07:45PM (#12169579)
I use Dropwizard in my day-to-day and I've never ran into any code generation or byte code manipulation.
Re:Java REST framework Dropwizard 1.0 released by asdf1234 on Tuesday July 26, 2016 @08:51PM (#12169809)
Yes you have. Jersey, Jackson and almost every Java database abstraction that's higher than JDBC uses one if not both. Dropwizard is one of the better Java libraries in this regard but it's still there.
Re:Java REST framework Dropwizard 1.0 released by ianai on Tuesday July 26, 2016 @08:08PM (#12169689)
Interesting because they made it sound pretty horrific.
Re:Java REST framework Dropwizard 1.0 released by spoondan on Tuesday July 26, 2016 @08:32PM (#12169768)
There's quite a bit of magic under the hood of DropWizard (or, rather, the components that make it up). My experience has been that a developer using DropWizard will rarely, if ever, encounter this magic: they don't need to be aware of it. But if the veil ever slips, the sheer amount of ugly machinery will shock and horrify.
Re:Java REST framework Dropwizard 1.0 released by CHY872 on Wednesday July 27, 2016 @03:57AM (#12171224)
I can see that. We found that if we added the Spotify Docker Client to our test classpath we couldn't run the application from Eclipse anymore because our Jackson object mapper had the wrong Jersey modules.

This was because that package depends on a different version of jersey-jackson or whatever, which was discovered by classpath scanning, and so because Eclipse doesn't keep a separate test classpath, we'd be discovering a new MessageBodyWriter which Jersey would be using to override the Dropwizard supplied MessageBodyWriter, which would not have the appropriate Jackson modules.

It was a mess.

Re:Java REST framework Dropwizard 1.0 released by i2shar on Wednesday July 27, 2016 @04:29AM (#12171298)
Classpath issues such as yours are very common in Java. I suppose that's why building a fat jar is part of the getting started section of the docs.
Re:Java REST framework Dropwizard 1.0 released by einrealist on Wednesday July 27, 2016 @06:06AM (#12171630)
Although it is very easy to add dependencies via Maven or Gradle, this does not prevent you from shooting yourself into the foot. You have to manage dependencies, including transitive ones. If the application has too many conflicting dependencies, then use classloader isolation (e.g. OSGi).

It is a littlebit sad, that there are no javac warnings enabled by default that at least check known classes for conflicts in the classpath. An IDE should do that by default, too.

Re:Java REST framework Dropwizard 1.0 released by quicksilver03 on Wednesday July 27, 2016 @04:35AM (#12171320)
That's 100% Eclipse's fault however, nothing to do with Jersey or Jackson.
Re:Java REST framework Dropwizard 1.0 released by sorokod on Wednesday July 27, 2016 @07:38AM (#12171963)
That's dynamic linking for you - you need to take the good with the bad
Re:Java REST framework Dropwizard 1.0 released by StreamBright on Wednesday July 27, 2016 @05:10AM (#12171437)
You just pointed out how a feature missing in your tooling can lead to problems. This has nothing to do with Dropwizard though.
Re:Java REST framework Dropwizard 1.0 released by avita1 on Wednesday July 27, 2016 @10:33AM (#12173080)
Personally ,the worst I've ever run into is some hairy classpath issue, as one the children comments mentions. Although maybe I'm just lucky.

Where does bytecode manipulation or code generation happen in Dropwizard? Reflection for sure, but not any more so than any major web framework in a dynamically typed language.

Maybe you're referring to the SQL library they suggest (which I've admittedly never used heavily). But I don't see how you can have a SQL library without generating SQL.

Re:Java REST framework Dropwizard 1.0 released by einrealist on Wednesday July 27, 2016 @05:43AM (#12171558)
I disagree. Dropwizard itself is really simple. The frameworks like Hibernate or HK2 are more complex, though. But there is definetely no magic involved.
Re:Java REST framework Dropwizard 1.0 released by alexbanks on Tuesday July 26, 2016 @08:13PM (#12169705)
So, is the answer to just bail on Java forever? I haven't written anything legitimate in Java in about two years, but I don't remember it being that bad.

For reference, what types of languages/frameworks do you like to work with?

Re:Java REST framework Dropwizard 1.0 released by switchbak on Tuesday July 26, 2016 @08:23PM (#12169733)
I'm not the OP, but I've had good luck with the Play2 framework. It works best with Scala, but it's Java support is great too.

I've also had good luck with Spring Boot, but it's a little magical for my tastes - I vastly prefer Guice for Java DI - just straightforward and predictable (that's just my subjective take though).

Dropwizard is a good bundling of stacks, but I don't think it'd match my personal preferences.

I will say that doing rest-style service work in modern Java frameworks is actually not too bad these days. Java 8 makes it even nicer.

Re:Java REST framework Dropwizard 1.0 released by darylteo on Wednesday July 27, 2016 @12:47AM (#12170582)
If you want to venture back to the JVM, Kotlin offers a very good middle ground between Java and Scala.
Re:Java REST framework Dropwizard 1.0 released by premium-concern on Wednesday July 27, 2016 @01:01AM (#12170625)
What's the "middle ground"? Java with a more concise syntax?
Re:Java REST framework Dropwizard 1.0 released by darylteo on Thursday July 28, 2016 @08:11PM (#12184215)
Pretty much. Its been very enjoyable to code in so far (and works with practically the whole Java ecosystem of libraries and platforms.

IntelliJ (Jetbrains are the leaders behind Kotlin) has first class support for the language. Gradle will have support for Kotlin as it's DSL in it's next major iteration.

Re:Java REST framework Dropwizard 1.0 released by premium-concern on Friday July 29, 2016 @10:24AM (#12186996)
Well, if you think the most important technical improvement to language design discovered since the creation of Java in 1995 is some shorter syntax, go ahead. I guess.

Despite some very loud people on the internet, it seems to have close to zero adoption, and JetBrains making big promises and then failing to deliver anything is not really helping them.

Re:Java REST framework Dropwizard 1.0 released by paukiatwee on Tuesday July 26, 2016 @10:33PM (#12170148)
We talking about DW here, so honest question, do you ever develop using DW before?
Re:Java REST framework Dropwizard 1.0 released by batbomb on Tuesday July 26, 2016 @06:49PM (#12169304)
Jackson+Jersey+Jetty is 95% of the way there for most things, it's not bad at all.