Archive: March 2024

GPU programming part 3: a partial real-world example

Posted on by  
Silvian Bensdorp

As promised last time, in the third and final installment we would look at some actual code. As it will turn out, our straightforward implementation will need a little rework in order to properly fire up the GPU.

Continue reading →

Mastering Mockito: Returning Fresh Stream For Multiple Calls To Mocked Method

Posted on by  
Hubert Klein Ikkink

When we mock a method that returns a Stream we need to make sure we return a fresh Stream on each invocation to support multiple calls to the mocked method. If we don’t do that, the stream will be closed after the first call and subsequent calls will throw exceptions. We can chain multiple thenReturn calls to return a fresh Stream each time the mocked method is invoked. Or we can use multiple arguments with the thenReturn method, where each argument is returned based on the number of times the mocked method is invoked. So on the first invocation the first argument is returned, on second invocation the second argument and so on. This works when we know the exact number of invocations in advance. But if we want to be more flexible and want to support any number of invocations, then we can use thenAnswer method. This method needs an Answer implementation that returns a value on each invocation. The Answer interface is a functional interface with only one method that needs to be implemented. We can rely on a function call to implement the Answer interface where the function gets a InvocationOnMock object as parameter and returns a value. As the function is called each time the mocked method is invoked, we can return a Stream that will be new each time.

Continue reading →

Consultant interview: Aino Andriessen

Posted on by  
Tjarda Peelen

This is our first blog in a series where we interview our consultants about their projects, current challenges, and how they approach these challenges. We build up the story in three parts: first, we sketch the context in which the project takes place; next, we look at the assignment and responsibilities. Finally, we dive into the approach taken and lessons learned by the consultant. In this first episode, we interview Aino Andriessen, IT-Architect.

Continue reading →

Gradle Goodness: Organizing Tasks Using The Task Container

Posted on by  
Hubert Klein Ikkink

A Gradle build file describes what is needed to build our Java project. We apply one or more plugins, configure the plugins, declare dependencies and create and configure tasks. We have a lot of freedom to organize the build file as Gradle doesn’t really care. So to create maintainable Gradle build files we need to organize our build files and follow some conventions. In this post we focus on organizing the tasks and see if we can find a good way to do this.

It is good to have a single place where all the tasks are created and configured, instead of having all the logic scattered all over the build file. The TaskContainer is a good place to put all the tasks. To access the TaskContainer we can use the tasks property on the Project object. Within the scope of the tasks block we can create and configure tasks. Now we have a single place where all the tasks are created and configured. This makes it easier to find the tasks in our project as we have a single place to look for the tasks.

Continue reading →

IntelliJ HTTP Client: Parsing JSON Web Tokens

Posted on by  
Hubert Klein Ikkink

The IntelliJ HTTP Client is very useful for testing APIs. We can use Javascript to look at the response and write tests with assertions about the response. If an API returns a JSON Web Token (JWT), we can use a Javascript function to decode the token and extract information from it. For example we can then assert that fields of the token have the correct value. There is no built-in support in IntelliJ HTTP Client to decode a JWT, but we can write our own Javascript function to do it. We then use the function in our Javascript response handler to decode the token.

Continue reading →

Sizing solutions around cognitive load and organizational constructs

Posted on by  
Martijn Ras
An image visualizing complex solutions

In today’s fast-paced digital world, complex solutions form an all-time high demand on the cognitive capacity of your team. That is why, in this article, we will introduce a rule of thumb for sizing solutions based on what your organization can handle. We will give a short introduction on cognitive load theory and organizational constructs. We believe that architects must consider these while decomposing their solutions into autonomous parts of a system that continuously and incrementally delivers value to the organization.

Continue reading →

shadow-left