Crafting Interpreters in Kotlin
Working as a software engineer, I was surprised how often there comes a need to interpret something and the code for that is a mini interpreter. But it makes sense, teams often work with data and need to evaluate them somehow and since the data is very specific to their domain, they need to use something very tailored. Last time this happened, I opened my copy of Crafting Interpreters this time for the third time and using third different language and determined that this time I would finally see it through. And this time I did and there were several fascinating concepts I learnt and want to highlight some of those.
Kover Kotlin code coverage
I am working on a Kotlin project that has lot of branching in the code and as such it's difficult to even estimate which parts are covered by unit tests and which parts are missing. The task at hand was to find a tool that would generate test coverage report for me and ideally would be configurable and plugable into the CI pipeline. I was aware of JaCoCo but had bad experience with it, as it mingles the generated bytecode and can break some libraries. Instead, I searched a novel approach, and found kotlinx-kover developed by JetBrains.
Migrating Jekyll blog to Eleventy
I decided to migrate my Jekyll based blog to another static site generator based one. My eyes were first on Hugo but I found it overly complicated with little explanations. My next option was Eleventy with its great in-depth tutorial. Here, I won't be describing my step by step process to migrating rather I will focus on differences and the overall experience.
Using Javascript to avoid clicking
Recently, I had to check hundreds of checkboxes to proceed with my work and the website didn't expose any API that I could leverage to make my life easier. Being a proper lazy developer who doesn't want to click hundreds of times using mouse and potentially missing some of the buttons, I got an idea involving Javascript and developer console.
Learning Kotlin as Python developer
After 7 years working as a Python developer, I started a new job working primarily with Kotlin. Here, I'll share the experience and some ways the two languages differ. Let's take a look.
Git Cheatsheet
It just recently happened to me that I wanted to do something in git, I knew exactly what but was unable to remember the git command that would do that. So I decided to make this blog, mainly for me, to keep all my favorite git commands and workflows in a single place. But if someone else finds this useful it would be great.
Use PDB over print
When I started coding in python, whenever my script crashed with some traceback, I would start adding
prints here and there and would re-run the script as many times as needed to figure out what's wrong. Now, this approach works, but takes a lot of time and may be quite frustrating (Where should I put prints? What should I print?).Mypy generics and subtypes
Type
Optional[bool]can be one of three values -None,TrueorFalse. Typeboolcan be one ofTrueorFalse. So we can easily say thatboolis subtype ofOptional[bool], right? Let's see what happens when we start nesting these types.