Spring WebFlux with Kotlin – Reactive Web

Spring WebFlux with Kotlin – Reactive Web

Functional Programming, Kotlin, Software Development, Spring
Spring 5.0 - even fancier In this article I will show how Spring and Kotlin can be used together. If you’re not familiar with my recent articles, have a look at the other Kotlin related posts here. Besides Kotlin, I’ve always been interested in working with Spring ever since I started with Java back in 2011. I still like the framework although it’s getting bigger and bigger and you often don’t quite know which feature to choose amongst all the alternatives. As the framework itself is growing, the documentation, which is one of best you’ll ever get to see, also is. The thing I like most about Spring is that you can focus on your business logic from day one and don’t have much technical, infrastructural stuff to set up before…
Read More
Create a DSL in Kotlin

Create a DSL in Kotlin

Functional Programming, Java, Kotlin, Software Development
Kotlin as a programming language provides some very powerful features, which allow the creation of custom internal Domain Specific Languages (DSL).  One of these features, I also wrote about on this blog, is called Function Literals with Receiver, others are the invoke convention or infix notation. In this article, I will show how to create a Kotlin DSL by introducing a library that exposes a DSL as its API. I've often been struggling with Java’s API when I had to set up SSL/TLS connections in scenarios where I e.g. needed to implement HTTPS communication. I always felt like wanting to write a little library that can support me with this task, hiding away all the difficulties and of course the boilerplate needed for it. (more…)
Read More
Kotlin Operator Overloading – Working by Convention

Kotlin Operator Overloading – Working by Convention

Functional Programming, Kotlin, Software Development, Tutorial
Kotlin Operator Overloading and Conventions Introduction Kotlin supports a technique called conventions, everyone should be familiar with. For example, if you define a special method plus in your class, you can use the + operator by convention: Kotlin Operator Overloading. In this article, I want to show you which conventions you can use and I will also provide a few Kotlin code examples that demonstrate the concepts. (more…)
Read More
Kotlin Coroutines Guide – Concurrent Programming in Kotlin

Kotlin Coroutines Guide – Concurrent Programming in Kotlin

Functional Programming, Java, Kotlin
updated 10/29/2018 Introduction and Motivation In this article, you will learn about Kotlin Coroutines: What they are, what they look like, and how they work. The demonstrated code examples were tested with Kotlin 1.3.0 and kotlinx.coroutines 1.0.0. Kotlin coroutines are one of the "bigger features" as indicated by the following quote, taken from JetBrains' blog: We all know that blocking is bad under a high load, that polling is a no-go, and the world is becoming more and more push-based and asynchronous. Many languages (starting with C# in 2012) support asynchronous programming through dedicated language constructs such as async/await keywords. In Kotlin, we generalized this concept so that libraries can define their versions of such constructs, and async is not a keyword, but merely a function. This design allows the…
Read More
Kotlin Function Literals with Receiver – Quick Introduction

Kotlin Function Literals with Receiver – Quick Introduction

Functional Programming, Kotlin, Software Development
Kotlin Function Literals with Receiver - The Foundation for DSLs and many Library Functions Today I want to give a quick introduction to Kotlin Function Literals with Receiver. This concept is what makes Kotlin great for designing Domain Specific Languages as we know it from Groovy for example. Also, Kotlin's standard library includes many functions which many of you have already used or at least seen probably: apply and with are the most prominent ones. (more…)
Read More
Kotlin on the JVM – Bytecode Generation

Kotlin on the JVM – Bytecode Generation

Functional Programming, Kotlin, Software Development
Kotlin on the JVM - How can it provide so many features? Introduction What exactly is a "JVM language", what is Kotlin? Isn’t only Java meant to run on the JVM? Kotlin provides many features that aren’t available in Java such as proper function types, extension functions and data classes. How is this even possible? I’ve taken a deeper look at how Kotlin works under the hood and what "JVM language" actually means. We'll be having a look at Kotlin's bytecode generation. If you also thought about these things already, this article should bring some light into the darkness :) For a more detailed introduction to Kotlin’s features you can have a look at my Getting Started Guide. (more…)
Read More