Skip to main content

Programming

Dependency Hygiene for Organizations

The article discusses the importance of updating dependencies within software projects to maintain security, compatibility, and feature access, particularly in large organizations where outdated dependencies can lead to significant technical debt. It outlines strategies for dependency management to mitigate risks and enhance efficiency.

Spring Boot Starters

This post discusses Spring Boot Starters and their importance to developers, who want to make the setup and configuration of Spring Boot applications a whole lot easier. It keeps dependencies organized, increases development speed, and grants you numerous options for customization and extension. This basically makes them indispensable in building all manner of applications with Spring Boot - from simple web applications to data access and security services. I showcase, with a practical example, how to create a custom Spring Boot Starter that consolidates logging configurations and standard dependencies across microservices. This guide provides step-by-step instructions on how to create and use a custom starter.

Code-Review Best Practices

Code review is a crucial practice in software development. One can design and write great software, but we are humans after all. And all humans make mistakes, so another pair of eyes is always helpful.

The review process might seem straightforward, but there are useful tips to make it less painful is some cases.

Spring Boot Configuration Best Practices

Spring Boot comes with very neat configuration mechanism. Default application configuration is defined in one configuration file and environment specific setting in separate files. But still, this mechanism is often not used properly resulting in verbose and unmaintainable configurations.

Building Data Pipeline with Kotlin Coroutines Actors

In this post I will show how to build simple data-enriching pipeline using Kotlin coroutines. I will use Channels and Actors abstractions provided by kotlinx-coroutines.

In Actors model “actors” are the universal primitives of concurrent computation. In response to a message that it receives, an actor can: make local decisions, create more actors, send more messages, and determine how to respond to the next message received. Actors may modify their own private state, but can only affect each other through messages (avoiding the need for any locks).

Let’s start with high-level definition of the pipeline:

(👤Producer) -✉️→ 📬(👤Enricher) -✉️→ 📬(👤Updater)
           RawData            RichData
  • Pipeline will have Producer Actor, which will get some raw data from database or some mock data and will send it to pipeline for enrichment.
  • Then Enricher Actor will handle raw data object and add some attributes to it.
  • Finally, Updater Actor will store enriched data to the database.

For the sake of simplicity, let’s implement squaring function: we will take integers as raw data and will enrich them by squaring.

Let’s define our data model: data class RawData(val value: Int)

Enriched data will be represented by data class RichData:

data class RichData(val value: Int, val square: Int)

Following Actors model, we will use Kotlin Actors to represent processing units in a pipeline and Channels to communicate with Actors.

In Kotlin actors are implemented as part of kotlinx-coroutines library:

An actor is an entity made up of a combination of a coroutine, the state that is confined and encapsulated into this coroutine, and a channel to communicate with other coroutines. A simple actor can be written as a function, but an actor with a complex state is better suited for a class.

Customizing REST API Error Response in Spring Boot / Spring-Security-OAuth2

Defining error format is important part of REST API design.

Spring-Boot and Spring Security provide pretty nice error handling for RESTful APIs out of the box. Although it has to be documented, especially when contract-first approach to API design is used.

It is good idea to follow some common format for error responses. But OAuth2 specification and Spring Boot format may not satisfy those requirements.

Monitoring your application locally with NewReclic

The New Relic Digital Intelligence Platform provides actionable insights to drive digital business results. You can monitor your application and infrastructure performance so you can quickly resolve issues and improve digital customer experiences.

Following instruction should help you to connect your application to NewRelic platform and customize application events sent to the platform.