In C# 9, we got `record` (which was a reference type). In C# 10, we get `record struct`. Syntax Performance Characteristics Because it’s a struct, `Point` is allocated on the stack. No GC pressure! Because it’s a record, you get: Value-based equality (automatically implemented) Deconstruction `ToString()` formatting Be careful: structs are copied by value. If […]
Read more โMonth: August 2021
Docker Init Process: The Zombie Reaper
Have you ever seen zombie processes (marked <defunct>) in your container? Or tried to Ctrl+C a container and it didn’t stop? It’s because your entrypoint isn’t handling PID 1 responsibilities. The PID 1 Problem In Linux, PID 1 has special responsibilities: reaping adopted child processes and handling signals (SIGTERM, SIGINT). If your app (e.g., a […]
Read more โSvelte vs React: A 2021 Perspective
Svelte is gaining massive traction. Why? Because it moves the “framework” from the browser to the compiler. No Virtual DOM React diffs the Virtual DOM on every render. Svelte compiles your components into imperative vanilla JavaScript code that updates the DOM directly when state changes. Reactivity Syntax React uses hooks. Svelte uses… JavaScript. I find […]
Read more โAzure Service Bus: Messaging Patterns
Azure Service Bus is the enterprise messaging backbone. Beyond simple queues, it offers powerful patterns. Topic Filters (Pub/Sub) Instead of creating a queue for every variation, create one Topic. Subscribers can filter what they receive using SQL filters. Dead Letter Handling Always handle your Dead Letter Queue (DLQ). Messages go there after max delivery attempts. […]
Read more โManaging Terraform State in Azure
Terraform state is the “brain” of your infrastructure. If you lose it, you are in trouble. Storing it locally is a no-go for teams. Azure Storage Backend We use Azure Blob Storage to hold the state file. It supports state locking (via Leases) to prevent two developers from applying changes simultaneously. Bootstrap Script The chicken-and-egg […]
Read more โTesting .NET 6 Applications: Integration Testing with WebApplicationFactory
Integration testing is the highest value testing you can do. In .NET 6, `WebApplicationFactory` makes it incredibly easy to spin up an in-memory version of your API for testing. Exposing the Program Class With Top-level statements, `Program` is internal. To test it, you need to expose it in `Program.cs`: The Test Setup
Read more โ