<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Riskiana on Medium]]></title>
        <description><![CDATA[Stories by Riskiana on Medium]]></description>
        <link>https://medium.com/@kiana.proudmoore?source=rss-fb4ae54f9db4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*W3UlrBLskCzNynUkbVRwSA.jpeg</url>
            <title>Stories by Riskiana on Medium</title>
            <link>https://medium.com/@kiana.proudmoore?source=rss-fb4ae54f9db4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 04:14:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kiana.proudmoore/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Engineering the AI Stack: How Model Context Protocols and Agentic Loops Are Redefining Software…]]></title>
            <link>https://medium.com/@kiana.proudmoore/engineering-the-ai-stack-how-model-context-protocols-and-agentic-loops-are-redefining-software-fbb8d506649c?source=rss-fb4ae54f9db4------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbb8d506649c</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[ai-harness]]></category>
            <dc:creator><![CDATA[Riskiana]]></dc:creator>
            <pubDate>Sun, 20 Sep 2026 10:57:57 GMT</pubDate>
            <atom:updated>2026-09-20T10:57:57.300Z</atom:updated>
            <content:encoded><![CDATA[<h3>Engineering the AI Stack: How Model Context Protocols and Agentic Loops Are Redefining Software Architecture</h3><h3>Moving beyond simple prompt engineering to build secure, autonomous, and deterministic software systems on top of non-deterministic models.</h3><p>Writing code faster was once primarily a matter of developer velocity, boilerplate reduction, and IDE tooling. Today, Artificial Intelligence (AI) models can generate substantial portions of application code in seconds.</p><p>The interesting question is no longer how quickly text or code can be generated, but <strong>how effectively we can wrap, orchestrate, and validate what these models produce within enterprise production environments.</strong></p><p>The industry is undergoing a fundamental structural transition. We are moving away from treating Large Language Models as isolated text-in, text-out chatbots and toward designing system-level execution frameworks. Building production-grade AI today is less about writing clever prompts and more about <strong>context management</strong>, <strong>protocol standardization</strong>, and <strong>runtime harness engineering</strong>.</p><h3>1. From Deterministic Rules to Statistical Models</h3><p>To build resilient architectures, software engineers must first recognize how AI fundamentally alters the software execution model. In traditional software engineering, developers write explicit, deterministic rules that process input data to produce a known output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yz1fOelKFUoVM6q-gL77dg.png" /></figure><p>Machine Learning (ML) flips this equation by ingesting input data alongside target outputs to mathematically learn the underlying rules. Consider a standard calculator versus a predictive statistical model:</p><ul><li><strong>A calculator</strong> executes rigid arithmetic instructions where $2 + 2$ strictly evaluates to $4$ without any learning loop.</li><li><strong>A predictive model</strong> analyzes thousands of numerical examples to model relationships, allowing it to predict outcomes for unseen inputs.</li></ul><p>A real-world example is <strong>Automated License Plate Recognition (ALPR)</strong>. Traditional image processing relied on rigid heuristics — such as scanning pixels for high-contrast rectangular borders — and failed when images were dirty, tilted, or dimly lit. Deep Learning models, trained on hundreds of thousands of license plate photos across diverse environmental conditions, learn essential visual patterns, enabling them to read obscured plates reliably.</p><p><strong>The AI Taxonomy</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*86fMO4OFoYX3vOZ3AOz6fA.png" /></figure><p>Within this taxonomy, AI acts as the broad umbrella. <strong>Machine Learning</strong> focuses on algorithms that learn from data, categorized primarily into <em>Supervised Learning</em> (training on labeled datasets for classification and regression) and <em>Unsupervised Learning</em> (discovering hidden patterns in unlabeled data via clustering and association). <strong>Deep Learning</strong> automates feature extraction using multi-layer neural networks, and <strong>Generative AI</strong> sits as a specialized subfield focused on generating new text, images, or audio.</p><p>At the center of this ecosystem is the <strong>Model</strong>. A model is a mathematical representation of patterns learned from a training dataset. Architecturally, a dataset acts like a textbook, the training process represents studying, and the resulting model serves as structured knowledge composed of billions of parameters — weights and biases — ready for inference.</p><h3>2. The Mechanical Evolution of Language Models</h3><p>Large Language Models (LLMs) do not process raw human text directly; they process numerical representations. Understanding this mechanical boundary is vital for managing context limits and latency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gNABE0dDrdMRO2pjMb-DKg.png" /></figure><h3>Tokenization and Embeddings</h3><p>Text enters a tokenizer that breaks strings into sub-words, words, or individual characters called <strong>tokens</strong>. On average, 1 token corresponds to roughly 0.75 English words. These tokens are mapped to discrete numerical IDs in the model’s vocabulary dictionary and converted into high-dimensional <strong>vector embeddings</strong> that capture semantic relationships.</p><h3>Architectural Lineage: From LSTMs to Transformers</h3><p>Processing sequential data like text has evolved through major architectural shifts:</p><ol><li><strong>Long Short-Term Memory (LSTM):</strong> A Recurrent Neural Network (RNN) variant designed with Forget, Input, and Output gates to manage state persistence across sequence steps. However, LSTMs processed text strictly word-by-word, creating severe training bottlenecks and struggling to maintain context across long documents.</li><li><strong>The Transformer Architecture (2017):</strong> Introduced the <strong>Self-Attention Mechanism</strong>, eliminating recurrent loops and allowing models to process entire text sequences in parallel.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pmPrb0UqoJ14XUhmYjxiqw.png" /></figure><p>This architectural leap enabled massive expansion in <strong>Context Windows</strong>. Early models were constrained to 2,000–4,000 tokens (~3 pages). Modern architectures routinely handle 1,000,000 to over 2,000,000 tokens, enabling systems to ingest entire codebases or lengthy technical specifications in a single prompt. Furthermore, models have transitioned from pure LLMs (text-only next-token predictors) to <strong>Large Multimodal Models (LMMs)</strong>, which natively process text, images, audio, and video within a unified architecture.</p><h3>3. System 2 Thinking: The Emergence of Reasoning Models</h3><p>Standard LLMs operate primarily on <strong>System 1 Thinking</strong> — generating response tokens reflexively based on statistical probability. When confronted with multi-step logic or complex refactoring, System 1 models often hallucinate plausible-sounding but factually incorrect code because they are trained to predict word probability rather than verify logical truth.</p><p>To solve this, modern AI development has introduced <strong>Reasoning Models</strong> powered by <strong>System 2 Thinking</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ztIE6GLDkGgNY1F2PJ3EKQ.png" /></figure><p>Reasoning models utilize several key mechanisms:</p><ul><li><strong>Chain-of-Thought (CoT):</strong> The model explicitly generates hidden intermediate reasoning steps before emitting its final answer.</li><li><strong>Tree of Thoughts (ToT) &amp; Search:</strong> The model branches out multiple logical paths, evaluates their viability, and backtracks if it hits a logical dead end.</li><li><strong>Test-Time Compute Scaling Law:</strong> Instead of relying solely on scaling pre-training compute, performance on complex problems is scaled by granting the model additional compute time during inference — allowing it to <em>“think longer”</em> before answering.</li></ul><h3>4. The 3 Generations of Developer Tooling and Agentic AI</h3><p>The integration of AI into software development has progressed across three distinct generations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WiTQJchn9QZkaOY7o2ZYxQ.png" /></figure><ul><li><strong>Generation 1 (Chatbots):</strong> Passive assistants where engineers manually copy-pasted prompts and responses back and forth.</li><li><strong>Generation 2 (IDE Integrations):</strong> In-editor extensions (such as Cursor, Windsurf, or GitHub Copilot) offering real-time inline code completion.</li><li><strong>Generation 3 (Agentic AI):</strong> Autonomous systems assigned high-level goals, roles, and tool access, capable of planning and executing complex tasks with minimal human intervention.</li></ul><h3>What Defines Agentic AI?</h3><p>Unlike passive predictors, Agentic AI relies on four core operational pillars:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IjhdhQlAaiTqh7mHjK-kFg.png" /></figure><ol><li><strong>Autonomy &amp; Planning:</strong> Decomposing complex software requests into structured sub-tasks using computational thinking principles (Decomposition, Pattern Recognition, Abstraction, and Algorithm Design).</li><li><strong>Tool Utilization:</strong> Interfacing with external systems via command-line interfaces (CLI), database drivers, and standardized protocols.</li><li><strong>Reflection &amp; Loop:</strong> Executing code, intercepting terminal errors, self-correcting buggy logic, and re-running tests iteratively until the objective passes.</li><li><strong>Multi-Agent Collaboration:</strong> Distributing work across specialized agent roles (e.g., a Researcher Agent, a Coder Agent, and a Test Runner Agent working in tandem).</li></ol><h3>5. System Integration: Model Context Protocol (MCP) and the AI Harness</h3><p>Connecting models to enterprise databases and internal toolsets historically required fragile, custom-built API integrations for every application. Standardizing this connectivity layer is critical for enterprise adoption.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*slEto96WcWjbMTIujlBqFg.png" /></figure><ul><li><strong>MCP Client:</strong> The application initiating the interaction (e.g., an IDE, Cursor, or Claude Desktop).</li><li><strong>MCP Server:</strong> Lightweight intermediate adapters that expose specific endpoints, tools, or data stores (e.g., a PostgreSQL MCP Server or GitHub MCP Server).</li></ul><p>Via MCP, an AI model can securely read local repositories, run database queries, or execute API calls using a unified specification.</p><h3>The AI Harness: Production Infrastructure</h3><p>An AI model in isolation is merely a word predictor. To turn a model into a resilient enterprise application, software engineers build an <strong>AI Harness</strong> — the wrapping infrastructure that controls execution, state, and reliability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*81vsmLodMy0mWYwodijhRQ.png" /></figure><blockquote><strong><em>Analogy:</em></strong><em> If the AI Model is the engine, the </em><strong><em>Agent Harness</em></strong><em> represents the chassis, brakes, steering, and electrical control system that make the vehicle drivable. Meanwhile, the </em><strong><em>Eval Harness</em></strong><em> acts as the automated testing track, continuously running benchmark datasets to evaluate reliability and performance.</em></blockquote><h3>End-to-End Enterprise AI Runtime Flow</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VmvTbil3PKDEIuAr8Y9fOw.png" /></figure><p>Within this flow, domain knowledge is typically provided through two primary strategies:</p><ul><li><strong>Fine-Tuning:</strong> Retraining internal model parameters to adopt specific formatting or stylistic rules.</li><li><strong>Retrieval-Augmented Generation (RAG):</strong> Dynamically fetching relevant document context from external vector databases during runtime.</li></ul><p>Behind the scenes, this entire software stack depends heavily on parallel computing hardware. Deep Learning training and inference require massive matrix multiplication operations. Nvidia maintains market dominance in this space not only due to GPU hardware parallelization, but largely because of its <strong>CUDA software ecosystem</strong>, which has provided developers direct low-level GPU compute control since 2006. Open-source hubs like <strong>Hugging Face</strong> tie the ecosystem together, hosting model repositories (Model Hub), structured datasets, execution libraries (transformers), and web demonstration environments (Spaces).</p><h3>6. Engineering Trade-offs &amp; Production Realities</h3><p>Deploying AI systems requires rigorous engineering evaluation rather than uncritical adoption.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RU1pap2uzChFj--LUiPcuA.png" /></figure><h3>7. Practical Takeaways for Tech Leads and Architects</h3><ol><li><strong>Treat AI Outputs as Unvalidated Artifacts:</strong> Never trust generated code or data blindly in production; enforce strict runtime validation, automated unit testing, and continuous integration checks within the Agent Harness.</li><li><strong>Standardize Integrations with MCP:</strong> Avoid writing proprietary, ad-hoc API wrappers for every internal tool; adopt open standards like Model Context Protocol to maintain decoupled, modular infrastructure.</li><li><strong>Establish Eval Harnesses Early:</strong> Deploy automated evaluation pipelines (using frameworks like DeepEval or benchmark datasets) before pushing AI features to production to measure regression and accuracy objectively.</li><li><strong>Match Architecture to Operational Intent:</strong> Utilize lightweight System 1 models for fast text transformation, and reserve System 2 Reasoning Models for multi-step algorithmic problem solving.</li><li><strong>Enforce Security Boundaries around Agents:</strong> Restrict autonomous agents using explicit execution guardrails — such as database read-only permissions and mandatory human approval for high-risk system mutations.</li></ol><p>The organizations that gain the greatest long-term advantage from AI will not be those that generate the largest volume of unverified code. They will be the engineering teams that understand how to build resilient runtime harnesses, enforce standardized protocols, and seamlessly integrate non-deterministic reasoning cores into deterministic enterprise architectures.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbb8d506649c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From “What is a SIP Trunk?” to Banking- Grade WebRTC: My Journey]]></title>
            <link>https://medium.com/@kiana.proudmoore/from-what-is-a-sip-trunk-to-banking-grade-webrtc-my-journey-e95eb77a3fa8?source=rss-fb4ae54f9db4------2</link>
            <guid isPermaLink="false">https://medium.com/p/e95eb77a3fa8</guid>
            <category><![CDATA[voip-telephone-system]]></category>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[voip]]></category>
            <category><![CDATA[avaya]]></category>
            <dc:creator><![CDATA[Riskiana]]></dc:creator>
            <pubDate>Sat, 11 Jul 2026 10:56:01 GMT</pubDate>
            <atom:updated>2026-07-11T11:12:23.128Z</atom:updated>
            <content:encoded><![CDATA[<h3>From “What is a SIP Trunk?” to Banking- Grade WebRTC: My Engineering Journey</h3><p>When I first joined my current company-an Avaya partner- I felt like I had stepped into a different dimension. My background was in standard software development experience, but suddenly, I was drowning in a sea of three-letter accronyms. People were talking about SIP, Trunks, SDP, RTP, and “Avaya thingies” that sounded like they belonged in a sci-fi movie.</p><p>If you’ve ever felt overwhelmed by the jump from standard web dev to enterprise telephony, this story is for you.</p><p><strong>Learning The “Telecom” Dictionary</strong></p><p>in my first weeks, I had to learn the language of voice:</p><ul><li>SIP (Session Initiation Protocol): Think of this as the “handshake”. It’s the language phones use to invite each other to a call.</li><li>SIP Trunk : the virtual version of those old physical phone lines. It’s how your PABX(the “office phone brain”) talks to outside world.</li><li>SDP (Session Description Protocol) : If SIP is the invitation, SDP is the details. it tells the other side: “I want to talk, here are my audio/video formats (codecs) and port where you should send the data.”</li><li>RTP (Real-time Transport Protocol): Once the handshake is done, this is the “truck” that actually carries your voice and video packets accross the internet.</li></ul><p><strong>Stepping into WebRTC</strong></p><p>I eventually realized that WebRTC was the missing link between our Avaya infrastructure and the modern mobile apps our customers were building.</p><p>Unlike traditional VoIP, which often relies on a central server to mediate every single conversation, WebRTC allows browsers and apps to talk directly each other (Peer-to-Peer). However, in an enterprise bank setting, we can’t just have random browsers talking to each other. We need control, security, and integration with our existing Avaya PABX.</p><p><strong>Our Architecture for the Bank</strong></p><p>Our challenge was to enable VoIP calling directly inside a secure mobile application for a major banking client. We weren’t building a consumer app; we were extending the bank’s exterprise Avaya infrastructure.</p><p>We designed a robutst pipeline where WebRTC was the secure entry point.</p><p>To make a mobile app “talk” to an Avaya system, we built a robust pipeline:</p><ol><li>Mobile App: Users tap “Call” in their banking app</li><li>Token Auth Service : Before the call starts, the app requests a temporary, time-bound token from our service. This ensures only authorized users can initiate a connection. So the Mobile apps do not talk directly to the Avaya Aura Web Gateway (AAWG). Instead, we built a custom Token Auth Service. The mobile app sends a request to this service with a secret key. Only then does our service authenticate the request and call the AAWG to generate an encrypted token.</li><li>AAWG (Avaya Aura Web Gateway): This is the magic component. The mobile app passes this token to the Avaya Aura Gateway to initiate the call. AAWG takes the WebRTC signal from the mobile app and translates it into a language the PABX understands. In the Avaya ecosystem, this is a purpose-built component that handles the complexity of signaling and media so your application doesn’t have to.</li><li>SBC (Session Border Controller: The “Bouncer”. It sits at the edge of the network, hiding our internal IP address (topology hiding), scrubbing bad traffic, and acting as the gateway for media. In a WebRTC deployment, the SBC performs transcoding and provides the essential security layer, terminating TLS/DTLS handshake before traffic hits your internal networks</li><li>CRM Pop-Up Integration: When a VoIP call hits the banking internal CRM, the Avaya system identifies the caller and triggers a browser/app event. This automatically launches a CRM pop-up for the agent, pre-loading the customer’s data based on the caller ID. It transforms a standard phone call into a context-aware service interaction.</li></ol><p>Engineering Challenges :</p><ul><li>The Android 16 Supported</li></ul><p>We were blocked for a long time trying to certify the app for Android 16. The official Avaya documentation only listed support up to Android 15, and when we tested our React Native (v0.77) build on the emulator, it crashed consistently. We were stuck in a loop of troubleshooting , trying to upgrade react version, testing it, until our client tested it on a real Android 16 device. It worked perfectly. sometimes the environment is the problem, not your code.</p><ul><li>The Bluetooth-to-Speaker Audio Bug</li></ul><p>We also faced a nasty bug where switching audio output from the Bluetooth to the phone’s speaker caused the voice to dissapear entirely. We had to dig deep into the audio session management and how the WebRTC SDK handles device switching. After some insense debugging of our audio manage layer, we were able to force the session to reinitialize correctly during the output transition, restoring seamless audio.</p><p>There are still several challenges occured that finally we managed to solve them.</p><p><strong>Addressing the Pentest</strong></p><p>The pentesters found links from certain endpoint payload and flagged them as a “sensitive data exposure” and initially requested that we remove or update this vendor-supplied link. Our first instinct was to clarify that those links structure is an immutable part of the underlying Avaya Aura Web Gateway (AAWG) framework — it is not a custom endpoint we built or control. However, simply saying “it’s a vendor issue” rarely enough for a thorough security audit. Instead, I shifted the conversation to risk validation and architectural behaviour. I explained that while the URL structure exists within the payload, it does not represent an exposed vulnerability because of how we manage the session:</p><ul><li>Separation of Concerns: the mobile app does not interact with that specific resource link to manage the call. The link is part of the standard AAWG discovery process, which the Avaya WebRTC SDK handles internally as part of its initialization logic.</li><li>Tightened Security Perimater: We mitigate the risk by strictly controlling the Token Auth Service that wraps these interations. Because the token is valid for only 20 seconds (This is very tight “validity window”) even If a third party intercepts an encrypted token and tries to use it to call an API (like terminateCall) on the 21st second, the Avaya server will immediately reject the request with a 401 Unauthorized error</li><li>Stateful Security (WebSocket vs REST API)</li></ul><p>this was the most important distintion to make:</p><ul><li>The SDK is Stateful: the mobile app doesn’t manually “call” those REST API links after the initial handshake.</li><li>The Handshake: the token is used exactly one at the beginning to establish a secure, persistent WebSocket connection via the Avaya WebRTC SDK.</li><li>Internal Signaling: Once the call is live, operations like terminateCall are handled internally by the SDK. the command is sent as an encrypted signal inside the existing, authenticated WebSocket pipe.</li></ul><p>Because the API endpoints are never exposed to manual HTTP calls after that 20-second window the “links” in the payload are essentially useless to an attacker. We weren’t just providing a service; we were building a secure, stateful communication tunnel.</p><p><strong>Closing Thoughts</strong></p><p>Whether you are working with an Avaya Aura Environment, a Cisco Unified Communication setup, or an Asterisk-based PBX, the fundamental challenge remains the same: Translating modern, web-native signals into the reliability of enterprise-grade telephony.</p><p>We aren’t just “providing VoIP”. We are building bridges between a bank’s digital mobile experience and the highly secure, proven infrastructure of the corporate telephony world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e95eb77a3fa8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Before You Draw the Architecture Diagram: A Thinking Guide for Solution Architects]]></title>
            <link>https://medium.com/@kiana.proudmoore/before-you-draw-the-architecture-diagram-2518bfd713c4?source=rss-fb4ae54f9db4------2</link>
            <guid isPermaLink="false">https://medium.com/p/2518bfd713c4</guid>
            <category><![CDATA[application-architecture]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[solution-architect]]></category>
            <dc:creator><![CDATA[Riskiana]]></dc:creator>
            <pubDate>Thu, 25 Dec 2025 13:02:14 GMT</pubDate>
            <atom:updated>2025-12-26T06:52:13.003Z</atom:updated>
            <content:encoded><![CDATA[<p>The most dangerous moment in a solution architect’s career is not when the system is failing.</p><p>It is the moment you join a new company and everyone expects you to <em>design the future</em>.</p><p>You walk into your first meetings and hear familiar phrases:</p><p>“We want to modernize.”<br>“We need to scale.”<br>“We should move to the cloud.”<br>“This monolith has to go.”</p><p>People look at you with anticipation. They expect diagrams. They expect decisions. They expect certainty.</p><p>But the best thing you can do at that moment is <strong>not draw anything at all</strong>.</p><p>Because architecture does not start with solutions.<br>It starts with understanding.</p><h3>The First Responsibility of an Architect Is Restraint</h3><p>When I join a new company as a solution architect, I deliberately slow myself down.</p><p>Not because I lack ideas, but because premature design is one of the most expensive mistakes an architect can make.</p><p>At this stage, your job is not to impress people with technology choices.<br> Your job is to avoid being wrong too early.</p><p>Every system you encounter has a history. It survived real users, real deadlines, and real failures. Even if the code quality is poor, the system itself is a form of evidence. It tells a story about what the business truly values, where it compromises, and where it refuses to compromise.</p><p>An architect who ignores this story will eventually design something elegant — and completely disconnected from reality.</p><h3>Learn How the System Behaves, Not How It Was Designed</h3><p>That is why early on, I avoid asking for architecture diagrams.</p><p>Instead, I ask engineers to tell me how the system behaves on its worst days.</p><p>I want to know what happens during peak traffic, when a database slows down, or when an integration partner becomes unreliable. I listen carefully to which parts of the system cause stress, late nights, and emergency fixes.</p><p>This is where the real architecture reveals itself — not in documentation, but in production incidents.</p><p>Once you understand how a system fails, you begin to understand which changes are safe and which are dangerous. That knowledge is far more valuable than any technology trend.</p><h3>Stop Judging the Monolith and Start Respecting It</h3><p>At this point, many new architects feel an urge to <em>fix</em> the monolith.</p><p>This mindset is risky.</p><p>A monolith is not a moral failure. It is usually the result of a small team doing the best they could under business pressure. Inside that codebase lives years of domain knowledge, edge cases, and customer behavior that no design document ever captured.</p><p>The right question is not, “How do we replace it?”</p><p>The right question is, “Which parts deserve to remain stable, and which parts are asking to evolve?”</p><p>When you start seeing the system as a set of business capabilities rather than a technical structure, the path forward becomes clearer — and far less emotional.</p><h3>Architecture Is Mostly About Constraints You Do Not Control</h3><p>As understanding deepens, another reality becomes unavoidable: architecture is not about freedom.</p><p>It is about negotiation with constraints.</p><p>Some constraints come from the business — regulatory rules, customer deployment models, budget limitations. Others come from the organization — team size, skill distribution, operational maturity.</p><p>A small team with no dedicated DevOps function cannot safely operate an aggressive microservices architecture, no matter how clean the design looks on paper. Pretending otherwise is not visionary — it is irresponsible.</p><p>A good architect does not fight constraints.<br> They design <strong>honestly within them</strong>.</p><h3>Non-Functional Requirements Are the Quiet Drivers of Architecture</h3><p>This is where many architecture discussions quietly go wrong.</p><p>When people talk about features, they talk about what the system should do.<br> But architecture is shaped by how the system must behave.</p><p>Performance expectations, availability guarantees, security posture, data isolation, upgrade strategy — these forces quietly shape every technical decision. They are rarely exciting, and they are often poorly articulated.</p><p>One of the most valuable contributions a new architect can make is to surface these invisible forces and make them explicit.</p><p>When non-functional requirements are unclear, architecture discussions turn into opinion battles. When they are clear, trade-offs become rational.</p><p>This is where architects begin to earn trust.</p><h3>Architecture Lives or Dies With the Team</h3><p>As decisions take shape, one truth must remain front and center:</p><p>The quality of an architecture is limited by the team that operates it.</p><p>It does not matter how well you understand distributed systems if the team is not ready to debug them at 3 a.m. It does not matter how elegant the design is if no one feels confident deploying it.</p><p>When you design architecture, you are designing a working environment for people — not just a system for machines.</p><p>The best architecture is the one the team can grow into, not the one they must survive.</p><h3>Every Architectural Decision Must Be Able to Answer “Why”</h3><p>At some point, a subtle but dangerous trap appears.</p><p>People start asking questions like:</p><p>“Why don’t we use microservices?”<br> “Why aren’t we using OAuth yet?”<br> “Why is the database still shared?”<br> “Why don’t we just deploy everything on Kubernetes?”</p><p>These questions are rarely malicious.<br> But they reveal whether architecture is driven by reasoning — or by fashion.</p><p>Before I draw any architecture diagram, I force myself to articulate the <em>why</em> behind every major decision. Not in technical jargon, but in clear, defensible logic.</p><p>If I cannot explain a decision simply, I am probably not ready to make it.</p><h3>Why Microservices — Or Why Not</h3><p>Microservices are often treated as the default destination of modern architecture.</p><p>That assumption is one of the most common mistakes I see in early-stage architects.</p><p>When I evaluate microservices, I do not start with technology. I start with consequences.</p><p>Do we genuinely need independent scaling, or do we simply like the idea of it?<br> Are domain boundaries truly clear, or are we guessing?<br> Is the team ready to debug distributed failures, not just write services?<br> Is deployment automation mature enough to support this complexity?</p><p>In many cases, especially with small teams, the honest answer is no.</p><p>A modular monolith — designed with clear boundaries and internal discipline — is often a far better starting point. It allows teams to stabilize domains, reduce risk, and evolve naturally.</p><p>Architecture is not ideological.<br> It is evolutionary.</p><h3>Why This Authentication Strategy</h3><p>Authentication is another area where architects often overreach too early.</p><p>OAuth2, JWT, and SSO are powerful tools — but power always comes with complexity.</p><p>Instead of jumping straight to “best practice”, I slow down and ask foundational questions.</p><p>Who are the users, really?<br> Are we authenticating humans, systems, or both?<br> Do we need SSO today, or simply reliable login?<br> Are there regulatory identity requirements we must satisfy now?<br> How complex will key management be in on-premise environments?</p><p>Sometimes the most responsible decision is to start with a simpler authentication mechanism that the team fully understands — while explicitly designing a migration path for the future.</p><p>Architecture that cannot evolve safely is fragile, no matter how modern it looks.</p><h3>Why Separate Databases Is Not an Obvious Win</h3><p>Database separation is often misunderstood as a sign of architectural maturity.</p><p>In reality, it is a trade-off — not a virtue.</p><p>Before recommending separate databases, I ask difficult questions.</p><p>Do teams truly need independent schema evolution?<br> Is data ownership clearly defined, or still blurry?<br> Is tenant isolation a hard requirement today, or a future goal?<br> What is the operational cost of running multiple databases on-prem?</p><p>Separation increases isolation and autonomy — but it also increases operational burden, backup complexity, and failure scenarios.</p><p>Architecture is not about maximizing purity.<br> It is about balancing isolation with operability.</p><h3>Why This Deployment Model</h3><p>Supporting both on-premise and cloud deployments forces discipline.</p><p>It quickly exposes architectural fantasies.</p><p>Containers provide portability, but they do not magically simplify operations. Kubernetes offers consistency, but not every customer — or team — is ready for it.</p><p>When evaluating deployment models, I focus on survivability.</p><p>Can the system be deployed repeatedly without heroics?<br>Can environments be recreated reliably?<br>Can failures be diagnosed by the existing team?</p><p>Infrastructure-as-Code becomes essential here — not because it is fashionable, but because it reduces uncertainty.</p><p>A good architecture must work well in constrained environments, not only in ideal cloud setups.</p><h3>Complexity Is a Cost, Not a Feature</h3><p>As these decisions accumulate, one principle guides everything:</p><p>If the system is hard to understand, it will be hard to maintain.</p><p>I actively resist the urge to impress through complexity. I push back against over-engineering, unnecessary abstractions, and architectures driven by trends rather than needs.</p><p>Every additional component increases cognitive load, operational risk, debugging difficulty, and long-term maintenance cost.</p><p>Architects are not rewarded for cleverness.<br>We are responsible for clarity, resilience, and sustainability.</p><h3>Functional vs Non-Functional Requirements: The Silent Forces</h3><p>Many architects fail not because they misunderstand technology, but because they underestimate non-functional requirements.</p><p>Functional requirements define what the system does.<br>Non-functional requirements define whether the system survives.</p><p>Scalability, availability, security, observability, and compliance shape architecture far more than feature lists.</p><p>Making these forces visible — and prioritizing them explicitly — is one of the most important responsibilities of a solution architect.</p><h3>CAP Theorem: Architecture as Risk Selection</h3><p>CAP theorem is not something you “solve”.</p><p>It is something you choose around.</p><p>Every distributed system makes quiet decisions about consistency, availability, and failure behavior. The danger is not choosing — the danger is choosing unconsciously.</p><p>The architect’s role is to align these trade-offs with business risk, not technical elegance.</p><h3>Team Readiness and DevOps Reality</h3><p>Finally, architecture must respect human limits.</p><p>A six-person team without a dedicated DevOps function cannot safely operate extreme architectural complexity. Modern systems assume automation, monitoring, and operational ownership.</p><p>Without them, ambition becomes fragility.</p><p>Architecture must always be paired with an enablement strategy: hiring, training, tooling, and time.</p><p>Architecture without enablement is theory.<br>Production systems punish theory.</p><h3>Speaking to Management: Strategy Over Ideology</h3><p>Executives do not care about frameworks or protocols.</p><p>They care about risk, cost, speed, and trust.</p><p>When architecture is explained as a way to reduce future pain, protect the business, and enable growth, it stops being a technical argument and becomes a strategic conversation.</p><p>That is where architects are most effective.</p><h3>Final Reflection</h3><p>Before you draw the architecture diagram, ask yourself:</p><p>Can I explain every major decision clearly?<br>Can I defend it under pressure?<br>Can the team operate it with confidence?</p><p>If the answer is no, the diagram is premature.</p><p>Great architecture is not loud.<br>It is calm, deliberate, and earned.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2518bfd713c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Where Should You Put Your Validations in a Spring Boot Microservice?]]></title>
            <link>https://medium.com/@kiana.proudmoore/where-should-you-put-your-validations-in-a-spring-boot-microservice-b8dc1219c0b7?source=rss-fb4ae54f9db4------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8dc1219c0b7</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[api-design]]></category>
            <category><![CDATA[bean-validation]]></category>
            <category><![CDATA[java-backend-development]]></category>
            <category><![CDATA[exception-handling]]></category>
            <dc:creator><![CDATA[Riskiana]]></dc:creator>
            <pubDate>Sat, 04 Oct 2025 15:58:46 GMT</pubDate>
            <atom:updated>2025-10-04T15:58:46.004Z</atom:updated>
            <content:encoded><![CDATA[<p>You’re building a Spring Boot microservice. You know you need validation, but the question nags at you: <em>Where does it actually belong?</em> In the DTO with annotations? The controller? The service layer? Sprinkle it everywhere?</p><p>Getting this wrong leads to inconsistent data, duplicate code, and a fragile API that’s easy to break.</p><p>In this article, I’ll walk you through a structured, layered approach to validation using a core banking scenario. By the end, you’ll know exactly which validations to put in each layer to build robust, secure, and maintainable microservices. Let’s end the confusion.</p><h3>Why Validate on Backend if Frontend Already Validates?</h3><p>A common question: <em>“If my React/Angular frontend already checks that the date of birth is in the past, why duplicate it in backend?”</em></p><p>Answer: <strong>Frontend validation is about UX, Backend validation is about integrity and Security</strong></p><p><strong>Frontend Validation</strong></p><ul><li>Improves user experience (e.g., immediate feedback for missing field).</li><li>Can prevent obvious invalid requests before sending them to the server.</li><li>But: It can be bypassed easily (disabled JavaScript, malicious curl request, mobile client bug, etc).</li></ul><p><strong>Backend Validation</strong></p><ul><li>Guarantees data integrity across all clients (web, mobile, batch APIs).</li><li>Ensures your database never receives corrupted or invalid data.</li><li>Acts as the final gatekeeper.</li></ul><p>👉 Always keep validation in the backend. Frontend validation is a <strong>convenience</strong>, not a <strong>defense</strong>.</p><h3>The Core Banking Example: Account Creation</h3><p>Now, let’s see this in action with our core banking example: Creating a Bank Account.</p><p>Requirements:</p><ul><li>Customer number must be provided.</li><li>Initial deposit must be at least $100.</li><li>Account type must be SAVINGS or CURRENT.</li><li>A customer cannot have two accounts of the same type.</li></ul><h3><strong>Validation in Different Layers</strong></h3><h3>1. POJO (DTO) Validation</h3><p>Spring Boot comes with <strong>Jakarta Bean Validation (JSR-380)</strong> support <strong>out-of-the-box</strong>. When you include spring-boot-starter-validation, Spring Boot automatically brings in:</p><ul><li>The Jakarta Bean Validation API (the interface)</li><li>Hibernate Validator (the implementation).</li></ul><p>Hibernate Validator provides extra annotations beyond the standard, like @Email, @URL, @CreditCardNumber</p><p>Commonly Used Bean Validation Annotations:</p><ul><li>@NotNull : Value must not be null (but can be empty string or collections). Where to Use : any field</li><li>@NotEmpty : Must not be null and must have size &gt; 0 (empty not allowed). Where to use : Strings, collections, arrays</li><li>@NotBlank: Must not be null, must contain at least one non-whitespace char. Where to use: Strings only</li><li>@Size(min, max): Length or size must be within range. Where to use: Strings, collections</li><li>@Pattern (regexp): Must match given regex. Where to use: Strings</li><li>@Min / @Max: Must be within numeric range. Where to use: Numbers</li><li>@Past / @Future: Must be in the past/future. Where to use: Dates</li></ul><p><strong>Tip:</strong></p><ul><li>Use @NotBlank for user inputs like names.</li><li>Use @NotEmpty for lists of items (e.g., multiple account beneficiaries).</li><li>Use @NotNull when null is not allowed but empty values are valid.</li></ul><p>Here’s a <strong>DTO for account creation</strong> :</p><pre>import jakarta.validation.constraints.*;<br><br>import java.math.BigDecimal;<br>import java.time.LocalDate;<br><br>public class AccountRequest {<br><br>    @NotBlank(message = &quot;Customer number is required&quot;)<br>    private String customerNumber;<br><br>    @NotNull(message = &quot;Initial deposit is required&quot;)<br>    @DecimalMin(value = &quot;100.0&quot;, message = &quot;Initial deposit must be at least 100&quot;)<br>    private BigDecimal initialDeposit;<br><br>    @NotBlank(message = &quot;Account type is required&quot;)<br>    @Pattern(regexp = &quot;SAVINGS|CURRENT&quot;, message = &quot;Invalid account type&quot;)<br>    private String accountType;<br><br>    // getters &amp; setters<br>}</pre><p>📌 <strong>Best practice:</strong></p><ul><li>Use Bean Validation for <strong>field-level constraints </strong>with Bean Validation annotations (@NotNull, @Size, @Pattern, etc).</li><li>Fail fast before hitting your business logic.</li><li>This keeps controllers thin and declarative.</li></ul><p>Controller activates validation with @Valid:</p><pre>@RestController<br>@RequestMapping(&quot;/accounts&quot;)<br>public class AccountController {<br><br>    private final AccountService accountService;<br><br>    public AccountController(AccountService accountService) {<br>        this.accountService = accountService;<br>    }<br><br>    @PostMapping<br>    public ResponseEntity&lt;AccountResponse&gt; createAccount(<br>            @Valid @RequestBody AccountRequest request) {<br>        return ResponseEntity.ok(accountService.createAccount(request));<br>    }<br>}</pre><h3>2. Controller Validation</h3><p>At the <strong>controller level</strong>, the goal is to validate <strong>incoming requests</strong>. We use @Valid to automatically trigger Jakarta Bean Validation. If the request is invalid, Spring throws a MethodArgumentNotValidException, which we can handle globally. This is where you check that a request body has the right format, mandatory fields, and simple constraints.</p><p>📌 <strong>Controller responsibility:</strong></p><ul><li>Handle <strong>request format</strong> and <strong>field-level validation</strong>.</li><li>Reject malformed requests <strong>before hitting the service layer</strong>.</li></ul><h3>3. Service Validation</h3><p>The <strong>service layer</strong> is where <strong>business rules</strong> and <strong>DB-dependent validations</strong> live. This is where the real logic lives. The service layer answers “can this specific business action be performed?”</p><p>Examples:</p><ul><li>Is the customer allowed to have this account?</li><li>A resource (customer, account) must exist before referencing it.</li><li>Ensuring uniqueness in DB.</li></ul><pre>@Service<br>public class AccountService {<br><br>    private final AccountRepository accountRepository;<br><br>    public AccountService(AccountRepository accountRepository) {<br>        this.accountRepository = accountRepository;<br>    }<br><br>    public AccountResponse createAccount(AccountRequest request) {<br><br>        // Example: uniqueness validation<br>        boolean exists = accountRepository.existsByCustomerNumberAndAccountType(<br>                request.getCustomerNumber(), request.getAccountType()<br>        );<br>        if (exists) {<br>            throw new ConflictException(&quot;Customer already has this type of account&quot;);<br>        }<br><br>        // Example: resource validation<br>        if (!accountRepository.customerExists(request.getCustomerNumber())) {<br>            throw new ResourceNotFoundException(&quot;Customer not found&quot;);<br>        }<br><br>        Account account = new Account(request);<br>        accountRepository.save(account);<br><br>        return new AccountResponse(account);<br>    }<br>}</pre><p>📌 <strong>Service responsibility:</strong></p><ul><li>Service layer = <strong>business rules and workflows</strong>.</li><li>Interact with DB and repositories.</li><li>Throw <strong>business-specific exceptions</strong> (ResourceNotFoundException, ConflictException).</li><li>Use custom exceptions (BusinessException) to separate from system errors.</li></ul><p>Sometimes, the <strong>service layer gets too crowded</strong> with validation rules. Example:</p><ul><li>Checking <strong>credit score</strong> from an external service.</li><li>Validating <strong>blacklisted customers</strong> from another microservice.</li></ul><p>In that case, extract them into a <strong>dedicated ValidationService</strong>:</p><pre>@Service<br>public class ValidationService {<br><br>    private final CustomerServiceClient customerServiceClient;<br><br>    public ValidationService(CustomerServiceClient customerServiceClient) {<br>        this.customerServiceClient = customerServiceClient;<br>    }<br><br>    public void validateCustomerEligibility(String customerName) {<br>        if (customerServiceClient.isBlacklisted(customerName)) {<br>            throw new BusinessRuleException(&quot;Customer is blacklisted&quot;);<br>        }<br>    }<br>}</pre><p>and in the AccountService</p><pre>public AccountResponse createAccount(AccountRequest request) {<br>    validationService.validateCustomerEligibility(request.getCustomerName());<br>    // other business rules...<br>}</pre><h3>4. Exception Handling Best Practices</h3><p>Without this, your API will throw ugly stack traces. With @RestControllerAdvice, you transform exceptions into clean, consistent API errors.</p><p>To avoid sprinkling try/catch everywhere, use <strong>custom exceptions</strong> and a <strong>global exception handler</strong>.</p><h4>4.1 Create Generic Exceptions</h4><p>Keep a small set of reusable exceptions:</p><ul><li>ResourceNotFoundException → 404</li><li>ConflictException → 409</li><li>UnauthorizedException → 401</li><li>BusinessRuleException → 400 or 422</li></ul><pre>public class ResourceNotFoundException extends RuntimeException {<br>    public ResourceNotFoundException(String message) {<br>        super(message);<br>    }<br>    <br>}<br>public abstract class NotFoundException extends RuntimeException {<br>    public NotFoundException(String message) {<br>        super(message);<br>    }<br>    <br>}<br>public class ConflictException extends RuntimeException {<br>    public ConflictException(String message) {<br>        super(message);<br>    }<br>    <br>}<br>public class BusinessRuleException extends RuntimeException {<br>  public BusinessRuleException(String message) {<br>    super(message);<br>  }<br><br>}</pre><h4>4.2 Global Exception Handler with @RestControllerAdvice</h4><p>Centralize exception handling so every service returns <strong>consistent JSON error response</strong>:</p><pre>@RestControllerAdvice<br>public class GlobalExceptionHandler {<br><br>    @ExceptionHandler(MethodArgumentNotValidException.class)<br>    public ResponseEntity&lt;ErrorResponse&gt; handleValidationErrors(MethodArgumentNotValidException ex) {<br>        // get first error message<br>        String errorMessage = ex.getBindingResult().getFieldError().getDefaultMessage();<br>        return ResponseEntity<br>                .status(HttpStatus.BAD_REQUEST)<br>                .body(new ErrorResponse(&quot;400&quot;, errorMessage));<br>    }<br><br>    // Handle custom not found exceptions<br>    @ExceptionHandler(ResourceNotFoundException.class)<br>    public ResponseEntity&lt;ErrorResponse&gt; handleNotFound(ResourceNotFoundException ex) {<br>        return ResponseEntity<br>                .status(HttpStatus.NOT_FOUND)<br>                .body(new ErrorResponse(&quot;404&quot;, ex.getMessage()));<br>    }<br>// Catch-all handler <br>    @ExceptionHandler(Exception.class)<br>    public ResponseEntity&lt;ErrorResponse&gt; handleGeneric(Exception ex) {<br>        return ResponseEntity<br>                .status(HttpStatus.INTERNAL_SERVER_ERROR)<br>                .body(new ErrorResponse(&quot;500&quot;, &quot;Internal server error&quot;));<br>    }<br>    <br>    @ExceptionHandler(ConflictException.class)<br>    public ResponseEntity&lt;ErrorResponse&gt; handleConflict(ConflictException ex) {<br>        return ResponseEntity<br>                .status(HttpStatus.CONFLICT)<br>                .body(new ErrorResponse(&quot;409&quot;, ex.getMessage()));<br>    }</pre><h4>4. 3: Implement Exceptions in Service Class</h4><p>Throw domain-specific exceptions instead of generic ones:</p><pre>if (accountRepository.existsByCustomerNumberAndAccountType(request.getCustomerNumber(), request.getAccountType())) {<br>    throw new ConflictException(&quot;Customer already has this account type&quot;);<br>}<br><br>if (!accountRepository.existsByCustomerNumber(request.getCustomerNumber())) {<br>    throw new ResourceNotFoundException(&quot;Customer not found&quot;);<br>}</pre><h4><strong>4.4 Helper class for error response</strong></h4><p>A clean JSON response model:</p><pre>public class ApiError {<br>    private int status;<br>    private String message;<br><br>    public ApiError(int status, String message) {<br>        this.status = status;<br>        this.message = message;<br>    }<br>    // getters<br>}</pre><p>📌 <strong>Best practice:</strong></p><ul><li>Use <strong>generic exceptions</strong> for CRUD-like errors (NotFound, Conflict, Unauthorized).</li><li>Use <strong>specific exceptions</strong> for unique business rules (OverdraftLimitExceededException, InvalidTransactionException).</li></ul><h3>Testing Validation</h3><p><strong>1.Invalid Request (initial deposit &lt;100)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*zL5EGU_zdy6uP5X8hS0geQ.png" /></figure><p>Response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*OzXXMse8ml9SdGnxc9c1sg.png" /></figure><p><strong>2. Business Rule Violation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*ejMVaPsJ6y2aSmKzRCnGJw.png" /></figure><h3>Conclusion</h3><p>A clean validation strategy makes your Spring Boot microservices more <strong>robust, secure, and maintainable</strong>:</p><ul><li><strong>Validate early, validate often</strong> → use DTO validation + service rules.</li><li><strong>Keep controllers thin</strong> → just request parsing &amp; triggering validation.</li><li><strong>Centralize exception handling</strong> → consistent API responses.</li><li><strong>Never rely only on frontend</strong> → backend validation is non-negotiab</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8dc1219c0b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Cloud-Ready Applications: The 12-Factor App with Spring Boot]]></title>
            <link>https://medium.com/@kiana.proudmoore/building-cloud-ready-applications-the-12-factor-app-with-spring-boot-2c01616f69b8?source=rss-fb4ae54f9db4------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c01616f69b8</guid>
            <category><![CDATA[the-twelve-factor]]></category>
            <category><![CDATA[12-factor-app]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[cloud-native-application]]></category>
            <dc:creator><![CDATA[Riskiana]]></dc:creator>
            <pubDate>Sat, 30 Aug 2025 05:33:13 GMT</pubDate>
            <atom:updated>2025-08-30T05:35:42.703Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why 12-Factor Still Matters Today</h3><p>Building modern application is not only about writing code that works. We face several challenges:</p><ul><li>Increasing development &amp; deployment complexity</li><li>Scaling applications across environments</li><li>Ensuring consistency from dev -&gt; staging -&gt; production</li><li>Running reliably in the cloud</li></ul><p>More than a decade ago, <a href="https://www.heroku.com/">Heroku</a> introduced the 12-Factor App manifesto. it became a set of best practises for building cloud native applications that are:</p><ul><li>portable (deploy anywhere: cloud or on-premise)</li><li>Automated (CI/CD friendly)</li><li>Scalable (easy to grow horizontally)</li></ul><p>Spring boot naturally aligns with these principles: it embraces<strong> convention over configuration</strong>, ship with <strong>embedded servers</strong>, and comes with <strong>production-ready features</strong> like Actuator.</p><p>Let’s explore all 12 factors one by one — and how they map to <strong>Spring Boot</strong>.</p><h3>1. Codebase — One Codebase, Multiple Deploys</h3><p>You should maintain <strong>a single codebase</strong> tracked in version control (like Git), which can be deployed to different environments such as development, staging, and production.</p><pre># application-dev.properties<br>spring.datasource.url=jdbc:h2:mem:testdb<br><br># application-prod.properties<br>spring.datasource.url=${SPRING_DATASOURCE_URL}</pre><p>spring boot profile reference : <a href="https://docs.spring.io/spring-boot/reference/features/profiles.html">https://docs.spring.io/spring-boot/reference/features/profiles.html</a></p><p>Run with:</p><pre>java -jar app.jar --spring.profiles.active=prod</pre><p>If multiple apps share the exact same codebase, that’s not really “one codebase” anymore. The better way is to <strong>extract reusable logic into a shared library</strong> and include it as a dependency. A good rule of thumb (the <strong>rule of three</strong>) is: once at least three apps reuse the same code (e.g., payment logic, logging, security), extract it into a library. This keeps apps independent while avoiding duplication.</p><h3>2. Dependencies — Explicitly Declare and Isolate</h3><p>A modern Spring Boot app must declare all dependencies explicitly (using Maven or Gradle) instead of assuming they exist on the system. For example, if your app needs Jackson for JSON parsing or PostgreSQL drivers, these must be defined in your pom.xml or build.gradle. Tools like Docker further ensure dependency isolation, so your app runs the same way everywhere. This prevents the common “works on my machine” problem.</p><pre>dependencies {<br>    // Jackson for JSON parsing<br>    implementation &#39;com.fasterxml.jackson.core:jackson-databind:2.17.2&#39;<br><br>    // PostgreSQL JDBC driver<br>    implementation &#39;org.postgresql:postgresql:42.7.3&#39;<br>}</pre><p>No hidden dependencies. Everything is in your pom.xml or build.gradle.</p><h3>3. Config — Store Config in the Environment</h3><p>Application code should remain the same across environments, while configuration (like database URLs, API keys, feature flags) should be stored externally. In Spring Boot, you can use application.properties or better yet environment variables and profiles (application-dev.yml, application-prod.yml). This makes your app flexible, portable, and secure—no more hardcoding secrets in the codebase.</p><p><strong>Spring Boot:</strong></p><p>reference: <a href="https://docs.spring.io/spring-boot/how-to/properties-and-configuration.html">https://docs.spring.io/spring-boot/how-to/properties-and-configuration.html</a></p><pre><br>spring.datasource.url=${SPRING_DATASOURCE_URL}<br>spring.datasource.username=${DB_USERNAME}<br>spring.datasource.password=${DB_PASSWORD}</pre><p>or via @Value:</p><pre>@Value(&quot;${spring.datasource.url}&quot;)<br>private String dbUrl;</pre><p>for distributed apps: use <a href="https://docs.spring.io/spring-cloud-config/docs/current/reference/html/">Spring Cloud Config </a>or Vault for secret management.</p><h3>4. Backing Services — Treat Services as Attached Resources</h3><p>A backing service is any service your app consumes, such as a database, cache, or message broker. The rule is: treat them as <strong>replaceable resources</strong>. Your Spring Boot app shouldn’t care if the database is local, on AWS RDS, or Google Cloud SQL — it just connects using a URL or credential. This abstraction makes it easy to swap services without changing your app code.</p><p><strong>Spring Boot example:</strong></p><pre>spring.redis.host=${REDIS_HOST}<br>spring.redis.port=${REDIS_PORT}</pre><p>Switching from local Redis → cloud Redis? Just change env vars, no code changes.</p><p>Spring Data abstracts DB access so you can swap MySQL with Postgres smoothly.</p><pre>public interface UserRepository extends JpaRepository&lt;User, Long&gt; {}</pre><p>Because the repository layer is abstract, you only change the connection string (jdbc:mysql://... → jdbc:postgresql://...), without rewriting business logic.</p><h3>5. Build, Release, Run — Strict Separation</h3><p>Your app’s lifecycle should follow three distinct stages: <strong>build</strong> (compile source, package JAR), <strong>release</strong> (combine build with config), and <strong>run</strong> (execute the app in production). In Spring Boot, this means first creating a JAR/WAR, then applying environment-specific settings, and finally running it. Mixing these stages leads to errors — so always keep them separate.</p><ul><li><strong>Build:</strong> Create JAR/WAR</li></ul><pre>./mvnw clean package</pre><p><strong>Release:</strong> Combine artifact with config (e.g., Docker)</p><pre>FROM eclipse-temurin:17-jdk<br>COPY target/app.jar app.jar<br>ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;app.jar&quot;]</pre><p><strong>Run:</strong> Deploy to environment with runtime config</p><pre>docker run -e SPRING_PROFILES_ACTIVE=prod my-app:1.0</pre><p>CI/CD tools (Jenkins, GitHub Actions) automate this pipeline.</p><h3>6. Processes — Execute as Stateless Processes</h3><p>A 12-factor app runs as one or more stateless processes. <strong>Stateless</strong> means a process does not remember anything between requests; all state is stored in the database, cache, or external services. For example, if a user uploads a file, you should not store it in local disk memory — save it in S3 or GCS instead. That way, you can scale horizontally by adding more instances, since no instance holds unique state. This allows your app to scale horizontally (more instances) without losing user data.</p><h3>7. Port Binding — Export Services via Port Binding</h3><p>Your app should be self-contained and expose services by binding to a port, instead of depending on external web servers. Spring Boot naturally follows this principle because every app runs with an embedded Tomcat/Jetty server and exposes endpoints on a port (default 8080). This makes deployment simpler and more portable.</p><p><strong>Spring Boot:</strong> runs with embedded Tomcat/Jetty. No need for external app server.</p><pre>java -jar app.jar</pre><p>Exposes HTTP on port 8080 by default. Change via config:</p><pre>server.port=9090</pre><h3>8. Concurrency — Scale Out via the Process Model</h3><p>Scale by running multiple processes, not giant monolith threads. For example, instead of scaling a single JVM vertically, you deploy more containers/pods running the same app behind a load balancer. In Spring Boot, this is usually achieved by running your app in containers (e.g., Docker + Kubernetes) where traffic is load-balanced across replicas. Each process should be independent, lightweight, and disposable so scaling is seamless.</p><p><strong>Spring Boot:</strong> Run multiple app instances in Kubernetes, Docker Swarm, or AWS ECS.</p><pre># kubernetes deployment.yaml<br>spec:<br>  replicas: 3<br>  containers:<br>    - name: springboot-app<br>      image: my-app:1.0<br>      ports:<br>        - containerPort: 8080</pre><p>Scaling = more replicas, no code changes.</p><h3>9. Disposability — Fast Startup, Graceful Shutdown</h3><p>Processes should start quickly and shut down gracefully. This ensures faster deployments, smooth scaling, and minimal downtime. Spring Boot apps should aim for quick startup times (using optimizations like lazy initialization) and graceful shutdown (e.g., closing database connections). This makes your app resilient to crashes and interruptions in cloud environments.</p><p><strong>Spring Boot:</strong></p><ul><li>Graceful shutdown support:</li></ul><pre>server.shutdown=graceful<br>spring.lifecycle.timeout-per-shutdown-phase=30s</pre><p>Use Actuator /actuator/health for readiness &amp; liveness.</p><h3>10. Dev/Prod Parity — Keep Environments Similar</h3><p>The closer your development, staging, and production environments are, the fewer surprises you’ll face. For example, don’t test on H2 locally and expect everything to work perfectly on PostgreSQL in production. Instead, use Docker to mirror production services in your dev environment. This reduces deployment risks and increases confidence.</p><p><strong>Spring Boot tip:</strong> use Docker Compose for local dev, and deploy similar images to staging/prod.</p><pre>docker-compose -f docker-compose.dev.yml up</pre><p>Same tech stack everywhere = fewer “works on my machine” issues.</p><h3>11. Logs — Treat Logs as Event Streams</h3><p>A 12-factor app doesn’t manage log files itself. Instead, it writes logs to stdout (console) so the environment can collect and aggregate them. In Spring Boot, you can log using Logback or SLF4J, and let the platform (Docker, Kubernetes, or a log aggregator like ELK/Datadog) handle storage and analysis. This makes monitoring and debugging much easier.</p><p>For structured logs:</p><pre>logging.pattern.console={&quot;time&quot;:&quot;%d&quot;,&quot;level&quot;:&quot;%p&quot;,&quot;msg&quot;:&quot;%m&quot;}</pre><p>Coud platforms (Kubernetes, ELK, CloudWatch) collect and analyze them.</p><h3>12. Admin Processes — Run Admin Tasks as One-Off Processes</h3><p>Occasionally you’ll need to run admin or maintenance tasks (like database migrations or data cleanup). In a 12-factor setup, these tasks should be executed as <strong>one-off processes</strong> using the same codebase and environment. Database migrations, for instance, should not be part of app startup logic. With <strong>Flyway</strong>, migrations are automatically applied at startup but tracked in schema history.</p><p>Example Maven config:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.flywaydb&lt;/groupId&gt;<br>    &lt;artifactId&gt;flyway-core&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><p>and application properties:</p><pre>spring:<br>  flyway:<br>    enabled: true<br>    locations: classpath:db/migration</pre><p>You just place SQL migration files in src/main/resources/db/migration, and Flyway applies them in order (e.g., V1__create_users.sql, V2__add_orders.sql).</p><h3>Why Spring Boot + 12-Factor = Perfect Match</h3><p>Spring Boot’s philosophy aligns naturally with the 12-Factor manifesto:</p><ul><li><strong>Convention over configuration</strong> → less boilerplate</li><li><strong>Embedded server</strong> → self-contained deployments</li><li><strong>Production ready</strong> → health checks, metrics, actuator</li></ul><p>When combined with Docker/Kubernetes, Spring Boot apps become true cloud-native citizens.</p><h3>Final Thoughts</h3><p>The <strong>12-Factor App</strong> is not an old-school theory; it’s still the <strong>blueprint for building reliable, scalable, and portable applications</strong>.</p><p>Spring Boot makes these principles practical and easy to adopt:</p><ul><li>Externalize your configs</li><li>Keep services stateless</li><li>Scale horizontally with processes</li><li>Rely on automation and CI/CD</li></ul><p>full reference: <a href="https://12factor.net/">https://12factor.net/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c01616f69b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Monolith to Microservices: My Journey Scaling a Java Banking System for 2 Million Customers]]></title>
            <link>https://medium.com/@kiana.proudmoore/from-monolith-to-microservices-my-journey-scaling-a-java-banking-system-for-2-million-customers-09a23cf448a7?source=rss-fb4ae54f9db4------2</link>
            <guid isPermaLink="false">https://medium.com/p/09a23cf448a7</guid>
            <dc:creator><![CDATA[Riskiana]]></dc:creator>
            <pubDate>Wed, 16 Jul 2025 11:31:02 GMT</pubDate>
            <atom:updated>2025-07-16T13:32:31.749Z</atom:updated>
            <content:encoded><![CDATA[<h3>What I Learned About Distributed Systems — After Leaving a Legacy Banking Monolith</h3><p>I’ve spent years maintaining and scaling a banking platform that served over <strong>2 million customers</strong>, written in <strong>Java Struts</strong>, <strong>Hibernate</strong>, <strong>MySQL</strong>, and <strong>Tomcat</strong>. At the beginning, it was one big, working system.</p><p>Until it wasn’t.</p><p>This post is not a tutorial. It’s a <strong>real-world story</strong> of what happens when you try to grow a Java monolith in a fast-evolving banking environment — and how we <strong>introduced distributed system practices</strong>, <strong>scaled across multiple app instances</strong>, and slowly brought in <strong>Spring Boot microservices</strong> the right way.</p><h3>The Original Architecture: Java Monolith Under Pressure</h3><p>Originally, our system followed a <strong>core-branch architecture</strong> with <strong>web applications</strong> deployed both at the <strong>central server</strong> and at <strong>each individual bank branch</strong>:</p><ul><li><strong>Backend Officers (central server) </strong>at the head office accessed a <strong>centralized web portal</strong> deployed on the server, providing centralized control and administrative tools.</li><li><strong>Branch Officers</strong> (<strong>client</strong>) accessed a <strong>web application deployed locally</strong> in the branch environment, built using Java Struts and deployed on Tomcat. It handled customer onboarding, transactions, and reporting.</li></ul><p>These clients operated semi-independently — offline when needed — then synchronized with the central server twice a day:</p><p><strong>-Start of Day (SoD)</strong>: Pull new data from the server to each branch client</p><p>-<strong>End of Day (EoD)</strong>: Push transactional data from branch client to the server</p><p>The sync process relied on:</p><ul><li><strong>Zipped data files</strong></li><li><strong>FTP connection</strong></li><li><strong>Manually maintained sync IDs</strong></li></ul><h3>Common Sync Issues:</h3><ul><li>Corrupted or partially downloaded ZIP files</li><li>Missing sync IDs that broke batch processes</li><li>Retry mechanisms that required <strong>manual intervention</strong></li><li>Delay or data conflicts between branches</li></ul><p>the application looked like this:</p><ul><li><strong>Frontend</strong>: JSP + Struts</li><li><strong>Backend</strong>: Monolithic Java services using Hibernate</li><li><strong>Database</strong>: MySQL (single master)</li><li><strong>Server</strong>: Apache Tomcat (single instance)</li><li><strong>Deployment</strong>: Manual WAR file upload</li><li><strong>Monitoring</strong>: reading logs file manually 🤕</li></ul><p>And for a while, it worked.</p><p>But soon we were processing thousands of transactions per second during peak hours — things began to crack. It was fragile. Any file mismatch or transfer issue during sync caused <strong>transaction discrepancies</strong>, <strong>reporting issues</strong>, and even <strong>branch downtimes</strong>.</p><h3>Pain Points We Hit</h3><h3>1. Scaling the App Was a Nightmare</h3><p>There was no easy way to scale individual parts of the app. Everything — from user login to transaction processing — ran in one container.</p><h3>2. The Database Became the Bottleneck</h3><p>Even with query tuning, a single MySQL master couldn’t keep up with read/write loads. We began seeing deadlocks, slow queries, and downtime during backups.</p><p>We tried introducing <strong>database replication</strong> — one master, one read-only replica — but we had to manually route reporting modules to the replica. That added complexity and didn’t solve the core bottleneck for write-heavy operations.</p><h3>3. Downtime for Every Deployment</h3><p>To deploy a new feature or fix a bug, we had to take the entire app down, redeploy the WAR, and restart Tomcat.</p><h3>4. Unit tests? Sadly, none</h3><p>All logic was embedded in action classes or DAOs. Testing was done <strong>manually</strong>, often in production-like environments. Each deployment carried significant regression risk and required heavy human QA cycles.</p><h3>Some of the changes we made:</h3><h4>1.Scaling Horizontally with JBoss and Load Balancing</h4><p>Our first move toward <strong>distributed thinking</strong> wasn’t microservices — it was <strong>multi-instance horizontal scaling</strong>.</p><p>We:</p><ul><li>Migrated from Tomcat to <strong>JBoss</strong>, which gave us more flexibility and thread handling.</li><li>Deployed <strong>multiple instances</strong> of the monolith across different VMs.</li><li>Introduced an <strong>F5 Load Balancer</strong> to distribute incoming requests.</li><li>Externalized configuration to avoid hard-coded envs (early move toward 12-factor app thinking).</li></ul><p>This bought us time. Traffic spikes were now shared across app instances. Failover improved. But the monolith still had limitations:</p><ul><li>A single module could crash everything.</li><li>Teams were blocked waiting for one release cycle.</li><li>Scaling was <strong>not fine-grained</strong> — it was still all-or-nothing.</li></ul><h4>2. ESB to Support Mobile Transaction Traffic</h4><p>As mobile banking emerged, we had to integrate new traffic from mobile apps into the legacy system. Instead of embedding mobile support into the monolith, we introduced an <strong>Enterprise Service Bus (ESB)</strong>.</p><p>The ESB helped us:</p><ul><li>Accept requests from <strong>external mobile channels</strong></li><li>Transform and route messages to internal legacy systems</li><li>Enforce <strong>security, validation,</strong> and <strong>logging policies</strong></li><li>Act as a middle layer between <strong>mobile frontends</strong> and <strong>core banking</strong></li></ul><p>Using the ESB reduced direct coupling between frontends and the monolith, but it still depended on backend services that weren’t optimized for real-time. Latency, maintenance complexity, and tight data contracts remained pain points.</p><h4>3. Microservices as Greenfield Modules</h4><p>We didn’t jump into full distributed systems right away. Instead, we started with a <strong>greenfield microservice</strong>: the <strong>Auto-Scoring Service</strong> — a standalone component that calculated customer creditworthiness based on rules and transaction patterns.</p><p>This service was:</p><ul><li>Built using <strong>Spring Boot</strong></li><li>Deployed as a <strong>standalone JVM process</strong>, not yet containerized</li><li>Exposed via <strong>Kong API Gateway</strong> for routing and security</li><li><strong>Kibana</strong> — to visualize and explore logs, enabling faster debugging and better observability</li><li>Managed and scheduled via <strong>HashiCorp Nomad</strong> (instead of Kubernetes)</li><li>Provisioned using <strong>Terraform</strong> for infrastructure-as-code</li></ul><p>This was also the beginning of our <strong>DevOps practice</strong>:</p><ul><li>Using <strong>Terraform</strong> to define and manage VM infrastructure</li><li>Leveraging <strong>Kong</strong> to create APIs that were manageable, observable, and secured</li><li>Monitored logs with <strong>ELK Stack</strong> (Elasticsearch + Logstash + Kibana), so developers and ops could trace issues across services</li><li>Deployed services on <strong>Nomad clusters</strong>, which simplified scheduling and resource allocation</li><li>Embracing version control for infrastructure and pipeline automation</li></ul><p>We didn’t have containers or Kubernetes yet — but <strong>we had modularity, API gateways, and automation</strong>, and that was a huge step forward.</p><p>More importantly, we had a small <strong>cross-functional team</strong> practicing Agile for the first time:<br> A few developers, one DevOps engineer, and a backlog of ideas we could now deliver faster, more safely, and more independently.</p><h3>Looking Back: The Missing Distributed System</h3><p>At the time, we were doing everything we could to keep the system running:</p><ul><li>Load balancing with F5</li><li>Introducing Kong Gateway</li><li>Moving to microservices one step at a time</li><li>Automating some CI/CD with DevOps</li></ul><p>But after moving to a new company — where I worked with <strong>real distributed systems</strong> — I realized something important:</p><blockquote><em>Our old system wasn’t truly distributed.<br> It was a </em><strong><em>scaling monolith</em></strong><em> with patches.</em></blockquote><p>We still had:</p><ul><li><strong>Tightly coupled services</strong></li><li><strong>Shared databases</strong></li><li><strong>Synchronous dependencies</strong></li><li><strong>Manual coordination of deployments</strong></li><li><strong>Stateful apps that didn’t scale horizontally well</strong></li></ul><p>In hindsight, many of the problems we faced — sync issues, scaling pain, global failures — were actually symptoms of a system <strong>not designed for distribution, resilience, or autonomy</strong>.</p><h3>What We Missed About Distributed Systems</h3><p>A <strong>distributed system</strong> isn’t just a cluster of services or a fancy tech stack. It’s a mindset and architectural model where:</p><ul><li>Each <strong>service is autonomous</strong></li><li>Failures in one area <strong>don’t take down the whole app</strong></li><li>Communication is done via <strong>APIs or messaging</strong>, not shared memory or databases</li><li>Systems are <strong>observable, testable, and independently deployable</strong></li><li>Teams can own their services and deliver value <strong>in parallel</strong></li></ul><p>Had we designed our core systems with distributed principles in mind, many things could have been different:</p><ul><li>Branch clients could sync via <strong>APIs</strong>, not zipped FTP files</li><li>Mobile apps could access real-time services directly, without relying on an ESB bottleneck</li><li>Critical services like transactions, scoring, and user management could scale independently</li><li>Teams could develop and deploy without waiting for the “big bang” monolith release</li></ul><h3>Final Thoughts</h3><p>I look back on those challenges now with a different perspective. At the time, we did the best we could with what we had. But we were trying to scale and modernize a system that was never designed to be distributed.</p><p>What I’ve learned since then is this:</p><blockquote><strong><em>A distributed system is not a silver bullet — but it’s a better foundation when you want to grow, adapt, and survive failure.</em></strong></blockquote><p>Today, I’m more intentional about <strong>service boundaries</strong>, <strong>asynchronous communication</strong>, <strong>fault isolation</strong>, and <strong>observability</strong>.<br> But those lessons were born from hard experience — watching a banking platform stretch to its limits, and realizing later what we really needed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=09a23cf448a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Java OOP in a Real-World Banking System]]></title>
            <link>https://medium.com/@kiana.proudmoore/understanding-java-oop-in-a-real-world-banking-system-de4192848b52?source=rss-fb4ae54f9db4------2</link>
            <guid isPermaLink="false">https://medium.com/p/de4192848b52</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[banking-system]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[solid-principles]]></category>
            <category><![CDATA[objectorientedprogramming]]></category>
            <dc:creator><![CDATA[Riskiana]]></dc:creator>
            <pubDate>Tue, 01 Jul 2025 05:49:56 GMT</pubDate>
            <atom:updated>2025-07-24T08:17:08.309Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*Sb0o8ltdpHf3hsG2qTAT_A.png" /></figure><h3>The Problem: Banking in a Nutshell</h3><p>Imagine you’re building a core banking system.</p><p>You’ve got:</p><ul><li><strong>Customers</strong>: People or businesses with names, contact details, and IDs.</li><li><strong>Accounts</strong>:</li><li>SavingsAccount: earns interest, may have withdrawal limits</li><li>CheckingAccount: for daily use, no interest</li><li>LoanAccount: borrowed money with repayment schedules</li><li><strong>Transactions</strong>: Deposits, withdrawals, transfers, loan payments</li><li><strong>Branches</strong>: Where accounts live and operations happen</li></ul><p>🧠 A few tables, a few APIs — done? Not even close.</p><p><strong>The Problem: A Legacy Banking Module on the Brink</strong></p><p>Let’s imagine this:<br> You’ve just joined a bank. The <strong>core transaction system</strong> has existed for a decade. It handles savings, checking, and loan accounts — all in one <strong>giant, procedural class</strong>:</p><pre>public class BankingSystem {<br>    public void deposit(String accountType, double amount) { /* ... */ }<br>    public void withdraw(String accountType, double amount) { /* ... */ }<br>    public void printStatement(String accountType) { /* ... */ }<br>    public void applyInterest(String accountType) { /* ... */ }<br>}</pre><p>The codebase is littered with if(accountType.equals(&quot;Savings&quot;)) and else if(accountType.equals(&quot;Loan&quot;)).<br> And guess what? A new <strong>Digital Wallet</strong> feature is coming next quarter.</p><p><strong>Code change = risk of breaking everything.</strong><br> <strong>Low readability, high complexity, tight coupling.</strong><br> <strong>No single responsibility. And forget about reusability.</strong></p><h3>Thinking Beyond the Obvious: Future Possibilities and Hidden Potholes</h3><p>The real challenge isn’t just building what you see — it’s preparing for what’s coming:</p><ul><li><strong>New Account Types</strong>: What if they launch “Fixed Deposit” or “Student Savings” with custom rules? A rigid design means rewriting everything.</li><li><strong>Complex Transactions</strong>: Think international transfers, fraud flags, or currency conversions.</li><li><strong>Security &amp; Auditing</strong>: Who accessed what? When? Is it logged and compliant?</li><li><strong>Scale</strong>: Can your system handle millions of concurrent transactions without collapsing?</li><li><strong>Integrations</strong>: You’ll need to connect to credit bureaus, tax systems, payment gateways.</li><li><strong>Analytics</strong>: Leadership wants live dashboards and financial reports — not SQL dumps.</li></ul><p>This is <strong>why Object-Oriented Programming is essential</strong>. It’s not fluff. It’s how you model complexity, evolve safely, and avoid spaghetti nightmares.</p><h3>🧠 Thinking in Objects — Not Just Code</h3><p>Before writing a single method, step back and model your <strong>business domain</strong>:</p><ul><li>Account (abstract)</li><li>SavingsAccount, CheckingAccount, LoanAccount (concrete)</li><li>Transaction</li><li>Statement, AuditLog</li><li>InterestCalculator, TransactionFeePolicy (behavioral strategies)</li><li>AccountService, TransactionService (orchestrators)</li></ul><p>Each object mirrors a real-world concept. This <strong>maps business logic directly into your code</strong> — making it easier to evolve, test, and reason about.</p><blockquote><em>TL;DR: The best banking systems don’t just process data — they reflect the domain. That’s what OOP empowers you to build.</em></blockquote><h3>🏛️ The 4 Pillars of Java OOP in Banking Systems</h3><h4>1. Encapsulation: The Bank Vault Principle</h4><p>Encapsulation means keeping the internal state of an object <strong>private and protected</strong>, only accessible through <strong>well-defined methods (object’s public methods)</strong>. It’s like placing your business rules inside a vault — no one gets in without permission.</p><p>🔥 Nightmare Scenario</p><p>In a legacy banking system, any developer can do this:</p><pre>public class BankAccount {<br>    public double balance; // Public field = disaster waiting to happen<br>}</pre><p>What Could Go Wrong?</p><ul><li>There’s no validation</li><li>Fraud: Hackers could set account.balance = 9999999</li><li>Race Conditions: Concurrent threads corrupting balances</li><li>No Audit Trail: No way to track who changed what</li></ul><h4>The Secure OOP Solution</h4><p>We encapsulate the balance and expose only controlled methods:</p><pre>public class BankAccount {<br>    private final String accountId; // Immutable identifier<br>    private double balance; // Private = safe from direct access<br>    private final List&lt;Transaction&gt; auditLog = new ArrayList&lt;&gt;();<br><br>    // Thread-safe deposit<br>    public synchronized void deposit(double amount) {<br>        if (amount &lt;= 0) throw new IllegalArgumentException(&quot;Invalid amount&quot;);<br>        balance += amount;<br>        auditLog.add(new DepositTransaction(amount));<br>    }<br><br>    // Controlled withdrawal<br>    public synchronized void withdraw(double amount) throws InsufficientFundsException {<br>        if (amount &gt; balance) throw new InsufficientFundsException();<br>        balance -= amount;<br>        auditLog.add(new WithdrawalTransaction(amount));<br>    }<br><br>    // Read-only balance access<br>    public double getBalance() { return balance; }<br>}</pre><h4>All state changes are now <strong>guarded by logic</strong>, and no external class can directly mutate the balance.</h4><p><strong>Why This Works:<br></strong>✔ No direct balance modification (prevents fraud)<br>✔ Thread-safe (synchronized prevents race conditions)<br>✔ Audit trail (every transaction is logged)</p><p>Pro Tip: For high-performance systems:</p><ul><li>Use AtomicDouble instead of synchronized</li><li>Move validation to a separate TransactionValidator service</li></ul><h4>2. Inheritance: Designing Financial Products</h4><p>Inheritance enables one class to <strong>reuse fields and methods</strong> from another. It’s how you centralize shared behavior and reduce redundancy across similar objects.</p><p><strong>Nightmare Scenario:</strong><br>You’re managing multiple account types — SavingsAccount, CheckingAccount, LoanAccount — and all of them duplicate the same apply monthlyFee, deposit or withdrawal logic.</p><pre>public class SavingsAccount {<br>    private double balance;<br>    public void applyMonthlyFee(double amount) {<br>        balance += amount;<br>    }<br>}</pre><p>This violates the <strong>DRY principle</strong>. If the deposit logic changes (e.g., adding audit logging or business rules), you must update every class. One mistake, and you’ve got inconsistencies across your system. One missed update? A bug in production.</p><p>It gets worse with logic like this:</p><pre>public class Account {<br>    public void applyMonthlyFee() {<br>        if (accountType == AccountType.SAVINGS) {<br>            // savings logic<br>        } else if (accountType == AccountType.CHECKING) {<br>            // checking logic<br>        }<br>        // ... more spaghetti<br>    }<br>}</pre><p>This design is:</p><ul><li>❌ <strong>Fragile</strong> — one change can break others</li><li>❌ <strong>Tightly coupled</strong> — account logic is mixed together</li><li>❌ <strong>Hard to test</strong> — you must test every path with every change</li></ul><h3><strong>Secure OOP Solution</strong></h3><p>We refactor into a <strong>proper inheritance hierarchy</strong>, letting each account type define its own behavior by defining a common abstract superclass with shared fields and structure:</p><pre>public abstract class BankAccount {<br>    protected String accountNumber;<br>    protected double balance;<br><br>    public abstract void applyMonthlyMaintenance();<br>}</pre><p>Defining Subclasses like SavingsAccount and LoanAccount just override what’s unique.</p><pre>public class SavingsAccount extends BankAccount {<br>    private double interestRate;<br><br>    @Override<br>    public void applyMonthlyMaintenance() {<br>        balance += balance * interestRate / 12;<br>    }<br>}<br><br>public class CheckingAccount extends BankAccount {<br>    private double monthlyFee;<br><br>    @Override<br>    public void applyMonthlyMaintenance() {<br>        balance -= monthlyFee;<br>    }<br>}</pre><p><strong>Why This Works:</strong></p><ul><li><strong>removes duplication</strong> and ensures <strong>common behavior</strong> stays consistent across the system.</li><li><strong>Cleaner Testing</strong>: Each account class can be tested in isolation</li><li><strong>Eliminates Type Checks</strong>: No more if(accountType == ...) — behavior is now distributed to the right place.</li><li><strong>Improves Readability &amp; Maintenance</strong>: Each class does one thing well.</li></ul><p>You can now apply monthly maintenance across all account types without knowing their concrete class:</p><pre>List&lt;BankAccount&gt; accounts = List.of(<br>    new SavingsAccount(),<br>    new CheckingAccount()<br>);<br><br>for (BankAccount acc : accounts) {<br>    acc.applyMonthlyMaintenance(); // Polymorphic call<br>}</pre><p>No if-else. No switch-case. Just clean, extendable code.</p><p>🧠 The combination of inheritance and polymorphism allows your system to grow <strong>horizontally</strong> (add new types) instead of <strong>vertically</strong> (add more complexity to existing classes). That’s the key to designing systems that last.</p><h4>3. Polymorphism: Processing Transactions Safely</h4><p>While polymorphism helps you structure your domain objects, it becomes even more powerful when applied to business processes and workflows — especially in <strong>transaction orchestration</strong>.</p><p>Polymorphism (meaning “many forms”) allows objects of different classes to be treated as objects of a common type. In Java, this is primarily achieved through method overriding (subclasses providing their own implementation of a method defined in the superclass) and interfaces.</p><h4>Nightmare Scenario</h4><p>Your transaction processor looks like this:</p><pre>public void processTransaction(Transaction t) {<br>    if (t instanceof Transfer) {<br>        // Transfer logic<br>    } else if (t instanceof Deposit) {<br>        // Deposit logic<br>    }<br>    // ... more conditionals<br>}</pre><p><strong>Why This Fails:</strong></p><ul><li>Adding new transaction types requires modifying this method</li><li>No isolation of transaction logic</li></ul><p><strong>The Robust Solution: Interface-Based Transactions</strong></p><p>We model each transaction as a <strong>Command</strong> — a standalone object that knows how to <strong>execute</strong> and <strong>rollback</strong> itself. This follows two key OOP principles:</p><ul><li><strong>Polymorphism</strong>: All transactions implement a common interface.</li><li><strong>Command Pattern</strong>: Encapsulate requests as objects.</li></ul><p>First we introduce a Transaction interface:</p><pre>public interface Transaction {<br>    void execute() throws TransactionException;<br>    void rollback();<br>}</pre><p>then , each transaction becomes its own class:</p><pre>public class WireTransfer implements Transaction {<br>    private final Account from;<br>    private final Account to;<br>    private final double amount;<br><br>    public WireTransfer(Account from, Account to, double amount) {<br>        this.from = from;<br>        this.to = to;<br>        this.amount = amount;<br>    }<br><br>  @Override<br>  public void execute() {<br>        // 1. Validate accounts<br>        // 2. Check fraud rules<br>        // 3. Move money<br>    }<br><br>  @Override    <br>  public void rollback() {<br>        // Reverse the transfer<br>    }<br>}<br></pre><p>then, introduce <strong>TransactionProcessor</strong> to coordinate transaction execution without knowing the type of transaction.</p><pre>public class TransactionProcessor {<br><br>    public void process(Transaction transaction) {<br>        try {<br>            transaction.execute();<br>            // maybe log success or persist to DB<br>        } catch (TransactionException e) {<br>            System.err.println(&quot;Transaction failed: &quot; + e.getMessage());<br>            transaction.rollback();<br>            // optionally log failure<br>        }<br>    }<br>}</pre><p>usage example:</p><pre>TransactionProcessor processor = new TransactionProcessor();<br>Transaction wire = new WireTransfer(account1, account2, 1000.0);<br>processor.process(wire);</pre><p><strong>Key Benefits:</strong></p><ul><li>Cleaner code, free from rigid type checks.</li><li>New transactions can be added without changing the processor</li><li>Built-in rollback for failure recovery</li></ul><p>Pro Tip: For distributed systems, use the Saga Pattern:</p><pre>public interface CompensatingTransaction {<br>    void execute();<br>    void compensate(); // Reverse if something fails later<br>}</pre><p>🧠 This kind of polymorphism isn’t about modeling objects — it’s about <strong>orchestrating behavior</strong>. That makes it ideal for workflows, scheduling systems, pipelines, and more.</p><h4>4. Abstraction: Simplifying Complex Banking Operations</h4><p>Abstraction hides complex logic behind a clean, simple interface.</p><p><strong>The Problem: When Banking Systems Become Too Complex</strong></p><p>Imagine a junior developer trying to implement a funds transfer:</p><pre>public void transferFunds(String fromAccount, String toAccount, double amount) {<br>    // Step 1: Validate KYC status<br>    KycService kyc = new KycService();<br>    if (!kyc.isVerified(fromAccount) || !kyc.isVerified(toAccount)) {<br>        throw new ComplianceException(&quot;KYC verification failed&quot;);<br>    }<br><br>    // Step 2: Check fraud patterns<br>    FraudDetectionService fraud = new FraudDetectionService();<br>    FraudRisk risk = fraud.assessTransferRisk(fromAccount, toAccount, amount);<br>    if (risk.isHighRisk()) {<br>        throw new FraudSuspicionException();<br>    }<br><br>    // Step 3: Execute core banking transaction<br>    CoreBankingService cbs = new CoreBankingService();<br>    TransactionResult result = cbs.postTransaction(fromAccount, toAccount, amount);<br><br>    // Step 4: Handle notifications<br>    NotificationService notifications = new NotificationService();<br>    notifications.sendTransferReceipt(fromAccount, toAccount, amount);<br><br>    // Step 5: Update audit logs<br>    AuditService audit = new AuditService();<br>    audit.logTransaction(fromAccount, toAccount, amount, result.getReferenceId());<br><br>    // ...and 10 more steps<br>}</pre><p><strong>Why This Fails:</strong></p><ul><li>The caller needs to understand all implementation details</li><li>Changes require modifying every place transfers are used</li><li>Testing becomes extremely difficult</li></ul><h4>The Abstraction Solution: Banking as a Service</h4><p>We create a clean abstraction:</p><pre>public interface BankingService {<br>    /**<br>     * Transfers funds between accounts<br>     * @param request Contains all transfer details<br>     * @return Receipt with transaction reference<br>     * @throws BankingException for any failures<br>     */<br>    TransferReceipt transferFunds(TransferRequest request) throws BankingException;<br>}</pre><p>Implementation Handles Complexity:</p><pre>public class CoreBankingService implements BankingService {<br>    private final KycService kyc;<br>    private final FraudDetectionService fraud;<br>    private final TransactionProcessor processor;<br>    private final NotificationService notifier;<br>    private final AuditService auditor;<br><br>    @Override<br>    @Transactional<br>    public TransferReceipt transferFunds(TransferRequest request) {<br>        // Validate<br>        kyc.validate(request.fromAccount());<br>        fraud.checkTransferRisk(request);<br>        <br>        // Execute<br>        Transaction tx = processor.initiateTransfer(request);<br>        <br>        // Notify<br>        notifier.sendTransferNotification(request, tx);<br>        <br>        // Audit<br>        auditor.recordTransaction(tx);<br>        <br>        return new TransferReceipt(tx.getId(), tx.getTimestamp());<br>    }<br>}</pre><h4>Why This Works</h4><p><strong>✔ Simplified Interface</strong><br>Clients call one method without knowing about:</p><ul><li>KYC checks</li><li>Fraud detection</li><li>Transaction posting logic</li></ul><p><strong>✔ Implementation Flexibility</strong><br>Can change internal processing without affecting callers</p><p><strong>✔ Cross-Cutting Concerns</strong></p><ul><li>Transaction management (@Transactional)</li><li>Error handling</li><li>Logging</li></ul><p>Real-World Example:<br>When we needed to add AML (Anti-Money Laundering) checks, we only modified the CoreBankingService implementation - no client code changes required.</p><h3>🛠️ Tips &amp; Best Practices</h3><h4>1. Favor Composition over Inheritance</h4><p>Use inheritance <strong>only when there’s a clear “is-a” relationship</strong> (e.g., SavingsAccount is an Account). Otherwise, <strong>prefer composition</strong>, where classes <strong>contain</strong> other components that can be reused and swapped easily.</p><p>Let’s say you want different types of accounts to send different notifications.</p><pre>public class EmailNotifyingAccount extends Account {<br>    public void notifyUser() {<br>        // Send email<br>    }<br>}</pre><p>Now what if you also need to support SMS, push, or WhatsApp? You’ll end up with SmsNotifyingAccount, PushNotifyingAccount, and a mess of subclasses.</p><p>✅ Better: Use composition</p><pre>public class Account {<br>    private NotificationService notificationService;<br><br>    public Account(NotificationService notificationService) {<br>        this.notificationService = notificationService;<br>    }<br><br>    public void notifyUser(String message) {<br>        notificationService.send(message);<br>    }<br>}</pre><p>Now you can inject any strategy:</p><pre>new Account(new EmailNotification());<br>new Account(new SmsNotification());</pre><p>This approach uses composition to <strong>separate concerns</strong> — the account focuses on business rules, and notification is handled independently. You avoid deep hierarchies and keep each class focused on a single responsibility.</p><blockquote><em>💡 Rule of thumb: If you’re subclassing just to swap one behavior, you’re better off using composition.</em></blockquote><h4>2. Use Factory Pattern for Object Creation</h4><p>Instead of scattering new SavingsAccount() across your codebase, centralize object creation in a factory:</p><pre>public class AccountFactory {<br>    public static Account createAccount(String type) {<br>        return switch (type) {<br>            case &quot;savings&quot; -&gt; new SavingsAccount();<br>            case &quot;loan&quot; -&gt; new LoanAccount();<br>            default -&gt; throw new IllegalArgumentException(&quot;Unknown type&quot;);<br>        };<br>    }<br>}</pre><p>This helps <strong>decouple instantiation logic</strong> and prepares your system for future account types or runtime configuration.</p><h4>3. Separate Concerns Using Layers</h4><p>A robust banking application should follow <strong>clean architecture layering</strong>:</p><ul><li><strong>Presentation Layer</strong> — REST controllers, APIs</li><li><strong>Service Layer</strong> — Business orchestration logic</li><li><strong>Domain Layer</strong> — Core entities and domain rules</li><li><strong>Persistence Layer</strong> — Repositories, DAOs</li></ul><p>Each layer has a clear role and <strong>only one reason to change</strong>, aligning with the <strong>Single Responsibility Principle</strong>.</p><h4><strong>4. </strong>Leverage Strong Typing and Enums</h4><p>Avoid “magic strings” for things like &quot;LOAN&quot;, &quot;SAVINGS&quot;, or &quot;FAILED&quot;. Instead, use enums:</p><pre>public enum AccountType { SAVINGS, CHECKING, LOAN }</pre><p>This improves <strong>readability, type safety, and reduces runtime bugs</strong>. Your compiler becomes a partner in catching errors.</p><h4><strong>5. </strong>Embrace Domain-Driven Design (DDD)</h4><p>In complex systems like banking, <strong>Domain-Driven Design</strong> helps you build software that reflects the business model accurately. Model core business concepts (e.g., Aggregate, Entity, Value Object), and group logic where it naturally belongs — inside the domain.</p><h4><strong>6. Testing, Testing, Testing</strong></h4><p>In financial systems, <strong>bugs are expensive</strong>. You need a layered testing strategy:</p><ul><li><strong>Unit tests</strong> for core business rules</li><li><strong>Integration tests</strong> for service and DB interactions</li><li><strong>End-to-end tests</strong> for real-world flows (deposit → withdrawal → rollback)</li></ul><p><strong>Test edge cases</strong> like overdrafts, race conditions, fraud scenarios, currency rounding errors, etc.</p><h3>🧵 Final Thoughts</h3><blockquote><em>OOP isn’t just for textbook examples.<br> In real-world systems like banking, it’s the foundation for </em><strong><em>scalability, maintainability, and sanity.</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de4192848b52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ From Confusion to Clarity: How the C4 Model Can Transform Your Software Architecture Diagrams]]></title>
            <link>https://medium.com/@kiana.proudmoore/from-confusion-to-clarity-how-the-c4-model-can-transform-your-software-architecture-diagrams-7dcb8a972fc2?source=rss-fb4ae54f9db4------2</link>
            <guid isPermaLink="false">https://medium.com/p/7dcb8a972fc2</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[diagram-software]]></category>
            <category><![CDATA[c4-model]]></category>
            <dc:creator><![CDATA[Riskiana]]></dc:creator>
            <pubDate>Fri, 06 Jun 2025 08:37:08 GMT</pubDate>
            <atom:updated>2025-06-12T12:47:24.832Z</atom:updated>
            <content:encoded><![CDATA[<h3>🧭 Software Architecture Diagrams with the C4 Model: A Developer’s Guide to Clarity and Communication</h3><blockquote><em>“Good architecture diagrams tell a story. The C4 model helps you tell it better.” — </em><a href="https://c4model.com/"><em>Simon Brown</em></a></blockquote><h3>🎯 Why I Wrote This Article</h3><p>As a senior software engineer and aspiring platform architect, I’ve often struggled to explain complex systems clearly — especially to different audiences like stakeholders, internal developers, and SRE/DevOps teams. I knew I needed a better way to communicate architecture.</p><p>This article is based on my learning journey and summarizes key insights from:</p><ul><li>🎥 <a href="https://www.youtube.com/watch?v=x2-rSnhpw0g">“Visualising software architecture with the C4 model” by Simon Brown</a></li><li>📄 <a href="https://c4model.com/">The official C4 Model site</a></li></ul><h3>❌ The Pain of Traditional Architecture Diagrams</h3><p>Have you ever felt lost looking at someone else’s architecture diagram? Me too. Often, these diagrams are:</p><ul><li>Inconsistent in style and meaning</li><li>Overwhelming or lacking detail</li><li>Quickly outdated</li><li>Impossible to understand without explanation</li></ul><p>This makes onboarding difficult, leads to miscommunication, and causes rework</p><h3>📌 What Is the C4 Model?</h3><p>The C4 model, created by Simon Brown, is a structured way to visualize software architecture using <strong>four levels of abstraction</strong>:</p><ol><li><strong>Context — </strong>How your system fits into the broader environment</li></ol><p>Context diagram is the <strong>highest-level diagram</strong>. It shows:</p><ul><li>The <strong>system</strong> you’re building</li><li><strong>Users</strong> and <strong>external systems</strong> around it</li><li>Basic responsibilities of the system</li></ul><p>This is great for onboarding new team members or non-technical stakeholders.</p><p><strong>2. Container — </strong>something that needs to be running in order for the overall software system to work.</p><p>This is where we zoom into the system and identify:</p><ul><li>Web apps, APIs, databases, mobile apps</li><li>How they <strong>communicate</strong> (HTTP, message queues, etc.)</li></ul><p>Ideal for engineers and DevOps to understand <strong>infrastructure layout</strong>.</p><p><strong>3. Component-</strong> The internal structure of each container.</p><p>Now we look inside one container (like a backend service) and show:</p><ul><li>Components/modules/classes</li><li>How they collaborate</li></ul><p>This is helpful during feature development or refactoring.</p><p><strong>4. Code</strong> <em>(optional)</em>: Dive into the source code and class-level view.</p><blockquote><em>✅ Think of C4 like zooming in with Google Maps:<br> Context (city) → Container (districts) → Component (buildings) → Code (rooms)</em></blockquote><p>The sample of each diagrams that represent Internet Banking System can be found in this <a href="https://c4model.com/diagrams">https://c4model.com/diagrams</a></p><h3>🧱 Key Abstractions in C4</h3><blockquote>“To map your code, you first need consistent abstractions.”<em> — c4model.com</em></blockquote><p>C4 uses an <strong>abstraction-first approach</strong> that matches how developers naturally think:</p><ul><li>A <strong>Software System</strong> contains one or more <strong>Containers</strong> (apps, APIs, databases)</li><li>Each <strong>Container</strong> contains <strong>Components</strong> (modules, services)</li><li>Each <strong>Component</strong> is implemented by <strong>Code Elements</strong> (classes, functions)</li><li><strong>People</strong> interact with the system (users, personas)</li></ul><p>These abstractions help teams communicate architecture across different zoom levels without losing the big picture.</p><p>📌 <strong>Notation &amp; Tooling Independent</strong> C4 doesn’t enforce specific tools or styles. Whether you use whiteboards, PlantUML, Structurizr, Lucidchart, or pen and paper, what matters is clarity and consistency.</p><h3>Why That Matters:</h3><ul><li>Promotes consistent diagrams</li><li>Makes architecture easier to maintain</li><li>Reduces ambiguity</li><li>Gives flexibility in tooling choices</li></ul><h3>🛠️ How to Create an Architecture Diagram</h3><ol><li><strong>Pick the Right C4 Level</strong> for your goal (Context, Container, Component, Code)</li><li><strong>Identify Actors</strong>: Who uses or interacts with the system?</li><li><strong>Define Boundaries</strong>: What is “inside” your system? What’s external?</li><li><strong>Add Interactions</strong>: How do components communicate?</li><li><strong>Keep It Simple</strong>: One purpose per diagram</li><li><strong>Use Tools That Support C4</strong>:</li></ol><ul><li><a href="https://github.com/plantuml-stdlib/C4-PlantUML">PlantUML C4 Extensions</a></li><li><a href="https://structurizr.com/">Structurizr</a></li></ul><h3>🎯 Matching Diagrams to the Audience</h3><p>Use the right diagram for the right person:</p><h3><strong>🧑‍💼 For Stakeholders / Product Owners:</strong></h3><ul><li>Use <strong>System Context Diagram</strong></li></ul><p><strong>Content:</strong></p><ul><li>Business value: How the system supports business goals.</li><li>Key functionalities: What the system <em>does</em>.</li><li>Major integrations: Which external systems it interacts with.</li><li>High-level data flow: How information moves through the system.</li><li>Impact on users: Who uses the system and how.</li><li>Avoid: Deep technical jargon, internal component details, specific programming languages, detailed infrastructure.</li></ul><h3><strong>👩‍💻 For Developers:</strong></h3><ul><li><strong>Use Container Diagram</strong> and <strong>Component Diagram</strong></li></ul><p><strong>Content:</strong></p><ul><li>Container responsibilities: Clear definition of what each deployable unit does.</li><li>Technology choices: Specific frameworks, databases, messaging systems used.</li><li>Communication protocols: (e.g., REST, gRPC, Kafka, SQS).</li><li>Data models (high-level): Key entities and their relationships.</li><li>Dependencies: Explicitly show upstream/downstream services.</li><li>Error handling patterns: How errors are managed across services.</li><li>Scaling considerations: Where are the potential bottlenecks?</li></ul><h3><strong>🛠️ For DevOps / SRE Teams:</strong></h3><ul><li>Use <strong>Container Diagrams</strong> + infrastructure views.</li></ul><p><strong>Content:</strong></p><ul><li>Deployment topology: How containers are deployed (e.g., Kubernetes pods, VMs, serverless functions).</li><li>Infrastructure details: Cloud providers, regions, availability zones, networking (VPCs, subnets, load balancers, firewalls).</li><li>Monitoring and logging: Where metrics are collected, logs are stored.</li><li>Resiliency patterns: Redundancy, failover mechanisms.</li><li>Security aspects: Network segmentation, access controls, data encryption.</li><li>Scalability mechanisms: Auto-scaling groups, queues.</li><li>Release process: How code moves from development to production.</li></ul><h3>⚙️ How Architecture Diagrams Help Tech Decisions</h3><p>One common challenge I’ve faced is deciding <strong>what to build</strong> and <strong>what to reuse</strong>. A well-structured architecture diagram provides clarity on this:</p><p>Use the <strong>Container and Component diagrams</strong> to:</p><ul><li>Identify parts of the system already implemented</li><li>Highlight areas where existing libraries, SaaS products, or tools can be reused</li><li>Spot gaps needing custom code</li></ul><h3>🧠 Questions to Ask:</h3><ul><li>Is this part of our core domain?</li><li>Can we use a secure, scalable third-party service?</li><li>What’s the trade-off in cost, time, and maintenance?</li></ul><p>🧪 <strong>Example</strong>: I often consider Auth0 or Keycloak for authentication unless there’s a clear reason to build in-house.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7dcb8a972fc2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java DSA Cheatsheet:Data Structures, Algorithms, and Everyday Use Cases]]></title>
            <link>https://medium.com/@kiana.proudmoore/java-dsa-cheatsheet-data-structures-algorithms-and-everyday-use-cases-3d15b9397798?source=rss-fb4ae54f9db4------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d15b9397798</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[data-structures]]></category>
            <dc:creator><![CDATA[Riskiana]]></dc:creator>
            <pubDate>Sun, 01 Jun 2025 08:47:24 GMT</pubDate>
            <atom:updated>2025-06-01T08:47:24.827Z</atom:updated>
            <content:encoded><![CDATA[<p>Java developers frequently rely on data structures to organize, store, and manage data efficiently. Choosing the right data structure can significantly improve your program’s performance, readability, and scalability. This article covers the essential Java data structures you need to know, explains their concepts, shows how to declare and initialize them, discusses their key methods, and presents real-life use cases.</p><p>A <strong>data structure</strong> is just a way of organizing and storing data so you can use it efficiently. Think of it like choosing the right container:</p><ul><li>Need something fixed and simple? Use an <strong>array</strong>.</li><li>Need something dynamic and searchable? Try a <strong>HashMap</strong>.</li></ul><h3><strong>Core Data Structures in Java</strong></h3><ol><li><strong>Array</strong>: A fixed-size collection of elements of the same data type, stored in contiguous memory locations. <strong>Supports:</strong> Primitive and non-primitive types. <strong>Supports duplicates:</strong> Yes. <strong>Best for:</strong> Fixed-size lists where fast index access is needed. <strong>Use Case:</strong> Storing user input, image processing (pixel arrays).</li></ol><p><strong>Common Operations:</strong></p><ul><li>length — Returns the size of the array.</li><li>Access by index (array[index]) — Get or set element at a specific position.</li><li>Enhanced for-loop (for (type var : array)) — Iterate over all elements.</li></ul><p>Example:</p><pre>int[] numbers = new int[5]; // declaration with fixed size<br>numbers[0] = 10;<br>numbers[1] = 20;<br><br>int[] scores = {90, 85, 70}; // declaration with initialization<br><br>System.out.println(Arrays.toString(numbers));<br>System.out.println(Arrays.toString(scores));</pre><p>Output:</p><pre>[10, 20, 0, 0, 0]<br>[90, 85, 70]</pre><p><strong>2. ArrayList (Dynamic Arrays): </strong>A resizable array implementation in Java that allows dynamic size changes.</p><p><strong>Supports</strong>: Non-primitive types only(use wrapper classes like Integer, Double, etc.).</p><p><strong>Supports duplicates:</strong> Yes<br><strong>Best for</strong>: Dynamic lists with frequent access by index.</p><p><strong>Use Case:</strong>Storing a list of items in a shopping cart (you don’t know how many items a user will add), managing a list of active users in a system.</p><p><strong>Common operations:</strong></p><ul><li>add(Element e) — adds to the end of the list.</li><li>size() — returns the number of elements.</li><li>remove(Object o) — removes the first occurrence.</li><li>Collections.addAll(list, elements...) — adds multiple elements efficiently.</li><li>forEach(consumer) — applies an action to each element (e.g., printing).</li></ul><pre>ArrayList&lt;String&gt; cart = new ArrayList&lt;&gt;();<br>cart.add(&quot;Apple&quot;);<br>cart.add(&quot;Banana&quot;);<br>cart.add(&quot;Mango&quot;);<br>System.out.println(cart);<br><br>System.out.println(&quot;Size: &quot; + cart.size());<br>cart.remove(&quot;Apple&quot;);<br><br>Collections.addAll(cart, &quot;Strawberry&quot;, &quot;Watermelon&quot;);<br><br>cart.forEach(System.out::println);</pre><p>Output:</p><pre>[Apple, Banana, Mango]<br>size:3<br>Banana<br>Mango<br>Strawberry<br>Watermelon</pre><p><strong>3. LinkedList: </strong>A <strong>doubly-linked list</strong> allowing efficient insertions/deletions anywhere where each node holds data and pointers to previous and next nodes. <strong>Supports:</strong> Non-primitive types, <strong>Best for:</strong> Frequent insertions/deletions, especially in the middle of the list.</p><p><strong>Use Case</strong>: Implementing the “undo” functionality in a text editor (each action is a node, linking to the previous action), managing a music playlist where you can easily skip to the next or previous song, or a task queue where tasks are processed one after another.</p><p><strong>Common operations:</strong></p><ul><li><strong>add(E element)</strong> — Adds element at the end.</li><li><strong>addFirst(E element)</strong> — Adds element at the beginning.</li><li><strong>getFirst()</strong> — Retrieves first element without removing it.</li><li><strong>remove(Object o)</strong> — Removes first occurrence of element.</li><li><strong>iterator()</strong> — Provides iterator for traversing.</li></ul><pre>LinkedList&lt;String&gt; history = new LinkedList&lt;&gt;();<br>    history.add(&quot;Home&quot;);<br>    history.addFirst(&quot;Login&quot;);<br>    history.add(&quot;about&quot;);<br>    System.out.println(history);<br><br>    history.addLast(&quot;Logout&quot;);<br>    System.out.println(history);<br><br>    history.removeFirst();<br>    System.out.println(history);<br><br>    history.pop();<br>    System.out.println(history);<br><br>    history.push(&quot;Logout&quot;);</pre><p>output:</p><pre>[Login, Home, about]<br>[Login, Home, about, Logout]<br>[Home, about, Logout]<br>[about, Logout]</pre><p><strong>4. Stack: </strong>Last-In-First-Out (LIFO) collection where elements are added and removed from the top only. <strong>Supports:</strong> Non-primitive types only<br> <strong>Duplicates allowed:</strong> Yes. <strong>Best for:</strong> Undo operations, expression parsing, backtracking algorithms.</p><pre>Stack&lt;String&gt; stack = new Stack&lt;&gt;();<br>stack.push(&quot;A&quot;);                     // Add element to top<br>stack.push(&quot;B&quot;);<br><br>System.out.println(stack.pop());     // Removes and returns &quot;B&quot;<br>System.out.println(stack.peek());    // Returns &quot;A&quot; without removing<br>System.out.println(&quot;Stack empty? &quot; + stack.isEmpty()); //Returns false</pre><p><strong>Common operations:</strong></p><ul><li><strong>push(E element)</strong>: Adds element to the top of the stack.</li><li><strong>pop()</strong>: Removes and returns the top element. Throws exception if empty.</li><li><strong>peek()</strong>: Returns top element without removing it.</li><li><strong>isEmpty()</strong>: Checks whether stack is empty (true/false).</li><li><strong>size()</strong>: Returns number of elements in the stack.</li></ul><p><strong>5. Queue: </strong>First-In-First-Out (FIFO) collection; elements are added at tail and removed from head. <strong>Supports:</strong> Non-primitive types only<br> <strong>Duplicates allowed:</strong> Yes<br> <strong>Use case:</strong> Job scheduling, request handling.</p><p><strong>Common operations:</strong></p><ul><li><strong>add(E element)</strong>: Adds element at tail, throws exception if full.</li><li><strong>offer(E element)</strong>: Adds element at tail, returns false if full (preferred for capacity-limited queues).</li><li><strong>poll()</strong>: Retrieves and removes head element, returns null if empty.</li><li><strong>peek()</strong>: Retrieves head without removing, returns null if empty.</li><li><strong>size()</strong>: Returns number of elements in queue.</li></ul><pre>Queue&lt;String&gt; queue = new LinkedList&lt;&gt;();<br>queue.add(&quot;User1&quot;);                   // Add element at tail<br>queue.add(&quot;User2&quot;);<br><br>System.out.println(queue.poll());     // Removes and returns &quot;User1&quot;<br>System.out.println(queue.peek());     // Returns &quot;User2&quot; without removing<br>System.out.println(queue);            // Prints remaining elements</pre><p><strong>6. HashMap(Hashtable): </strong>Key-value pairs with fast access by key. Keys are unique; values can be duplicates. <strong>Supports:</strong> Non-primitive types only<br> <strong>Duplicates allowed:</strong> Keys — No; Values — Yes<br><strong> Use Case:</strong> Storing user profiles where the user ID is the key and the user object is the value, implementing a cache for frequently accessed data (e.g., API responses), counting frequencies of words in a document.</p><p><strong>Common operations:</strong></p><ul><li><strong>put(K key, V value)</strong>: Adds or updates the key-value mapping.</li><li><strong>get(Object key)</strong>: Retrieves value by key; returns null if key not found.</li><li><strong>remove(Object key)</strong>: Removes key-value pair if key exists.</li><li><strong>keySet()</strong>: Returns a Set of all keys.</li><li><strong>values()</strong>: Returns a Collection of all values.</li><li><strong>entrySet()</strong>: Returns a Set of key-value mappings (Map.Entry).</li></ul><pre> Map&lt;String, String&gt; countries = new HashMap&lt;&gt;();<br>countries.put(&quot;ID&quot;, &quot;Indonesia&quot;);<br>countries.put(&quot;US&quot;, &quot;United States&quot;);<br><br>System.out.println(countries.get(&quot;ID&quot;));   // Returns &quot;Indonesia&quot;<br>countries.remove(&quot;US&quot;);                     // Removes key &quot;US&quot;<br><br>System.out.println(&quot;Keys: &quot; + countries.keySet());    // Prints all keys<br>System.out.println(&quot;Values: &quot; + countries.values());  // Prints all values</pre><p><strong>7. HashSet: </strong>Unordered collection that stores unique elements. It’s typically implemented using a HashMap internally, where the elements are keys and a dummy constant value is used for the map values.</p><p><strong>Supports:</strong> Non-primitive types only. <strong>Duplicates allowed:</strong> No<br><strong>Use case:</strong> Checking if an item has been processed before, finding unique visitors to a website, detecting duplicate entries in a dataset.</p><p><strong>Common operations:</strong></p><ul><li><strong>add(E element)</strong>: Adds element if not already present, returns true if added.</li><li><strong>contains(Object o)</strong>: Checks whether element exists in set.</li><li><strong>remove(Object o)</strong>: Removes element if present.</li><li><strong>size()</strong>: Returns count of unique elements.</li><li><strong>forEach(Consumer&lt;? super E&gt; action)</strong>: Performs the given action on each element.</li></ul><pre>Set&lt;String&gt; emails = new HashSet&lt;&gt;();<br>emails.add(&quot;a@example.com&quot;);<br>emails.add(&quot;a@example.com&quot;);          // Duplicate ignored<br>emails.add(&quot;b@example.com&quot;);<br><br>emails.forEach(System.out::println);</pre><p>output:</p><pre>a@example.com<br>b@example.com</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d15b9397798" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Secret to Faster Microservice Development on Kubernetes? It’s Tilt]]></title>
            <link>https://medium.com/@kiana.proudmoore/streamlining-kubernetes-development-with-tilt-solving-the-pain-of-microservices-workflows-767dc120e151?source=rss-fb4ae54f9db4------2</link>
            <guid isPermaLink="false">https://medium.com/p/767dc120e151</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Riskiana]]></dc:creator>
            <pubDate>Thu, 29 May 2025 07:05:00 GMT</pubDate>
            <atom:updated>2025-06-01T09:09:29.771Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*TzlBUVEevbuGgmTEz5kLbg.png" /></figure><p>Developing microservices on Kubernetes often introduces friction into the local development process. Each change can require multiple commands and several minutes of waiting:</p><pre>Code → docker build → docker push → kubectl apply → wait for pod → check logs → repeat</pre><p>This cycle becomes even more painful in a multi-service setup. To streamline the process, I use k3d as a lightweight Kubernetes cluster and kubectl for managing resources — both running locally. These tools integrate seamlessly with <a href="https://tilt.dev/"><strong>Tilt</strong></a>, which has significantly improved my dev workflow by automating tedious, repetitive tasks.</p><p>Whether you’re just getting started with Kubernetes or already deploying production clusters, this article hopefully can help you understand how <strong>Tilt</strong> simplifies and accelerates local development. <strong>Tilt</strong> — a powerful tool that transforms the local Kubernetes dev workflow into a fast, automated, and synchronized process.</p><h3>Pain Before Tilt</h3><p>If you’ve ever developed microservices with Kubernetes <strong>without Tilt</strong>, you’ll relate to these issues:</p><p><strong>Slow Feedback Loops</strong></p><p>Every code change means rebuilding the Docker image, pushing it to a registry, and deploying it. Multiply that by 5–10 services? It kills your productivity.</p><p><strong>Manual Orchestration</strong></p><p>You had to run multiple shell scripts or commands to make sure all services were up and connected correctly.</p><p><strong>Hard-to-Debug Logs</strong></p><p>You’d run kubectl logs or open multiple tabs just to tail logs from different pods.</p><h3>What Is Tilt?</h3><p><strong>Tilt</strong> is an open-source tool that improves the local development experience for Kubernetes-based applications. It watches the codebase for changes, builds Docker images, applies Kubernetes manifests, and updates running services — all automatically.</p><p>Tilt is an open-source tool that helps developers:</p><ul><li><strong>Build</strong>, <strong>deploy</strong>, and <strong>test</strong> microservices in Kubernetes <strong>locally</strong>.</li><li>Automatically reload and redeploy code changes without restarting everything.</li><li>Simplify the <strong>inner dev loop</strong> (code → build → deploy → test).</li></ul><h3><strong>How Tilt Works</strong></h3><p>Tilt uses a configuration file called <strong>Tiltfile</strong> written in <strong>Starlark</strong> (a Python-like DSL) to define:</p><ul><li>What services to build (e.g., Docker images)</li><li>How to deploy them to Kubernetes</li><li>What to watch for changes (e.g., source code, config files)</li></ul><p><strong>Typical workflow with Tilt:</strong></p><ol><li><strong>Write code</strong> for a microservice.</li><li><strong>Tilt watches</strong> for changes in files (source code, Dockerfile, YAML, etc.).</li><li>When a change is detected:</li></ol><ul><li>Rebuilds the Docker image.</li><li>Re-applies the Kubernetes manifests (e.g., via kubectl apply).</li></ul><p>4. Displays live status and logs in a web UI or terminal.</p><p><em>It speeds up feedback loop from minutes (manual build+push+apply) to seconds.</em></p><p><strong>Tilt works with:</strong></p><ul><li>Local clusters like <strong>k3d</strong>, <strong>Minikube</strong>, <strong>Kind</strong>, or remote clusters.</li><li>Any Kubernetes resource — from deployments and services to CRDs.</li><li>Templating tools like <strong>Carvel YTT(YAML Templating Tool) </strong>for dynamic and DRY YAML configs which enables dynamic Kubernetes manifest generation. This helps avoid duplication and makes configs easier to manage.</li></ul><h3><strong>How Tilt Works with Docker and Kubernetes</strong></h3><p>Tilt acts like the <strong>glue</strong> between your <strong>Docker setup</strong> and your <strong>Kubernetes cluster</strong>.</p><p>Here’s how:</p><ol><li>You define your services and dev workflow in a Tiltfile (written in Starlark).</li><li>Tilt uses Docker (locally or remote) to build container images.</li><li>It deploys these images to your local Kubernetes (e.g., Minikube, KIND, or even a remote dev cluster).</li><li>It watches for file/code changes and triggers rebuilds/redeploys automatically.</li><li>It shows a real-time dashboard of what’s running, logs, and build status.</li></ol><h3><strong>Real Example: Local Microservices Dev with Tilt</strong></h3><p>Suppose you’re building a system with:</p><ul><li>A frontend React app</li><li>A backend Java Spring Boot API</li><li>A PostgreSQL database</li></ul><p>In your Tiltfile, you can define:</p><pre>docker_build(&#39;my-backend&#39;, &#39;./backend&#39;, dockerfile=&#39;Dockerfile&#39;)<br>k8s_yaml(&#39;k8s/backend-deployment.yaml&#39;)<br>k8s_resource(&#39;my-backend&#39;, port_forwards=8080)</pre><p>Now just run:</p><pre>tilt up</pre><p>Tilt handles the rest. You get a nice dashboard at http://localhost:10350 showing what&#39;s running, logs, rebuild status, and more.</p><p>Then edit a line of code in your backend or frontend service.</p><p>Tilt automatically:</p><ul><li>Rebuilds the affected Docker image (Tilt can watch code changes)</li><li>Re-applies the Kubernetes manifests</li><li>Shows you logs in real time</li></ul><p>That’s it. No more docker build, docker push, or kubectl apply spam.</p><p>Tilt is highly customizable. Developers can run:</p><pre>tilt up                     # All services  <br>tilt up backend             # Only backend  <br>tilt up backend frontend    # Selected services  <br>tilt up --to-resource=db    # Specific resource like PostgreSQL</pre><p>This flexibility allows only specific services or resource groups to be deployed — useful when working on one microservice without spinning up everything else.</p><h3>Seamless Cluster Switching</h3><p>Tilt integrates smoothly with local clusters like k3d, Minikube, or kind, and even remote clusters. Switching clusters? Just point your kubectl config to a different context — Tilt picks it up <strong>automatically</strong>.</p><p>No need to reconfigure your whole environment. This is especially useful when testing different environments or switching between team and personal clusters.</p><h3>Early Error Detection</h3><p>One of Tilt’s underrated benefits is its <strong>early error detection</strong>:</p><ul><li>Misconfigured Kubernetes YAML? Tilt catches it instantly.</li><li>Syntax errors in your templating logic (e.g., <a href="https://carvel.dev/ytt/">YTT</a>)? Tilt shows it in the UI.</li><li>Resource not responding? Tilt alerts you immediately.</li></ul><p>You get real-time feedback, saving hours of debugging time later in CI or staging.</p><h3>Final Thoughts</h3><p>Tilt helped me go from spending <strong>5–10 minutes</strong> per change to <strong>5–10 seconds</strong>. It’s become a core part of my development workflow for Kubernetes-based microservices.</p><p>If you’re tired of wasting time with manual Docker builds and slow Kubernetes deployments, give Tilt a try. You might wonder how you ever coded without it.</p><p>…developers can replicate production-like behavior locally with precision and speed.</p><p>Tilt helps ensure that <strong>local setups mirror production</strong> with fewer errors, less boilerplate, minimizes delays, simplifies orchestration, centralizes logs, and — importantly — ensures <strong>development and production stay in sync</strong> through shared configuration.</p><h3>Resources</h3><ul><li>Tilt: <a href="https://tilt.dev/">https://tilt.dev</a></li><li>YTT: <a href="https://carvel.dev/ytt">https://carvel.dev/ytt</a></li><li>k3d: <a href="https://k3d.io/">https://k3d.io</a></li><li>kubectl: <a href="https://kubernetes.io/docs/reference/kubectl">https://kubernetes.io/docs/reference/kubectl</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=767dc120e151" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>