kotlin
Today in “Idiomatic Kotlin”, we’re looking at day 4 of the Advent of Code 2020 challenges, in which we tackle a problem that feels as old as programming itself: input sanitization and validation.
Day 4. Passport processing We need to build a passport scanner that, given a batch of input text, can count how many passports are valid. You can find the complete task description at https://adventofcode.com/2020/day/4.
Like many challenges, we first inspect our input:
This blog post accompanies a video from our YouTube series which you can find on our Kotlin YouTube channel, or watch here directly!
Today, we’re talking all about lists! Lists are the most popular collection type in Kotlin for a good reason, and we’ll find out why together.
Lists What’s a list? If you’ve written Kotlin code before, you’ve definitely seen a list – they’re collections of ordered elements, where each element is accessible via an index.
This blog post accompanies a video from our YouTube series which you can find on our Kotlin YouTube channel, or watch here directly!
Today, we are learning about advanced functions that we can use to work with and manipulate all kinds of Kotlin collections!
Checking predicates: any, none and all Let’s warm up by having a look at a selection of functions that allow us to check conditions for our collection elements.
A while ago, I tweeted about a small game I had created on top of Compose for Desktop: A small clone of the classic arcade game Asteroids, in which you control a space ship with your mouse, and navigate the vastness of space, avoiding and breaking asteroids in the process.
Today, it’s time to take a look under the hood and understand how I built a basic version of this game, and how Compose for Desktop helped me achieve it in just one evening!
In the first part of my blog post series about building a small clone of the classic arcade game Asteroids on top of Compose for Desktop, we saw how to implement the main game loop, as well as manage state and draw basic shapes. In this post, we will explore some more details of the game implementation. This includes:
Rendering details – making sure game objects don’t escape our play area, and using a device-independent coordinate system for rendering Geometry and linear algebra – the secret sauce that makes the space ships fly Frame-independent movement – so that our game works consistently.
This blog post accompanies a video from our YouTube series which you can find on our Kotlin YouTube channel, or watch here directly!
Kotlin Collections! You’ve heard of them, you’ve used them – so it makes sense to learn even more about them! Kotlin’s standard library provides awesome tools to manage groups of items, and we’re going to take a closer look!
Let’s see what types of collections the Kotlin standard library offers, and explore a common subset of operations that’s available for all of the collections you get in the standard library.
This blog post accompanies the first episode of our YouTube series “Kotlin Standard Library Safari”, which you can find on the official Kotlin YouTube channel, or watch here directly!
What’s Kotlin Standard Library Safari? In the “Kotlin Standard Library Safari” series, we’re going through the useful functionality the standard library in Kotlin has to offer, one subject at a time. In the process, we’re hopefully going to unearth some hidden gems together, which will come in handy the next time you write Kotlin code.
Together with some colleagues, I maintain a small full-stack web application called CodeQuiz, which we built during a 48-hour hackathon at JetBrains, and use at events to gamify learning about Kotlin. I recently migrated its frontend which you can see below (and which is using the kotlin-react wrappers) to the new Kotlin/JS IR compiler backend.
The new compiler made a bunch of issues in our code visible, so I wanted to share my experience of migrating a Kotlin/JS app, and provide some hints on where to look when your app behaves unexpectedly after moving to the IR compiler.
This blog post accompanies a video from our YouTube series which you can find on our Kotlin YouTube channel, or watch here directly!
We’re going to take a look at some handy tips and tricks to help you explore Kotlin code, no matter whether it’s your own code or the code from the Kotlin standard library or any of your other dependencies. They will equip you to discover some of the goodies in the code you’re working with on your own.
GitHub Pages is an easy way to host your Kotlin/JS application - and in combination with the continuous integration service GitHub Actions, you can easily set up a smooth development (and deployment!) experience for your projects. Read on to learn how you can build and test your application on GitHub’s CI, and get your Kotlin/JS web apps published for free.
In this post, we are going to configure GitHub Actions and Pages so that new code pushed to our repository or added via pull request is automatically validated (by having the project built and our tests run on GitHub’s servers), and code pushed to the main branch of our project is automatically made available to the public (by generating and publishing production artifacts of our app).