Better HN
topnewbestaskshowjobs
Log inSign up

davidalayachew

68 karma · joined Nov 1, 2023 (3y ago) · 47 submissions

https://github.com/davidalayachew

https://stackoverflow.com/users/10118965/davidalayachew

Submissions

comment 1y ago · link · parent

Thanks, you are right. Wish I could edit it.

comment 1y ago · link · parent

Isn't the entire point of "reinventing the wheel" to address this exact problem?

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

The IDE that I use is called jGRASP (https://www.jgrasp.org/) and it has a viewer that shows off the changes in data structures over time.

Here is an example.

https://www.youtube.com/watch?v=D-zrayZQj6w

comment 1y ago · link · parent

But then it is no longer an apples to apples comparison. This is Spotify. Spotify is the embodiment of the top radio stations idea.

By that metric, Spotify is actually doing better than they did, if memory serves.

comment 1y ago · link · parent

Is it fine? How would we determine that? What's the metric?

comment 2y ago · link · parent

I strongly disagree.

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

https://docs.oracle.com/en/java/javase/22/docs/api/index.htm...

comment 2y ago · link · parent

> Author here. Yes, the search bar is nice already, and the performance is good enough for most use cases.

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

> Instead of relying on Javadoc, the built-in doc generator, I created the engine from scratch to give the documentations a modern look, build fast search indexes, and enable link resolution to other packages.

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

It absolutely does. Here is a (modified) snippet of my Java code from yesterday.

    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

It's ABSOLUTELY by design.

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

Very helpful, ty vm.

comment 2y ago · link · parent

Complete distraction of a question -- for that video clip, what is the song playing at the time stamp you selected? Is that in-game music? I figure not.

comment 2y ago · link · parent

Excellent. I love Checked Exceptions, and this just made them that more useful. Can't wait for it to land.

comment 2y ago · link · parent

That's fair. Though, my point stands. Once that number starts to grow, that's when inheritance starts to shine. Again, only in Java as is.

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

Thanks for posting this. I made a playable version of your game too. Bundled inside is algorithms for solving it as well.

https://github.com/davidalayachew/ReverseTheListOfIntegers

comment 2y ago · link · parent

Lol, they got me too. Mine has an algorithm to find a solution quickly, and another to find the shortest solution possible. I also created a very rudimentary GUI so that the game could be played. I'll clean the GUI up later though.

https://github.com/davidalayachew/ReverseTheListOfIntegers

comment 2y ago · link · parent

For me, it was taking the joke too far. The catwalk comment intro was actually really good, but then it just kept running with it the whole way through. That is not in and of itself a sin, but unless there's a good reason to do so, it dries quickly. You need something to keep it flowing, otherwise it just feels like you really needed to write 8 flamboyant lines mocking HN about inheritance with catwalk references stuck in for all of the lines. Feels forced, almost like you are trying to meet a quota. Which is what makes it feel AI-ish, to me at least.

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

I can think of one. For Java at least.

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

I have a scroll bar on mine. I am using the latest version of Firefox (124.0.2). It is the exact same scroll bar that is on this website, Hacker News.

comment 2y ago · link · parent

Well, you are partially correct that the tool in question is optimized for larger projects. But the fact that there isn't an option (in the standard lib) for smaller projects is absolutely a problem. I think that is their point.

comment 2y ago · link · parent

That information is several years out of date. At best, the build tools in the ecosystem don't do a great job of supporting modules, but that's about it.

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

The example in question is very much a "include-more-than-you-need-by-default" problem. So, bloat.

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

jlink is very much out of date. jpackage is the new way to do it. I use jpackage for all of my builds.

Pointing to the 2 most recent projects I have, my Microsoft Paint clone starts up ~0.25 secs, and my Checkers clone is the same.

comment 2y ago · link · parent

This is really nice! It's sad to see the processors go, but they aren't gone, just aren't likely to be given to us for free anymore. It's something we code ourselves. I did prefer the following format...

  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

Very fair. I know there's at least a couple of mailing lists that actually keep up with the mod queue, but it is as you say -- you can be stuck there for a long time, if not indefinitely. It does not feel like it is actively monitored. I've had messages approved/rejected after weeks of waiting.

But happy to have you join the discussion! I look forward to see your email!

comment 2y ago · link · parent

Yeah, the mailing lists are built with subscription in mind. You can't really interact with them easily otherwise.

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

> Nothing short of making exceptions transparent to lambda receivers will cut it for me.

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

> Most of Java problems come down to unfortunate design choices in the past. E.g. checked exceptions vs lambdas

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

I will certainly concede that it is a lot of friction.

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.

12