Sondre Larsen Ovrid
4 innlegg
Kotlin code sketching in IntelliJ with Scratch Files and Kotlin REPL
Imagine you're sitting on the train on your way to work, and you suddenly get an epiphany on how to solve that mind numbing coding problem that's been bothering you over the last few days. You whip out your laptop, create a new Kotlin file, implement the standard main function, and hit "Build" to verify that everything is OK. By the time IntelliJ responds with a "green light", your stop has been announced on the speaker system and you have to drop what you were doing. At the office, the solution you once had so clear in your mind now is lost to the void. If only you had a tool to quickly verify that code snippet, with less overhead!
Imagine you're sitting on the train on your way to work, and you suddenly get an epiphany on how to solve that mind numbing coding problem that's been bothering you over the last few days. You whip out your laptop, create a new Kotlin file, implement the standard main function, and hit "Build" to verify that everything is OK. By the time IntelliJ responds with a "green light", your stop has been announced on the speaker system and you have to drop what you were doing. At the office, the solution you once had so clear in your mind now is lost to the void. If only you had a tool to quickly verify that code snippet, with less overhead!
Bring your generic function type parameters back to life with the reified keyword
Reification. Like many other concepts, it can be applied in a number of different ways and it might carry slightly different meanings depending on the context. According to this definition, reification is simply the act of representing something abstract in a physical way. In Java, on the other hand, the term is used in the context of which types that are available to us at runtime. Additionally, in Kotlin we actually have a modifier keyword built into the language, namely reified. In this article we'll take a closer look at how reification and type erasure are connected, and more specifically how we can combine inline functions and reified type parameters in Kotlin to achieve things in generic functions that we normally would not be able to.
Reification. Like many other concepts, it can be applied in a number of different ways and it might carry slightly different meanings depending on the context. According to this definition, reification is simply the act of representing something abstract in a physical way. In Java, on the other hand, the term is used in the context of which types that are available to us at runtime. Additionally, in Kotlin we actually have a modifier keyword built into the language, namely reified. In this article we'll take a closer look at how reification and type erasure are connected, and more specifically how we can combine inline functions and reified type parameters in Kotlin to achieve things in generic functions that we normally would not be able to.
Using the Bytecode Viewer and Decompiler tools in IntelliJ to lift the veil of Kotlin's magic
IDE's commonly include a lot of useful tools that can make our lives as developers easier. Some are pure productivity tools to speed up our development, while others may actually help our understanding of the code we are implementing. The toolset included with the IntelliJ IDEA IDE is no exception. In this article we will take a look at the Bytecode Viewer and Java Bytecode Decompiler integrated tools in IntelliJ, and how they may help us getting a better understanding of how our Kotlin code is represented on the JVM, and how it could potentially look in Java.
IDE's commonly include a lot of useful tools that can make our lives as developers easier. Some are pure productivity tools to speed up our development, while others may actually help our understanding of the code we are implementing. The toolset included with the IntelliJ IDEA IDE is no exception. In this article we will take a look at the Bytecode Viewer and Java Bytecode Decompiler integrated tools in IntelliJ, and how they may help us getting a better understanding of how our Kotlin code is represented on the JVM, and how it could potentially look in Java.
Streamlining your functions with Named and Default Arguments
As developers, we spend a considerable amount of time declaring and invoking functions when writing software. Kotlin provides several features that can boost your productivity when working with functions. In this post we'll take a closer look at two of these features; Named Arguments and Default Arguments, and how we might use them to make our Christmas preparations more carefree!
As developers, we spend a considerable amount of time declaring and invoking functions when writing software. Kotlin provides several features that can boost your productivity when working with functions. In this post we'll take a closer look at two of these features; Named Arguments and Default Arguments, and how we might use them to make our Christmas preparations more carefree!