Category algorithms

Items in Containers: Count Items in Closed Compartments (Code Interview Problem)

This one shows up in online coding assessments under the name Items in Containers, and it’s a trap: the obvious solution passes the examples and then times out on the...

Shopping Options: Count the Ways to Buy Within a Budget (Code Interview Problem)

Four nested loops solve this problem in five minutes, and that’s exactly the trap. With up to 1,000 prices per category, brute force has to check 10¹² combinations. Here’s how...

Random Without Repeats in Java: Schedule Posts to X with Spring Boot and a Shuffle Bag

You’ve written a hundred articles, and you want a bot to share one of them every three hours, even while you sleep. “Pick a random article” sounds like one line...

Assemble Parts in Minimum Time: Greedy Min-Heap Solution in Java (Code Interview Problem)

This problem looks easy, and most candidates find the right idea within minutes. Then many of them implement it in a way that passes the examples and fails on half...

Merge Two Sorted Lists in Java: Array List and Linked List Solutions

Merging two sorted lists is one of the classic coding interview problems, and one of the most useful: it is the heart of merge sort, of merging k sorted lists,...

Big O Notation and Analysis of Algorithms - coding interview

Big O Notation is a mathematical notation that helps us analyze how complex an algorithm is in terms of time and space. When we build an application for one user...

Graphs: Depth-First Search

Depth-First Search (DFS), is an algorithm to search for information in Graphs.

Tree data structure: Binary Search Tree

Tree data structures are non-linear data structures, and they allow us to implement algorithms much faster than when using linear data structures.

Given N, find the smallest number with the same digits

Write a method that, given an original number N, returns the smallest number with the same number of digits.

Category test-driven development

Combinational Optimization Problem

The Knapsack problem is a classic optimization problem in computer science and mathematics. It belongs to a class of problems known as combinatorial optimization problems. The basic idea of the...

Category design

Java App Slow Under Load? A Step-by-Step Performance Playbook

Your Java application works fine in testing, then falls over in production: requests pile up, the database runs out of connections, the server stops responding. The fix is rarely “add...

Software Design Principles Explained with Java Examples: SOLID, DRY, KISS, YAGNI and More

Why are some codebases still easy to change after five years, while others need a rewrite after one? It’s rarely the framework or the language. It’s whether the people who...

UML Diagrams for Java Developers: From Requirements to Code

The Unified Modeling Language (UML) is a graphical notation for modeling software systems. UML diagrams are not just pretty pictures: they communicate design decisions to the developers who build the...

Open-Closed Principle in Java with a Spring Boot Example (SOLID Part II)

SOLID principles tell you how to arrange your functions into classes and how those classes should depend on each other. Applied well, they make your software easier to change, easier...

SOLID principles: The Definitive Guide (Part I)

SOLID principles tell you how to arrange your functions into classes and how those classes should be interrelated.

Category Web APIs

Build a RESTful Web Service with Spring Boot, Gradle, and OpenAPI

By the end of this guide you’ll have a working Spring Boot RESTful API, built with Gradle and documented with OpenAPI, and a live Swagger UI page you can show...

Generate a Spring Boot Server from an OpenAPI Spec with Swagger Codegen

You’ve designed your API. Now comes the boring part: writing controllers, models and request mappings that only repeat what the spec already says. Swagger Codegen writes that code for you....

Design-First APIs with OpenAPI 3: A Step-by-Step Tutorial

Most API problems aren’t coding problems. They’re design problems found too late: a missing field, an inconsistent name, an error nobody documented. Design-first fixes that by agreeing on the contract...

Load-Test Your API's Rate Limiting with Concurrent Java Clients

Your API has rate limiting. But does it actually work when several clients hammer different endpoints at the same time, on Black Friday? You don’t want to find out in...

REST API Tutorial: Resources, HTTP Methods, Status Codes and a Spring Boot Example

A restaurant app needs a supplier’s food prices; the supplier’s system needs the restaurant’s orders. Two companies, two technologies, no shared code, and REST is how they talk. This tutorial...

Rate Limiting in Spring Boot with Bucket4j: Token Bucket Algorithm per Client

A partner company starts integrating with your API. On day one, their developer writes a loop to load test data, and suddenly your API answers slowly for every other client....

How a REST Client Should Handle 503 Service Unavailable: Retries with Backoff in Spring

Your nightly job sends 50,000 articles to a partner’s API, in batches of 1,000. At batch 23, the API answers 503 Service Unavailable. What should your client do? Give up,...

Fix 'Received fatal alert: handshake_failure' in Java: SSL/TLS Troubleshooting

Your Java client calls an HTTPS API and fails before sending a single request:

Secure a Spring Boot REST API with OAuth2 and OpenAPI (Swagger UI)

Your REST API is documented with OpenAPI, and anyone who finds the URL can call it. This tutorial secures it with OAuth2: clients get a short-lived access token and send...

Documenting a SpringBoot REST API with OpenAPI 3

The main idea for documenting our back-end RESTful APIs is to communicate to third-party developers what our endpoints are doing.

Category Coding Practices

Clean Code Best Practices: 10 Rules with Java Examples

Clean code is code that a developer other than its author can read, change and extend without fear. The idea was made popular by Robert C. Martin in his book...

Category distributed-systems

The Trade-offs Every Engineer Should Know Before Their Next Whiteboard Interview

System Design on AWS: The Trade-offs Every Engineer Should Know Before Their Next Whiteboard Interview

Hot-Warm-Cold Architecture in Elasticsearch: Data Tiers, ILM and Centralized Logs

Recent logs are written and searched all the time. Logs from last month are searched now and then, and logs from three months ago almost never. Keeping all of them...

Category Object-Oriented

OOP Concepts in Java: The 4 Pillars and Composition, with Examples

Get object-oriented programming (OOP) wrong and you’ll pay for it for years: tangled classes, features that break other features, a codebase nobody wants to touch. Get it right, and new...

Category Domain-Driven Design

Ubiquitous Language in Domain-Driven Design: How to Build One, with Java Examples

The business people say delivery note, the ticket says shipping document, and the code says DocService.getDoc(). Every conversation needs a translation, and every translation is a chance for a bug....

Category Language

German IT Vocabulary for Software Developers Working in Germany

I have worked as a software developer in Berlin for more than ten years. This list contains the German words I hear and use most often in meetings, documents, emails,...

Category Web Performance

Access Denied When Deleting Files in a Load-Balanced Java Cluster

Your Java application runs on two servers behind a load balancer. Both write images to the same file server. Everything works, until one day old images stop being deleted, and...

Category career

The Trade-offs Every Engineer Should Know Before Their Next Whiteboard Interview

System Design on AWS: The Trade-offs Every Engineer Should Know Before Their Next Whiteboard Interview

Soft Skills for Software Developers: 10 Skills with Real Workplace Examples

Two developers on the same team write equally good code. One of them leads the next project; the other is still waiting. The difference is almost never technical. It’s how...

Category startup

Startup Ideas for Software Developers: How to Find, Validate and Build One

Most side projects built by developers don’t fail because of the code. They fail because nobody wanted to pay for them. The code was clean, the tests were green, and...

Category Project

How to Break Down a Software Project into Tasks: From Epics to User Stories, with a Real Example

“Build the new customer portal” is not a task. Nobody can estimate it, start it, or tell when it’s done. Projects fail less from bad code than from work nobody...

Category data structures

From O(n²) to O(n): Replace Nested Loops with a HashMap in Java

One endpoint in a B2B order system I worked on returned 1,000 orders, and it was slow. The database wasn’t the problem. Two innocent-looking nested loops were. Here’s how one...

Java Data Structures: Which One to Use and Why (with a Big-O Cheat Sheet)

Choosing the wrong data structure is one of the most common reasons code is slow, and one of the most common interview questions. A list where you needed a map...

Category programming

Replace OAuth2RestTemplate with RestClient: A Modern Spring Boot API Client

In the previous post, we built a program that walks an Order API (buyers, suppliers, customer numbers, articles) and places a test order. It works, but it’s built on OAuth2RestTemplate,...

Break Out of Nested Loops in Java: Automating a Real REST API Client

Testing an order API by hand means clicking through buyers, suppliers, customer numbers and articles until you find a combination that works. This program does it in seconds: it walks...

Log Every Login Attempt with Spring Boot Actuator Auditing

When a login fails at 3 a.m., you want to know who tried, how often, and whether it worked. Spring Boot Actuator already publishes these security events; you only have...

Java OCP Practice Questions: Building Blocks, with Answers Explained

The OCP Java exam doesn’t test whether you can write code. It tests whether you can read code like a compiler: which line fails, what exactly gets printed, which object...

Java Bit Flags with Enums: Combine, Check and Decode Errors with Bitwise Operators and EnumSet

An order API has to report several problems at once: a wrong quantity, a price difference and an article that no longer exists. Sending a list of strings works, but...

Java Generics Explained: Wildcards, PECS and Type Erasure with Examples

Before Java 5, every collection held Object, and every value you took out needed a cast, which could fail at runtime. Generics moved that check to the compiler. Here’s how...

Functional Programming in Java: Lambdas, Streams, Records and Immutability

You already use functional programming in Java every time you write a lambda or a stream. Used well, it turns a 20-line loop over orders into five readable lines. Used...

Category system-design

The Trade-offs Every Engineer Should Know Before Their Next Whiteboard Interview

System Design on AWS: The Trade-offs Every Engineer Should Know Before Their Next Whiteboard Interview

Category aws

The Trade-offs Every Engineer Should Know Before Their Next Whiteboard Interview

System Design on AWS: The Trade-offs Every Engineer Should Know Before Their Next Whiteboard Interview

Category book-review

The Trade-offs Every Engineer Should Know Before Their Next Whiteboard Interview

System Design on AWS: The Trade-offs Every Engineer Should Know Before Their Next Whiteboard Interview