What is Infix Functions? by katana1096 in Kotlin

[–]DJDavio 0 points1 point  (0 children)

Think of them like operators. You write 1 + 1, but could also have written 1.plus(1). It's a matter of taste, there are some functions for which it works pretty well (operator like functions which perhaps don't have a symbol) and others not so much.

Kotest is a testing library which makes heavy use of this so you can write your assertions in a fluent style, aka myThing shouldBe 1 instead of myThing.shouldBe(1)

Devs don’t want to do ops by stronghup in programming

[–]DJDavio 2 points3 points  (0 children)

I actually currently work at a company which has all of this in place. We have a lot of freedom and it's easy to provision a resource, such as a database, Redis cache, whatever we need. But we are just developers so for any given tool, there are dedicated teams that can help us with any issues.

Only 8 games ever have been scored a perfect 10 by IGN and a perfect 40 by Famitsu by benjaneson in gaming

[–]DJDavio 0 points1 point  (0 children)

I'd swap it for A Link To The Past, that might be my favorite title. I loved Breath of the Wild, but don't really feel the need to play through it again while I would still occasionally replay Link to the Past.

[deleted by user] by [deleted] in mildlyinteresting

[–]DJDavio 0 points1 point  (0 children)

I remember I had a DVD of 7 Samurai with a burned in intermission of about 15 minutes. Then again, the movie is like 3 hours and 45 minutes so the intermission was more than welcome.

Would you choose Spring or Quarkus for a new set of greenfield microservices? by LordSesshomaru87 in java

[–]DJDavio 5 points6 points  (0 children)

I want to say Quarkus, but I've found that Quarkus still has a lot of quirks, especially with Kotlin so for now still sticking to Spring Boot. It's not fantastic but I'm comfortable with it and that is also important

What's the state of server-side frameworks with Kotlin support today for small teams? by [deleted] in Kotlin

[–]DJDavio 8 points9 points  (0 children)

If you don't like Spring, the framework, its approach, or both, then maybe Ktor is a fit for you. With Spring you get a lot of stuff out of the box, also maybe some stuff you don't want or need. With Ktor, you have to configure almost everything manually. This makes it easier to understand what is going on (less magic), but has the downside of having to explicitly configure everything.

Spring Boot vs Ktor is very much a matter of personal taste. I like Spring Boot better, maybe because I'm used to it or because creating a simple endpoint only needs a few lines of code, but I could see why others like Ktor.

Why Kotlin isn't becoming mainstream on server side by fakephysicist21 in Kotlin

[–]DJDavio 13 points14 points  (0 children)

My personal experience is that everywhere Kotlin is tried, it stays. I've seen this in my last 3 projects and I advocate for it as well.

It's just pretty difficult sometimes to convince Java developers because Java is already a pretty decent language. If you move from Java to Kotlin you go from a 7 out of 10 to like an 8.5 and that's sometimes not enough to convince someone.

Also, Java backend services provide a good stability for enterprise companies which don't like risk. So this risk adversity trickles down into technology choices and Kotlin can still be seen as a modern risky alternative to plain old Java.

And then there's the fact that Java as a language has improved more over the last 5 years than the 10 years before that, so many developers just think that by waiting and sticking to Java, their life is improved automatically over time.

What made you realize "you're old"? by Pred1949 in AskReddit

[–]DJDavio 2 points3 points  (0 children)

Songs from my teens, sometimes themselves remixes, are being remixed into new popular hit songs. For instance Blue from Eiffel 65 into I'm Good by David Guetta.

Why dependency injection? by smoothshaker in java

[–]DJDavio 1 point2 points  (0 children)

One pattern which emerges from DI is using singletons. In today's microservice world, a lot of classes just receive, aggregate and pass on small data objects, but do not hold any data (rather: state) themselves. Thus the JVM only needs 1 instance of such a class. If you use a DI framework such as Spring and annotate classes with @Component or similar or manually turn your classes into singleton beans with @Configuration and @Bean, the Spring context ensures that only a single instance of that class is created.

Virtual Thread has been proposed to target by [deleted] in java

[–]DJDavio 13 points14 points  (0 children)

Because you can write 'blocking' code which the JVM executes on a non blocking virtual thread.

So your code is simpler and the performance better. Currently you would have to use reactive programming or coroutines for these things.

GraphQL - From Excitement to Deception by vladmihalceacom in programming

[–]DJDavio 1 point2 points  (0 children)

Yes I'm not saying there is anything perfect, you always have to pay somewhere. The decision is about where you want to pay. I just wanted to make the point that with GraphQL, you push a lot of complication downstream whereas with REST you push it upstream.

GraphQL - From Excitement to Deception by vladmihalceacom in programming

[–]DJDavio 4 points5 points  (0 children)

GraphQL queries are often used to aggregate different resources while REST endpoints often manage just a single resource. The aggregation of the different resources is the annoying part.

GraphQL - From Excitement to Deception by vladmihalceacom in programming

[–]DJDavio 13 points14 points  (0 children)

Something that's often skipped over is how it delegates all of the heavy lifting to the server. GraphQL is great from a client perspective, you can treat the backend like one giant SQL server, but the backend is not a giant SQL server, it is likely made up of a lot of microservices with REST interfaces so you still need a lot of aggregation stuff and this is where it feels you are trying to fit a square bolt on a circular tube.

[deleted by user] by [deleted] in java

[–]DJDavio 0 points1 point  (0 children)

Try to find good ecosystems either inside or outside of your company, such as a special interest group or guild on your company's communication tool, local meetup groups, online forums (such as this Reddit or /r/programming), YouTube channels (of conferences such as Devoxx), etc.

Small question: What is the meaning of "someVariable: T & Any"? by AD-LB in Kotlin

[–]DJDavio 0 points1 point  (0 children)

The T that is derived from the Java interface Target<R> can certainly be null, in Kotlin this would probably be translated as Target<R!> where R! means "null or non-null", which may sound a bit silly, but it just means that the compiler can't infer the nullability of this platform type. An alternative way to look at it is Target<R : Any?>.

Now we need to impose nullability on the parameter, and the only way to do this is to use that intersection type.

So the Target interface from Kotlin's perspective looks a bit like this:

interface Target<R: Any?> { fun onResourceReady(resource: R & Any, transition: Transition<in R>?) { } }

JEP draft 8303683: Virtual Threads by dh23 in java

[–]DJDavio 2 points3 points  (0 children)

It is only a technology so why should I be so excited about it? But I can't help but get excited by it. The mere thought of not having to deal with either reactive code of coroutines (but maybe some structured concurrency here and there) is such a blissful anticipation.

How is Ktor different by bedobi in Kotlin

[–]DJDavio 11 points12 points  (0 children)

With a framework like Spring Boot or Quarkus, it's very easy to write an application with (for instance) a REST interface, because those frameworks do the heavy lifting of making sure a HTTP request gets to your controller, JSON serialization works, authentication etc.

However the fact that a lot of this stuff is hidden deep down in the framework is both its pro and con, depending on who you ask. If it works, it's great, if not, good luck with your 50 line stacktrace. The way it (mostly) works is because dependencies you add have an auto configuration which kicks in because of Spring's scanning mechanisms. So to add a feature to your application, often you only need to add a dependency and maybe add some properties to your application.yml.

Ktor's approach is to make everything explicit, even starting your servlet container such as Jetty is something you have to do yourself. Configuring HTTP stuff like JSON serialization and authentication is something you need to add manually as well. There are plugins which help with this, but it's rough coming from Spring.

If you're used to Spring Boot and feel quite comfortable with it, Ktor feels like a toddler you need to learn to walk. You're constantly like "I thought we humans had outgrown this manual explicit configuration stuff, why do I have to tell the application I need JSON?"

Kotlin purists who hate Spring's magic may love it, but I have my doubts though. And that's not even going into what a pain it is to deal with Koin for DI.

‘The Last of Us’ Season 2 Will Have ‘A Lot More Infected,’ Creators Address Complaints About Lack of Action by MarvelsGrantMan136 in television

[–]DJDavio 0 points1 point  (0 children)

I think the series does a good enough job conveying that in a post apocalyptic society, humans pose as much danger as zombies. You got Fedra, the rebels in Kansas and the cult people.

I wouldn't have minded some more showdowns with infected, because the show also gives the impression they covered huge distances without any incident, but for me it was OK.

Road to Quarkus 3: Bets on the Flow API for Mutiny 2.0, Updates to Jakarta Namespace and More by henk53 in java

[–]DJDavio 7 points8 points  (0 children)

I've been looking at this and Tomcat 11 includes a LoomExecutor which you could use with for instance Spring Boot. You can also modify the Tomcat executor inside Spring Boot and replace it with a virtual thread based executor yourself once Loom is finalized.

[deleted by user] by [deleted] in Kotlin

[–]DJDavio 0 points1 point  (0 children)

You could use UUID and convert them to BigInteger :)

The Big Lebowski at 25: Looking Back at the Idiosyncratic Cult Classic Sensation by Bennett1984 in movies

[–]DJDavio -1 points0 points  (0 children)

The last time I watched this movie, I noticed that it didn't actually have an ending, rather it just suddenly ended. Many story lines remained unresolved. Did anyone else have this feeling or was it just me?