LATEST POSTS

Back to the Trunk: Cutting Heavy Feature Branches

This article is written after an evaluation of trunk-based development and feature toggles for my project. It might be opinionated, but I tried to present a holistic explanation of why you might want to move from feature branching to trunk-based development and how you can do that using a set of different techniques and best practices.
[read more]

You Should Avoid Debugging

Disclaimer: debugging is one of the most important techniques in the toolbox of every software developer. Investigating issues in your code by interspersing it with “print” statements or slightly changing it until it works is rarely a good solution, so “learn how to debug” is the best advice you can give to a less experienced developer.
[read more]

Why You Should Learn Functional Programming: Type Classes vs. Interfaces

In this article, I’ll describe a cool concept of functional programming, type classes, on the example of the Haskell programming language. I’ll start by providing some Java examples and go through the limitations of the Java language and its object-oriented paradigm. I will then describe how those limitations are lifted when moving into the functional programming world.
[read more]

How long does a line of Java code execute?

You may wonder how long a particular line of Java code executes. If this line is part of your code, it’s easy to find out by putting System.currentTimeMillis() calls before and after the line and finding the difference. But what if this line of code is part of a library or a framework? You could use a profiler, but a quicker and easier way might be to use breakpoints in IDEA.
[read more]

Compressed Kafka Topics

Text messages may consume quite a lot of space in Kafka topics. However, text may usually be compressed with a high ratio, so sometimes it makes sense to enable topic compression. In this article, I’m going to show how easy it is to set up compression. I’m also going to check out the practical difference between compressed vs. uncompressed topics.
[read more]

Solving issues with installing the "Real World OCaml" prerequisite libraries under Mac OS X

I’ve run into some troubles installing the «Real World Ocaml» prerequisites under Mac OS X Yosemite. The installation process is described on the books’ wiki here. I’ve found little help by googling the error messages, which possibly means they could be very specific to my installation. So I’ve decided to share my experience in case someone runs into similar issues.
    At one point, the instruction advises you to install some libraries that are used throughout the book, by issuing the following command:

[read more]

Creating the simplest HTTP server with basic authentication using node.js

In this article I will show you how to create the simplest possible HTTP server with basic authentication in node.js. I have to warn you though, I needed a quick and dirty solution for testing purposes, so this is definitely not for production use. You should at least keep hashes of user passwords, not plaintext passwords themselves, and use digest authentication as a more secure method.
        First, install the htpasswd module globally:

[read more]

Sending large attachments via SOAP and MTOM in Java

Sometimes you need to pass a large chunk of unstructured (possibly even binary) data via SOAP protocol — for instance, you wish to attach a file to a message. The default way to do this is to pass the data in an XML element with base64Binary type. What it effectively means is, your data will be Base64-encoded and passed inside the message body. Not only your data gets enlarged by about 30%, but also any client or server that sends or receives such message will have to parse it entirely which may be time and memory consuming on large volumes of data.

[read more]

Of Domain Modeling, Separation of Concerns, and How the JPA Annotations Fail at Both

Not all of the JPA annotations are actually about mapping the entities to the database, or even about persistence at all. Some of them are intended to instrument the Java language for better modeling of the domain. Here’s a simple example of two domain classes that are somehow associated with each other (accessor methods are omitted for clarity):

[read more]

Integrating DBUnit with Spring TestContext Framework

The Spring Framework 2.5 came with a new TestContext framework which made integration testing of database code a lot easier. It provided annotations to declaratively specify the application context to execute your test in, annotations to mark the transactions for test methods, and also some base test classes for JUnit and TestNG. In the following article I will describe an approach for integrating the TestContext framework with the DBUnit framework, which in turn allows you to initialize the test database before test and verify its condition with the expected dataset after the test is complete.

[read more]