Continue reading: Readable Java system tests with good old JUnit

Readable Java system tests with good old JUnit

This article is the third in a series about system testing:

  1. Dockerized testing vs end-to-end testing
  2. How to setup Dockerized testing
  3. Readable Java system tests with good old JUnit

JUnit is poorly named. Given the name, people tend to think that it should only be used to write Java unit tests. And then people feel a bit hesitant about writing their integration tests with JUnit too. When they start with system tests, they often think they need another driver for their tests. Sure, maybe using another abstraction layer and a custom domain specific language (BDD), you can make the tests more readable for a non-programmer. That often comes at the cost of making the tests less readable for the programmers. And if we are honest, who’s going to read the tests the most? Perhaps just naming test classes and methods well and writing readable code can suffice?

Continue reading

Continue reading: How to setup Dockerized testing

How to setup Dockerized testing

This article is the second in a series about system testing:

  1. Dockerized testing vs end-to-end testing
  2. How to setup Dockerized testing
  3. Readable Java system tests with good old JUnit

You may want to read Dockerized testing vs end-to-end testing first.

How to setup Dockerized testing?

A prerequisite for running your tests against a dockerized environment is of course that the service you want to test is packaged as a Docker image. Also, all of the services which the System Under Test (SUT) depends on needs to be dockerized. If you don’t have that, your environment is not fully dockerized and you will suffer the consequences of having to test against external services.

If your SUT is packaged as a Docker image and has no dependencies on other services, you can just start it using “docker run” and run your tests against it. However, usually services have one or more dependencies to other services, such as its own database, a queue and perhaps a external RESTish service that returns nasty XML. You want each of these services in their own container. To spin up a bunch of docker containers, you can use docker-compose.

Continue reading

Continue reading: Dockerized testing vs end-to-end testing

Dockerized testing vs end-to-end testing

I recently rewrote the end-to-end tests for a service. This brought up the question of what we should test in the end-to-end (e2e) tests vs our Dockerized tests.

This article is the first in a series about system testing:

  1. Dockerized testing vs end-to-end testing
  2. How to setup Dockerized testing
  3. Readable Java system tests with good old JUnit

e2e tests vs dockerized tests

Since the original e2e tests were written, we (my team) have also introduced another type of tests. We call them “dockerized system tests”. These are similar to the e2e tests. They also test the connections between services in the system, and how the system works as a whole. One key difference between e2e tests and dockerized tests is that the dockerized tests do not test the system when it is deployed the way we deploy it in staging and production environments. Our dockerized tests bring up all services in a single machine, and we usually don’t set up redundancy, clustering, load balancers and such things.

Continue reading

Continue reading: Elm for backend developers

Elm for backend developers

Before there was the concept of frontend and backend developers, there were just developers and I was one of them. We did everything from HTML to SQL and it was not hard. Then something happened, JavaScript became popular. After years of server side rendering and thin clients, the pendulum was swinging back to fat clients again. And I was a backend developer.

Believe me, I have tried to get on the train with JavaScript and its hose of new frameworks. I took courses in JavaScript. I wrote applications using Meteor, tried Angular and React. But what I never managed to do, is liking it. There is simply to many ways of shooting yourself in the foot. And all these frameworks that come and go points to something, perhaps we are trying to fix the wrong problem. I suspect it is the foundation itself, JavaScript.

Continue reading

Continue reading: Three “no brainer” engineering practices for developers

Three “no brainer” engineering practices for developers

In modern software development there are three development practices that everyone should strive to apply:

  • Automated testing
  • Pair or mob programming
  • TDD, test driven development

After many years of using and researching these practices in the development community there is no longer any question whether these engineering practices bring value or not – they do. It’s not a matter of opinion, it’s a matter of fact. We know that now.

Continue reading

Continue reading: Codekvast soon available as a Heroku add-on

Codekvast soon available as a Heroku add-on

Codekvast is a tool for detecting Truly Dead Code in your Java application. Truly Dead Code is code that is in production, but has not been used for a significant time. Codekvast has been lurking in the spare-time realm for too long. Now the project has eventually been granted some full-time development effort, with the initial

Continue reading
Continue reading: Programmer productivity: SP < PR < PP < MP

Programmer productivity: SP < PR < PP < MP

In my experience, when it comes to programming productivity, mob programming beats the rest. Of course the definition of productivity in this context is debatable and these are just my observations. Thus, it is not a proper scientific study but bear with me anyway.

I wish to compare one aspect of productivity, how we work together. I look at single programming, pull requests, pair programming and mob programming.

Continue reading

Continue reading: Programming with kids & co-speaking with my son :)

Programming with kids & co-speaking with my son :)

Yesterday me and Dave (11 yrs) spoke together for the first time! We did a public talk at Spotify about how to help kids learn to program. We’ve been experimenting a lot with that in my family (4 kids to experiment with… muahahaha), and wanted to share some learnings. Worked out better than we could have hoped, considering all the risky tech demos and live coding involved 🙂

Shared the stage with teacher Frida Monsén who talked about how to get this kind of stuff into schools. Thanks Helena Hjertén for organizing this, and Spotify for hosting & sponsoring. Here’s an article in Computer Sweden about this event and our little “mod club”.

Here are the slides! They are in Swedish though. Might do an English version of this talk some day 🙂

Dave on Stage

Continue reading

Continue reading: 7 Rules on Code Readability

7 Rules on Code Readability

What makes good code? Many things but whatever the qualities are, readability is a cornerstone.  If you can’t read the code, you can’t fix it. So how do you write readable code? I’ll give you my view but it’s like books, what I find enjoyable may be different from you.

Continue reading

Continue reading: Programming with kids using LearnToMod and Minecraft

Programming with kids using LearnToMod and Minecraft

I’ve spent years experimenting with how to teach kids programming, mostly using Scratch. But now we’ve found a new favorite: LearnToMod! Kids love Minecraft, and LearnToMod is entirely based on Minecraft, so it’s a perfect match!

We now do a Mod Club every Saturday evening, my older kids (9 & 11 years old) and some of their friends. It’s basically a programming school based on LearnToMod and Minecraft programming. Reeeeaaaally fun, the kids go wild (OK, me too)! AND they learn lots while doing it. To them it’s “magic powers”, not “programming skills”.

I made a 5 minute video showing how it works:

Continue reading

Continue reading: Another builder pattern for Java

Another builder pattern for Java

Whenever you have a domain object, data transfer object, parameter object or any other object that can’t be instantiated with constructor parameters only, you need to create a builder for its class.

The great thing about Java is that it is strongly (statically) typed so a builder can give you compiler errors if you forget to set the compulsory parameters. If you use the builder in this pattern, you also get a very fluent interface that imposes order on the parameters. When using the builder, your IDE will suggest the next parameter to set.

Continue reading

Continue reading: Stop the Line – Build Quality In with Incremental Compilation

Stop the Line – Build Quality In with Incremental Compilation

We in the software industry are still far behind when it comes to automated quality checks. Toyoda Sakichi for example invented the automated loom with stop the line capability almost 100 years ago. I write more about that in my first blog in a three-part series on building the quality in on the SmartBear blog.

Continue reading
Continue reading: Twitter Bootstrap: Easy to Use

Twitter Bootstrap: Easy to Use

Are you building a Lean Startup, and want fast results? Twitter Bootstrap could be the solution you’re looking for. Are you a “backend” programmer who would love to have a beautiful site, but you “don’t know frontend”? Twitter Bootstrap could be the solution you’re looking for. Are you just looking for a simple frontend that works? Twitter Bootstrap could be the solution you’re looking for. Nice rounded corners, customizable colors, margins that look good, padding that’s right, JavaScript that just works: that’s what Twitter Bootstrap offers.
Continue reading

Continue reading: Logo: Programming with Kids

Logo: Programming with Kids

It’s pretty tough to explain to a 6 and an 8 year old what it is you do all day at work as a programmer. They take the computer programs they use for granted, and just assume that websites work because they’re supposed to work. Explaining that someone had to write “code” to cause a button press on the screen to do something is a bit too abstract. A simpler example though worked wonders! I was working on a little HTML5, Canvas application for a Crisp seminar a couple of years ago called Ball Bounce (a simplified pong-like game), and the girls were mesmerized by how changing a few characters in the editor made huge visual changes in the web browser. Finally a break-through! But JavaScript is not really an entry level language, and teaching kids about events is probably not the best start. So, what is an easy, visual program with instant gratification? Well, why not Logo?
Continue reading

Continue reading: Programmerarna visar vägen

Programmerarna visar vägen

Lite i skymundan pågår något av en revolution inifrån i IT-branschen, och då särskilt i företag med många programmerare. På gräsrotskonferenser, i nätfora och i management-litteratur äger vår tids kanske mest avancerade och levande diskussion om hur man bäst organiserar arbete rum. Om det skriver jag i en längre essä om hur programmerarna visar vägen

Continue reading
Continue reading: Parprogrammering – är du tveksam?

Parprogrammering – är du tveksam?

Innan jag började med parprogrammering för några år sedan var jag en skeptiker. Numera vet jag att det fungerar och varför. Får jag välja själv, programmerar jag inte på något annat sätt.

När en kollega nyligen efterlyste argument för parprogrammering (då han mött en motsträvig organisation) fick jag konkretisera min tankar kring varför det fungerar och vilka vinster man når.

Continue reading