Scroll to see more

Kotlin

2 min read – Kotlin

Happy holidays

One article a day for twenty-four days from nine authors! Merry christmas and happy holidays from all of us.

3 min read – Kotlin

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.

4 min read – Kotlin

Collection magic

3 min read – Kotlin

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.

2 min read – Kotlin

It's (Christmas) Time for Kotlin

6 min read – 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!

4 min read – Kotlin

Delegation

3 min read – Kotlin

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.

3 min read – Kotlin

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.

2 min read – Kotlin

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.

2 min read – Kotlin

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 🤯.

2 min read – Kotlin

Operator Overloading

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!

5 min read – Kotlin

MockK Library

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.

2 min read – Kotlin

Spek Framework

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?

4 min read – Kotlin

Bring your generic function type parameters back to life with the reified keyword

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.

3 min read – Kotlin

Serialization: New player has joined

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.

3 min read – Kotlin

Gson and Kotlin: The nightmare before christmas!

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!

4 min read – Kotlin

Type Classes

3 min read – Kotlin

String templates

4 min read – Kotlin

Using the Bytecode Viewer and Decompiler tools in IntelliJ to lift the veil of Kotlin's magic

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.

3 min read – Kotlin

Destructuring

6 min read – Kotlin

Why and When: let, apply, run, also

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.

3 min read – Kotlin

Kotlin changelog

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.

3 min read – Kotlin

Immutability

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!

2 min read – Kotlin

Happy holidays and thanks for this year!

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.

2 min read – Kotlin

Lists vs. Sequences

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.

10 min read – Kotlin

The ins and outs of Kotlin

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!

3 min read – Kotlin

Receivers

8 min read – Kotlin

Going from Java to Kotlin

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!

4 min read – Kotlin

Streamlining your functions with Named and Default Arguments

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!

3 min read – Kotlin

On wavelength with lambdas

7 min read – Kotlin

Typesafe Error Handling in Kotlin

5 min read – Kotlin

Overhead from calling? Not with inline!

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!

2 min read – Kotlin

When we need a concrete generic

While using Java or Kotlin, have you ever needed the actual type of the type parameter in a generic function? Meet reified!

4 min read – Kotlin

Coroutines channels🔥 and flow❄️

6 min read – Kotlin

Disecting the very important details of coroutines

3 min read – Kotlin

Coroutines intro

6 min read – Kotlin

Making games with Kotlin!

2 min read – Kotlin

It’s in the small things

2 min read – Kotlin

Extension functions

An extension functions is, as the name implies, a function that extends an existing class. The function does this without actually modifying it!

4 min read – Kotlin

Anti-bikeshedding with ktlint

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.

5 min read – Kotlin

On the second day of KotlinConf

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.

3 min read – Kotlin

On the first day of KotlinConf

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.

3 min read – Kotlin

Sealed classes

3 min read – Kotlin

'Twas the night before KotlinConf

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.

1 min read – Kotlin

If Not Now, When?

This article will give you a brief introduction to the Kotlin when expression and how to use it.

2 min read – Kotlin

Null Safety

3 min read – Kotlin

Get started with Kotlin!

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.