Innhold om Kotlin
Totalt 52 innlegg
Side 1 av 4
Introduksjon til Ktor
Denne artikkelen tar deg stegvis gjennom hvordan man kan lage et enkelt API som lar deg hente og poste julehilsner ved hjelp av rammeverket Ktor.
Denne artikkelen tar deg stegvis gjennom hvordan man kan lage et enkelt API som lar deg hente og poste julehilsner ved hjelp av rammeverket Ktor.
Auth is hard and Kotlin is crazy!
I started my career as a developer in 2011. Soon I came upon the problem of a user proving who they are, and what they’re allowed to do. Seemed hard, but I reasoned I would get the hang of it quickly. That didn’t really happen. Authentication is hard. Authorization is harder. But. New tools and services make things easier. And today I will share a tiny crazy Kotlin tidbit that made my day a bit easier.
I started my career as a developer in 2011. Soon I came upon the problem of a user proving who they are, and what they’re allowed to do. Seemed hard, but I reasoned I would get the hang of it quickly. That didn’t really happen. Authentication is hard. Authorization is harder. But. New tools and services make things easier. And today I will share a tiny crazy Kotlin tidbit that made my day a bit easier.
Test data generators in Kotlin
Not too long ago I came across this pattern that helped me with a longstanding problem I have had when writing tests: generating valid test data without spending half of your day instantiating domain models. Now, I’ve had this idea before, but I’ve never actually ended up testing it. That changes today, because from now this is easily my go to method of creating valid test data.
Not too long ago I came across this pattern that helped me with a longstanding problem I have had when writing tests: generating valid test data without spending half of your day instantiating domain models. Now, I’ve had this idea before, but I’ve never actually ended up testing it. That changes today, because from now this is easily my go to method of creating valid test data.
Julerengjøring i Kotlin på 5 minutter
“Nå har vi vaska kode, og vi har slettet alt. Og vi har krasja appen, og databasen falt." Dette var nesten min julelåt da jeg skulle slette litt kode sist. På 5 minutter kan du lære hvordan gjøre det samme OG hvordan du kan unngå å gjøre nøyaktig som meg, men bedre.
“Nå har vi vaska kode, og vi har slettet alt. Og vi har krasja appen, og databasen falt." Dette var nesten min julelåt da jeg skulle slette litt kode sist. På 5 minutter kan du lære hvordan gjøre det samme OG hvordan du kan unngå å gjøre nøyaktig som meg, men bedre.
Happy holidays
One article a day for twenty-four days from nine authors! Merry christmas and happy holidays from all of us.
One article a day for twenty-four days from nine authors! Merry christmas and happy holidays from all of us.
Resources for Learning Kotlin
There are many ways of getting started with learning Kotlin, different people learn best from different approaches. Whether it's reading books, solving code puzzles, getting practical experience or watching talks I hope this blogpost helps you find some interesting resources.
There are many ways of getting started with learning Kotlin, different people learn best from different approaches. Whether it's reading books, solving code puzzles, getting practical experience or watching talks I hope this blogpost helps you find some interesting resources.
Collection magic
Functional Interfaces
Functional interfaces was introduced in Kotlin 1.4 and is a way of giving lambdas proper types which can make our code more readable and make the intent clearer.
Functional interfaces was introduced in Kotlin 1.4 and is a way of giving lambdas proper types which can make our code more readable and make the intent clearer.
It's (Christmas) Time for Kotlin
Kotlin code sketching in IntelliJ with Scratch Files and Kotlin REPL
Imagine you're sitting on the train on your way to work, and you suddenly get an epiphany on how to solve that mind numbing coding problem that's been bothering you over the last few days. You whip out your laptop, create a new Kotlin file, implement the standard main function, and hit "Build" to verify that everything is OK. By the time IntelliJ responds with a "green light", your stop has been announced on the speaker system and you have to drop what you were doing. At the office, the solution you once had so clear in your mind now is lost to the void. If only you had a tool to quickly verify that code snippet, with less overhead!
Imagine you're sitting on the train on your way to work, and you suddenly get an epiphany on how to solve that mind numbing coding problem that's been bothering you over the last few days. You whip out your laptop, create a new Kotlin file, implement the standard main function, and hit "Build" to verify that everything is OK. By the time IntelliJ responds with a "green light", your stop has been announced on the speaker system and you have to drop what you were doing. At the office, the solution you once had so clear in your mind now is lost to the void. If only you had a tool to quickly verify that code snippet, with less overhead!
Delegation
Contracts
Kotlin contracts are a way to help the compiler get more information about what the code actually does. Sometimes the compiler can’t infer all the information we as programmers know.
Kotlin contracts are a way to help the compiler get more information about what the code actually does. Sometimes the compiler can’t infer all the information we as programmers know.
Creating domain-specific languages
Kotlin introduces a lot of new language features for us developers. Those features allows us to create code that is type-safe, easy to write and easy to reason about. A good example of this are the type-safe builders a.k.a DSLs, and in this article we're taking a look at how we can create our own DSLs.
Kotlin introduces a lot of new language features for us developers. Those features allows us to create code that is type-safe, easy to write and easy to reason about. A good example of this are the type-safe builders a.k.a DSLs, and in this article we're taking a look at how we can create our own DSLs.
Companion object vs top level val
Ever wondered where to declare your constants, or static methods in Kotlin? Even though Kotlin has no explicit notion of statics, there are multiple ways of mimicking the same behavior.
Ever wondered where to declare your constants, or static methods in Kotlin? Even though Kotlin has no explicit notion of statics, there are multiple ways of mimicking the same behavior.
Kotlin metaprogramming with kotlinpoet
Wouldn't it be sweet if you could automate writing code. Well, that's what we're taking a look at today. Metaprogramming, code generation, or in short; writing kotlin code that generates even more kotlin code 🤯.
Wouldn't it be sweet if you could automate writing code. Well, that's what we're taking a look at today. Metaprogramming, code generation, or in short; writing kotlin code that generates even more kotlin code 🤯.