Live data from Hacker News

Java at 30: Interview with James Gosling

thenewstack.io

351–360 of 437 posts

Re: Java at 30: Interview with James Gosling

#351

Earlier quoted context omitted.

I don't know that I'd say "messed up", but I do wish C# had checked exceptions. I strongly believe that they are superior to non-checked exceptions, basically static type signatures but for error handling. It's a real pity that everything after Java seems to have abandoned the idea.

Java itself has basically abandoned the idea, or at least the ecosystem at large has. Checked exceptions are a decent idea but Java's implementation sucks. It needs to be a lot more automatic or something

> Java itself has basically abandoned the idea

Some Java developers may have, due mostly to misinformation from the .NET camp.

Re: Java at 30: Interview with James Gosling

#352
post #192

Earlier quoted context omitted.

Personally I think C# is miles ahead of Java and in meaningful ways (like a drastically better implementation of generics, not to mention value types have existed for eons at this point and an FFI system that doesn't hate you for using it) But nobody seems to talk about or care about C# except for Unity. Microsoft really missed the boat on getting mindshare for it back in the day.

It barely works on non MS platforms,has had many slightly incompatible versions so it's a non starter for many projects where I run into that might benefit from c#. I spoke to a manager recently who had invested in silverlight in the past. Based on that alone it was a no MS policy for his development teams.

>It barely works on non MS platforms

What a bullshit

I've been running C# on Linux on production web apps backends since 2018 and had no issues

Re: Java at 30: Interview with James Gosling

#353

Earlier quoted context omitted.

Let me extol the virtues of Java the language. You can take pretty much any code written for Java 1.0 and you can still build and run it on Java 24. There are exceptions (sun.misc.Unsafe usage, for example) but they are few and far between. Moreso than nearly any other language backwards compatibility has been key to java. Heck, there's a pretty good chance you can take a jar compiled for 1.0 and still use it to this…

That is an excellent point too. It always made me wonder why I hear about companies who are running very old versions of Java though. It always seemed like backwards compatibility would make keeping up to date with the latest an almost automatic thing.

It is - but you don’t want to find out that something broke because of odd JVM update. If it ain’t broken…

Re: Java at 30: Interview with James Gosling

#354
post #223

Earlier quoted context omitted.

One area where C# really messed up is exception handling. See https://mckoder.medium.com/the-achilles-heel-of-c-why-its-ex...

Java streams and a lot of other APIs are extremely ugly because of checked exceptions. Conversely, LINQ and delegates and a lot of other syntax is far cleaner in C#. Your linked blog is pretty wild. Only throw RuntimeExceptions to crash? Why not just Exit if that's the proper thing to do? If you treat all C# exceptions as RuntimeExceptions, then it satisfies the blog anyhow.

Side effects are not allowed in functional style programming. Exceptions are side effects, it doesn't matter whether they are checked or unchecked exceptions.

https://jessewarden.com/2021/07/why-functional-programmers-a...

While composing methods in stream style is convenient, methods that can throw exceptions warrant more careful coding, so convenience should not always be the priority.

Re: Java at 30: Interview with James Gosling

#355
post #7

Java performance isn't the fastest, that's ok, a close 3rd place behind C/CPP ain't bad. And you're still ahead of Go, and 10x or more ahead of Python and Ruby. Java syntax isn't perfect, but it is consistent, and predictable. And hey, if you're using an Idea or Eclipse (and not notepad, atom, etc), it's just pressing control-space all day and you're fine. Java memory management seems weird from a Unix Philosophy POV…

I really like the JetBrains IDEs, both for Java and .NET, it feels way more pleasant to write code and refactor it than just in something like Visual Studio Code (which still feels better for utility scripts). They have pretty good run profiles that you can put in your repo, pretty good debugger, plenty of suggestions/inspections and customizability.

Java, .NET and languages like that also lend themselves pretty well to tools (and even LLMs) understanding what's going on, their runtimes are pretty good and platform differences don't give you too many issues from what I've seen. Though when it comes to the frameworks or libraries you might use (e.g. how often you will see the likes of Spring Boot in enterprise projects) will definitely leave some performance on the table [1] and have plenty of awkward and confusing situations along the way [2], especially if you're unlucky enough to have to work on codebases that have been around for over a decade. Old Java projects really suck sometimes, though maybe that applies to many of the old projects, regardless of tech.

Overall, I quite like them and am pretty productive, plus I unironically think that using Maven is pleasant enough (even adding custom repos isn't too convoluted [3]) and the modern approach of self contained .jar files that can just be run with a JDK install instead of separately having to manage Tomcat or GlassFish (or TomEE or Payara nowadays, I guess) is a step in the right direction!

Though while I do like packages such as Apache Commons and they're very useful, I also very much enjoy using something like Go more recently, it's easier to get started making simple web apps with it, less ceremony and overhead, more just getting to writing code.

[1] https://www.techempower.com/benchmarks/#section=data-r23&l=z...

[2] https://blog.kronis.dev/blog/it-works-on-my-docker (a short rant of mine, but honestly I very much prefer when you have configuration done explicitly in the code, not some layered abstractions with cryptic failure modes; Dropwizard is way nicer in that regard than Spring Boot)

[3] https://maven.apache.org/guides/mini/guide-multiple-reposito... and https://maven.apache.org/guides/mini/guide-mirror-settings.h...

Re: Java at 30: Interview with James Gosling

#356
post #297

Earlier quoted context omitted.

Wrong. Linux support is first class in .Net just like Windows. We are strictly running our .Net code on linux servers and have encountered 0 problems over the past 5 years.

3 seconds of looking at the API and you see it's not 1st class at all. Presuming you have ever done any programming on linux, that is.

> The API

Which one?

Re: Java at 30: Interview with James Gosling

#357

Earlier quoted context omitted.

When I got out of college and was still firmly in the "Java is the solution to everything" mentality I didn't realize that my admiration was really for the JVM and the Java App Server tooling that was so much more advanced than anything else at the time. It was basically Docker + K8s for anything running on the JVM more than 2 decades earlier. Java the language eventually drove me away because the productivity was so…

Let me extol the virtues of Java the language. You can take pretty much any code written for Java 1.0 and you can still build and run it on Java 24. There are exceptions (sun.misc.Unsafe usage, for example) but they are few and far between. Moreso than nearly any other language backwards compatibility has been key to java. Heck, there's a pretty good chance you can take a jar compiled for 1.0 and still use it to this…

> Moreso than nearly any other language backwards compatibility has been key to java.

The Java 8 and 8+ divide very much works against this. It was a needed change (much like Python 2 vs 3) but nowhere near pleasant, especially if some of your dependencies used the old Java packages that were removed in, say, OpenJDK 11.

Furthermore, whenever you get the likes of Lombok or something that has any dynamic compilation (I recall Jaspersoft having issues after version upgrade, even 7 to 8 I think), or sometimes issues with DB drivers (Oracle in particular across JDK versions) or with connection pooling solutions (c3p0 in particular), there's less smooth sailing.

Not to say that the state of the ecosystem damns the language itself and overall the language itself is pretty okay when it comes to backwards compatibility, though it's certainly not ideal for most non-trivial software.

Re: Java at 30: Interview with James Gosling

#358

Earlier quoted context omitted.

Depending on the situation, channels can absolutely be higher overhead and not worthwhile. Google internally recommends not using them in many situations. Unbuffered IO is a tradeoff. For certain use cases it does help, because throughput isn't everything. I'm sure Buffered is better in the average use case, but that doesn't mean you would never need unbuffered.

> Depending on the situation, channels can absolutely be higher overhead and not worthwhile. Like streaming arrays one byte at a time through the channel. Such devs just aren't very good, and hear "Google internally recommends not using them in many situations" but jump to inferring that means all of their situations qualify. > but that doesn't mean you would never need unbuffered. Note that this was never claimed.

Channels make the most sense when you need to decouple code. The performance differences rarely are a bit deal. Most of the time it's unnecessary cognitive overhead. People treat both sides as dogma, but the truth is that you need to be think critically when choosing between the two.

Re: Java at 30: Interview with James Gosling

#359

Earlier quoted context omitted.

> I've been trying rust for the past 2 months fulltime, > recently lost an afternoon on something that could very well be a known compiler bug With respect, at two months, you're still in the throes of the learning curve, and it seems highly unlikely you've found a compiler bug. Most folks (myself included) struggled for a few months before we hit the 'joyful' part of Rust.

Okay, but I have hit the joyful part of some other languages long before a few months. What gives?

Rust is genuinely novel, so for most of us its going to be less familiar, so it will take longer to learn. It's not like learning Python if you already know Ruby, for example. The upside is that it offers some pretty great guarantees you can't (yet) find elsewhere. If you want those guarantees it will be worth it, if those guarantees don't matter to you, it may feel like a slog.

Re: Java at 30: Interview with James Gosling

#360
post #255

Earlier quoted context omitted.

That’s just obtuse. Compare Lisp, Forth, APL, Prolog, Ada, or Fortran. Java is just C++ with a few twists. You can literally write code that will compile in both.

That's exactly how I meant it. Another alternative to Java at the time was Smalltalk, with different syntax. Choosing C++ syntax for Java was clearly a marketing move (as it was for C++) - we shouldn't underestimate network effect of familiar syntax. I think Java succeeded for the same reasons C++ succeeded - built on familiar syntax, reasonably free and "supported by" a large company. Java being a decent language is…

Free as in beer, in contrast to proprietary Smalltalk.
Post reply on HN