August 21, 2016

iOS: Creating a Custom UIViewController Transition Animation – a Step-By-Step Guide

First of all - what is this 'Transition animation', you might ask? Well, no rocket science here - transition animations provide visual feedback about changes to your app’s interface. UIKit provides a set of standard transition styles to use when presenting view controllers, and you can supplement the standard transitions with custom transitions of your own.You may have seen a lot of transition animations that look really nice and neat but you might not have any idea of how to create one. Some of them look really complicated and some really simple, but in the end you just don't know where to start.

That's why I am going to introduce you to custom transitions. In this step-by-step guide, we are going to create a regular custom transition animations and, in doing so, wash away any fears you might have had about them.
So let's get started!

July 04, 2016

The WWWW Guide to Refactoring

If you are working on an ever-evolving codebase, refactorings are something you're sure familiar with. Martin Fowler’s Refactoring book is a must-read for any developer. Lets start with his definition of refactoring:
Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code, yet improves its internal structure.” [1]
The book describes the process of refactoring and spends most of the time explaining how to do the various refactorings. In this post I will talk about the essential wwww questions:

WHY should we refactor?
WHEN should we refactor?
WHO is involved in a refactoring?
WHAT should be refactored?

June 27, 2016

Sorting objects - working with "Java Comparator"

Today I want to show you how to sort objects by one or more properties. There are a lot of possibilities how to do that.
There are two interfaces in Java which help you to sort a list. There is the Comparator interface and the Comparable interface. So how do you decide which one to use?

API interface definition Comparable<T>:
"This interface imposes a total ordering on the objects of each class that implements it. This ordering is referred to as the class's natural ordering, and the class's compareTo method is referred to as its natural comparison method."  [1]

Simply put, if you implement the Comparable interface in a class, the class instance is able to compare itself to another object. So you can just use Collections.sort(List<T> list); and you will get a sorted list.

June 22, 2016

Performance Testing with Gatling, Part 1

This is the first part of a two-part series covering the theory on performance
testing. The next part will showcase a practical example using Gatling, an “open-source load
testing framework based on Scala, Akka and Netty”.


Testing system performance can be done on multiple levels. Last time, we covered micro
benchmarking with JMH. Whereas micro benchmarking deals with optimization of code and algorithms, testing system performance ensures that an entire system meets the required metrics such as throughput and response times.

March 25, 2016

Event Sourcing at willhaben

This is the start of a series of blog posts about the introduction of Event Sourcing and Command Query Responsibility Segregation (CQRS) in one of our internal products. The first blog post gives a short introduction to these topics and talks about the problem domain and the current status of development. Further posts will talk about the concepts in detail and our lessons learned. So stay tuned for more.

The problem domain

At willhaben we currently deal with around 120.000 new ads and around 200.000 ad changes per day. For this data we need to make sure that the data adheres to our quality standards and to our terms & conditions, e.g. the ad must be placed in the right category. Also we want our users to be fair to others and not reinsert an ad in order to be pushed to the top of the search result.

For this reason we've developed a system where the people in the quality assurance department can define rules which implement the current quality requirements. The rules can be created, changed and deleted at runtime, making the system very flexible for rule editors because no developers or deployments are needed for changing business rules.

March 22, 2016

Implementing Leader Election and automatic fail over

Leader election and automatic fail over are two common tasks in every distributed environment. There are various reasons why multiple instances of the same software are running at the same time, for example because of load balancing, hot standby or dedicated instances for different tasks (same software but other configuration, etc.). Depending on your architecture, different aspects of these are more important than others. Furthermore, it is easier to develop services that have one master and one or more slaves than developing service set-ups in which every service is equal.

One common task would be having multiple services running for load balancing but only one that executes batch jobs like data base clean up jobs. This can be done in different ways, but one smart way would be to have the same configuration for all service instances and let the services decide at runtime which one executes the batch job (typically the master slave: the master executes the batch jobs and the slaves do not execute any batch jobs at all).

March 21, 2016

A taste of reactive components

The easiest way I can imagine to build a web application is just putting together some HTML and Javascript until I get more or less what I want. But usually, as the project grows, I end up with some unmaintainable mess. Why is that? Lets take a look at some code: