Multi-target compilation with Kotlin

Kotlin allows to compile application code for different platforms, namely into JVM (byte code), JavaScript and native binaries. In one of our projects we were facing the challenge to use the same source code as well in a Java client as in a web application written in TypeScript/Angular. The main reason not to just copy the code and convert it manually to TypeScript is maintenance, i.e. the code is expected to evolve over time.

Thus we came up with the solution to convert the original Java code to Kotlin and compile it for both platforms.

Continue reading

Different JSON views from a single source

Getting data in JSON format via REST services from the backend server is common practice. In the simplest case a JSON provider like Jackson translates your Java objects into a JSON string and back into Java objects automatically.

However, this does not cover cases where the data model (e.g., implemented as JPA entities) is different from the view model. For example, if you have BLOBs in your model it does not make much sense to transfer them as BASE64 encoded strings. Mostly, because BLOBs tend to be large and may not be needed at once.

In this article we will show how to provide different JSON “views” or dialects of the data using the same REST service.

Continue reading

Jacoco and Sonar with Kotlin

When we began a new project recently the team thought about using Kotlin over Java to implement the backend. The project lead had issues with this because there was no clear information on how Kotlin would be supported by tools like Sonar and Jacoco. Since these tools deliver important information about code quality and potential issues we decided to spend some time on evaluating how these tools would collaborate with Kotlin.

Continue reading

Stay alert – taking action upon log file events (part 1)

Almost every application writes log files. Where organizations differ (vastly) is in how and to which extent these logs are used. Aside from the ultimate no-go of not checking them at all, this takes discipline and effort, especially for timely reactions. This post shows how to automate the tedious task of checking log files (especially those from Java backends), how to consolidate them into existing infrastructures (like the Windows Event Log) and how to effortlessly generate alerts for serious incidents.

Continue reading

Predicting house prices on Kaggle: a gentle introduction to data science – Part III

We know our dataset inside out (Part I), the data is immaculately clean (Part II) and we’ve engineered some powerful and informative features. Finally, in this third and final part of our tutorial series, we are ready to proceed to the guts of the data science process: the modelling itself. Given the abundance of excellent machine learning libraries available, we will not delve here into developing the algorithms themselves. Rather, we will discuss how one might go about choosing and fitting one of the models already available, and how to verify whether the solution we end up with is up to task.
Continue reading

Functional Reactive Programming with Angular and Sodium

Functional reactive programming (FRP) is a variant of reactive programming for the development of user interfaces based on the functional paradigm and a strict set of basic operators. In contrast to reactive frameworks, such as RxJs, using FRP enables a developer to define a pure area in her code in which some error classes, typical for event-based architectures, do not occur. Sodium is an FRP-framework, which is independent of a specific GUI-framwork and supports several different programming languages. Here, we describe how to use Sodium together with Angular.
Continue reading