68 karma · joined Nov 1, 2023 (3y ago) · 47 submissions
https://stackoverflow.com/users/10118965/davidalayachew
comment 1y ago · link · parent
This is one of the tradeoffs of maintaining backwards compatibility and stewardship -- you are required to keep track of each "cause" of that backwards compatibility. And since the number of "causes" can quickly become enumerable, that's usually what prompts people to reinvent the wheel.
And when I say reinvent the wheel, I am NOT describing what is effectively a software port. I am talking about going back to ground zero, and building the framework from the ground up, considering ONLY the needs of the task at hand. It's the most effective way to prune these needless requirements.
comment 1y ago · link · parent
Here is an example.
comment 2y ago · link · parent
Haskell is great in a pure world, but it has an undue amount of friction when in the IO world. It does work in the IO world just fine, but languages like Java handle the actual concerns of the IO world better than Haskell. And for that reason, I say that no, Haskell is not the one true way to write correct code.
It definitely is the One True Way to write happy path code though.
comment 2y ago · link · parent
Agreed. If you do have performance improvements in mind, I would recommend you bring them up to the Javadoc jdk team. They would definitely take a look if you can point out a faster solution.
https://openjdk.org/projects/javadoc-next/
> That's why the search bar in the official java.base documentation is noticeably laggy.
On my $400 laptop from 2020, I have a response time of <= 0.25 seconds. Are you seeing something different?
comment 2y ago · link · parent
Javadoc already gives you an extremely fast search index and search bar. Granted, it's only in the newest versions of Java.
comment 2y ago · link · parent
final boolean hasUncollectedSecret =
switch (each)
{
case Wall() -> false;
case Goal() -> false;
case Player p -> false;
case BasicCell(Underneath(_, var collectible), _)
->
switch (collectible)
{
case NONE, KEY -> false;
case SECRET -> true;
};
case Lock() -> false;
};comment 2y ago · link · parent
On the Java Mailing Lists, the creators/stewards of Java are constantly fighting back so many feature requests BECAUSE those features would threaten backwards compatibility. And that mailing list has been going on for a long time now. You can see feature requests (and their subsequent rejections) going as far back as the late 90's lol
comment 2y ago · link · parent
And yes, excellent wording with the idea of "Should not even know about the concept". I think that is another good place where inheritance shines.
comment 2y ago · link · parent
Definitely one of the better ones though, very impressive. AI really is great at making some very impressive things. But since AI doesn't "get it", a lot of what it produces just feels off or misses the point.
comment 2y ago · link · parent
Imagine that I have a class that has 15 methods -- 14 are a perfect fit as is, but 1 of them needs to be completely overwritten.
If I were to do inheritance, I would do `extends` on the class, and then `@Override` the offending method. Problem solved.
If I were to do composition, I could use the Delegation Pattern from the Gang of Four, but that would require me to write 14 do-nothing methods just to be able to override the one.
In general, composition has more use than inheritance. However, inheritance has a non-zero number of use cases where it is a better choice than composition.
comment 2y ago · link · parent
And your comment about `jlink` MIGHT be true if your application is nor modular/ does not use modules with a well-formed `module-info.java`. I haven't tried an automatic module in a long time. If your application is modular, everything happens as expected. I do this for all the builds for all of my projects. Last build from last night confirms that it still works, and works well.
comment 2y ago · link · parent
Java lets you include only the parts of the JDK that you need for your app. These parts are called modules.
Unfortunately, all modules MUST include the base module (java.base), which is ~22MB. And if you add a GUI (java.desktop), that's another ~13MB. And since the linked example uses Java FX, there is yet another layer on top of that.
Java is doing a lot of work to bring that number down by a lot. More to come.
comment 2y ago · link · parent
PROCESSOR."Template with \{holes}"
...but the new suggestion is perfectly acceptable too. Regardless of which one they land on, things are in a good place.comment 2y ago · link · parent
But happy to have you join the discussion! I look forward to see your email!
comment 2y ago · link · parent
But to be fair, you can subscribe, but change the settings to decide what gets sent to you.
For example, you can turn off mail delivery so that you will only get included in conversations that you start yourself. People do that when they are in a mailing list just to ask a few questions, and don't want to opt-in to the flood of other discussions. Sounds like that might be for you.
And fair point on the indexing. I am actually working on a workaround myself. I'll let you know when it's finished up, in case you rediscover the motivation to try your comment again.
Alternatively, if you want, let me know your email address and send me your question. I would be happy to forward your message along, and then CC you in the thread. Get you past the door, so to speak.
comment 2y ago · link · parent
If your wish is to have Checked Exceptions be throwable from the lambda, then I understand your point. Still, I stand by argument, which is that they are actively addressing these pain points, but doing so slowly in ways that minimize intrusion.
> Kotlin
If it's not a fair comparison in your eyes, I'll leave it.
> async await in C#
I'd be more willing to accept your point of view if there wasn't so much discussion online about how painful async await is via color-my-function. And that's ignoring the fact that languages such as Go and Erlang have been garnering a big following, in large part due to their concurrency model and how simple it is.
I have had my share of async await too. I think it's no coincidence that many language designers are looking more and more into moving away from async await, thus prompting these PoC's and experiments.
As for the C# link specifically, I interpreted that to be that they felt the pain of async await strongly, and did the PoC in response. However, the PoC did not play well with their async await world, and trying to change the world to make room for it would be too much of a lift. Therefore, they stick with async. I did not interpret it to be that async await was good enough for them, but rather, that improving async await is the best option available to them for now.
> Age of languages
Sure, there are some languages that are a similar age to Java. But those are the languages where I believe the costs for the decisions they made are becoming more apparent. I already gave 1 example with C#. And I think we can both agree that Scala's design philosophy served as a great learning experience for other languages, but was a poor survivability tactic as a language. It feels like the language is buckling under its own weight.
Either way, I am not trying to say that these other languages are bad. Merely that their design philosophies benefit them in the short term, but show cracks in the long term. Java's philosophy, meanwhile, minimizes intrusion, and thus, allows it to sidestep alot of the problems that these other languages are trying to get out of.
comment 2y ago · link · parent
Funnily enough, your example has actually supported my point.
They just released a proposal that effectively side-steps the problem of checked-exceptions-in-lambdas. Here is a link -- https://inside.java/2023/12/15/switch-case-effect/
This is still just a proposal, so nothing is hammered out. And we can talk about the merits of this solution. But my point is, by focusing on designing features the way they have, you can minimize intrusion while maximizing the value provided. I think this proposal demonstrates that extremely well.
This proposal allows the developer to maintain all the good parts about checked exceptions and lambdas, while being able to side-step the major downside.
> Don't think like Java is a good example of that, more like the anti-example. Plenty of more sophisticated languages move way faster without negative effects on long term progress (C#, Kotlin, to some extent Scala)
To be clear, when I say long term, I am measuring on the scale of decades. In that respect, I actually don't think your statement is correct.
To give an example with Kotlin, someone (I think Brian) talked about Kotlin's release strategy for features being great for short term, but costly in the long term. Kotlin had record-esque classes long before Java ever got theirs, but now that Java finally has theirs, Kotlin is using an annotation to disambiguate between Java style records and Kotlin style records -- https://kotlinlang.org/docs/jvm-records.html#declare-records.... While this isn't some critical problem on its own, this type of rift growing wider means that Kotlin is going to have to wrestle with how much they want to allow Java representation of concepts to exist in Kotlin. For example, how will Kotlin handle Java's version of pattern-matching vs their own? The 2 are not the same, so you cannot just call them aliases of each other - they have different semantics.
To give another example with C#, there has been a lot of recent discussion about finding potential alternatives to their async-await concurrency model. They cite the level of effort it takes to maintain the async await style code and the costs that come from this. Rust had a similar conversation not too long ago too.
The point I am trying to say is that, I think Java's strategy of play it slow and conservative is actually paying off for them, but on the scale of decades. Some of the languages it gets compared too aren't even that old yet.
comment 2y ago · link · parent
The mailing list is also very clunky, I will further concede that.
And no matter how you slice it, this is all still community-hostile behaviour, I will also concede that too.
I think part of the reason for all of this friction is precisely because they don't want to keep the barrier of entry that low. It's no secret that the Java community is *ENORMOUS*. Having a little bit of friction goes a long way in quelling the influx of repetitive discussion topics. I'm not saying that's a good excuse -- more so saying that there probably isn't enough incentive to take the effort to fix these friction points.
And leaning into that further -- I'm not sure how much they are missing out on by keeping these friction points *on official Java discussion platforms, like the mailing lists*.
The fact is, there are an influx of Java opinions being given on the internet with no help from the Java Team, and if they want to get the public opinion, these social media sites will have it within hours. So if they already have that, why take on the massive burden of opening the flood gates on their official community discussion platforms?
Still, that's no excuse for things like no search function or the lack of moderator activity. It's probably something they have just de-prioritized in the name of getting features out faster.