Development

Matching strings in Scala

Arnout Engelen

Over December I had a lot of fun doing the Advent of Code coding challenges with some colleagues.

Many of those, such as day 21, require interpreting some kind of string input. While normally I'd probably marshall those strings into case classes before processing, in this case that seemed like overkill: a quick pattern-match should be sufficient.

It turns out there's a couple of ways to approach that, which is also a good excuse to look under the hood and see which Scala concepts they're built on.

 Read more

A Guide to Generating Boring Code with Node

wvenema@xebia.com

Writing boring code is not fun. Especially if that code is just a derivative of some data. You should generate it instead! A great example is to generate your HTTP client code from an API definition. This is actually very easy to do with a recent node version and requires almost no extra dependencies. In this post I will show you how to take a JSON schema definition and generate some validation logic from that.

Read more

An alternative AngularJS test runner

Freek Wielstra

When building an Angular application, we usually stick to the suggested or auto-generated solution of unit testing; the Karma test runner and server, the Jasmine testing framework, and PhantomJS as the environment to run it all in.

In this blog post I'll explain how this is rather silly, and will provide an alternative and lightweight approach to writing and running unit tests. It will depend on having a certain way of defining your Angular components, and may not be a full 1:1 drop-in replacement, but I can say with a certainty that it'll make your tests faster, the overhead of running them a lot smaller, and improve the quality of tests by having less to worry about.

 Read more

Linking Animations to Scroll Position in React Native

Albert Brand

When you want to link a custom animation to the scroll position in a ScrollView, like in the card example below, you are in for some bad performance on low end devices. Let’s figure out why and learn how to make it buttery smooth.

Read more

example animation

Cypress - Dealing with flaky tests

Test automation is all about feedback. Feedback that gives you quality updates about the features your team has built. A continuous green build is always the goal because this should give you the confidence you need to go to production. Unfortunately, I’m more used to a “traffic light build”, a build which passes and fails intermittently, mainly because of flaky tests. That is one of the worst things about end to end testing in my opinion.

Why on earth do we still put software into production when we can’t trust our test automation?! Well, that's because we retry the build a couple of times until we have a lucky hit: the build is green and we’re ready to go to production. Although this is a solution, it still feels like a pretty silly thing to do.

Another option, which has my preference, is refactoring those tests until they actually work. The annoying part about this is that you don’t know what’s going on, and most of the time it is impossible to reproduce the failures. Reproducing them takes a lot of time debugging, analysing and mostly guessing where the problem is.

What if we could actually see what’s going on?

 Read more

Robots bring business and IT together

Erik Zeedijk

Maybe you’ve already read the diary of one of our mBots, if not I encourage you to do so first! So, what was this day all about? How did we come to organise this and what did the participants learn?

Changing teams

As companies decide to adopt a more agile way of working, they also start to form multidisciplinary scrum teams. However, there still is a big challenge. When you work with several disciplines in your scrum team, you are exposed to the risk that you still create mini-handovers. First the business analyst will make the design, the developer(s) will build it, the testers will test it and if you’re lucky the business is happy in the end. Team members tend to keep doing what they’ve always been doing. Nothing really changed! Of course, we cannot realistically expect that the business suddenly starts programming, but it would be great if they know the difficulties that developers cope with. It works the same the other way around. We need to learn from each other and bring our work closer together. Read more

The Purpose Alignment Model

Chris Lukassen

When scaling Agile/Scrum, we invariably run into the alignment vs. autonomy problem. In short, you cannot have autonomous, self-directing teams if they have no clue what direction they should go. Or, even shorter, alignment breeds autonomy.

But how do we create alignment? And what tools can we use to quickly evaluate whether or not what we want to do is part of the mission? Niel Nickolaisen, chief technology officer at OC Tanner, created the purpose alignment model. I use it with innovation labs in large enterprises to determine what aspects of innovation to keep, and what to leave to others.

 Read more

Filtering objects to Optionals

Lammert Westerhoff

A while ago I stumbled upon a Blog post by Natascha the Robot about Configuring a Constant Using Shorthand Argument Names in Swift. Which by itself is a great post, but I was most inspired by the Then library mentioned at the end of her post. Seeing how such a small amount of code could change the way we configure constants everywhere gave me the idea to create something in a very similar fashion. But instead of configuring a variable it’s used to filter one based on a condition. Because why should filter only be applicable to collection types?

The usage of it is extremely simple and very useful:

extension String: Filter {}

"12345".filter { $0.characters.count > 4 } // Optional("12345")
"12".filter { $0.characters.count > 4 } // Optional(nil)

Only very little code is required to make this work:

extension Filter {

    /// Allows filtering of non sequence types.
    ///
    ///     let label = UILabel().then {
    ///         $0.textAlignment = .Center
    ///         $0.textColor = UIColor.blackColor()
    ///         $0.text = "Hello, World!"
    ///     }
    public func filter(@noescape condition: Self -> Bool) -> Self? {
        return condition(self) ? self : nil
    }

}

extension NSObject: Filter {}

Not enough code to make a library out of it in my opinion. Just copy this code into your project. I did create a GitHub Gist which I will update if needed.

With this code, any object that inherits from NSObject will work by default. For pure Swift objects, just add the one liner to let the object adhere to the Filter protocol.

I’d love to hear your comments and hear about alternatives to this.

Keeping dependencies up-to-date in Maven

Jesse van Bekkum

Keeping your dependencies up-to-date is more important than ever in modern projects. Everything is connected to the internet and needs to be secure. New vulnerabilities in libraries are found, exploited and patched within days. We use a lot of dependencies, and due to continuous delivery some of your dependencies will need updating every day. Solid dependency management is a primary requirement for good software.

In this blog post I will describe how to keep a Maven project up-to-date with the versions plugin. Using the versions plugin has a lot of benefits and configuring it takes less than an hour. So I suggest using it for all maven projects.

 Read more

Generic JS Android API wrapper for React Native

Albert Brand

During a React Native project for one of our clients we added some custom Android and iOS libraries to our code and wanted to call a few exposed methods. In such a case, React Native requires you to write a wrapper class to call those public APIs. It was a small boilerplate nuisance and these wrappers would be unnecessary if we made a generic method call bridging API. Also, using such an API wrapper you can call any (obscure) available Android API that is not wrapped yet. Let's see how far we can get!

 Read more