Database Integration Tests with Docker Sidecar in Jenkins

More often than not, developers want to test the source code against a real database instead of Fakes or Test Doubles during a CI job in order to verify the code works as expected. Therefore a clean database is needed for every CI-job. One solution is to use a shared instance of the database in your existing test-environment which get cleaned before and after a job. But this suffers from being “shared” and you never can run multiple CI-jobs in parallel without jobs interfering with each other....

May 9, 2021 · 2 min · Daniel Gerlach

Emacs as RSS reader

Do you have a list of websites you visit regularly? Just to find out nothing new was added. This manual scraping is often a waste of time. Worse yet, scanning and filtering these websites for new interesting content is even more time consuming. Subscribing to an RSS feed can reduce your effort immensely. An RSS feed “pushes” the newest updates to subscribers and they will never miss updates. In order to make use of RSS feeds you need a “feed reader” or “feed aggregator”....

October 10, 2020 · 2 min · Daniel Gerlach

Product Management Quotes

I collected my favorite quotes about product management: We need teams of missionaries, not teams of mercenaries. Marty Cagan, Inspired It doesn’t matter how good your engineering team is if they are not given something worthwhile to build. Marty Cagan, Inspired The use of OKRs in most companies is a mess - because it’s a framework that originated in an empowered team environment - and most companies applying it today don’t have empowered teams....

October 8, 2020 · 3 min · Daniel Gerlach

Writing better Code

In Joel Spolsky’s blog post “The Joel Test: 12 Steps to better Code”, he describes a test composed of twelve simple yes-no questions. For a yes you get one point. 10 points are acceptable and 12 are perfect. If you have less than 10 points, you will get in trouble with your software – sooner or later. For a quick self-check, these are the original questions: Do you use source control?...

August 16, 2020 · 15 min · Daniel Gerlach

Google Testing Toilet Collection

In my one of my previous posts i wrote about Good Unit Tests. During my research i discovered the famous Google Testing on the Toilet posts which provide great advice. The Testing-on-the-Toilet articles are short (~3min reads) and give hands-on examples, ready to be applied immediately. Here are my favorites: Testing on the Toilet Tests Too DRY? Make Them DAMP! Exercise Service Call Contracts in Tests...

May 23, 2020 · 2 min · Daniel Gerlach

Programming Quotes

Over the years i collected some (funny) programming quotes. Lean back and enjoy: Everyone knows that debugging is twice as hard as writing a program in the first place. So if you’re as clever as you can be when you write it, how will you ever debug it? Brian W. Kernighan Don’t comment bad code—rewrite it. Brian W. Kernighan The most effective debugging tool is still careful thought, coupled with judiciously placed print statements....

May 17, 2020 · 7 min · Daniel Gerlach

Why and How to write better Unit Tests

TL;DR Good unit tests build the foundation of a maintainable and high-quality codebase Unit Tests should help developers to be productive Unit Tests should be fast Unit Tests should be isolated Unit Tests should be deterministic Unit Tests should focus on a single unit Unit Tests should be enduring Unit Tests should be clear, concise and complete Avoid complex control flow logic like nested ifs or loops Unit Tests should follow a consistent naming pattern like UnitName_StateUnderTest_ExpectedBehavior Unit Tests should comply to a consistent structure Unit Tests should be DAMP not DRY Unit Tests should give developers confidence to deploy and to refactor Test Doubles help to make tests fast and deterministic The overuse of Mocking makes test hard to read and brittle Prefer state verification over interaction verification Prevent brittle tests Prevent flaky tests Read more: Software Engineering at Google Kent Becks’s Programmer Test Principles Microsoft’s Best Practices for Unit testing All Your Tests are Terrible TDD, Where Did It All Go Wrong (Ian Cooper) Why good unit tests are important TDD and test engineering culture is considered best practice these days....

May 4, 2020 · 20 min · Daniel Gerlach

ESlint + Prettier + Typescript = Consistency

Consistency is one of the most important factors in a codebase. It gives new developers an orientation and direction how to write new code. It keeps the code understandable, clear and free from bikeshedding, so developers can focus on real problems instead of indulging in discussions on their preferred codestyle and individual taste. Consistency can be pertained by strict discipline but if possible you should enforce good style and formatting via opinionated code formatters like Prettier which makes development and collaboration a breeze....

March 24, 2020 · 7 min · Daniel Gerlach

Install Postgres on Ubuntu

Recently i decided to switch from MacOS to Linux. I was already an Ubuntu user from 2006 till 2015. So i am used to Linux. Nevertheless i struggled a little bit with the installation of PostgreSQL. For MacOS there is a nice all-in-one package which i recommend: Postgres.app. Everything works out-of-the-box there. In Ubuntu, on the other hand, we need to adjust the default installation a little bit in order to start application development....

July 26, 2019 · 4 min · Daniel Gerlach

Emacs Delete Lines

Sometimes when i write small scripts i tend to insert print statements for debugging. After i verified the correctness of my program i want to get rid of all unnecessary debug statements. With Emacs you can delete all lines which match a specific regular expression with M-x flush-lines or with its alias M-x delete-matching-lines. Interactively you can enter your regular expression and all matching lines will be deleted from you cursor position downwards....

May 13, 2019 · 1 min · Daniel Gerlach