News for hackers. Stuff that matters.
Re:A Picture of Java in 2020 by rapsey on Tuesday September 22, 2020 @03:29AM (#24551888)
Java people always tout their advanced IDEs as a major benefit of working in Java. But the thing is that Java is a language that is unusable without a strong IDE and that is not an advantage.
Re:A Picture of Java in 2020 by discreteevent on Tuesday September 22, 2020 @04:17AM (#24552155)
Unusable? I wrote java with a text editor for three years and got a lot done. I wrote C++ for about 10 years with a text editor (It was called an IDE but it was a text editor with a debugger).

But having a language that enables the functions of an IDE is a big advantage. A good text editor that manipulates characters efficiently is absolutely valid. But an IDE that treats code as an AST gives you a lot. After all when you think of code you think of it in trees/graphs: You go to fix a bug, one of the first things you will probably ask is "what calls this code?". Being able to do that, right up to the top of the call hierarchy, instantly, without having to run the system is a huge advantage.

An IDE gives you the tools to reverse engineer the design (or lack of it) from the code.

Re:A Picture of Java in 2020 by nicoburns on Tuesday September 22, 2020 @07:25AM (#24553235)
> You go to fix a bug, one of the first things you will probably ask is "what calls this code?". Being able to do that, right up to the top of the call hierarchy, instantly, without having to run the system is a huge advantage.

This is indeed useful, and languages with semantic IDE tools are indeed better at it. But this works for me in JavaScript 90% of the time with just text-based (and I think it probably tracks imports) tooling.

Re:A Picture of Java in 2020 by Traubenfuchs on Tuesday September 22, 2020 @03:41AM (#24551943)
"Needing an IDE" certainly isn't an advantage, but framing it as a disadvantage is luddite thinking.
Re:A Picture of Java in 2020 by rapsey on Tuesday September 22, 2020 @03:54AM (#24552017)
One should always strive to use the simplest tool that gets the job done. Java comes with an insane stack by default. Not only must you understand all those parts (the vm and IDE), you must have a strong enough computer to work with it. Java developers always need the beefiest most expensive machines to work.
Re:A Picture of Java in 2020 by matthewmacleod on Tuesday September 22, 2020 @04:25AM (#24552201)
No, I don’t think this is a supportable assertion. The “simplest tool that gets the job done” is obviously a ridiculous over-simplification, since even Notepad will allow you to write Java apps. The choice between different development tools is down to the specific environment, developer requirements, and preferences.

Also it’s not 2000. A Java IDE will work fine on any computer you can buy.

Re:A Picture of Java in 2020 by selfhoster11 on Tuesday September 22, 2020 @06:07AM (#24552772)
IDEs can help to learn programming and can facilitate exploration. Step-by-step debugging and refactoring are a crapshoot in less advanced editors, but both are powerful learning aids if they are easy to access - which they are in IDEs. Both IntelliJ and Eclipse are very easy to explore - just point-and-click, no need to set anything up if your language is well supported. Experienced devs also benefit, since IDEs are made to manage and navigate complexity that will inevitably show up in any mature codebase.

Your runtime and tooling will always be a dependency, and you will always have to learn enough to troubleshoot it regardless of the language. PHP, JavaScript, Ruby and Python are no different to Java - the SDK must also be installed and kept upgraded, you still have to fix your application to work with a newer runtime when the language changes or when fixes are backwards-incompatible, and your SDK version might still clash.

Performance is not an issue in practice. I only ever noticed IntelliJ being slow on a machine that was too slow to run a web browser, and I don't think that such machines would be very common because people would just get rid of them. Resource use has ballooned over the past few years due to the rise of Electron, so your machine already needs to be powerful enough to run Discord, Slack, Postman, or whatever other applications you wish to run in parallel. Adding a JVM alongside that is not much of an ask, given that IntelliJ consumes around 500 MB with two fairly sizable projects open.

Re:A Picture of Java in 2020 by jcelerier on Tuesday September 22, 2020 @06:28AM (#24552888)
> One should always strive to use the simplest tool that gets the job done.

why in earth would you think that. we get further as a species because we develop more complex tools to achieve our goals, be they nuclear reactors, smartphones, etc.

Re:A Picture of Java in 2020 by vetinari on Tuesday September 22, 2020 @10:04AM (#24554467)
It is the essential vs accidental complexity.

Simplest tool that gets the job done does not mean it is simple. There's still the the part that gets the job done, so it still can be essentially complex tool.

Accidental complexity, on the other hand, will only slow you down in the future, or even make you incapable to continue further development.

Re:A Picture of Java in 2020 by brazzy on Tuesday September 22, 2020 @04:06AM (#24552094)
Bullshit. I can develop Java just fine using a desktop PC I built cheaply in 2010. And yes, I use IntelliJ for that.
Re:A Picture of Java in 2020 by HelloNurse on Tuesday September 22, 2020 @07:43AM (#24553354)
In a professional sphere, appropriate tools are the best one can afford (i.e. the best that justify their cost).

Simple tools are only appropriate for cheap, low-value projects (e.g. don't set up an IDE and build automation when some trial and error with Maven to compile something occasionally is enough).

Re:A Picture of Java in 2020 by coldtea on Tuesday September 22, 2020 @07:13AM (#24553148)
>One should always strive to use the simplest tool that gets the job done.

So, like we should all build houses with straws and mud, since that is the simplest and gets the job done (creates a habitable structure) too?

Re:A Picture of Java in 2020 by vbezhenar on Tuesday September 22, 2020 @07:16AM (#24553169)
I would build my house from bricks or from logs, like people dit thousands years ago. Not from some modern carbon fiber.
Re:A Picture of Java in 2020 by oblio on Tuesday September 22, 2020 @07:26AM (#24553244)
It's very naive to assume that just because the general category of the base material is the same, the construction techniques are similar. Even the materials are not actually the same, modern bricks are a lot more complex than basic bricks. I doubt any civilization even 500 years ago, let alone thousands of years ago could have made them. And we make them like this for reasons such as increased durability, better thermal insulation, probably reduced production costs, etc.

For all intents and purposes a modern brick might as well be carbon fiber compared to ancient bricks.

Re:A Picture of Java in 2020 by iamAtom on Tuesday September 22, 2020 @07:12AM (#24553140)
Good luck with working on complex enterprise projects with simplest tool like golang
Re:A Picture of Java in 2020 by Traubenfuchs on Tuesday September 22, 2020 @05:38AM (#24552607)
What languages do you write and which tools do you use?

How much assistance are you used to or do you consider worthwhile? Where do you draw the line?

Re:A Picture of Java in 2020 by tannhaeuser on Tuesday September 22, 2020 @04:00AM (#24552046)
I don't think Java the language is particularly unusable without an IDE compared to eg ad-hoc approaches extending weakly-typed languages with type annotations such as TypeScript and Python (while not 100% relevant, I even refactored maven+ant driven builds into Makefiles calling plain javac *.java as recently as a couple months ago, using vim as code editor).
Re:A Picture of Java in 2020 by indigo747 on Tuesday September 22, 2020 @04:01AM (#24552059)
Java IDEs are so thorough that I learned Java from NetBeans autocomplete rather than any tutorial.

Which is not to say that my understanding of Java extends to working professionally in it; I'm a functional programmer and broadly unfamiliar with modern Java's specific patterns.

Re:A Picture of Java in 2020 by brazzy on Tuesday September 22, 2020 @03:58AM (#24552037)
Conversely I'd say that a language that doesn't enable an IDE to provide some of the features Java does (first and foremost: call graphs) is unusable, period.
Re:A Picture of Java in 2020 by anonymoushn on Tuesday September 22, 2020 @04:08AM (#24552101)
Java developers seem to habitually use metaprogramming facilities that make it impossible to determine what code is calling what other code by hand, let alone using single command in an IDE. When not doing this, they are usually creating interfaces with a dozen implementations that wrap and delegate to one another. So I would very much like to know what calls what, and this is a reason I cannot use Java.
Re:A Picture of Java in 2020 by The_Colonel on Tuesday September 22, 2020 @04:18AM (#24552157)
> Java developers seem to habitually use metaprogramming facilities make it impossible to determine what code is calling what other code by hand

I assume you mean reflection - this would be very untypical for normal business logic code and would get smashed very quickly in any code review. It's also far from nice and easy code. You can program "dynamically" in Java, but it gets ugly quickly which in itself discourages you from doing that habitually.

Reflection is used mostly in frameworks only.

> When not doing this, they are usually creating interfaces with a dozen implementations that wrap and delegate to one another.

Sure, Java devs have so much time that they don't implement the business logic once, they create dozen different implementations just for the fun of it. Again, this situation (one interface, many implementations) happens mostly in frameworks and rarely in business code.

If you want to hate on Java, use some real arguments ...

Re:A Picture of Java in 2020 by michaelt on Tuesday September 22, 2020 @04:40AM (#24552278)
> I assume you mean reflection - this would be very untypical for normal business logic code

No, a lot of java critics complain about it being hard to tell what's calling what at the framework-to-user-code boundary

That means not only reflection, but also most Dependency Injection (Spring autowiring, Guice...), anything that runs on annotations (including @Test and JAX-RS), any code auto-generation (e.g. Protobufs, Jooq), most mock libraries (e.g. Mockito) and most configurable logging, especially the logging libraries that try to auto-detect one another.

Of course, some would say those problem are with Corporate Java Culture choosing to use all those things, rather than the Java language itself.

Re:A Picture of Java in 2020 by selfhoster11 on Tuesday September 22, 2020 @06:21AM (#24552831)
The loosely coupled metaprogramming of frameworks like Spring is an indication of how feature-poor Java is in those areas. Autowiring and mocking should be first-class features with dedicated syntactic elements, rather than something that's handled by third parties with opaque annotations that mean nothing before the application is run.

I understand that Java wants to remain conservative with its development roadmap, but the fact that the majority of an ecosystem uses a third-party framework is a good reason incorporate something similar into the language.

Re:A Picture of Java in 2020 by The_Colonel on Tuesday September 22, 2020 @04:58AM (#24552379)
> No, a lot of java critics complain about it being hard to tell what's calling what at the framework-to-user-code boundary

That's rather an industry criticism since these problems exist everywhere and are often direct consequence of trade off for looser coupling.

There are also often alternatives - e.g. Dagger for DI and MapStruct for mapping which go the code generation path which allow you to statically inspect the whole code path, you can also always trade the looser coupling for more directed paths e.g. for logging by avoiding the wrapper and using a logging library directly.

Re:A Picture of Java in 2020 by valenterry on Tuesday September 22, 2020 @12:39PM (#24556652)
> That's rather an industry criticism since these problems exist everywhere and are often direct consequence of trade off for looser coupling.

No they don't. Java is just not expressive enough, so library/framework authors have to decide between bloat or magic and they often choose magic for better or worse. There are languages that doing better in this regards.

Re:A Picture of Java in 2020 by apta on Tuesday September 22, 2020 @09:58PM (#24562173)
> There are languages that doing better in this regards.

Such as?

Re:A Picture of Java in 2020 by valenterry on Tuesday September 22, 2020 @10:49PM (#24562443)
As we are talking about Java, the closest language would be Scala. The language is much more flexible and powerful. This brings different problems onto the table, but it resolves the issue with awkward framework annotation/wiring problems that I have experienced in Java way to often.
Re:A Picture of Java in 2020 by apta on Wednesday September 23, 2020 @03:55PM (#24571206)
What about languages not on the JVM platform?
Re:A Picture of Java in 2020 by valenterry on Wednesday September 23, 2020 @09:02PM (#24574236)
Yes there are also such languages which are not on the JVM platform!
Re:A Picture of Java in 2020 by apta on Friday September 25, 2020 @04:36PM (#24593844)
I'm curious what they are in your view.
Re:A Picture of Java in 2020 by pron on Tuesday September 22, 2020 @07:47AM (#24553370)
> Of course, some would say those problem are with Corporate Java Culture choosing to use all those things, rather than the Java language itself.

I'm not sure this is necessarily a culture, either. Java tends to be picked more for applications with more demanding/richer requirements, and so they need to do a lot. This demand for features drives a demand for richer frameworks. You see this exact thing happening with JS on the client. So to the extent this is a problem, perhaps it is a general software design problem.

Re:A Picture of Java in 2020 by anonymoushn on Tuesday September 22, 2020 @04:23AM (#24552189)
The main metaprogramming facility in Java is annotations. Some annotations work like higher-order functions, except that my advanced Java IDE is unable to find what function is wrapping the annotated function. Some other annotations work more like macros, but there's not a convenient way to evaluate the macro to have a look at the code it would generate.

I previously asked in another forum about this sort of thing and heard that I should read the docs. I suppose when working at a big company ships internal libraries that expose annotations and use inheritance extensively, but do not have docs, I should just pretend that I am not actually in such a situation, or something.

Re:A Picture of Java in 2020 by The_Colonel on Tuesday September 22, 2020 @04:47AM (#24552312)
> Some annotations work like higher-order functions, except that my advanced Java IDE is unable to find what function is wrapping the annotated function.

Intellij can show you which aspects have been applied for e.g. AspectJ or Spring AOP.

I mean if you or your company really insist on writing your own metaprogramming library then yes, IDE can't do much to help you, but that hardly represents industry practice.

Re:A Picture of Java in 2020 by raducu on Tuesday September 22, 2020 @07:58AM (#24553456)
It's funny, because I always complain about interfaces with just one implementation, I've never complained about an interface with dozens of implementations :)
Re:A Picture of Java in 2020 by dkarl on Tuesday September 22, 2020 @12:14PM (#24556296)
This is a real world problem, and I say that as someone who has been doing Java and Scala for many years. When you are exploring code trying to figure out how it works and what it does, it's easy to follow the chain of what method is this, where is it implemented, where is this symbol imported from, etc. Subclassing introduces some ambiguity in method parameter types, but at least you can get some information from the documentation of the interface or abstract class, and you can find usages of the method and see what concrete types are passed in different places. Where it really breaks down is dependency injection and annotations. When you hit these, it's no longer "command-click" or "google for Javadoc" to find out what's going on; it's a minor research project. With annotations, if you can't find the information you need in the documentation, you will have to search the source code of the framework and study the code that processes the annotation before you can even locate the code you're looking for[0].

You might be thinking this is pretty awful, but hey, software is complicated, you have to understand the code you're working on —- fine. It's reasonable to put this amount of effort into the code you are actually working on. But when you're working on service A and have a question about service B, it's nice to be able to pop over to service B's source code and find the answer without investing a lot of time understanding the technologies underlying it.

This is why "enterprise" Java programmers end up obsessed with anointing "best practice" frameworks. Me relying on a big magical framework for everything I do is only problematic because some other people don't use it. Solution: let's establish my framework as the "de facto standard," and then nobody can complain that it's ridiculous overkill for simple applications. Let's make proficiency with my preferred framework part of the definition of being a professional Java developer, and then nobody can complain about how time-consuming it is to get up to speed with it.

The alternative is to use libraries instead of frameworks, use as little magic as possible, and work in a language that is powerful enough that you can write straightforward code and still say everything you need to say in a reasonable amount of space.

Consider the simple, ubiquitous case of writing a method to implement a POST endpoint in a database-backed CRUD web service. Suppose you need to authorize the request according to some business logic, deserialize the entity body, validate the body according to some business rules, get a database connection, construct a query, run the query, process the query results into a response object, set the status code and headers for the HTTP response, and serialize the response body. Why shouldn't all of this functionality be discoverable in the code via chains of method calls from the method that implements the endpoint? With a concise language and a well-organized codebase, this is entirely possible. Readers of your code can see: here's where to dig in if I want to see how the request is deserialized, here's where to dig in if I want to see how the database query is constructed. If your code becomes exhaustingly verbose when you express it in this straightforward way, then your language is failing you.

As a fan of Scala, I have to admit that Scala introduces a similar difficulty with implicits (and the horrible practice of using wildcard imports to import entire menageries of implicit methods and values, which is epidemic in FP-style Scala.) Implicits are indisputably widely abused, but at least IDEs can show you how implicits are resolved at compile time, and in your own code, you can make implicits reasonably readable without IDE support by declaring them in an enclosing scope with a good name.

[0] I'll make an exception for one style of annotation: annotations that point you directly to the relevant code, like @ExceptionMapper(MyExceptionMapper.class). This is almost always all the information I need, the only exception being if the person who wrote MyExceptionMapper misunderstood some subtlety in how it gets wired in via ExceptionMapper.

Re:A Picture of Java in 2020 by cutler on Tuesday September 22, 2020 @11:57PM (#24562794)
Agreed. Implicits were a deal-breaker for me with Scala.
Re:A Picture of Java in 2020 by Constellarise on Tuesday September 22, 2020 @06:01AM (#24552743)
A lot of problems with modern programming can be traced to the "pipe compiler" like model, where your development environment is nothing more than a file editor with a shortcut to run the compiler. It doesn't understand the code, and it can't really help you, and the compiler only really outputs errors.
Re:A Picture of Java in 2020 by dmitriid on Tuesday September 22, 2020 @04:16AM (#24552146)
Java is perfectly usable without an IDE. Just like any other language is usable without one.

The question is: why? Why would you not use an IDE? Looking at refactoring capabilities alone you'd want those for any language [1] And on the fly actionable code analysis [2]? Why would you not want that for a programming language?

[1] https://www.jetbrains.com/help/idea/refactoring-source-code....

[2] https://www.jetbrains.com/help/idea/list-of-java-inspections...

Re:A Picture of Java in 2020 by The_Colonel on Tuesday September 22, 2020 @04:25AM (#24552194)
> But the thing is that Java is a language that is unusable without a strong IDE and that is not an advantage.

How does Java need strong IDE more than other languages?

The only thing I can think of is the (long) import handling, but that's hardly a "strong" IDE feature, more like bare bones IDE feature.

Re:A Picture of Java in 2020 by hibbelig on Tuesday September 22, 2020 @05:26AM (#24552545)
I guess it is partly the design of the application: Enterprise Java apps often contain lots and lots of classes and have deep inheritance trees. So if you have a piece of code that says "foo.save(a, b);", then which of the 132 different "save" methods that your codebase contains is being called here?

And because Java is statically typed, this enables you to do things like changing the name of the "save" method in 83 of the different 132 instance, namely the method from class "Widget" and all its subclasses. And, of course, update the right callers.

If you are doing Python or JavaScript, you often don't have much of a clue what the type of "foo" is in that "foo.save(a, b);" call, and so you don't know which of the "save" methods are being called. And you know that when creating your app, so you stay clear of class hierarchies that require this IDE functionality to untangle :-)

Re:A Picture of Java in 2020 by The_Colonel on Tuesday September 22, 2020 @05:56AM (#24552711)
> I guess it is partly the design of the application: Enterprise Java apps often contain lots and lots of classes and have deep inheritance trees. So if you have a piece of code that says "foo.save(a, b);", then which of the 132 different "save" methods that your codebase contains is being called here?

Deep inheritance trees came out of fashion (everywhere, not just in Java) long time ago. Inexperienced developers can misuse inheritance in Python just like in Java.

> And because Java is statically typed, this enables you to do things like changing the name of the "save" method in 83 of the different 132 instance, namely the method from class "Widget" and all its subclasses. And, of course, update the right callers.

As opposed to Python or JS where "we don't know for sure so it's gonna be safer to not refactor".

> And you know that when creating your app, so you stay clear of class hierarchies that require this IDE functionality to untangle :-)

That's an extremely optimistic view.

Re:A Picture of Java in 2020 by nicoburns on Tuesday September 22, 2020 @07:28AM (#24553255)
> That's an extremely optimistic view.

I haven't seen inheritance more than one level deep in JavaScript for years. And most code isn't using it at all.

Re:A Picture of Java in 2020 by The_Colonel on Tuesday September 22, 2020 @11:26AM (#24555591)
Inheritance in JS is not widely used since even the concept of classes is still very new and technically not safe for use (not supported in IE), not because JS devs are somehow wiser and self-limiting themselves to one level inheritance.

(unless you mean prototype based inheritance which is very different beast)

Re:A Picture of Java in 2020 by nicoburns on Tuesday September 22, 2020 @11:59AM (#24556092)
> unless you mean prototype based inheritance which is very different beast

All inheritance in JS is prototype based inheritance. The class syntax is just syntax sugar prototypes. In theory you can do all sorts of crazy things with prototypes. In practice people use them just like classes. The reason people don't use inheritance in JS has nothing to do with browser support.

Re:A Picture of Java in 2020 by The_Colonel on Tuesday September 22, 2020 @02:43PM (#24558291)
> All inheritance in JS is prototype based inheritance. The class syntax is just syntax sugar prototypes.

And async/await is promise based yet it results in quite different programming style. It doesn't matter which primitives are used for feature implementation.

> The reason people don't use inheritance in JS has nothing to do with browser support.

I don't think so. Since the advent of ES6/Babel/TypeScript I see inheritance on frontend daily.

Re:A Picture of Java in 2020 by bitwize on Tuesday September 22, 2020 @04:30AM (#24552227)
Bull roar. I've only ever used Emacs and command-line tools to work with Java, whether on the job or writing my Android game.
Re:A Picture of Java in 2020 by vips7L on Tuesday September 22, 2020 @07:25AM (#24553230)
This is nonsense. I write multimodule Java in VSCode/vim every day.
Re:A Picture of Java in 2020 by apta on Tuesday September 22, 2020 @09:54PM (#24562145)
Any non-trivial project will require an IDE to manage complexity regardless of language. It's tautological.
Re:A Picture of Java in 2020 by hactually on Tuesday September 22, 2020 @11:58PM (#24562797)
i disagree. Look at the linux kernel.

Throw something like eclipse/Jetbrains at it and the whole thing has an aneurysm .

If your language requires an IDE, you've already failed

Re:A Picture of Java in 2020 by apta on Wednesday September 23, 2020 @03:55PM (#24571213)
How do you manage large scale refactoring then?
Re:A Picture of Java in 2020 by hactually on Wednesday September 23, 2020 @09:34PM (#24574421)
Be good at your job and not rely on your IDE? Saying that, refactoring Java is the closest thing I've experienced to a slow and painful death so YMMV