I realised in the edit that I didn’t stress how wonderful the symmetry in http4k is, and how I miss that in other frameworks. The fact that the client and server both work with the same Request and Response and HttpHandler and Filter is freeing. I’ll look at this next episode.
I love that Intellij had the exact same response to you including a hyphen in a filename as me. Great video, I've been meaning to try http4k and seeing the comparison has been very useful.
I’m in the habit of using lower-case file names for collections of functions: saving.kt, printing.kt etc, and I think dashes in filenames are just easier to type and read in these cases. But we all have different tastes.
It’s good to know that it’s useful material, so thank you. I am biased, having worked in the group that created http4k, but I truly rate it as a world-class piece library.
@@PairingWithDuncan I've never considered it, I'm a camelcase kind of person though. Only poking fun though, genuinely great content, looking forward to seeing more.
It's available free for premium subscribers! Or you can install the initimatble @dmitrykandalov's liveplugin plugins.jetbrains.com/plugin/7282-liveplugin and then this gist gist.github.com/dmcg/1f56ac398ef033c6b62c82824a15894b
This one is very new, but UA-cam says it is the second most popular of the last 10 - I’m seeing a steady growth in views and subscribers over the months. Which is nice, as is the feedback and thanks that i get from people here and in real life.
Interesting, thank you! Personally I find http4k less magical than Ktor, which is a lot less magical than Spring. I suppose that magic is a question of perspective, of what tricks we have seen before or know how they are done.
It seems like the main thing that was bothering you was Ktor's mutating routing at each step... but if you look at the DSL as a type of builder, which it is since most of this code is running at startup, then it might not be so bad. And you gain the fact you can run coroutines libraries... I'm sure there's a more generic form instead of post(...)... etc that gets the type of request, so that might not be an issue if you want to have the same handler for multiple route types, and anyways, you could always pass a lambda you saved in a val before in multiple routes.
It’s certainly true that undetectable mutation during initialisation isn’t an issue, but I do find it interesting that one api requires a context during configuration and the other doesn’t.
I suppose that I’ve started from the examples provided by the documentation to get a feel for the way that the authors think. Ktor is DSL-based; http4k is building functions with functions. In Ktor it would be difficult to configure serialisation on a handler-by-handler basis; in http4k we have to specify the serialisation in each handler. There are pros and cons to each, I suppose I might characterise the feel as Ktor is more out-of-the-box framework; http4k more blocks that can be composed.
@@PairingWithDuncan Given the amount of libraries currently supporting coroutines and it's KMP support, I don't think it's being replaced by loom in the near future, and the simplicity of handling concurrency with it is great! You just write what looks like imperative code and the concurrency is mostly handled for you... and Flows don't have a Loom replacement for now (maybe RxJava or the likes will/do support it? -- but their complexity compared to Flow is a big disadvantage...)
@@PairingWithDuncan I'm not saying I don't like Http4k's composable block approach -- I'm just saying that Ktor's approach isn't really some mutable monster that could explode on you... it's just a builder DSL that also uses functions to handle requests - but instead of (Request) -> Response, you have a context that you get the request from and call functions from it to return a response, which is a better model for concurrency inside that lambda... you don't wait for a response to return from the lambda with it - so you can do a bunch of concurrent stuff beyond the lifetime of the lambda as long as you call the respond function on the context to return a response. And the lifetime of the lambda is, I suppose, the "threads/coroutines" pool that handle the requests that are incoming and should not be blocked... in Http4k, you'd have to open a new virtual thread to run the lambda and get the response without blocking the pool that receives the incoming requests.
I realised in the edit that I didn’t stress how wonderful the symmetry in http4k is, and how I miss that in other frameworks. The fact that the client and server both work with the same Request and Response and HttpHandler and Filter is freeing. I’ll look at this next episode.
That aspect of http4k is indeed a joy!
I love that Intellij had the exact same response to you including a hyphen in a filename as me.
Great video, I've been meaning to try http4k and seeing the comparison has been very useful.
I’m in the habit of using lower-case file names for collections of functions: saving.kt, printing.kt etc, and I think dashes in filenames are just easier to type and read in these cases. But we all have different tastes.
It’s good to know that it’s useful material, so thank you. I am biased, having worked in the group that created http4k, but I truly rate it as a world-class piece library.
@@PairingWithDuncan I've never considered it, I'm a camelcase kind of person though. Only poking fun though, genuinely great content, looking forward to seeing more.
I keep seeing this nice green test bar in all your videos. I want it! Can you tell me the name of the plugin?
It's available free for premium subscribers!
Or you can install the initimatble @dmitrykandalov's liveplugin plugins.jetbrains.com/plugin/7282-liveplugin and then this gist gist.github.com/dmcg/1f56ac398ef033c6b62c82824a15894b
I have seen that there are very less views on your video but still, you are making it for a very long time how do you get motivation for that.
6000 people a month considering your opinions is better than most of us achieve in a whole career. Seems pretty motivating.
This one is very new, but UA-cam says it is the second most popular of the last 10 - I’m seeing a steady growth in views and subscribers over the months. Which is nice, as is the feedback and thanks that i get from people here and in real life.
ktor looks less magical, which is a good thing
Interesting, thank you! Personally I find http4k less magical than Ktor, which is a lot less magical than Spring. I suppose that magic is a question of perspective, of what tricks we have seen before or know how they are done.
kttp4k looks less magical to me than ktor, being made largely from plain functions. But, then again, there's real magic in what functions can do.
It seems like the main thing that was bothering you was Ktor's mutating routing at each step... but if you look at the DSL as a type of builder, which it is since most of this code is running at startup, then it might not be so bad. And you gain the fact you can run coroutines libraries... I'm sure there's a more generic form instead of post(...)... etc that gets the type of request, so that might not be an issue if you want to have the same handler for multiple route types, and anyways, you could always pass a lambda you saved in a val before in multiple routes.
It’s certainly true that undetectable mutation during initialisation isn’t an issue, but I do find it interesting that one api requires a context during configuration and the other doesn’t.
I suppose that I’ve started from the examples provided by the documentation to get a feel for the way that the authors think. Ktor is DSL-based; http4k is building functions with functions. In Ktor it would be difficult to configure serialisation on a handler-by-handler basis; in http4k we have to specify the serialisation in each handler. There are pros and cons to each, I suppose I might characterise the feel as Ktor is more out-of-the-box framework; http4k more blocks that can be composed.
Ultimately I think coroutines will prove to be an irritation not a benefit for server-side JVM developers who can use Loom. I may be proved wrong!
@@PairingWithDuncan Given the amount of libraries currently supporting coroutines and it's KMP support, I don't think it's being replaced by loom in the near future, and the simplicity of handling concurrency with it is great! You just write what looks like imperative code and the concurrency is mostly handled for you... and Flows don't have a Loom replacement for now (maybe RxJava or the likes will/do support it? -- but their complexity compared to Flow is a big disadvantage...)
@@PairingWithDuncan I'm not saying I don't like Http4k's composable block approach -- I'm just saying that Ktor's approach isn't really some mutable monster that could explode on you... it's just a builder DSL that also uses functions to handle requests - but instead of (Request) -> Response, you have a context that you get the request from and call functions from it to return a response, which is a better model for concurrency inside that lambda... you don't wait for a response to return from the lambda with it - so you can do a bunch of concurrent stuff beyond the lifetime of the lambda as long as you call the respond function on the context to return a response. And the lifetime of the lambda is, I suppose, the "threads/coroutines" pool that handle the requests that are incoming and should not be blocked... in Http4k, you'd have to open a new virtual thread to run the lambda and get the response without blocking the pool that receives the incoming requests.