Rust WebAssembly Wasm front-end javascript integration

Rust on the front-end

This is the 5th post in the Start Rust focus series. Up until now, JavaScript has been the only ubiquitous language available in browsers. It has made JavaScript much more popular than its design (and its associated flaws) would have allowed. I don’t want to start a holy war about the merits of JavaScript, but IMHO, it only survived this far because of its role in browsers. In particular, the current architecture that moves the responsibility of executing the code from the server to the cli

blockhound reactive programming

BlockHound: how it works

One of the talks in my current portfolio is Migrating from Imperative to Reactive. The talk is based on a demo migrating from Spring WebMVC to Spring WebFlux in a step-by-step approach. One of the steps involves installing BlockHound: it allows to check whether a blocking call occurs in a thread it shouldn’t happen and throws an exception at runtime when it happens. I’ve presented this talk several times in the previous week, both in its Java version and its Kotlin one. One such pre

Rust exercises practice learning beginners

The Rustlings exercises - part 1

This is the 3rd post in the Start Rust focus series. To continue building my understanding of Rust, I searched for some simple Rust exercises. Hence, I dedicated my weekly personal work time to the Rustling exercises. There will be two posts dedicated to Rustlings. The reason for that is that it contains many (many!) exercises. Besides, I need to learn about the more advanced themes such as threading.

hack API

Hacking third-party APIs on the JVM

The JVM ecosystem is mature and offers plenty of libraries, so you don’t need to reinvent the wheel. Basic - and not so basic - functionalities are just a dependency away. Sometimes, however, the dependency and your use-case are slightly misaligned. The correct way to fix this would be to create a Pull Request. But your deadline is tomorrow: you need to make it work now! It’s time to hack the provided API. In this post, we are going through some alternatives that allow you to make

software engineering

Timely computation of derived values

In my penultimate post, I described the use-case of an e-commerce shop. In general, interactions in such a shop are the following: You can browse a catalog of itemsEach item has a price tagYou can put x items in your cart It’s when the exciting part starts. On most pages, you want to give users a condensed view of their cart’s state. Here are a couple of options for the state’s view: Empty/non-emptyNumber of cart linesNumber of itemsTotal cost. In demos, it’s as sim

Stream Collector API

Teeing, a hidden gem in the Java API

Last week, I described a use-case for a custom Stream Collector. I received a intriguing comment on Twitter: Interesting article. For completness' sake this specific problem could also be solved using the standard teeing collector— Miguel Martins (@Miguucm) May 3, 2021 Hats off to you, Miguel! Your comment revealed a method I didn’t know! So I decided to investigate what the teeing() method is about. Returns a Collector that is a composite of two downstream collectors.

Stream Collector API

A real-world example of a Stream Collector

Java Stream’s Collectors methods fit most use-cases. They allow returning either a Collection or a scalar. For the former, you use one of the toXXX() method, for the latter, one of the reducing() one. Let’s imagine an e-commerce platform that implements a shopping cart. The cart is modeled as the following: This diagram might translate into the following (abridged) code: Product.java public class Product { private final Long id; (1) priva