Live data from Hacker News

Spring vs. Java EE

gist.github.com

51–60 of 119 posts

Re: Spring vs. Java EE

#51
post #47
post #34

If I want to build a web app from scratch which should have some basic features (user identification, some standard level of security, REST interface, database integration) and I have some okay knowledge of Java (mainly CLI applications and some Android programming), which framework would you recommend for me to get started? I'm afraid to get lost in the details too quickly, so a framework that provides a working exa…

These are good answers but nowadays we would be remiss not to mention so-called "serverless" frameworks. Dropwizard et al are good suggestions for running your own instance, but more and more the serverless approach is an attractive alternative to implementing a web app. AWS Lambda now supports Java, so perhaps we could consider API Gateway, Cognito and DynamoDB/Aurora as one of the new "frameworks". Google has their…

RE: AWS Lambda, there are a lot of shortcomings, the biggest is latency when it's cold. Another is duration, if your process takes too long and you can't break it into smaller steps (probably not a good sign, but still...) Lambda is no-go.

Configuration generally kind of sucks to manage, you don't get some of the role inheritance you can get from standard EC2/IAM, and forget running inside a VPC.

The idea behind using something like API Gateway + a Lambda for the various end points sounds awesome in theory, but going beyond contrived examples shows that we're a long way out.

Re: Spring vs. Java EE

#52
post #34

If I want to build a web app from scratch which should have some basic features (user identification, some standard level of security, REST interface, database integration) and I have some okay knowledge of Java (mainly CLI applications and some Android programming), which framework would you recommend for me to get started? I'm afraid to get lost in the details too quickly, so a framework that provides a working exa…

Having used both I'd say JavaEE 7 is more concise and less complex of an API than the Spring framework. Unfortunately it's hard to predict the future of EE and its implementations thanks to Oracle. Spring uses some EE technologies and adds its own abstractions on top of them, which adds a whole layer of complexity.

Re: Spring vs. Java EE

#53

Spring vs. JavaEE is a topic that stopped being relevant five years ago. I cant believe anyone seriously considering any of these heavy duty teach stack in 2017. There are much much better choices out there even for Java developers, and if they can come out of their comfort zone a bit there is Clojure, Scala, Kotlin etc with MUCH nicer fraemworks

What frameworks would you recommend or look to get started with?

Re: Spring vs. Java EE

#54
post #34

If I want to build a web app from scratch which should have some basic features (user identification, some standard level of security, REST interface, database integration) and I have some okay knowledge of Java (mainly CLI applications and some Android programming), which framework would you recommend for me to get started? I'm afraid to get lost in the details too quickly, so a framework that provides a working exa…

I'd say Spring Boot. When you use JPA for basic data access, you don't have to have much in the way of data code. It's really easy to use Spring MVC for web front ends with Thymeleaf. It's really easy to make REST for when you don't want to render server side. All of this plugs into a free version of Eclipse called Spring STS. You can also use IntelliJ if you so chose. The nice thing about all of this is that you can simply deploy a JAR. No need for Tomcat or some other web container.

There is also a huge number of tutorials from the horse's mouth on the topic.

Re: Spring vs. Java EE

#55
post #47

Earlier quoted context omitted.

These are good answers but nowadays we would be remiss not to mention so-called "serverless" frameworks. Dropwizard et al are good suggestions for running your own instance, but more and more the serverless approach is an attractive alternative to implementing a web app. AWS Lambda now supports Java, so perhaps we could consider API Gateway, Cognito and DynamoDB/Aurora as one of the new "frameworks". Google has their…

RE: AWS Lambda, there are a lot of shortcomings, the biggest is latency when it's cold. Another is duration, if your process takes too long and you can't break it into smaller steps (probably not a good sign, but still...) Lambda is no-go. Configuration generally kind of sucks to manage, you don't get some of the role inheritance you can get from standard EC2/IAM, and forget running inside a VPC. The idea behind usin…

There's a lot to criticize about running your own Dropwizard, Play, Spring and Java EE instances as well, including the same issue of management headaches. In fact one of the key advantages of the "serverless" approach is less devops management overhead. To consider running your own instance "management suckage free" but calling something like serverless.com a headache is definitely not an apples-to-apples comparison.

Cold start time is a known issue but frankly, not that big of a problem in practice for many apps. Definitely I feel that dismissing this out of hand (I even got a downvote) is more of an emotional reaction to something really different and new than a rational one. There's nothing contrived about implementing a REST service with FaaS -- it's just simpler. It's worth giving it a serious look even as an experienced Java developer (as I am). There are a lot of benefits to the architecture, like minimal devops and tremendous cost effectiveness.

Re: Spring vs. Java EE

#56

I like Java, but I've never tried diving into the Spring or Java EE world. The little I've looked at it seem daunting and complex and I'm not sure what it really gives you at the end of the day. What functionality does it provide, what are the killer features? And is all this complexity justified?

I'll put my disclosure up-front: I work for Pivotal on a Cloud Foundry project. Pivotal employs many members of the Spring team. I am not speaking for either Spring or Pivotal. Both Spring and Java EE are very featuresome because of a long period of evolution across multiple partial paradigm shifts (3-tier, CORBA, Web 1.0, App Containers, SOA, VMs, Web 2.0, Containers...). I'm personally only familiar with Spring. An…

> Or: I could use Spring-Retry[0].

The idea that you would add a dependency to avoid writing a try-catch in a loop is absolutely bewildering to me. What next, Spring Pad? I can see it now:

  @LeftPad(width = 50)
  public String getNameForDisplay() {
    return name;
  }

Re: Spring vs. Java EE

#57

I like Java, but I've never tried diving into the Spring or Java EE world. The little I've looked at it seem daunting and complex and I'm not sure what it really gives you at the end of the day. What functionality does it provide, what are the killer features? And is all this complexity justified?

I've spent multiple-year periods using each of Java EE, Spring, and no formal framework (in practice, Guice for DI, Tomcat/Servlets for web, lots of libraries, and lots and lots of homebrew stuff). I can say with confidence that if your goal is just to build a sophisticated application, there's no advantage to using the frameworks.

They include a lot of functionality, but beyond demo-scale applications, you will spend as much time fighting the framework as you save by using it.

The frameworks probably do save you time in getting started; Spring Boot certainly has a pretty smooth experience going from nothing to a running project with a controller, database, etc. But that's a tiny expense in the lifetime of a project.

EE might give you some kind of confidence that you can port your app between app servers (or different releases of an app server!). If you work in an environment where some idiot up the hierarchy has decided everyone should use app servers, that might be useful, but there's no point setting out to create such an environment.

Re: Spring vs. Java EE

#58
post #29

Earlier quoted context omitted.

Same here, Scala rocks ! Too bad play 2 is now using guice and promots runtime dependency injection like in Java world. Compile dependency injection is much better, I fear they'll try to mimick spring more and more in order to attract java crowds.

I got the same feeling here. Implicits in Scala can act as statically checked dependency injection, I don't know why they are going for this runtime dependant injection instead.

Play supports static DI aka cake pattern or macwire aswell.

Re: Spring vs. Java EE

#59
post #34

If I want to build a web app from scratch which should have some basic features (user identification, some standard level of security, REST interface, database integration) and I have some okay knowledge of Java (mainly CLI applications and some Android programming), which framework would you recommend for me to get started? I'm afraid to get lost in the details too quickly, so a framework that provides a working exa…

I'd say Spring Boot. When you use JPA for basic data access, you don't have to have much in the way of data code. It's really easy to use Spring MVC for web front ends with Thymeleaf. It's really easy to make REST for when you don't want to render server side. All of this plugs into a free version of Eclipse called Spring STS. You can also use IntelliJ if you so chose. The nice thing about all of this is that you can…

[deleted]

Re: Spring vs. Java EE

#60
post #42
post #34

If I want to build a web app from scratch which should have some basic features (user identification, some standard level of security, REST interface, database integration) and I have some okay knowledge of Java (mainly CLI applications and some Android programming), which framework would you recommend for me to get started? I'm afraid to get lost in the details too quickly, so a framework that provides a working exa…

http://sparkjava.com/ Definitely not all batteries included, but a great minimalist web library to get started with.

Have been using Spark a lot recently. Very impressed. Gets out of the way and makes Java considerably less painful then it used to be.
Post reply on HN