News for hackers. Stuff that matters.
Re:Java 12 by MarkMc on Tuesday March 19, 2019 @09:00PM (#19437851)
I'm so glad I was taught Java at Macquarie University back in 1998. For the past 20 years I've had a career built on a solid API that doesn't change every 2 years like some flavour-of-the-month Javascript framework.

Even on the client where Java has lost to Javascript, I'm finding it more enjoyable to add features to my 15-year-old SWT app [0] rather than dealing with the multiple layers of abstractions that is Javascript+CSS+DOM (+ maybe Electron). Personally I think it's a shame Sun dropped the ball with client Java - if they had chosen SWT over Swing and provided a minimal JVM then maybe Java Web Start would have beaten Javascript web apps. It's also a shame Sun sold Java to Oracle - Google would have been a better steward, and probably would have been willing to pay more for the Java parts of Sun.

I'm now trying Dart to develop a few Flutter apps. It's no doubt a better language, but not that much better - I think Flutter would have been more successful if it was built on Java.

[0] https://www.solaraccounts.co.uk

Re:Java 12 by tannhaeuser on Wednesday March 20, 2019 @03:10AM (#19439726)
The times of ever-changing JavaScript frontend frameworks is long behind us (and, arguably, React has won for MVw-style browser apps). The core node.js web serving APIs (expressjs and core http request API, which expressjs middlewares forwards and decorates) is stable since node.js v0.1 or at least 2015, and infinitely better than Java's servlet, JSP, and taglib APIs (web.xml/jetty-config.xml anyone?).

The flip side of Java's stability is stagnation. On the server-side, customers use mostly Spring/Spring Boot these days to make Java's overengineered stack usable, using even more over-engineering and metaprogramming. Same with maven/gradle, which turns what should be a developer-focussed build system into an enterprise XML mess.

SWT? I'm glad it works for you. Last I heard, IBM had pulled out of developing Eclipse and SWT/RCP over ten years ago. In the one project where we used it, the app looked like an IDE, and customers hated, then cancelled it. Designed as wrappers for OS-native GUI controls, it has even less of a place in a browser than Swing had. Last I looked, of the Java rich-client frameworks, only Swing has been updated with HIDPI support, whereas JavaFX and SWT haven't. None is using any of those (with the exception of experimental JFX apps) for new apps in this decade.

Re:Java 12 by vbsteven on Wednesday March 20, 2019 @03:34AM (#19439803)
You can call Spring (boot) over-engineered. I call it feature full and extensible.

Whereas in the modern JS world, you start out with a lean project and then add small libraries from NPM that all work slightly different for every feature you need, in the Spring world where the framework has matured for 10+ years most of the things you will need are in the box or are available as external libraries that all work on the same defined interfaces.

Spring Boot with Java 11 or Kotlin are still my preferred backend stack for that reason. It’s solid, has aged well and makes me super productive.

Re:Java 12 by nickspacek on Wednesday March 20, 2019 @07:31AM (#19441002)
Actually they just said that Java's server-side stack is overengineered, and that Spring/Spring Boot hides that complexity. I think that is mostly true.
Re:Java 12 by jimbokun on Wednesday March 20, 2019 @01:20PM (#19444414)
"Spring/Spring Boot hides that complexity"

Until it doesn't, then everything goes to Hell very quickly.

Spring is close to impossible to debug, because everything is driven by annotations, configuration settings, property files, beans defined in XML, default values, or code that runs because you added a dependency even though you never explicitly call it.

Program logic is defined in anything and everything, except actual Java code.

The whole thing is a nightmare ignoring every principle of simplicity, composability, referential transparency, and every other established principle of good software design.

Re:Java 12 by vbsteven on Friday March 22, 2019 @04:20AM (#19460456)
> Spring is close to impossible to debug, because everything is driven by annotations, configuration settings, property files, beans defined in XML, default values, or code that runs because you added a dependency even though you never explicitly call it.

I see a comment like this every week on HN and I've been meaning to write a blogpost or two to address this.

Yes, as you mentioned there is a myriad of ways to configure a Spring(Boot) application, and I think that is one of things that make it such a powerful framework or platform to build a service on. To address a few of your points:

* beans defined in XML : we don't do that anymore since annotations got introduced. I haven't written a beans.xml file in years.

* Program logic is exactly where you expect it: in the Java code. All the property files and annotations are used for configuration to allow for different environments. This setup allows us to run the exact same binary jar or docker image built from CI to run in CI, in dev, in staging and in multiple different production environments.

* configuration settings and property files are the same thing as the configuration values go into property files, you can have multiple property files to group configuration logically by their purpose, and if needed duplicate each property file per environment to group those together. I know my database config for the staging environment is in database-staging.properties. If that is not enough you can easily override any of the values with environment variables

* Debugging : another point where Java gets huge flak here on HN is huge stack traces, well I think those are actually helpful in figuring out exactly what is running and giving you trouble in a specific environment. And because of the separation of configuration from code mentioned above it is trivial to setup a testcase with the exact same configuration that you are having trouble with and use a debugger on that testcase to inspect and debug.

* Simplicity and composability : While the framework can look complex if you don't understand the configuration system, it is actually there to facilitate composability. See my point about running the same binary in all environments. The big idea is that you put all code in the same repo and then compose and configure your application at runtime with the configuration system.

Re:Java 12 by mtrovo on Friday March 22, 2019 @10:35AM (#19462888)
I understand where you come from but for me this is a huge drawback when I have to use Spring. I never know what to expect when working on a new spring project.

> beans defined in XML : we don't do that anymore But you still can do that! Also you still can do DI with Autowired private fields instead of injecting via constructors. You can also create beans based on properties. You can also create beans automatically via a included JAR on your class path. On Spring Boot you can also have beans created based based on some conditional annotation. And now there's yet another new DSL [1] to create your beans programatically on startup time. Tracking down and debugging what's loaded in Spring is super hard compared to Guice for example.

Configuration is another piece of software that I have a really hard time to think why they do that. You can configure via a YAML file, AND via a properties file, AND overriding via environment variables, AND also with a configuration server that store your properties on a separated server, and they are all mixed together in a weird single configuration entry for the specific environment that you have. Probably this made sense some 10 years ago when we loved J2EE but why support this kind of madness nowadays?

What I feel Spring is missing so much is forgetting about all the past and where the framework came from, start from scratch with simple premises around reactor-netty [2], only supporting the functional DSL, no crazy class path scanning, no crazy configuration loading, just a simple DI framework with some batteries included.

[1] https://spring.io/blog/2017/08/01/spring-framework-5-kotlin-... [2] https://github.com/reactor/reactor-netty

Re:Java 12 by vbsteven on Wednesday March 20, 2019 @08:14AM (#19441284)
Parent said that Spring Boot accomplishes that with more over-engineering and metaprogramming. I wanted to point out that what parent calls over-engineering is actually useful abstractions that make it easy to get started out of the box, and have sane standardized interfaces to replace or integrate components where needed.
Re:Java 12 by BozeWolf on Wednesday March 20, 2019 @03:56AM (#19439905)
Haha! Funny man! I am only doing javascript occasionly. Most of my time i do python and swift.

Even stuff in “core” dependencies like webpack/yarn/npm/npx/nvm/babel changes a few times a year.

Right now doing a react native app and a browser extension. While javascript/typescript is fun to write, the time you have to spend fixing the tools is just horrible. Whiping cache, rebooting, switching package versions.. It makes the overall experience cumbersome.

I would not call something stable if it manages to work 2 whole years.

Re:Java 12 by lmm on Wednesday March 20, 2019 @06:09AM (#19440566)
> On the server-side, customers use mostly Spring/Spring Boot these days to make Java's overengineered stack usable, using even more over-engineering and metaprogramming.

There was definitely an era of that, but over the past decade or so it's been acknowledged as a problem, and there's been a lot of effort put into making things simpler and more vanilla. Modern Spring is much much closer to plain old code. (Of course it's still possible to write in the XML/setter injection/afterPropertiesSet style, and always will be - that's backward compatibility for you - but it's very possible to migrate existing applications to a better style in place, which very few platforms manage).

> Same with maven/gradle, which turns what should be a developer-focussed build system into an enterprise XML mess.

Maven is pretty close to the perfect build system, it's just taken a while for knowledge and practices to catch up with it. All the stuff people love and praise Cargo for, Maven has been doing for 15+ years.

Re:Java 12 by tannhaeuser on Wednesday March 20, 2019 @08:06AM (#19441223)
The basics of maven might be sound (though it could make it easier to work with local dependencies) and npm et al have basically copied it. Where maven dropped the ball is the myriad of maven plugin magic, maven's implicit lifecyle, and a pom.xml's Turing pits, etc. I've developed Java apps since almost the beginning, and am as much of a markup geek as could be, but still hate maven with a passion, and often times do not understand what tf it wants from me. I just don't have the patience with wading through crap that 2003ish Java nerds thought would be a good idea. And increasingly, as Java libs get EOLd, this will be a major problem for monolithic Java apps with tens of submodules. I don't think you can expect younger devs to keep maintaining daddy-o's web framework crap and cleanup the mess left by Java heads.

However, I don't want to sound too negative. I can see a perspective for the JVM (Graal/Truffle) as a polyglot runtime where most of the ancient Java stuff is hidden from you, and you're using JavaScript or other non-JVM-only language as a migration strategy to get rid of Java alltogether in the distant future.

Re:Java 12 by lmm on Wednesday March 20, 2019 @09:24AM (#19441840)
> Where maven dropped the ball is the myriad of maven plugin magic, maven's implicit lifecyle, and a pom.xml's Turing pits, etc.

Could you be a bit more concrete? I don't recognize any of your descriptions in my experience of maven.

There are probably some bad plugins out there, but as in any system the solution is not to use them.

The complete lifecycle is listed in the documentation, and it's all very common-sense.

pom.xml isn't meant to be Turing-complete, and if you try to use it like a Turing-complete build language you will get yourself in trouble (as many of the early Ant diehards did). You need to treat it as a declarative config file, no different from e.g. Cargo.toml.

> I just don't have the patience with wading through crap that 2003ish Java nerds thought would be a good idea. And increasingly, as Java libs get EOLd, this will be a major problem for monolithic Java apps with tens of submodules. I don't think you can expect younger devs to keep maintaining daddy-o's web framework crap and cleanup the mess left by Java heads.

It's just the opposite. I don't expect anyone to want to maintain Ant or Gradle builds in the future, since they can have any kind of crap in them. But Maven builds are forced to be kept sensible; the tool just isn't flexible enough to let you put crap in your build definition, by design. (If you really insist on doing crap you can make a crappy plugin, but your plugin is then forced to be versioned, tagged in VCS etc., so stands a better chance of being picked up by your organisation's normal code quality efforts).

Re:Java 12 by tannhaeuser on Wednesday March 20, 2019 @11:17AM (#19443012)
I may be biased by doing freelance work (eg. seeing only crap projects), but almost all customers struggle with fckn maven: migrating freaking jetty-maven-plugin, servlet api versioning conflicts, ad-hoc scripting using ant plugin, shading/fatjar plugins, multiple mvn central listings for the same artifact, fragile local dependency resolution, dozens of pointless submodules. A customer of mine even had a solid 3 week outage when they wanted to setup a product for blue/green deployment based on maven. Makes autotools look like a sane build tool.
Re:Java 12 by lmm on Wednesday March 20, 2019 @11:47AM (#19443351)
> migrating freaking jetty-maven-plugin

There's a jetty-maven-plugin? What for? When I use jetty I treat it as a library, embed it in my application, write my own main() and then my application is just a normal application.

> servlet api versioning conflicts

> multiple mvn central listings for the same artifact

These are a genuine problems but they're ones that every mature ecosystem struggles with. Maven has better tooling than most IME - you can use the enforcer plugin to require dependency convergence, and when multiple packages contain the same API you can put exclusions in a common parent. No ecosystem has really solved the problem of package renames nicely, IME.

> ad-hoc scripting using ant plugin

Yeah don't do that. If people will insist on shooting themselves in the foot, there's only so much you can do to stop them.

> shading/fatjar plugin

What went wrong there? IME the shade plugin is very good. There are a couple of inherent JVM-level limitations (having to specify transformers for service locator files etc. because of the way the JVM spec is written) but it's hard to imagine any other build tool could do better.

> fragile local dependency resolution

Not my experience at all - what specifically goes wrong?

> dozens of pointless submodules

Submodules are cheap. IME when coming to work on a new project it's much easier to understand the build/dependency structure if there are lot of submodules rather than a complex build - e.g. rather than trying to have a custom build phase for generating some RPC stubs or whatever, it's fine to just have them in their own submodule and then it's obvious to the reader what the dependency graph looks like. What's the downside?

> A customer of mine even had a solid 3 week outage when they wanted to setup a product for blue/green deployment based on maven.

What? How?

> Makes autotools look like a sane build tool.

Strongly disagree with that one. Autotools has several layers of template/macro expansion that all seem to do much the same thing (so why not just one?) and encourages builds that use arbitrary unversioned command line tools from the host system, meaning you very rarely get reproducible behaviour on a host with a different setup. Maven gives consistent, declarative builds - what's not to like?

Re:Java 12 by jimbokun on Wednesday March 20, 2019 @01:25PM (#19444490)
"Modern Spring is much much closer to plain old code."

Modern Spring, as far as I can tell, is still very much driven outside of Java code, it's just migrated from XML to annotations and yaml properties files. Seems almost like the typical Spring application has more lines of annotations and properties files than lines of Java code.

I am fond of Maven, though, especially with Gradle (superior to pom files).

Re:Java 12 by lmm on Wednesday March 20, 2019 @07:03PM (#19447869)
> Modern Spring, as far as I can tell, is still very much driven outside of Java code, it's just migrated from XML to annotations and yaml properties files.

Disagree; there's been a shift to using constructor injection over setter injection, which often obviates the need for Spring-specific lifecycle methods. So it's now much more common to have a service class that, while it may have Spring annotations on its constructor, can also be used in a first-class way in plain old Java, and e.g. doesn't use Spring for unit tests. If you're using Spring at all then part of your application wiring lives outside Java code almost by definition, but it's now more common to express wiring logic as e.g. an annotated Java method rather than encoded into XML. It's not a complete departure, and it may not go as far as you or I would like, but I do think there's been a real cultural shift.

> especially with Gradle (superior to pom files).

It really isn't. Arbitrary unmanaged code in the build definition is great for writing but terrible for maintainability.

Re:Java 12 by sourcesmith on Wednesday March 20, 2019 @05:49AM (#19440473)
Bad decisions can be made using any technology. Java has a lot of crufty legacy APIs because, well it has a legacy. I gave up using JSPs years ago for Freemarker. I now use Vert.x rather than servlet contains which gives me a node.js environment but with access to the Java ecosystems and basic things like mature logging frameworks, as well as more advanced features (oh and multithreading in a single process).

Despite Spring being Enterprise it still scales down to simpler apps pretty well due to its modularity.

These can be build into a single jar app that is easy to build and deploy, and combined with a database migration library, maintain their own database schemas. Very, very usable.

Yes, I probably would not use Java on the frontend unless it was for a technical audience.

Re:Java 12 by provolone on Wednesday March 20, 2019 @07:26AM (#19440976)
Spring and other frameworks may be popular, but the base servlet api with db connection pooling is enough. This approach feels much lighter than using frameworks. Not sure where the 'over-engineered' view comes from. I'd call that 'sane'.

People complain about the verbosity of Java, but how much time do you spend learning a new framework and all of the gotchas? At the end of the day it seems easier to just write the boilerplate. All of that verbose code means you got exactly what you asked for.

JVM projects never surprise me. When there is a problem debugging is a dream.

Re:Java 12 by coldtea on Wednesday March 20, 2019 @07:38AM (#19441061)
>Spring and other frameworks may be popular, but the base servlet api with db connection pooling is enough. This approach feels much lighter than using frameworks.

That. I've used the Servlets API for years in the early to late 00s.

I'm now (for the past 5 years) using Express with Node.

Static typing and cosmetic differences aside, Servlets and Express (or Node's raw handlers) are pretty much the same API.

Request, Response objects, handlers, middleware (iirc we used to call those last "filters" in the Servlet era), etc. It's not like it's some alien convoluted design.

(Java Server Faces now was another thing)

Re:Java 12 by ivan_gammel on Wednesday March 20, 2019 @03:54AM (#19439898)
Any app reaching complexity of what’s being done on Java will look the same, no matter what platform do you choose. I haven’t yet seen large nodejs deployments with MLOCs and hundreds of developers, but I’m pretty sure it can easily become much bigger mess - the tools and the libraries are immature, there’s lack of enterprise SDLC patterns etc, which creates a lot of obstacles. Spring is becoming too enterprisey these days, that’s true, but it’s still fit for use in modern architectures - only if you understand how to utilize all of its capabilities.
Re:Java 12 by tannhaeuser on Wednesday March 20, 2019 @04:43AM (#19440136)
nodejs isn't a replacement for fat backends for sure, but it's working really well for a frontend-facing light backend where frontend developers can add endpoints as the need arises, such as for autocomplete functionality, and where first-party support for asset pipeline tools is desired. The Spring experience isn't bad for newbies creating "REST" microservice spaghetti to have something to show at the end of their agile day, but it gets seriously in your way if you're a seasoned dev and have a solid understanding of what you want to achieve in terms of network-exposed interfaces and integration with other apps.
Re:Java 12 by ivan_gammel on Wednesday March 20, 2019 @01:04PM (#19444223)
I‘m seasoned dev with 20 years of Java programming experience, I see no problems using Spring and I don’t see why anyone with similar experience would have any. It’s sometimes not obvious, how some things work, but it’s open source and the code is quite good to analyze, extend or replace.
Re:Java 12 by jimbokun on Wednesday March 20, 2019 @01:33PM (#19444583)
"the code is quite good to analyze, extend or replace"

But how do you even know what code to read when so much of the program's logic is in annotations and other kinds of action at a distance?

Re:Java 12 by tannhaeuser on Wednesday March 20, 2019 @02:17PM (#19445139)
Exactly. For example, if you're (still) using Spring MVC, what gets called in your backend on a given action attribute in your JSP or Thymeleaf or whatever template, is expressed through your method signature and lots of annotations where the order of arguments matter eg. some magic attributes must come right after others. All you see in your debugger, though, is that your request hangs in some nested and chained handler and reflection monstrosity driven by annotations and who knows what. Took multiple developers a day or two to figure out, each on their own.

It's not that Spring is badly coded or something, I just don't need these surprises and the magical thinking surrounding newbie Spring Boot projects.

Re:Java 12 by ivan_gammel on Wednesday March 20, 2019 @03:09PM (#19445702)
Newbie can write bad code on any platform, but it‘s a short period of life of software developer - the problem of beginners is solved not by the tools they use, but through a reasonable composition of the team with sufficient number of experienced developers who can define the architecture and best practices.
Re:Java 12 by jimbokun on Wednesday March 20, 2019 @03:50PM (#19446134)
From what I can tell, the "bad" Spring code is the code following the recommended Best Practices, at least according to the tutorials that pop up in Google search results.
Re:Java 12 by ivan_gammel on Thursday March 21, 2019 @02:43AM (#19449685)
There’s one “must read” tutorial - documentation on official Spring website. There’s also github account with lots of examples. It’s better to ignore the trash that comes from search results, because either it’s trivial or obsolete.
Re:Java 12 by ptx on Wednesday March 20, 2019 @05:30PM (#19447156)
Another related surprising thing (as I'm currently learning Spring/Hibernate/etc.) is what happens when the Hibernate Validator library is missing at runtime:

Nothing.

All the carefully crafted validation annotations just don't do anything, no validation is performed, and there is no indication whatsoever of this.

Re:Java 12 by ivan_gammel on Thursday March 21, 2019 @02:37AM (#19449669)
It’s not a problem with annotations or Spring - could happen e.g. with SPI and anything that’s discovered in runtime. It’s about how you build your project and configure dependencies (separation of API and implementation in different JARs is typical for Java and implies certain way of thought about build and deployment).
Re:Java 12 by ivan_gammel on Wednesday March 20, 2019 @03:04PM (#19445650)
The source code of Spring itself. I know Spring internals - there’s no dark magic there and reference guide describes it well. DI is straightforward, MVC - not perfect, but generally easy, Security - well, it has design problems, but they are not related to annotations.
Re:Java 12 by jimbokun on Wednesday March 20, 2019 @03:48PM (#19446107)
"but they are not related to annotations"

I had a problem with security that I could only solve by adding an "Order" annotation to my class. Reading the code and stepping through it in the debugger did me absolutely no good.

Re:Java 12 by ivan_gammel on Thursday March 21, 2019 @02:47AM (#19449692)
So, annotation was a solution to a problem (how to define a sequence in which configuration is applied), not a cause, right?
Re:Java 12 by apta on Wednesday March 20, 2019 @01:53PM (#19444820)
> On the server-side, customers use mostly Spring/Spring Boot these days to make Java's overengineered stack usable, using even more over-engineering and metaprogramming.

Could you elaborate on the overengineering part? There are many modern frameworks that are much lighterweight than Spring/Spring Boot, and with the introduction of lambdas in Java, things are even more straightforward.

Also, gradle doesn't use XML.

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @03:48AM (#19439867)
In all these years I have used Spring exactly once for an architecture prototype, during one month project.

All our customers doing Java Web projects are either on JEE, or a CMS platform running on top of servlets and JEE related JSRs, like Liferay and AM.

Re:Java 12 by tannhaeuser on Wednesday March 20, 2019 @04:17AM (#19439999)
I have no doubt it's working for you and your customers. But JEE and JSRs have been a dead end for many years now. When there are only single implementations for JSRs left, the whole exercise becomes pointless and masochistic, doesn't it?

In 2006 I played around with Jackrabbit for an architecture concept (for managing airworthiness of airplanes and kit). That was before the Iphone even existed. I was honestly surprised Adobe is still using it in their AEM product. From what I recall, it manages a document tree, based on a 2004-ish, Drupal-like node graph in typical Java enterprise fashion.

I'm no insider, but my guess is Adobe is struggling for some time now to integrate AEM, Magento, and other purchases into a lineup for creating shopping experiences. We'll see how this works out.

Re:Java 12 by coldtea on Wednesday March 20, 2019 @07:39AM (#19441069)
>When there are only single implementations for JSRs left, the whole exercise becomes pointless and masochistic, doesn't it?

Not any more than PEPs are.

Re:Java 12 by tannhaeuser on Wednesday March 20, 2019 @04:52AM (#19440168)
Edit: Liferay is a portlets container isn't it? My experience is only with Websfear portal (shudder) but I think managing UI state on the server has had no reason to exist since at least 2008 when Chrome/V8 came out, and the massive JavaScript improvements of the last 10 years following it
Re:Java 12 by pjmlp on Wednesday March 20, 2019 @06:16AM (#19440612)
Meanwhile JavaScript frameworks are all the hype rediscovering server side rendering to improve performance.

I have learned it pays off longterm to watch caravans pass by.

Pure HTML and CSS with minimal JavaScript rules rendering performance.

Re:Java 12 by spricket on Tuesday March 19, 2019 @09:10PM (#19437912)
One of my Java guilty pleasures is pulling in some 14 year old library and it just works. Absolute gold for a company with a lotta old code sitting around.

I also do a good bit of frontend and holy crap it's exhausting. That's the main reason I push hard for Java backend. Backends tend to stick around about a decade longer than you would like, while front end code is due for a rewrite every 3 years

Re:Java 12 by ksec on Wednesday March 20, 2019 @03:15AM (#19439739)
>Google would have been a better steward, and probably would have been willing to pay more for the Java parts of Sun.

They didn't and Google didn't want a pay a single dollar to Sun on Java. As James Gosling has mentioned multiple times. I don't understand why people are still painting Google as Saint after all these years.

Re:Java 12 by merb on Wednesday March 20, 2019 @04:25AM (#19440053)
actually they didn't want to pay a single dollar to sun, because of licensing reasons, not because they didn't wanted to buy java.

currently they recreated the java apis by pulling in apache harmony and they tought that they are in the right or at least in a fair use position (they still think they do). but I agree, I'm not sure if the direction of java would've been better when google would have the stewardship.

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @07:31AM (#19440998)
They had the opportunity to buy Sun when it went on sale, instead they thought they could get away with it.
Re:Java 12 by Justsignedup on Tuesday March 19, 2019 @09:05PM (#19437885)
just had this conversation with a co-worker today.

java is a stable api but it also doesn't evolve. The tradeoff is you get a program guaranteed to work no matter the upgrade vs being able to build better toolage.

React changes every year or 2. It is exhausting. But you get way better patterns and some things that drastically improve productivity.

Re:Java 12 by sixstringtheory on Tuesday March 19, 2019 @09:51PM (#19438139)
Java gives you a flexible object oriented language and an incredible set of libraries. It's got an archiver for artifact and dependency management. It now has lambdas and has FRP style stream programming. I'd say it's kept up pretty well with modern fashion, while it's been doing other things far longer than newer, more popular languages. Take Swift, now my daily driver (which I love so much compared to ObjC, which I moved to after Java)... an example of something Java had way before Swift is "Protocol Oriented Programming". Also, Swing's GridBagLayout predates iOS' AutoLayout and CSS (edit: don't know where I was going with CSS haha...). Everything old is new again, and I'm sure Java reinvented a few wheels of it's own.

Also keep in mind that React is a library, not a language. If you want to compare things, compare Javascript to Java, or the Java stdlibs to React. Maybe that's what you meant when you said Java.

IMO, Java and its libraries are nicer to work with solely due to its static nature and OO design. It is worlds apart from a scripting language when you need to refactor, or even just understand, legacy code. And if you can't even run tests on that legacy code anymore, like a React project over a year or two old?

What are the better patterns and productivity boosts you get from React vs. a Java ecosystem?

Re:Java 12 by humbleMouse on Tuesday March 19, 2019 @11:03PM (#19438532)
In addition to all of these good things, you can also use groovy which has a ton of shorthand syntax and makes writing code super easy. Groovy also makes writing tests short and simple. I love java and all jvm languages honestly.
Re:Java 12 by euyyn on Wednesday March 20, 2019 @02:47AM (#19439633)
Kotlin though. Everything you said, but a joy to write instead of a chore.
Re:Java 12 by pjmlp on Wednesday March 20, 2019 @03:50AM (#19439882)
I am betting Kotlin is the new Groovy.

Lets see where it stands 5 years from now, specially if Fuchsia actually gets released.

Re:Java 12 by ptx on Wednesday March 20, 2019 @05:07AM (#19440262)
Kotlin is different because of the focus on tooling, which is the advantage Java still had over all the dynamically typed JVM languages.

Also, Kotlin/Native is in beta now and could target Fuchsia (compiling AOT to native code using LLVM).

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @06:14AM (#19440594)
What tooling? Being forced to use InteliJ, without any proper support on Eclipse and Netbeans?

Still not able to use several of Android Studio features available to Java, like incremental compilation and slim APKs?

Kotlin advocates seem to forget JVM will never be rewritten in Kotlin, the language is just yet another guest, with the usual syndrome to wrap existing libraries, having to take care about FFI for Java access, not having all features taking advatange of the latest bytecodes, e.g. lambdas implementation.

As for Kotlin/Native, there is nothing to worry about versus what Go, Rust, C++, Dart, D, Nim offer in terms of performance, libraries and in some cases tooling.

Having to buy CLion for a graphical debugger isn't a selling point versus the established alternatives.

Fuchsia is being written in Go, Rust, C++ and Dart, with the team now hiring for node.js support.

https://www.androidpolice.com/2019/03/19/google-working-to-b...

Re:Java 12 by coldtea on Wednesday March 20, 2019 @07:55AM (#19441157)
>What tooling? Being forced to use InteliJ, without any proper support on Eclipse and Netbeans?

Seeing that both Eclipse and Netbeans are now more or less dead (and speaking as a long time Eclipse user, from the very first version to around 4), yes, first class vendor-direct InteliJ support is more than enough. And more than most languages (including Groovy) ever had.

>As for Kotlin/Native, there is nothing to worry about versus what Go, Rust, C++, Dart, D, Nim offer in terms of performance, libraries and in some cases tooling.

IMHO, Rust will always be kind of niche as hard to tackle, Dart we'll see, D never went anywhere, and Nim will remain niche, it's a little too idiosyncratic to catch on.

Kotlin is already more popular than all of the above except perhaps Go.

>Fuchsia is being written in Go, Rust, C++ and Dart, with the team now hiring for node.js support.

Fuchsia is still vaporware or at least irrelevant. It's not even in the market yet. And the fact that it's written in 4 (and looking for 5th) languages doesn't really bring much confidence.

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @08:13AM (#19441271)
Groovy had Netbeans and Eclipse support, which was dropped when it started fading away.

We move in different worlds, no InteliJ installations around here.

I remember when Groovy was popular, with every JUG in Germany having weekly talks and Sun talking how the next JEE revision would support Groovy for writing beans.

Popularity doesn't write software.

Re:Java 12 by coldtea on Wednesday March 20, 2019 @09:44AM (#19442043)
>Groovy had Netbeans and Eclipse support, which was dropped when it started fading away.

I know, I've used it. What I said is that it did not have the first class IDE attention of a major vendor, those were mostly third party sub-par plugins compared to the Java focus of those IDEs. For Kotlin, however, it was first class IDE support as a primary concern from the start.

>We move in different worlds, no InteliJ installations around here.

Then we indeed move in different worlds.

>Popularity doesn't write software.

No, its just the only thing that matters when it comes to get paid for it.

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @10:26AM (#19442527)
Delivering working software as per customer's RFP is what matters, everything else is fluff.
Re:Java 12 by olavgg on Wednesday March 20, 2019 @08:51AM (#19441499)
I don't understand how Groovy is fading away when it is getting more and more popular. Groovy is also very similar to Java. There is no learning curve, you are immediately creating value.
Re:Java 12 by pjmlp on Wednesday March 20, 2019 @09:19AM (#19441783)
More popular where?

Had it not been for Google's adoption of Gradle for Android and it would have been left for Grails maintenance projects.

And even then, the pressure for perfomance has been so much that it is being superceded by a Kotlin based DSL.

How to improve Gradle has been a common talk at every Android conference since Android Studio has been introduced.

Re:Java 12 by olavgg on Wednesday March 20, 2019 @10:00AM (#19442223)
Everywhere?

Google Trends says Groovy is just as popular as it was 10 years ago. The number of downloads has increased significantly but it is not because of Gradle, as Gradle bundles Groovy. It is also currently placed #16. on TIOBE Index

And last, Groovy with compile static is in most cases, just as fast and memory efficient as Java.

Some people always talk down Groovy, yet the numbers speak for them self. Before Kotlin, Groovy was attacked by Scala developers.

The major thing Groovy has over both Scala and Kotlin is strong similarity to Java syntax which makes the learning curve non-existing. And that is a bigger deal than a random cryptic/confusing programming expression. Code readability is very important.

Re:Java 12 by vorg on Thursday March 21, 2019 @02:04AM (#19449558)
> Some people always talk down Groovy, yet the numbers speak for them self

Many of those numbers are fake. Groovy was #70 on the Tiobe index only 12 months ago, see [1], but is #16 now. How do you explain that? Groovy was last in Tiobe's top 20 about 2 years ago when the search numbers for "Groovy" from Baidu were hugely incorrect. Groovy later quickly dropped back out of the top 50.

[1] https://www.tiobe.com/tiobe-index/groovy/

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @10:29AM (#19442557)
Certainly not in Germany where it vanished from JUGs.

https://trends.google.com/trends/explore?q=%2Fm%2F07sbkfb,%2...

Java worldwide average 86%

Groovy worldwide average 2%

Pretty popular indeed.

Re:Java 12 by pjmlp on Thursday March 21, 2019 @10:41AM (#19452854)
Re:Java 12 by dcow on Wednesday March 20, 2019 @11:52AM (#19443402)
Fuchsia is language agnostic. This is a boon. Writing for Fuchsia isn’t like writing for Unix where C is king. Fuchsia is able to natively host many more ecosystems than Linux cares to bother with. It gives me great confidence.
Re:Java 12 by coldtea on Wednesday March 20, 2019 @05:37PM (#19447217)
Tons of great stuff for Unix is written in C++ and other languages all the way to Python and Java. You can write Unix apps in whatever language you want. Ditto for Windows and MacOS.

Not sure what the special deal is with Fuchsia here.

Perhaps you think you'll be able to write Fucshia device drivers with any language you like? That wont be the case at all.

Also Linux has this going in its favor over Fucshia: it actually exists.

Re:Java 12 by hota_mazi on Wednesday March 20, 2019 @05:21PM (#19447068)
Windows has been language agnostic for decades.

What's so remarkable about that fact?

Re:Java 12 by stewbrew on Thursday March 21, 2019 @12:30AM (#19449304)
"InteliJ support is more than enough"

That won't get kotlin more traction. No proper/official tools for LSP support means no vscode, vim, emacs etc. users. As a happy eclipse user, I wouldn't call it dead either.

Re:Java 12 by coldtea on Wednesday March 20, 2019 @07:49AM (#19441130)
Groovy was a random JVM-based dynamic language with no major company support and no special tooling.

Kotlin has IntelliJ (and thus a great IDE) and Google standing behind it, and Steve Yegge's nod of approval.

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @08:10AM (#19441253)
Not every Java shop is going to drop Eclipse and Netbeans just to make JetBrains happy.

As for Android, lets see what happens with Fuchsia.

The overwhelming majority of Java developers don't even know who Steve Yegge is.

Re:Java 12 by coldtea on Wednesday March 20, 2019 @09:46AM (#19442075)
>Not every Java shop is going to drop Eclipse and Netbeans just to make JetBrains happy.

True. They will drop them because Eclipse has been faltering for ages and has been dropped by IBM, and Netbeans has always been a subpar unloved stepchild used by the kind of devs that don't know better and think SlickEdit or Notepad++ are great editors.

>The overwhelming majority of Java developers don't even know who Steve Yegge is.

That's on them.

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @10:32AM (#19442598)
I guess Fortune 500's have missed that memo, including IBM own subsidiaries.

Lets talk back in 5 years from now.

I am betting Kotlin would become yet another language that happens to compile to the JVM, after the Android honeymoon goes away.

Re:Java 12 by coldtea on Wednesday March 20, 2019 @11:30AM (#19443169)
>I guess Fortune 500's have missed that memo, including IBM own subsidiaries.

They probably did. They're late for all memos. The Fortune 500 is not were you'll go to gauge adoption. Heck, half of them still have IE6 only apps.

There are hundreds of thousands of companies, and just 500, well, Fortune 500.

Apparently you use the most established and boring development-wise of companies (Fortune 500) to prove Kotlin is not used widely, but you're OK with vaporware like Fucscia that's not even beta yet as an argument that Dart and co are.

>I am betting Kotlin would become yet another language that happens to compile to the JVM

And I bet you're wrong. Let's see in 5 years. We were on HN 10 years ago, we'll probably be here then. I'll set a reminder.

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @12:25PM (#19443762)
Because they prove Google is struggling with internal politics where to go next.
Re:Java 12 by mosdl on Tuesday March 19, 2019 @10:57PM (#19438502)
There are plenty of java projects that change apis. Comparing a framework to a language is stupid.
Re:Java 12 by jaabe on Wednesday March 20, 2019 @02:56AM (#19439673)
If you develop, not if you maintain. This is a major reason we stay away from JS frameworks after burning the hands on implementing an AngularJS that was obsolete a year later.

That and a few page reloads never killed anyone.

Re:Java 12 by freewilly1040 on Tuesday March 19, 2019 @10:40PM (#19438394)
Doesn't evolve _quickly_. Which as you say is say is part of the tradeoff of giving a trustable guarantee that the tooling you do use will continue to work for a long time.
Re:Java 12 by Consultant32452 on Wednesday March 20, 2019 @01:20AM (#19439242)
I've been working professionally in Java for almost 20 years. I can't remember the last time I saw someone use features introduced after 1.6. The time API in 1.8 was nice. I've never seen anyone use lambdas in production code. I'm sure people do use newer stuff, but I think it's the minority. So in practice it's even more stable than it is in the headlines.
Re:Java 12 by Scea91 on Wednesday March 20, 2019 @02:34AM (#19439578)
Strange, our production code is full of streams and lambdas. It probably depends on the type of product.
Re:Java 12 by qw on Wednesday March 20, 2019 @03:07AM (#19439715)
I work for a large company and the code base is full of streams and lambdas. Streams are almost used too much and could be replaced with a simple for-loop.
Re:Java 12 by ionised on Wednesday March 20, 2019 @08:22AM (#19441325)
Yeah, stream overuse is definitely an issue at our company.
Re:Java 12 by jcadam on Wednesday March 20, 2019 @07:32AM (#19441006)
I started using Streams and lambdas immediately, along with functional interfaces. Java is still not nearly as pleasant as Scala or Clojure, however.
Re:Java 12 by euyyn on Wednesday March 20, 2019 @02:49AM (#19439641)
Chromium (and so Chrome too) uses lambdas in its Java parts.
Re:Java 12 by gbersac on Wednesday March 20, 2019 @04:50PM (#19446731)
Last time I used java, I used it extensivelly lambda, collection map and flatmap, optinnals... But old school javaist barely used them though.
Re:Java 12 by ionised on Wednesday March 20, 2019 @08:21AM (#19441320)
We start using new features pretty much as soon as the new JDK version is released to general use.
Re:Java 12 by astura on Wednesday March 20, 2019 @08:22AM (#19441328)
I started using them ASAP.
Re:Java 12 by coldtea on Wednesday March 20, 2019 @07:45AM (#19441104)
>java is a stable api but it also doesn't evolve

You have probably missed the last 5 years. From streams, to closures, to default methods, to functional interfaces, to local type inference, to new Process APIs, to modules, to unsigned arithmetic, to new date/time APIs, http client, 2 new GCs, shell REPL, etc... with more to come, and new releases every 3 months...

Re:Java 12 by ptx on Wednesday March 20, 2019 @05:48PM (#19447324)
> unsigned arithmetic

I thought I had missed something there, but it looks like it's just a bunch of utility methods to reinterpret integers and convert them to longs (etc.)?

Kotlin, on the other hand, recently added actual unsigned types[0] – taking up the same number of bits as the corresponding signed type, supporting the normal mathematical operators, and preventing unintended mixups with signed types.

[0] https://kotlinlang.org/docs/reference/basic-types.html#unsig...

Re:Java 12 by coldtea on Thursday March 21, 2019 @08:34AM (#19451549)
>I thought I had missed something there, but it looks like it's just a bunch of utility methods to reinterpret integers and convert them to longs (etc.)?

Yes, but it's also a new feature (along with dozens of others). The complaint I answered was that Java is stagnant somehow, when it has been evolving fast in the last 5 years, and is accelerating its pace (release cadenze) even more.

>Kotlin, on the other hand, recently added actual unsigned types[0] – taking up the same number of bits as the corresponding signed type, supporting the normal mathematical operators, and preventing unintended mixups with signed types.

Which, given that the JVM doesn't support them at the bytecode level (iirc), they also use some similar trick of working with signed numbers under the hood, just hide it better at the syntax level.

Re:Java 12 by tobiaswk on Wednesday March 20, 2019 @06:31AM (#19440685)
I love Dart and Flutter. I actually think it was a good idea not to use Java. Dart is much more modern and nice to work with in my opinion. There are many reason and I won't dwell into it here. The biggest-ish project I've built with Flutter is an alternative to Nissan's ConnectEV app; it's used with the electric vehicles Nissan Leaf and Nissan E-NV200. You can see statistics, battery status and control climate control and charging of your vehicle. My alternative is called "My Leaf" on the Play Store and "My Leaf for Nissan EV" on the App Store. It's completely open source; https://gitlab.com/tobiaswkjeldsen/carwingsflutter

It consists of the main Flutter app and a Dart library for communicating with Nissan's API.

Re:Java 12 by schwurb on Wednesday March 20, 2019 @07:32AM (#19441004)
I am currently building my first mobile app on Flutter and quite happy I choose that technology! Developing in AndroidStudio + Flutter does not feel like the chore I remember developing android apps to be.
Re:Java 12 by gigatexal on Wednesday March 20, 2019 @01:25AM (#19439264)
Biggest barrier to entry for me is the build dependency system Maven. And I never understood Ant. I did like the language when I played around with Java 8. Streams are amazing.
Re:Java 12 by BinaryIdiot on Wednesday March 20, 2019 @02:34AM (#19439579)
Maven is an incredible system. It can do so much and yet, even though I've setup countless apps and services, I can never use it without looking literally everything up.

Maven and spring are the worst parts, for me, when dealing with Java. I don't mind the language at all.

Re:Java 12 by gigatexal on Wednesday March 20, 2019 @03:37AM (#19439816)
Yeah I felt the same. The language is fine. It’s got a fantastic set of libraries and a large ecosystem and one would be hard pressed to not find a job being a competent Java dev but maven ugh
Re:Java 12 by eitland on Wednesday March 20, 2019 @03:46AM (#19439858)
With maven, less is more. Huge maven files usually means something is wrong.

Follow the conventions and it is less than a screenful for a basic project.

I typically solved maven problems by removing cruft and falling back to the standards.

Re:Java 12 by thecleaner on Wednesday March 20, 2019 @05:24AM (#19440345)
What was your problem specifically ? For me these two worked great together actually. I really loved Spring. Maybe the problem has some overlooked fix that I can help with ?
Re:Java 12 by BinaryIdiot on Wednesday March 20, 2019 @04:26PM (#19446477)
Nothing in particular just lots of seemingly random issues trying and failing to get them working correctly, likely due to my lack of knowledge but every time I try to better learn them my brain just can't handle it.

I don't know what it is. I think part of it is my auto-cringe when I see XML nowadays.

Re:Java 12 by thecleaner on Sunday March 24, 2019 @03:59PM (#19478426)
I can understand the feeling. I think in the new Spring framework configurations are written in Java. I think this is from version 4.0. So that will solve your XML issues. However, I do make the assumption that you have control over what version of Spring you use. I think there is a problem with the documentation of Spring Boot when it comes to config code since you have a lot of stuff with XML but not so much with the modern Java based stuff. However you can try to learn how to map the XML to Java, you only need a few things to learn that mapping not the full XML configuration knowledge.
Re:Java 12 by cztomsik on Thursday March 21, 2019 @08:46AM (#19451648)
The success of javascript is hugely because of no dependency-hell (not being able to upgrade some lib to a new version, because it would conflict with some other lib which requires it in its current version and you can't have both of them loaded at the same time)
Re:Java 12 by theandrewbailey on Tuesday March 19, 2019 @10:50PM (#19438455)
> It's also a shame Sun sold Java to Oracle

Worse: Oracle bought Sun.

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @03:52AM (#19439890)
Worse: IBM, Google and everyone else could have done it as well, but decided not to counter-offer.