Posts

Showing posts from June, 2025

Spring: How to deal with circular dependencies

Image
  🔄 Solving Circular Dependencies in Spring Boot: A Complete Guide When your Spring services get tangled up and can't start - here's how to fix it! 🤔 What is a Circular Dependency? A circular dependency happens when two or more Spring beans depend on each other, creating a loop. Spring can't figure out which bean to create first, so your application fails to start. Think of it like this: Service A needs Service B, but Service B also needs Service A - it's like two people waiting for each other to go first through a door! 🚪 💥 How Does It Happen? (Real Example) Let's say you're building an e-commerce app: @Service public class OrderService { @Autowired private PaymentService paymentService; public void createOrder(Order order) { // Process order paymentService.processPayment(order.getPaymentInfo()); } } @Service public class PaymentService { @Autowired private OrderService orderService; // ...

Kafka: How to handle duplicate messages

Image
Kafka is "at least once" by default. ???? What is "At Least Once" in Kafka? (Simple Explanation) "At least once" means: Kafka guarantees that every message will be delivered , But sometimes the same message might be delivered more than once (duplicate). 🔁 Why it happens: If a consumer crashes or times out, Kafka resends the message after retry.            (Here, what I meant by resend  that Kafka allows to pull the same message. If you know about Kafka Architecture it does not push/ send messages to consumer. Instead consumer is the one pulls the messages) If the system didn’t record that it already processed it, it may process it again . 🛠 Example: You (Consumer) receive a payment event. You process it and update the database. But before you commit (Telling Kafka "I have successfully processed this message" or in other words consumer failed to submit the offset to Kafka ), the consumer crashes. Kafka thinks it fa...

Software Architecture Fundamentals - 08

Image
🌐 Microservices, Miniservices & Reactive Systems A simple guide to modern software architecture Software systems today are getting bigger and more complex. To manage that complexity, developers use smart architectural patterns. Three of the most important ones are: Microservices Miniservices Reactive (Choreographed) Systems Let’s break them down. 👇 🧩 What Are Microservices? Microservices are small, independent programs that work together to build a larger application. 🚀 Imagine This: You run an online store. Instead of having one huge program to do everything, you split it up: A billing service 💳 A warehouse service 📦 An email service 📧 A shopping cart service 🛒 Each one runs on its own , and they all talk to each other through messages or API calls. ✅ Key Features of Microservices: Small & Focused : Each service handles one job. Independent : Can be built, deployed, and updated separately. Autonomous : Each service has i...

Software Architecture Fundamentals - 07

Image
  🏗️ Understanding Architectural Patterns: A Simple Guide In software development, the way we structure our systems matters—a lot. It affects how fast we can build features, fix bugs, and scale our apps. These structures are called architectural patterns . Think of them like blueprints for software. In this post, we’ll look at the two major patterns: Monolithic Architecture Microkernel (Plugin) Architecture Let’s break them down in simple terms. 👇 🧱 1. Monolithic Architecture: One Big Block of Code A monolith is one single, large program where all the features live together: UI (User Interface) Business logic Database access All tightly connected in a single codebase. ✅ Benefits: Fast execution – everything runs in one process Easier to start – one project, one deploy ❌ Drawbacks: Hard to maintain – huge and messy over time Slow deployment – updating takes hours or days Risky changes – one bug can break everything ☠️ The “...

Software Architecture Fundamentals - 06

Image
  🏗️ System Architecture vs. Enterprise Architecture. And Why Design Patterns Matter As developers or architects, we often get lost in the layers of structure we build. We use big words, system architecture, enterprise architecture, design patterns, but what do they really mean , and why should you care? Let’s break these ideas down. 🧱 1. System Architecture: Building a Specific Machine System Architecture is the blueprint for a single computer system . It’s the detailed plan for: How code is organized How data flows What subsystems exist How those parts communicate Think of it like designing a car: engine, wheels, sensors. all working together to move one vehicle forward. ✅ Goals: Solve a specific business problem Be lean, understandable, and maintainable Use tools and structures fit for purpose It’s focused, agile, and designed for one job,  like the comment approval workflow in a blog platform. 🏢 2. Enterprise Architecture (EA): Desig...

Software Architecture Fundamentals - 05

Image
🛠️ A Simple Design Process: From Problems to Architecture Designing great software starts by solving real user problems. Here’s a step-by-step guide to how that happens, from identifying the issue to defining the system's structure. This post uses plain language , is sectioned clearly , and includes a helpful diagram to guide your thinking. 🔍 1. Understand the Problem (Problem Statement) Before building anything, ask: "What real-world problem am I solving?" 🎯 Example: Blogging “I need to build influence in my field by publishing articles people read and trust.” The blog isn’t the problem. Becoming influential is. Writing a blog is just one possible solution. ✍️ 2. Tell the Story (User Stories) Write short stories about how users interact with your system. Don’t describe buttons or features — describe real human tasks and why they matter . ✏️ Example Stories "Readers need to submit comments so authors get feedback." "Editors need to approve comme...

Software Architecture Fundamentals - 04

Image
  🧠 Conway’s Law & Modern Software Architecture: A Simple Guide 👷 Who Was Mel Conway & What’s His Law? Back in the late 1960s, Mel Conway made a pretty big observation that no one really paid much attention to at the time. But today? His idea is a cornerstone of modern software architecture and agile thinking . 👉 Conway's Law says: “The structure of your software will reflect the communication structure of your organization.” In simple terms, how your teams talk to each other determines how your code ends up looking . 🏢 Siloed Teams = Siloed Systems Let’s say you’re at a traditional company: One team handles databases , Another builds the user interface (UI), A third team writes business logic . These groups often work in silos — each one doing their own thing with limited communication between them. What happens in code? You get an N-Tier system : 🧱 Database Layer ⚙️ Business Logic Layer 🖥️ UI Layer And just like the teams, the la...

Software Architecture Fundamentals - 03

Image
  👨‍💻 From Developer to Architect: Your Career Path Guide So you’re a developer and wondering what it takes to become a software architect ? Let’s break it down simply. Here’s how you grow from coding day-to-day to designing systems that power entire applications. 🧱 Step 1: Master Programming First ✅ All good architects are good developers first. Why? You can’t design great systems if you don’t understand how code works. Writing code teaches you about: 🔹 Simplicity 🔹 Maintainability 🔹 Testability Tip: Stay hands-on. 🧩 Step 2: Learn Design Patterns 📦 Patterns are the building blocks of architecture. What are they? Small, reusable solutions to common coding problems. Start with basic ones (like Singleton, Observer, Factory). Over time, you’ll learn how they interact,  that’s where architecture begins . 🧠 Step 3: Work on Many Different Systems 💡 Architecture is all about trade-offs. The more systems you build or ex...