hey guys, I'm just starting to learn Kotlin for a ...
# ktor
c
hey guys, I'm just starting to learn Kotlin for a new job I start in a couple weeks. Would you recommend learning ktor along with it, or should I focus on the language fundamentals first and start with integrating something like Spring Boot, Micronaut, or some other solution for building REST APIs?
r
If you are starting a new job, focus on the language fundamentals. In order to use Ktor you have to know Kotlin quite well. Also, it's possible that your company is not using Ktor but some other framework to create APIs.
c
It'll be a new project with a new team, where we get to decide the tech stack, so it is pretty exciting! Hopefully I have some time to evaluate various approaches in Kotlin.
r
Oh got ya. Be sure to learn Kotlin properly, because you can understand how well a framework integrates with a language only when you know that language 😉
c
One of my biggest concerns is testability, how easy is it to write solid, succinct, easy to read and maintain unit and integration tests for a REST API. Hopefully that will be largely decoupled from the particular frameworks used though. Anything you'd recommend checking out to that end?
r
Ktor has a really good documentation on testing too. And that is one thing you have to consider when choosing a framework. I started with Javalin but the tests were a mess. Now with Ktor is really easy, succint and they run very quickly. Also, remember that tests are not going to be too decoupled from the framework while dealing with a REST API. The only tests that are going to be decoupled are system tests that you can run by performing test requests on a live test instance. P.S. Ktor test documentation is here: https://ktor.io/servers/testing.html
h
For testing ease, check out Koin, which handles DI and works well with Ktor, and Mockk. I learned Kotlin alongside making Ktor microservices.
a
Re testing, my experience was also very good with ktor. So simple compared to Spring 😄