Live data from Hacker News

Java 21 makes me like Java again

wscp.dev

771–777 of 777 posts

Re: Java 21 makes me like Java again

#771

Earlier quoted context omitted.

I can't see users caring about it all being one single codebase and I don't think that they should. Every cross-platform development tool like this means awkward, non-native UIs. Maybe there's something to new feature development. But, I suspect the big players could be a little less profitable and deliver a better experience for their end users. I've used Electron as a developer, too. While it may have been fast & e…

> Security with Electron is a problem in general given its massive surface area. I'm new to Electron development. I've read the docs recommending hardened runtime. Would it be sufficient for security? Can you give examples of such security issues?

Here I was referring specifically to pulling in a web browser as a dependency. Chrome pumps out security releases regularly for all sorts of issues. If you're essentially making Chromium the core of your application, you inherit those security issues (setting aside the fact it may happen in code paths you don't use). And, consequently, you need to keep up on updating Electron and distributing new builds to your end users, even if you haven't made any code changes.

I'm not suggesting every Electron app is a giant bag of vulnerabilities, just that you have a lot more to keep on than you would writing with GTK or UIKit. And, since everything is bundled with the application, you can't rely on OS updates to fix things for you. You need to cut a new release and distribute it.

If you follow the Electron recommendations on security you'll be on the right path. You'll just find common tasks have become harder than they were back when Electron was attracting people with its ease-of-use. I found trying to do type-safe IPC to be an exercise in frustration. If you read the old docs, tutorials, or books, you'll find IPC used to be considerably more free-wheeling. Locking it down is the right trade-off, I think. But there's been an accumulation of many small changes like that. As a result, I don't think the framework is nearly as easy to work with as when Slack or VS Code adopted it.

Re: Java 21 makes me like Java again

#772
post #753

Earlier quoted context omitted.

That's a difference between a dangerously unsafe tool and a good tool. By unsafe I mean providing enough of footguns to shoot yourself in the foot. Java has a community of people that indulge in teaching about inheritance as the first thing after classes in their "OOP" lessons. This ingrains the habit in beginners.

> By unsafe I mean providing enough of footguns to shoot yourself in the foot. Just to play on the comparison: would you say that a gun is a "dangerously unsafe tool"? I would tend to think that guns have been very well optimized over time, and I don't know of a gun design that prevents me from shooting myself in the foot. Actually that would be a limitation of the gun. But we all agree that people who use guns need…

Yes, guns are dangerously unsafe, they're designed to cause harm. It's hard to reconcile that goal with the need for safety. That said, guns do have safeties - guarded trigger, safety switch, drop safety, etc. [1].

The general principle is to design in as much safety as possible without compromising the intended purpose of the tool too much. The degree to which this is possible varies. Inherently complex and/or dangerous tools like guns, cars and aeroplanes require significant training before safe operation is possible. Most tools however can be made perfectly safe to use for anyone without any special training. Like plugs and outlets [2].

Programming languages are no different. The history of PL design is defined by the ever increasing restrictions placed on what languages let programmers do in the pursuit of safety & correctness.

But really, we humans, especially programmers, have no clue what we're doing and need all the help we can get.

[1]: https://en.wikipedia.org/wiki/Safety_(firearms)

[2]: https://youtu.be/139Q61ty4C0?t=42, https://youtu.be/139Q61ty4C0?t=105, https://youtu.be/139Q61ty4C0?t=205

Re: Java 21 makes me like Java again

#773

Earlier quoted context omitted.

> Security with Electron is a problem in general given its massive surface area. I'm new to Electron development. I've read the docs recommending hardened runtime. Would it be sufficient for security? Can you give examples of such security issues?

Here I was referring specifically to pulling in a web browser as a dependency. Chrome pumps out security releases regularly for all sorts of issues. If you're essentially making Chromium the core of your application, you inherit those security issues (setting aside the fact it may happen in code paths you don't use). And, consequently, you need to keep up on updating Electron and distributing new builds to your end u…

Thank you for your response. I have previously dealt with IPC for a different project and it was painful indeed.

But I found out that there is this new Preload module in electron that lets you use Node.js very easily via normal export and import. I'm using a popular starter template and it works great so far.

Re: Java 21 makes me like Java again

#774

Earlier quoted context omitted.

You're doing it wrong if you think programming for work is about the code being a means of expressing your inner soul. The most successful professional programmers derive their enjoyment from achieving business objectives, like making products that users love and improve the world. If you want to express your soul in your code, do that on the weekend using whatever language you want. Trying to mix these motivations i…

> The most successful professional programmers derive their enjoyment from achieving business objectives, like making products that users love and improve the world. Successful by what metric? Achieving business objectives? I don't necessarily disagree with the point, but this seems like a truism.

Or a tautology. No true professional programmer would derive more enjoyment from beauty than from making his boss happy.

Re: Java 21 makes me like Java again

#775

Earlier quoted context omitted.

Go gives you the illusion of simplicity because it gets rid of guard rails and error checking. If you remove all error checking, of course your code is going to look a lot simpler. It's also going to be a lot more wrong and crashy. Wait until your code base grows, your team grows to >10 developers, and you will understand what I mean. Java (and preferably Kotlin) are a lot more serious about making sure your code is…

Wait, are you implying Go doesn't have error checking? In what way? It has famously verbose error semantics.

No exhaustive enum checks.

No Option type, so you can still use results of a function if it returns an error.

Re: Java 21 makes me like Java again

#777

Earlier quoted context omitted.

HtmlElement. AST. Socket. Stream. Window. Closable. Runnable.

Your Point? Long: Please make your Point Understandable.

Examples of classes where inheritance is indispensable. I cannot imagine what kind of programming you are doing where that pattern never comes up.
Post reply on HN