One article a day for twenty-four days from nine authors! Merry christmas and happy holidays from all of us.
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.
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.
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!
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 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.
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.
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 🤯.
Have you ever tried to use the compare operations on two instances of your self-made data class in Kotlin just to realize it is not possible? By employing operator overloading, you are actually able to do so!
MockK is a mocking library for Kotlin, written in Kotlin. Because of this, it has extensive support for Kotlin language features such as extension functions and companion objects.
Most of us use JUnit as our go-to testing framework, often without really considering the alternatives. Are you ready to try something new? Why not give Spek Framework a shot?
Reification. Like many other concepts, it can be applied in a number of different ways and it might carry slightly different meanings depending on the context. According to this definition, reification is simply the act of representing something abstract in a physical way. In Java, on the other hand, the term is used in the context of which types that are available to us at runtime. Additionally, in Kotlin we actually have a modifier keyword built into the language, namely reified. In this article we'll take a closer look at how reification and type erasure are connected, and more specifically how we can combine inline functions and reified type parameters in Kotlin to achieve things in generic functions that we normally would not be able to.
With the release of Kotlin 1.4 we got a new treat; kotlinx.serialization. A new tool to help us with the cumbersome task of converting our objects to and from Json.
Does it really matter which serialization library you choose for your application? They're all pretty much the same, right? Right... It's story time!
IDE's commonly include a lot of useful tools that can make our lives as developers easier. Some are pure productivity tools to speed up our development, while others may actually help our understanding of the code we are implementing. The toolset included with the IntelliJ IDEA IDE is no exception. In this article we will take a look at the Bytecode Viewer and Java Bytecode Decompiler integrated tools in IntelliJ, and how they may help us getting a better understanding of how our Kotlin code is represented on the JVM, and how it could potentially look in Java.
The Kotlin standard library has a lot of amazing stuff and today we will take a closer look at what let, run, also and apply is and when to use them.
The year 2020 has certainly been a special one, but that hasn't stopped Jetbrains from continuing its work on the Kotlin language and its ecosystem. In March we got the 1.3.70 version, an incremental release, which included some new functions and classes in the standard library. And after the summer break we got the all new 1.4.0 version, a feature release, which came with some really sought after changes to the language and even more changes to the standard library.
Welcome to the second year of the Bekk’s Kotlin advent calendar. If you followed us last year welcome back, and if you’re new this year you’re in for a treat. Each day leading up to Christmas Eve there will be a new post about Kotlin features, tooling, the Kotlin ecosystem and more!
It's the 24th of December and a visit from Santa is right around the corner. The reindeer are eager and his sleigh is ready. He has determined who is naughty and who is nice.
The Kotlin library comes with several container types. Two of these are List and Sequence. At the first glance these two look quite similar, but we will look at the differences in this article.
Wonder why a MutableList<Cat> isn't a subtype of MutableList<Animal>? Ever seen the "in" and "out" modifiers in Kotlin and wondered what they do? Let's find out!
We used to have a pure Java application. Then we decided to add some Kotlin code to it, just to try it out. Now there is almost no Java code left. How did that come about? Read on!
As developers, we spend a considerable amount of time declaring and invoking functions when writing software. Kotlin provides several features that can boost your productivity when working with functions. In this post we'll take a closer look at two of these features; Named Arguments and Default Arguments, and how we might use them to make our Christmas preparations more carefree!
On the JVM, calling a function or instantiating a class will always incur an overhead, unless the JVM runtime performs some magic. At least, that's how it used to be before Kotlin introduced the inline keyword. This article will give you a quick introduction to this fantastic keyword, and how it can help you!
While using Java or Kotlin, have you ever needed the actual type of the type parameter in a generic function? Meet reified!
An extension functions is, as the name implies, a function that extends an existing class. The function does this without actually modifying it!
How the code is formatted can be a hot topic, but it's a solved problem - just use a linter and/or formatter! In this article, I'll introduce you to a linter and formatter for your Kotlin codebase.
KotlinConf 2019 is over. Two fantastic days of talks, announcements, conversations and more. Here are some of the highlights from the product announcement on day 1 and the whole of day 2.
Yesterday (the non-workshop part of) the third edition of KotlinConf kicked off. This year the conference is held in Copenhagen, the capital of Denmark. While a visit to "Kongens by" is nice in any circumstance, a December visit with a taste of Kotlin is almost perfect.
Tomorrow the festivities, that are KotlinConf 2019, are upon us. And in that spirit we take time to look back at last years conference and some of the informative, inspiring and fun talks we witnessed in Amsterdam.
This article will give you a brief introduction to the Kotlin when expression and how to use it.
Welcome to the Bekk 2019 Kotlin advent calendar! In the days leading up to Christmas, we will present you with 24 articles, one for each day, about different topics regarding Kotlin. To start of, we'll give a short presentation of the language and show you how to get started with Kotlin in your existing Java project.