• Unwrapping Use-site Targets in Kotlin

    I like Kotlin for its expressiveness. Its interoperability with Java allows the developer to easily use the existing Java ecosystem while enjoying a modern language. When it comes to annotations Kotlin handles them almost the same as Java. In Kotlin, a single syntax construction might be compiled into several JVM constructions. A Kotlin property would produce a JVM field, a getter, and optionally a setter. This is where annotation use-site targets are useful.

    continue...
  • A Better Structure for Kotlin Projects

    When I write programs in Kotlin I usually don’t think about where to put my source files and how to structure packages; my build tool knows it better. After years of working with Java and then with Kotlin, it is not a surprise that code lies in src/main/kotlin and tests in src/test/kotlin. I know where the resources are and how they are packaged. Paths like com/companyname/projectname are paths corresponding to package names. This all looks familiar. However, we are so used to such setups that we often don’t understand what inconveniences they bring. In this article, I will explain what’s wrong with these defaults and how we can do better.

    continue...
  • My Two-Years-Long Journey in Learning German

    When I started learning German I was curious about what I could expect from the language, how fast I would learn it, and what experience I would have. At the time, most of the stories I could find on the Internet were about people reaching fluency in half a year and guides about repeating their success. I would gladly read something close to how regular people learn. Learning English was tough. I didn’t expect German to be any easier. Now, after two years, I want to share my experience. I will try to explain my motivation, how I learn, what resources I use, how it went, how much it cost, and where I am right now. I do it for myself, but I hope other language learners might find it useful.

    continue...
  • Twitter Integration Plugin for JetBrains IDEs

    I have implemented a small IntelliJ plugin to post code to Twitter. I often see tweets with code, so I thought why not make a better way to tweet. When you have the plugin installed, you can right-click on a selected piece of code, press “Tweet” and your IDE will redirect you to the Tweet creation window in your browser with the selected text.

    continue...
  • Using 'any' Matchers in Unit Tests Is a Code Smell

    If you’ve worked with JUnit and Mockito, you must be familiar with matchers. They provide a way to verify parameters during method invocation. Among many of those, there is a group that allows matching any object as a condition. Their names all start with the word ‘any’: Matchers.any(), Matchers.anyString(), anyCollection(), etc. If in your project, you find many of such calls there is a high chance that something is wrong with your code. Let me explain why.

    continue...
  • Why Would a Java Engineer Love Frontend Development?

    It often happens that backend developers don’t like working with a frontend. Even more, some hate frontend development. The complaints are always the same: JavaScript is hell, there’s no types, it’s hard to predict the result, all that cross-browser stuff is a pain and many more. I was one of those guys but now I’m on the other side as the situation with JavaScript has changed. Sure, they still invent a new framework a day, what I mean is that working with a frontend is not a pain anymore. I’m going to explain some of the reasons I like frontend development and particularly why I like Angular with TypeScript.

    continue...
  • Why You Need to Implement Your Own IntelliJ IDEA Plugin

    IntelliJ IDEA is a powerful tool that aims at increasing productivity. It speeds up the development process and optimizes most of the standard use cases such as code formatting, code generation, navigation, etc. However, the utility of IntelliJ IDEA is not limited to these processes. For instance, I set up my IDE to generate tests prefixed with the word ‘should’. My IDE also automatically adds annotations to test classes depending on their names. But what could make an IDE even more useful is implementing an own plugin that will optimize processes that cannot be customized via standard tools. What exactly could be achieved thereby? And how complex is it? This is what I’ll try to address in this blog.

    continue...
  • Why Event Sourcing Is Not a Choice for Your Next Project

    Event-driven architecture has become extremely popular nowadays. It is easy to start and it can easily be integrated with popular Java frameworks like Spring. I have been working on event sourcing for the past six months. In this period, I have collected some thoughts on the subject of event-driven architecture. Despite all its features, I believe that such architecture should be applied very carefully in terms of understanding its consequences.

    continue...
  • Implementing do-while Loop in Scala

    I have recently completed a Scala course on Coursera. Now that doesn’t turn me into a Scala programmer; however, the knowledge I acquired certainly has been very helpful with my everyday projects, especially when it comes to applying that knowledge to Java stream API. One of the tasks proposed by Martin Odersky was to implement a do-while loop using only Scala built-in features. This statement made a great impression on me. It’s proof of the power of the language and its features. In this blog post, I want to share the implementation of the do-while loop in Scala with you.

    continue...
  • Shipping Docker with a Java Application

    Docker is not a new technology anymore. In the meanwhile, it has become an everyday tool for many developers. However, there are still a lot of people out there who haven’t tried Docker. In this article, I’m going to show you how to ship a standalone Java application in a Docker container.

    continue...