My blog about programming, computer science, and other stuff.

Everything here is my personal opinion and is not related in any way to my current, past, or future employers.

Functional Java

With Java 8 the language got lambdas. This is a huge step towards allowing functional programming in Java and hence brings a fresh breeze. The language designers did not stop by simply providing lambdas but also extended the runtime API significantly to support lambdas and functional programming. What are lambdas? The Java Documentation for Lambda expressions gives a rather dry definition: “Lambda expressions let you express instances of single-method classes more compactly.

Updating FreeBSD with ZFS Root File System

This weekend I wanted to update my FreeBSD box and saw that the ZFS tools fundamentally changed. The UPDATING file has a corresponding note: Installing kernel and world simultaneously is scary. If something breaks you are left with a broken system, no way to roll back, and uncertain repair possibilities. Sure, you should have backups, but restoring a whole system is still something that takes a lot of time. But is this not exactly one of ZFS' strength?

Equals != Equality

The other day, I read the article How to Write an Equality Method in Java. Which reminded me that I wanted to write an entry about equality in programming. I cannot hope to cover this topic adequately in a blog post. My goal is merely to show that equality is very hard and that we often have a sever misconception about it. Most programming languages give us several ways to check equality.

duckprxy with javasist

I just released version 0.2 of duckprxy. It now comes with a duck proxy implementation that uses Javassist: JavassistDuckPrxy. Proxies created with JavassistDuckPrxy are not using runtime reflection, but dynamically created code that is compiled to byte code by Javassist. This should reduce the overhead to that of normal delegation, hence, very little. I did not do any performance tests yet, though.

FreeBSD: Encrpyted ZFS Root with Geli

ZFS is supposed to support encryption, but it does not yet on FreeBSD. In a previous post I wrote about setting up ZFS on FreeBSD where the root file system uses UFS and the rest goes to logical ZFS volumes. This time I use geli to encrypt a disk partition and use ZFS for the root file system. I encountered a few problems which I’d like to document here. The FreeBSD Handbook section on encrypted disks show how to set up encrypted disks with geom or geli.

Duck Typing for Java

Every now and then I need to implement some interface, but only one (or very few) methods of it. Usually I need something like this in test code, but it is useful elsewhere, too. The mocking libraries I have seen so far offer something similar, but not quite in the way I want to have it. I had the idea to use something like duck typing for it for a while now.