Decorator pattern in Kotlin – Design Patterns

Nowadays, optionality is everywhere. Typically, before purchasing an item, one can choose among multiple configurations, models, and kinds available.

The decorator pattern will allow you to implement a dynamic code structure where the new behaviors can be applied to the basic object.

It increases your optionality.

Continue reading Decorator pattern in Kotlin – Design Patterns

Observer pattern in Kotlin – Design patterns

Have you ever been subscribed to the newsletter? When the author publishes the new issue, it comes straight to your inbox. You can always choose to unsubscribe too.

Why am I asking? Chances are that you’re already familiar with the pattern I’m going to describe today – the observer pattern.

Continue reading Observer pattern in Kotlin – Design patterns

Design patterns – do we still need them?

Design patterns are a set of solutions for the most common problems in software design. The most commonly used patterns came from the book published in 1994. The question is, do we still need them in our modern software projects?

The short answer is: yes, we do. Wanna know the details? Read more.

Continue reading Design patterns – do we still need them?

Console output unit testing in the Kotlin application

Are you looking for a way to test your console output (println()) in your Kotlin project?

In this post, I’m going to walk you through the process of creating a simple project setup that allows you to unit test the console output of the application.

Continue reading Console output unit testing in the Kotlin application

OpenAPI 3 documentation for your Spring REST API with springdoc-openapi

Looking for the OpenAPI 3 compliant documentation for your Spring Boot-based project REST API?

As you know, there are many ways to achieve it (e.g. using the Springfox library). But which solution will be both integrated with the Spring ecosystem and OpenAPI 3 compliant?

Fortunately, the answer is springdoc-openapi. It’s the library that generates documentation almost automatically, without even providing configuration and thousands of cluttering annotations.

In this text, I’m going to show you how you can integrate your Spring Boot project with the springdoc-openapi library to generate nice API documentation which will be compatible with the OpenAPI 3 standard.

Continue reading OpenAPI 3 documentation for your Spring REST API with springdoc-openapi

Spaced repetition algorithm implementation in Kotlin

Have you ever thought about creating your own flashcards app?

Well, I have. Although there are plenty of applications like that I developed a simple one for my personal purposes.

Today I’d like to share the implementation of the SM-2 spaced repetition algorithm in the Kotlin language.

Continue reading Spaced repetition algorithm implementation in Kotlin

Provide basic security for your Spring Boot application with Spring Security and Kotlin

When you’re creating your REST API, most of the time you don’t want it to be publically accessible. Moreover, sometimes you’d like to restrict certain paths for users with specific roles (for example administrators).

In this blog post, I’m going to provide very basic Spring Security integration for Spring Boot application written in Kotlin language.

Please note that I’m using the example REST API I provided in the previous article. So if you don’t have your Spring Boot REST API built yet, move through the steps I described there.

Continue reading Provide basic security for your Spring Boot application with Spring Security and Kotlin

Swagger documentation for your Spring Boot API with Springfox

If you’d like to provide Swagger documentation for your Spring Boot REST API in a nice way, you’re in the right place.

Today I’m going to show you how you can achieve it in an automated way, without using tons of annotations in your controllers.
Springfox is a nice tool that allows you to do it.

In this text, I’ll be using the REST API built previously in that text using Spring Boot and Kotlin language, as an example.

Continue reading Swagger documentation for your Spring Boot API with Springfox

REST API with Spring Boot and MongoDB using Kotlin

If you think about Kotlin you could probably think about Android and mobile development.
It’s true. When Google announced Kotlin as the preferred language for the Android platform, its overall popularity increased sharply.

According to The State of Developer Ecosystem 2019, the survey made by JetBrains (Kotlin language creators), 62% of Kotlin-based apps were mobile. But 41% of Kotlin projects were related to web back-end development.

Indeed, Kotlin may be a good choice for server-side development. Among other frameworks, Kotlin is one of the officially supported languages of the Spring Framework.

In this text, I’d like to show you how easy it is to create a Spring application using Kotlin. I’m going to implement a simple CRUD REST API with Spring Boot and MongoDB as a database using Kotlin as a language.

So, get started with implementation and try it yourself.

Continue reading REST API with Spring Boot and MongoDB using Kotlin