Thomas Sundberg

February 16, 2015

Which artifacts do you want when you build a system?

A Continuous Integration, CI, server builds a system every time a change has been detected in the version control system. This is a very common practice and something good. We are able to catch many silly mistakes early. The question is, what should the CI server build? Which artifact should the build produce?

(more…)

January 30, 2015

BDD with Cucumber-JVM at GeeCON TDD 2015

This blog post is the same as the example I presented at GeeCON TDD in Poznan, Poland, January 2015. It is a step-by-step example that I hope you will be able to follow and implement yourself.

But before I begin with the implementation, let me reason about why you should care about BDD.

Behaviour Driven Development, BDD, is a way to try to bridge the gap between developers, who can read code, and people who are less fluent in reading code. Cucumber is not a tool only for acceptance testing. It is a communication tool where you can express examples in plain text that anyone can read. These examples can also be executed. They are the outcome from discussions between stakeholders, developers and testers.

Given this, the technical part of BDD that I will show you is the less important part. The most important part is the conversations that occurs and defines the application that should be implemented.

(more…)

December 31, 2014

How do you recruit a good developer?

You are recruiting a new software developer to your team. How can you decide that this candidate is a good candidate?

The only good way I know is to work together. And do it for some time, preferably a few weeks.

(more…)

November 30, 2014

Hard code first

Filed under: Programming — Tags: , , — Thomas Sundberg @ 20:38

I came across this tweet the other day:

“Novice engineers have not yet grokked this: the number of modes or options in your system is the *exponent* in how hard it is to maintain.” by @zooko.

This is very true. The more options a system has, the harder it is to understand, maintain and use. This is one of the reasons why I usually always try to hard code things like parameters to scripts in my first iteration.

Hard coding is something that some of my colleagues sometimes have a hard time to accept. It happens that the argument is “I don’t like hardcoded things”. I can understand that point of view and I extract parameters when I have got one use case working with a hard coded solution. But I don’t do it before I have something working.

(more…)

October 24, 2014

Removing the auto generated class header in IntelliJ IDEA

Filed under: Tools — Tags: , , , — Thomas Sundberg @ 15:58

My weapon of choice when it comes to editors is without question IntelliJ IDEA. It is great and behaves as I want and usually expects. It has, however, one feature that I find annoying and that I always remove.

IDEA will automatically insert a header with my user name and the date when I created a new class. I use version control so this information is never important. Adding a user name implies code ownership. Code ownership is against one principle I think is very important, collective code ownership. It is a core principle in XP with the goal to make sure that every developer feels that it is ok to work on all code in a project.

The header IDEA inserts used to include where to find it so you easily could find and modify it. Today, when I set up a new environment at a new customer, I noticed that the template had changed. It didn’t tell me where to find the template. It looked like below:

/**
* Created by ${USER} on ${DATE}.
*/

(more…)

October 23, 2014

An email marketing system built using test first and Cucumber-JVM

This is the example I implemented at JDD 2014 in Krakow, Poland at my Cucumber-JVM tutorial.

It is a (baby) step by step tutorial. The purpose for me taking baby steps is that you should be able to follow and implement the same things. Be prepared to spend some time with the implementation, it will probably take you a few hours.

Before we dive into the example, let me define what I am aiming for. My goal is to show you how an example (or specification if you want) can be executed. The example is written in plain text and is used to automate the testing of the system I will create. These executable examples can later be relied upon for regression testing and a living documentation.

(more…)

September 20, 2014

Making life easier with a multi module Maven project

Filed under: Automation, Maven — Tags: , , , — Thomas Sundberg @ 00:02

Working with slow modules in Maven is a problem. People will not build the module as often as they need and they will therefore not find problems as early as they could.

A solution could be to separate some of the slow stuff to a separate module. One separation can be to have a specific module for slow tests. This will, however, not solve the problem, that the module is too slow.

A solution to the problem could be to only include it in the execution when you invoke a specific Maven profile. This would separate the execution of a slow module from the execution of the rest, fast, modules.

Let me implement a simple example with two modules. There is the first module, the application, that we always want to build. It has fast unit tests and it is therefore not hindering to execute it often. Then there is the second module, the acceptance tests. It requires you to fire up your application before it can be executed. It is therefore dead slow. As a developer you will probably only want to execute the acceptance test module now and then.

Let me show you one way to achieve this.

(more…)

August 27, 2014

Run SSH from Java

Filed under: Automation, Java — Tags: , , , — Thomas Sundberg @ 21:19

Suppose that you need to do something from a Java program on a remote Linux server? How can you do that?

One thing we know is that Linux servers usually supports ssh and that you can do everything you need from a command line. In other words, you need a Java implementation of ssh so you can execute whatever you need on the remote host. Next problem is to either implement ssh yourself or find an implementation that you can use. If you decide not to implement ssh yourself, you will probably prefer a self contained implementation so you don’t have to include more dependencies than necessary. This is a good use case for Ganymed SSH-2 for Java. The only thing left is to:

  1. Include a dependency in your Maven, Gradle or Ant/Ivy project
  2. Implement whatever you want to do

I will show you one solution to 1 and 2 above.

(more…)

August 24, 2014

Cucumber-JVM Hello world with Gradle!

Cucumber is very easy to run from Maven. How do you run it from Gradle?

The answer to this question is: It is as easy as to run it from Maven. Depending on your background, perhaps even easier. The reason for this is because we run Cucumber from a JUnit runner. That is as a unit test with a specific runner. Maven or Gradle really doesn’t have anything to do with this. It all boils down to the need for a Gradle project that can build a Java project. A Java project that has a unit test.

(more…)

July 2, 2014

Comparing Maven and Gradle

Filed under: Gradle, Maven — Tags: , , , — Thomas Sundberg @ 21:18

I have been using Maven for a long time. I used to use Ant and it took me a while to get used to Maven and accept the Maven way. Reading a blog post from Neal Ford Why Everyone (Eventually) Hates (or Leaves) Maven got me thinking. He talks about the popularity of 4GL, Fourth Generation Languages, during the 1990s and why they never really took off. The idea was great, but they were not able to solve the entire problem good enough. They solved perhaps 80% easily and the rest was harder and the last part was even harder to solve. The customers want this last part as well and that is the reason why we use general purpose programming languages today.

I used Paradox to build a system for a customer a long time ago. I was able to solve most of their problems.

One thing though, there was an error situation and the customer demanded a correct error message. My problem was that it was a system error that came from the runtime environment that I couldn’t control. My solution? To patch the binary that I delivered my application with. I replaced the error message with another message. I was lucky, the message I needed was one character shorter so the binary format was never changed. I am not sure that it was legal, I never asked Borland about it. But the error message became correct and the customer was happy and so was I.

(more…)

Older Posts »

The Silver is the New Black Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 63 other followers