Posts

Showing posts from May, 2025

Reimagining Chain of Responsibility with Coroutines in C++20

Introduction Design patterns are essential tools in a developer’s toolkit. Among them, the Chain of Responsibility Design Pattern stands out as a clean way to decouple request senders from receivers. Traditionally, this pattern is implemented using class hierarchies where each handler either processes the request or passes it down the chain. While effective, the classical approach can be verbose and inflexible. With the advent of C++20 coroutines , we now have the power to rethink how we implement such patterns. Coroutines offer a lazy, resumable, and composable mechanism that naturally aligns with the idea of passing control across a chain. In this post, we’ll explore how to modernize the Chain of Responsibility pattern using coroutines, leading to more readable, testable, and flexible code. Whether you're an intermediate developer or a seasoned C++ programmer, this article will show you how modern C++ features can revitalize well-known design patterns. What is the Chain of...

Must Know : Basics Of Blockchain Made Easy

What Is a Blockchain? Shared Google Doc Analogy Just like you and your friends all see the same live document, every participant (node) in a blockchain network holds a full copy of the ledger. If Alice adds a sentence, Bob instantly sees it—on-chain, if one node confirms a transaction, all nodes update too. Decentralized Ledger Traditional ledgers live on one server (a bank, company, etc.). If it’s hacked or fails, you’re out of luck. Blockchain copies that ledger to hundreds or thousands of nodes around the world—no single point of failure. Immutable Records Each new entry becomes part of an immutable chain. To change it, you’d have to re-write every subsequent block on every node—practically impossible. How It Works in 3 Steps Gather Transactions → Make a Block Users broadcast transactions (“Alice pays Bob 2 BTC”). Nodes collect these into a candidate block—like packing letters into an envelope. Each block can hold thousands of transactio...