You go in “Tool -> Kotlin -> Configure Kotlin in Project.” It was worth a try. Looking around, I found that IntelliJ contains a tool to add Kotlin’s support in your current project. I knew it is possible, but I still felt fear and excitement. ![]() Let’s begin by converting one classĪt this point, I had a Java Spring codebase and I needed to configure my build system ( Maven) to compile a Java/Kotlin hybrid Spring codebase. If you add to this the fact that the main Kotlin design principle is “painless Java interoperability”, you already know the best way to proceed. They are less verbose and they are widely supported. Kotlin, on the other hand, has been designed with this modern principle in mind and nullable/non-nullalbe types flow straightforwardly into the code. It is not completely integrated into the language and legacy libraries, and converting an old-style Java code into an Optional-Java code pollute your code of a lot of ugly if (foo.isPresent()) checks. The feature is a life-saver, but, unfortunately, it is still a bit clunky. If you know Kotlin, Rust, Swift, or any other language designed in this decade, you know what I am talking about. Optional types are not an exoteric feature anymore. If you have Optional foo, you cannot use it where a String is expected: you will first need to unwrap it and, as a consequence, check if the content of foo is not null. Optional, in short, wraps around a nullable variable providing type-safe access to that value. The addition of Stream was excellent but the introduction of the Optional type is probably the best feature of any modern Java implementation. After years and years of stagnation, Java is now a not-unbearable language to work with. In recent years, Java got much better at almost everything. ![]() Do your research first! Talk with who is in charge. If you are not, it is always a bad idea to switch technology on an impulse. Therefore, I can assume the risk of playing and spending time messing with the core application of our business. At work I am the guy in charge of deciding the technical stack.
0 Comments
Leave a Reply. |