<?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 Arpit Choudhary on Medium]]></title>
        <description><![CDATA[Stories by Arpit Choudhary on Medium]]></description>
        <link>https://medium.com/@arpit.choudhary?source=rss-4d6e81293aab------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rsEfGgJZXy6PgHhSJlykJg.jpeg</url>
            <title>Stories by Arpit Choudhary on Medium</title>
            <link>https://medium.com/@arpit.choudhary?source=rss-4d6e81293aab------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 02:50:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arpit.choudhary/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[The Context Window Is Not Your Engineering Memory]]></title>
            <link>https://medium.com/@arpit.choudhary/the-context-window-is-not-your-engineering-memory-3f2ec4df727a?source=rss-4d6e81293aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f2ec4df727a</guid>
            <dc:creator><![CDATA[Arpit Choudhary]]></dc:creator>
            <pubDate>Tue, 13 Oct 2026 08:23:55 GMT</pubDate>
            <atom:updated>2026-10-13T08:44:37.873Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xkgm2t_gELHKPP36PQpNaQ.png" /></figure><p><em>Why larger context windows alone won’t give AI coding agents the continuity that software engineering requires.</em></p><p>Imagine an AI coding agent implementing authentication in an Android application.</p><p>It places token refresh logic in a shared repository so every feature uses the same behavior. The implementation works. The tests pass.</p><p>A week later, another agent adds background synchronization. It encounters the same requirement and implements its own token refresh logic.</p><p>That feature works, too. But now the application has two implementations of a behavior that was deliberately centralized. Under concurrent requests, they could interfere with each other.</p><p>Both agents completed their tasks successfully.</p><p><strong>So, what went wrong?</strong></p><p>The second agent lacked a reliable connection to an earlier engineering decision: why token refresh was centralized, where that decision applied, and what needed to remain true.</p><p>A larger context window might help it examine more code. But it doesn’t automatically preserve that connection across tasks.</p><p><strong>A context window is not your engineering memory.</strong></p><h3>What the code doesn’t tell you</h3><p>A repository captures the implementation of a system. It doesn’t always capture the reasoning behind it.</p><p>An agent can see that token refresh lives in a shared repository. But was that an intentional architectural decision, a temporary workaround, or simply the most convenient solution for the first feature?</p><p>The answers might be scattered across pull requests, architectural decision records, tickets, and conversations. Some may never have been documented.</p><p>Experienced developers ask these questions because existing code isn’t always authoritative guidance. Sometimes a pattern should be followed. Sometimes it’s technical debt that needs to be removed.</p><p>Giving an agent more files helps only if the relevant reasoning is available, recognizable, and still current.</p><p>That’s the engineering continuity problem: <strong>carrying useful knowledge forward while allowing the system — and its decisions — to evolve.</strong></p><h3>What engineering memory needs to preserve</h3><p>Engineering memory is the durable record of decisions, constraints, and relationships that helps guide future work.</p><p>In our authentication example, a useful record would include:</p><ul><li><strong>Decision:</strong> Token refresh is coordinated through the shared authentication repository.</li><li><strong>Reason:</strong> Independent refresh attempts can conflict when requests run concurrently.</li><li><strong>Scope:</strong> All components making authenticated requests, including background tasks.</li><li><strong>Evidence:</strong> The implementation, relevant reviews, and concurrency tests.</li><li><strong>Status:</strong> Whether the decision remains active or has been superseded.</li></ul><p>This is more useful than a note saying, “Use the repository pattern.” It tells a future agent what matters and why.</p><p>The distinction is straightforward:</p><p><strong>A context window holds information available during an interaction. Engineering memory preserves knowledge across interactions and helps determine what should enter the next one.</strong></p><p>The two are complementary. Persistent knowledge still needs to reach the agent’s working context, and the agent still needs to interpret it correctly.</p><p>Storage alone doesn’t solve that problem.</p><h3>Follow a decision across two tasks</h3><p>Let’s return to the agent implementing background synchronization.</p><p>Before writing code, a useful workflow would connect the task to authentication and recover the active decision about token refresh.</p><p>During implementation, the agent might discover that the existing interface doesn’t support background work cleanly. It now has a legitimate engineering choice: extend the interface, introduce an adapter, or reconsider the original design.</p><p>Memory should help the agent recognize that choice. It shouldn’t turn every historical decision into a permanent rule.</p><p>Validation must then address the original concern. Tests covering the synchronization feature alone may be insufficient; the change might also require checks for concurrent authenticated requests.</p><p>Finally, the outcome should update the engineering record. If centralization remains the design, the new component becomes another consumer. If the team approves a different approach, the old decision should be marked as superseded, with the replacement and its rationale recorded.</p><p>The useful cycle is simple:</p><p><strong>Recover the decision → assess its relevance → validate the change → preserve what changed.</strong></p><p>Without that final step, persistent memory gradually becomes a collection of outdated instructions.</p><h3>Memory, coordination, and verification are different</h3><p>These responsibilities become especially important when multiple agents work on the same system, but they shouldn’t be treated as interchangeable.</p><ul><li><strong>Engineering memory</strong> preserves what was decided and why.</li><li><strong>Coordination</strong> manages who is changing which components, what depends on what, and which tasks must happen first.</li><li><strong>Verification and governance</strong> establish the checks and evidence required before accepting a change.</li></ul><p>In our example, memory explains why token refresh is centralized. Coordination helps prevent agents from working against conflicting assumptions. Verification checks whether the combined implementation preserves the required behavior.</p><p>Each supports the others, but none guarantees the others.</p><p>An agent can retrieve the correct decision and still implement it incorrectly. Two well-coordinated agents can share a mistaken assumption. A passing test suite can miss an architectural constraint.</p><p><strong>Local task completion is useful evidence. It isn’t proof that the combined system is correct.</strong></p><h3>Why semantic search alone isn’t enough</h3><p>Semantic search can help an agent find a relevant design discussion, even when the current task uses different language.</p><p>But similarity alone doesn’t establish authority.</p><p>A document describing the original authentication design may be highly relevant and no longer valid. Another document may describe a proposed replacement that was never approved.</p><p>A useful retrieval workflow needs to answer a few additional questions:</p><ul><li>Is this decision still active?</li><li>Which components does it govern?</li><li>Has a later decision replaced it?</li><li>What implementation or evidence supports it?</li></ul><p>More stored information can make things worse when obsolete guidance looks indistinguishable from current requirements.</p><p>For many projects, ordinary documentation, repository instructions, architectural decision records, tests, and CI provide a strong foundation. Not every team needs a dedicated memory service or a knowledge graph.</p><p>The real challenge is keeping these pieces connected as the project changes.</p><p>When an interface changes, which decisions need review? When a decision is superseded, which agent instructions still repeat it? When several tasks affect a shared component, who catches conflicting assumptions?</p><p>That’s where dedicated tooling can become useful.</p><h3>Where Nool fits</h3><p>This is where I find Nool interesting.</p><p>Nool brings engineering coordination and governance into workflows involving AI coding agents. Its approach connects persistent agent memory, task coordination, evidence trails, and policy gates around repository changes.</p><p>The important idea isn’t simply giving agents more information. It’s helping them work with engineering context while making changes to a larger system.</p><p>One example is Nool’s <strong>Semantic Impact Envelope</strong>. Nool describes computing a change’s potential reach using its repository architecture model and comparing that reach with the declared scope. If the computed impact exceeds that scope, the proposal requires justification.</p><p>In our authentication scenario, this kind of analysis could help expose that a change reaches beyond background synchronization into shared authentication components.</p><p>That gives the workflow a reason to examine the wider consequences rather than treating the task as an isolated implementation.</p><p>Of course, identifying affected components doesn’t prove that token refresh remains correct. The outcome still depends on the architecture model’s coverage, the declared scope, and the checks in place.</p><p>Nool doesn’t eliminate the need for sound engineering decisions and validation. It addresses parts of the broader problem: coordinating changes, making their potential impact visible, and maintaining traceability.</p><p>You can explore <a href="https://www.nool.dev/platform">Nool’s platform</a> and its approach to <a href="https://www.nool.dev/semantic-impact-envelope/">semantic impact analysis</a>.</p><h3>A practical place to start</h3><p>Before adding more infrastructure, choose a few engineering decisions that would be costly for the next agent to miss.</p><p>For each decision, record its rationale, scope, status, and supporting evidence. Link it to the relevant implementation. Make reviewing affected decisions part of changing that implementation.</p><p>Then establish a simple expectation for agent tasks: identify applicable decisions before implementation and report whether the completed work preserved or changed them.</p><p>Engineers still need to decide which constraints matter, which trade-offs are acceptable, and what evidence is sufficient. Agents can help recover and apply that knowledge, but the quality of the process depends on the quality of those judgments.</p><p>The aim isn’t to remember everything. It’s to preserve consequential knowledge.</p><h3>Engineering continuity is the goal</h3><p>Larger context windows give agents more room to reason. Engineering memory helps ensure that the information they reason over includes the decisions and constraints that remain relevant.</p><p>Software evolves through connected changes. An authentication decision made today can shape a synchronization feature next week and an account migration months later.</p><p>That reasoning needs to remain accessible — and revisable — across those tasks.</p><p>The measure of a useful engineering memory system isn’t how much information it stores. It’s whether it helps future work respect current decisions, recognize when they need to change, and leave a trustworthy record for whatever comes next.</p><p><strong>The goal is to carry the right engineering knowledge forward — and keep it worthy of being trusted.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f2ec4df727a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Vibe Coding: A New Rhythm for Building Software in the Age of AI]]></title>
            <link>https://medium.com/@arpit.choudhary/vibe-coding-a-new-rhythm-for-building-software-in-the-age-of-ai-7745edbbc801?source=rss-4d6e81293aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/7745edbbc801</guid>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[aritificial-intelligence]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[future-technology]]></category>
            <dc:creator><![CDATA[Arpit Choudhary]]></dc:creator>
            <pubDate>Sat, 24 May 2025 19:06:38 GMT</pubDate>
            <atom:updated>2025-05-24T19:06:38.695Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ooO6E23SrjrmEbL43S_8hQ.png" /></figure><p><em>“Imagine building apps the way you describe dreams.”</em></p><p>That’s not science fiction. That’s where we’re headed.</p><p>In a world powered by LLMs and context-aware developer tools, software is no longer something you <em>code</em> — it’s something you <strong>create</strong> through <strong>intent</strong>, <strong>conversation</strong>, and <strong>collaboration with AI</strong>.</p><p>Welcome to <strong>vibe coding</strong> — the new way to build.</p><h3>🚧 Why We Need a New Way to Build</h3><p>Let’s start with the truth:<br><strong>Building software today is unnecessarily hard</strong> — for everyone.</p><ul><li>Developers spend 40–60% of their time writing boilerplate and searching documentation.</li><li>Designers hand off pixel-perfect mocks, but developers recreate them imperfectly.</li><li>Product managers write specs, but those specs get lost in translation.</li><li>Non-technical founders sit frustrated, unable to bring their ideas to life.</li></ul><p>We’ve built walls between <strong>ideas and implementation</strong>, <strong>creatives and coders</strong>, <strong>vision and value</strong>.</p><p>That’s what vibe coding tears down.</p><h3>🪩 What Is Vibe Coding, Really?</h3><p><strong>Vibe coding</strong> is the practice of describing what you want — in plain language — and letting AI help you build it.</p><p>Instead of:</p><pre>function createTodoList() {<br>  const list = document.createElement(&quot;ul&quot;);<br>  ...</pre><p>You say:</p><blockquote><em>“Build a to-do list UI with checkboxes, input field, and a clear-all button. Make it in React.”</em></blockquote><p>AI writes the first version.<br>You review, adjust, and improve.<br>You <strong>orchestrate</strong>, not operate.</p><p>It’s a <strong>shift from manual construction to intelligent composition</strong>.</p><p>It’s like going from writing music note-by-note to just humming the tune and letting the band pick it up.</p><h3>🎯 Who Should Care About This?</h3><p>This isn’t just for engineers.It’s for:</p><ul><li>👩‍💻 <strong>Developers</strong>, who want to focus on architecture, logic, and creative problem solving.</li><li>🧠 <strong>Product Managers</strong>, who want to go from spec to prototype without bottlenecks.</li><li>🎨 <strong>Designers</strong>, who want to turn their mockups into real apps.</li><li>🚀 <strong>Founders</strong>, who want to build MVPs without dev teams.</li><li>🧩 <strong>Non-technical creators</strong>, who’ve never touched code but have ideas worth building.</li></ul><p>In the world of vibe coding, <strong>your role isn’t defined by your title — it’s defined by your intent</strong>.</p><h3>🔍 A Closer Look at the Pain We’re Solving</h3><p>Let’s zoom in:</p><h4>🔄 Problem 1: Too much time on “how”, not enough on “what”</h4><p>Dev time is wasted on syntax, formatting, and repetitive logic. AI offloads this.</p><h4>🔄 Problem 2: Translation gaps kill ideas</h4><p>Designers → Devs, PMs → Devs, Founders → Freelancers.<br>The intent gets diluted with every handoff.<br>Vibe coding lets the <strong>originator of the idea drive creation</strong>, directly.</p><h4>🔄 Problem 3: Learning to code is a steep curve</h4><p>Not everyone can learn programming — but everyone can learn to prompt.</p><h3>🧠 What You Should Learn Now to Prepare</h3><p>Here’s the <strong>core skillset</strong> for a vibe coder — explained clearly:</p><h4>1. 🎙 Prompt Engineering for Builders</h4><p>Prompting isn’t just talking to an AI.<br>It’s knowing <strong>how to talk to it well</strong>.</p><p>🔑 A good prompt includes:</p><ul><li><strong>Intent</strong>: “Build a landing page for a finance app.”</li><li><strong>Constraints</strong>: “Use Tailwind CSS. No JS frameworks.”</li><li><strong>Format</strong>: “Return HTML and CSS only.”</li></ul><p>🧪 Practice Exercise:</p><blockquote><em>“Create a Flutter screen that lists books with title, author, and thumbnail, using dummy data.”</em></blockquote><p>Learn by prompting. Iterate until the AI gets it right.<br>That’s how you build muscle memory in vibe coding.</p><h4>2. 🧱 System Thinking &gt; Syntax Mastery</h4><p>Your biggest value is not how well you write code — it’s <strong>how clearly you define problems and systems</strong>.</p><p>As a vibe coder, think like a:</p><ul><li>Product architect (what are the flows?)</li><li>UX storyteller (what’s the experience?)</li><li>Data modeler (how does information move?)</li></ul><p>📌 Sketch flows, draw state machines, write specs — then prompt your AI assistant to scaffold it.</p><h4>3. 🔍 Review and Refine AI Output</h4><p>AI is fast, but not perfect. It <strong>speeds up creation</strong>, but <strong>you own the quality</strong>.</p><p>What you need to get good at:</p><ul><li>Spotting bugs or anti-patterns</li><li>Testing the happy &amp; sad paths</li><li>Adding business logic that AI can’t infer</li><li>Keeping code maintainable</li></ul><p>🧠 Remember: you’re not replacing your brain. You’re <strong>amplifying it</strong>.</p><h4>4. ⚙️ Learn the Tools That Enable Vibe Coding</h4><p>Here’s the <strong>stack to master</strong> right now:</p><p>Here’s the essential toolstack that makes vibe coding possible — and powerful:</p><ul><li><strong>🧠 ChatGPT (GPT-4o)</strong><br>Your all-in-one <strong>architect</strong>, <strong>debugger</strong>, and <strong>creative coder</strong>. It helps you ideate features, write documentation, and generate working code in multiple languages.</li><li><strong>🧩 Cursor IDE</strong><br>A futuristic IDE with GPT built-in. Think of it as your <strong>AI-native coding environment</strong> — perfect for inline suggestions, instant refactoring, and AI-powered file search.</li><li><strong>💡 GitHub Copilot</strong><br>Your pair programmer on steroids. It autocompletes code, writes functions as you type, and helps reduce context switching. Great for speeding up coding sprints.</li><li><strong>🌐 Replit Ghostwriter</strong><br>Ideal for solo devs and startups. Spin up <strong>full-stack apps with backend APIs</strong> using prompts. Build, test, and deploy right from the browser.</li><li><strong>🎨 Figma + Locofy / TeleportHQ</strong><br>Turn UI <strong>designs directly into code</strong> — especially useful for designers and frontend teams. Locofy bridges Figma to Flutter/React; TeleportHQ does similar for web.</li><li><strong>📊 Whimsical / Mermaid.js</strong><br>Use these tools to create <strong>user flows, system diagrams, and state machines</strong> that can be translated into code or directly explained to AI for scaffolding.</li></ul><p>Use them together. Let them “jam” with you.</p><h3>🔮 What the future looks like</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z8S2KCZGVNfpWd4Cm8_k0g.png" /></figure><h3>⚠️ But Let’s Talk Risks Too</h3><p>Vibe coding isn’t magic. It’s powerful — but only with <strong>mindful use</strong>.</p><p>🛑 Risks to manage:</p><ul><li>AI hallucinations (it makes things up!)</li><li>Dependency on models you can’t control</li><li>Loss of low-level skill over time</li><li>Lack of testing discipline</li></ul><p>✅ How to mitigate:</p><ul><li>Always review AI-generated code</li><li>Write or prompt for tests</li><li>Stay curious about the “why” behind the “what”</li></ul><h3>🎧 Final Thought: From Syntax to Symphony</h3><p>We’ve treated software like engineering.</p><p>But in the age of AI, <strong>software is a creative discipline</strong> again.</p><p>You don’t have to write every note — you just need to hum the tune.</p><p>Vibe coding is about:</p><ul><li>Feeling your way through the build</li><li>Thinking in flows, not files</li><li>Building with <strong>clarity, speed, and joy</strong></li></ul><blockquote><em>You’re not just coding anymore.<br>You’re composing. You’re designing.<br>You’re vibing.</em></blockquote><p><strong>Let’s build better — by vibe.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7745edbbc801" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Secure  Mobile App : Best Practices, Modern Techniques, and Real Code Examples]]></title>
            <link>https://medium.com/@arpit.choudhary/building-a-secure-mobile-app-best-practices-modern-techniques-and-real-code-examples-4ce2ac9f63e1?source=rss-4d6e81293aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ce2ac9f63e1</guid>
            <category><![CDATA[secure-coding]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Arpit Choudhary]]></dc:creator>
            <pubDate>Sat, 03 May 2025 07:32:25 GMT</pubDate>
            <atom:updated>2025-05-05T09:41:38.856Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Building a Secure </strong>🔐<strong> Mobile App : Best Practices, Modern Techniques, and Real Code Examples</strong></h3><figure><img alt="secure mobile app" src="https://cdn-images-1.medium.com/max/1024/1*ipcOZLkorLC_4Nt3mwgCmQ.png" /></figure><h3>🏛️ Introduction</h3><p>When developing a banking or payment mobile app, <strong>security isn’t an option — it’s the foundation</strong>.<br>Users trust the app with their most sensitive data: passwords, OTPs, payment credentials, biometric data.</p><p><strong>In this blog</strong>, we will walk through the <strong>latest modern security techniques</strong> that every serious app must follow in 2025 — with <strong>real code examples</strong> to show how you can implement them properly.</p><h3>🧩 Key Security Areas We Will Cover:</h3><ul><li>Secure Key Management (using Android Keystore)</li><li>Data Encryption (EncryptedSharedPreferences, EncryptedFile)</li><li>Biometric Authentication</li><li>Secure Network Communication (HTTPS, SSL Pinning)</li><li>Root Detection and Device Integrity</li><li>Screen Capture Prevention</li><li>Session Timeout and Auto-Logout</li><li>Tamper Detection (Debugger, Emulator)</li></ul><h3>🛡️ 1. Secure Key Management with Android Keystore</h3><p>Sensitive data should <strong>never</strong> be stored directly.<br>Instead, it must be encrypted with a key that is <strong>hardware-protected</strong> using the <strong>Android Keystore System</strong>.</p><p><strong>🔥 Example: Generating a Master Key</strong></p><pre>val masterKey = MasterKey.Builder(context)<br>    .setKeyScheme(MasterKey.KeyScheme.AES256_GCM)<br>    .build()</pre><p>✅ This MasterKey is stored inside the <strong>secure hardware</strong> (TEE / StrongBox) and <strong>cannot be extracted</strong>.</p><h3>🛡️ 2. Data Encryption: EncryptedSharedPreferences &amp; EncryptedFile</h3><p><strong>a) Encrypt Key-Value Pairs (Tokens, Email, User Settings)</strong></p><pre>val securePrefs = EncryptedSharedPreferences.create(<br>    context,<br>    &quot;secure_banking_prefs&quot;,<br>    masterKey,<br>    EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,<br>    EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM<br>)<br><br>securePrefs.edit()<br>    .putString(&quot;access_token&quot;, &quot;sensitive_token_value&quot;)<br>    .apply()</pre><p>✅ Internally uses <strong>two random AES keys</strong> (one for keys, one for values) that are encrypted with the <strong>MasterKey</strong>.</p><p><strong>b) Encrypt Files (Statements, Reports)</strong></p><pre>val encryptedFile = EncryptedFile.Builder(<br>    file,<br>    context,<br>    masterKey,<br>    EncryptedFile.FileEncryptionScheme.AES256_GCM_HKDF_4KB<br>).build()<br><br>encryptedFile.openFileOutput().use { outputStream -&gt;<br>    outputStream.write(&quot;User Statement Content&quot;.toByteArray())<br>}</pre><p>✅ Use this for <strong>user invoices</strong>, <strong>bank statements</strong>, <strong>confidential documents</strong>.</p><h3>🛡️ 3. Biometric Authentication for Sensitive Actions</h3><p><strong>🔥 Example: Authenticate Before Payment</strong></p><pre>val biometricPrompt = BiometricPrompt(<br>    activity,<br>    executor,<br>    object : BiometricPrompt.AuthenticationCallback() {<br>        override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {<br>            proceedWithPayment()<br>        }<br>    })<br><br>val promptInfo = BiometricPrompt.PromptInfo.Builder()<br>    .setTitle(&quot;Confirm Payment&quot;)<br>    .setSubtitle(&quot;Authenticate to continue&quot;)<br>    .setNegativeButtonText(&quot;Cancel&quot;)<br>    .build()<br><br>biometricPrompt.authenticate(promptInfo)</pre><h3>🛡️ 4. Secure Network Communication (HTTPS + SSL Pinning)</h3><ul><li>Always use <strong>HTTPS</strong> for network communication.</li><li><strong>Enforce SSL Pinning</strong> to avoid MITM attacks.</li></ul><p><strong>🔥 Example: Retrofit with SSL Pinning</strong></p><pre>val certificatePinner = CertificatePinner.Builder()<br>    .add(&quot;yourapi.bank.com&quot;, &quot;sha256/yourPublicKeyHashHere==&quot;)<br>    .build()<br><br>val okHttpClient = OkHttpClient.Builder()<br>    .certificatePinner(certificatePinner)<br>    .build()<br><br>val retrofit = Retrofit.Builder()<br>    .baseUrl(&quot;https://yourapi.bank.com/&quot;)<br>    .client(okHttpClient)<br>    .build()</pre><p>✅ SSL pinning ensures that your app trusts <strong>only your real server’s SSL certificate</strong>, not fake ones.</p><h3>🛡️ 5. Root Detection and Device Integrity Check</h3><p>Allowing access to a rooted or compromised device can be <strong>dangerous</strong>.</p><p><strong>🔥 Example: Basic Root Detection</strong></p><pre>fun isDeviceRooted(): Boolean {<br>    val paths = arrayOf(<br>        &quot;/system/app/Superuser.apk&quot;,<br>        &quot;/system/xbin/su&quot;,<br>        &quot;/system/bin/su&quot;<br>    )<br>    return paths.any { File(it).exists() }<br>}</pre><p>✅ Show warning and <strong>block</strong> sensitive operations if the device is rooted.</p><p>✅ Use <strong>Play Integrity API</strong> for stronger attestation (recommended).</p><h3>🛡️ 6. Prevent Screenshots and Screen Recording</h3><pre>window.setFlags(<br>    WindowManager.LayoutParams.FLAG_SECURE,<br>    WindowManager.LayoutParams.FLAG_SECURE<br>)</pre><p>✅ Set this flag on <strong>LoginActivity</strong>, <strong>Transaction Screens</strong>, <strong>Sensitive Info Screens</strong>.</p><h3>🛡️ 7. Session Timeout and Auto Logout</h3><p>Force logout after inactivity to prevent unauthorized access.</p><p><strong>🔥 Example: Auto-Logout After 5 Minutes of Inactivity</strong></p><pre>private var lastInteractionTime = System.currentTimeMillis()<br><br>override fun onUserInteraction() {<br>    super.onUserInteraction()<br>    lastInteractionTime = System.currentTimeMillis()<br>}<br><br>fun shouldLogout(): Boolean {<br>    return (System.currentTimeMillis() - lastInteractionTime) &gt; 5 * 60 * 1000<br>}</pre><h3>🛡️ 8. Tamper Detection (Debugger, Emulator)</h3><p>Detect if app is running under debug mode or emulator.</p><p><strong>🔥 Example: Debugger Detection</strong></p><pre>fun isDebuggerAttached(): Boolean {<br>    return Debug.isDebuggerConnected() || Debug.waitingForDebugger()<br>}</pre><p>✅ Exit or block sensitive features if debugger is attached.</p><h3>📈 Conclusion</h3><p>Building a <strong>secure banking app</strong> today requires a <strong>multi-layered approach</strong>.<br>You must combine:</p><ul><li>Keystore-based encryption</li><li>Biometric authentication</li><li>Secure networking</li><li>Integrity checks</li><li>Tamper detection</li></ul><p>Modern Android provides excellent APIs like <strong>MasterKey</strong>, <strong>EncryptedSharedPreferences</strong>, <strong>BiometricPrompt</strong>, and <strong>Play Integrity API</strong> to help you achieve <strong>real banking-grade security</strong> — but only if you use them wisely.</p><p>🛡️ Security is not a one-time task — <strong>It’s a discipline.</strong><br>You build it in layers, with precision, and audit it regularly.</p><h3>🎯 Final Note:</h3><p>If your users trust your app with their money,<br>you must <strong>earn</strong> that trust through <strong>world-class security</strong>.</p><blockquote>That said, <strong>I’m always open to suggestions, feedback, or better alternatives</strong>.<br>These methods reflect what I’ve found effective, but if you’re a developer working on similar high-security apps — <strong>I’d love to hear your approach or insights.</strong><br>Let’s keep learning and securing better — together. 💬🔐</blockquote><blockquote><strong>Edited</strong> : Even with secure storage and encrypted communication, your secure mobile app can be compromised at <strong>runtime</strong> using tools like:Frida, Magisk, Xposed.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ce2ac9f63e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kotlin runCatching Explained: A Cleaner Alternative to try-catch ?]]></title>
            <link>https://medium.com/@arpit.choudhary/kotlin-runcatching-explained-a-cleaner-alternative-to-try-catch-5010a326062d?source=rss-4d6e81293aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/5010a326062d</guid>
            <category><![CDATA[jetpack]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Arpit Choudhary]]></dc:creator>
            <pubDate>Sun, 27 Apr 2025 09:57:06 GMT</pubDate>
            <atom:updated>2025-05-09T09:41:04.173Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kotlin runCatching Explained: A Cleaner Alternative to try-catch ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SgzhxXLAT_qaTzKzGe9Zpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/0*kEaeclwZ8Q4_yLL_" /></figure><p>Handling errors gracefully is a fundamental skill in building reliable Kotlin applications.<br>Most developers start by using the familiar try-catch blocks — and while they work, they often lead to verbose, nested, and hard-to-read code.</p><p>Luckily, Kotlin offers a cleaner, more functional alternative: <strong>runCatching</strong>.<br>In this guide, we&#39;ll start from the basics and progressively dive deeper. By the end, you’ll know when and why runCatching is often the better choice.</p><h3>Traditional Error Handling: try-catch</h3><p>In Kotlin (and Java), we usually handle exceptions using try-catch blocks.</p><pre>fun divide(a: Int, b: Int): Int {<br>    return try {<br>        a / b<br>    } catch (e: ArithmeticException) {<br>        println(&quot;Cannot divide by zero.&quot;)<br>        0<br>    }<br>}<br><br>fun main() {<br>    println(divide(10, 2))  // Output: 5<br>    println(divide(10, 0))  // Output: Cannot divide by zero. Then 0<br>}</pre><p>While this works fine for small examples, it becomes increasingly <strong>bulky and error-prone</strong> as operations grow in complexity.</p><h4><strong>Introducing </strong><strong>runCatching</strong></h4><p>Kotlin’s runCatching function provides a <strong>functional and fluent</strong> way to handle exceptions.<br>It wraps risky code inside a block and <strong>returns a </strong><strong>Result object</strong> representing success or failure — <strong>without the need for explicit catch blocks</strong>.</p><h3>A Simple Example</h3><pre>fun divide(a: Int, b: Int): Int {<br>    return runCatching {<br>        a / b<br>    }.getOrElse {<br>        println(&quot;Cannot divide by zero.&quot;)<br>        0<br>    }<br>}<br><br>fun main() {<br>    println(divide(10, 2))  // Output: 5<br>    println(divide(10, 0))  // Output: Cannot divide by zero. Then 0<br>}</pre><p>Notice how the code is <strong>more concise and readable</strong> compared to traditional try-catch.</p><h3>Understanding the Result Type</h3><p>When you use runCatching, it returns a Result object that can be:</p><ul><li><strong>Success(value)</strong> — the operation completed successfully</li><li><strong>Failure(exception)</strong> — the operation threw an exception</li></ul><p>You can work with the result easily:</p><pre>fun riskyOperation(): String {<br>    if (Math.random() &gt; 0.5) throw RuntimeException(&quot;Something went wrong!&quot;)<br>    return &quot;Success!&quot;<br>}<br><br>fun main() {<br>    val result = runCatching { riskyOperation() }<br><br>    if (result.isSuccess) {<br>        println(&quot;Yay! ${result.getOrNull()}&quot;)<br>    } else {<br>        println(&quot;Oops! ${result.exceptionOrNull()?.message}&quot;)<br>    }<br>}</pre><h3>Scaling Up: Chaining Operations with runCatching</h3><p>Real-world applications often require <strong>multiple operations that can fail</strong>.<br>runCatching shines here by letting you <strong>chain</strong> risky operations beautifully.</p><pre>fun fetchDataFromServer(): String {<br>    throw RuntimeException(&quot;Server not reachable&quot;)<br>}<br><br>fun parseData(data: String): Int {<br>    return data.length<br>}<br><br>fun saveData(parsedData: Int) {<br>    println(&quot;Saving data of length: $parsedData&quot;)<br>}<br><br>fun main() {<br>    runCatching { fetchDataFromServer() }<br>        .map { parseData(it) }<br>        .onSuccess { saveData(it) }<br>        .onFailure { println(&quot;Failed due to: ${it.message}&quot;) }<br>}</pre><p>Instead of <strong>deeply nested try-catch blocks</strong>, you get a <strong>linear, readable</strong> flow of operations.</p><h3>Bonus Tip: Recovering from Failures</h3><p>You can also <strong>recover gracefully</strong> from a failure without throwing an error to your users.</p><pre>val result = runCatching { &quot;Kotlin&quot;.substring(10) } // Will throw<br><br>val finalResult = result.getOrDefault(&quot;Fallback value&quot;)<br><br>println(finalResult)  // Output: Fallback value</pre><p>Or using .recover() for more flexible recovery:</p><pre>val finalResult = result.recover { throwable -&gt;<br>    &quot;Recovered from error: ${throwable.message}&quot;<br>}.getOrNull()<br><br>println(finalResult)</pre><h3>When Should You Prefer runCatching?</h3><p>✅ When you want <strong>functional-style error handling</strong>.<br>✅ When you have <strong>multiple dependent risky operations</strong>.<br>✅ When you want to <strong>chain operations cleanly</strong>.<br>✅ When you prefer <strong>working with results instead of exceptions</strong>.<br>✅ When you need <strong>better readability and maintainability</strong>.</p><h3>Final Thoughts</h3><p>Traditional try-catch blocks are reliable but can quickly clutter your code.<br>Kotlin’s runCatching offers a more <strong>elegant</strong>, <strong>functional</strong>, and <strong>readable</strong> way to handle errors.</p><blockquote><strong>“If error handling is making your code messy, it’s a sign you should runCatching it.”</strong></blockquote><p>The next time you catch yourself writing nested try-catch blocks, pause and think:<br><em>&quot;Can I solve this better with </em><em>runCatching?&quot;</em><br>Most often, the answer will be <strong>yes</strong> — and your codebase will thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5010a326062d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Side Effects in Jetpack Compose: A Practical Guide with Code Examples]]></title>
            <link>https://medium.com/@arpit.choudhary/side-effects-in-jetpack-compose-a-practical-guide-with-code-examples-b3336708b216?source=rss-4d6e81293aab------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3336708b216</guid>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[jetpack-compose-state]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Arpit Choudhary]]></dc:creator>
            <pubDate>Mon, 21 Apr 2025 10:02:01 GMT</pubDate>
            <atom:updated>2025-04-21T10:02:01.068Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lGogNfQLtNfw51vnjezPaA.png" /></figure><p>Jetpack Compose uses a declarative approach, where your UI is driven by state. However, most real-world apps rely on more than just state — they require side effects, such as displaying a Toast, retrieving data from a server, or responding to lifecycle changes.</p><p>So, how can we handle side effects effectively in a Compose world filled with recompositions?</p><p>In this guide, we’ll walk through the side effect APIs offered by Jetpack Compose, discuss the best use cases for each, and highlight common mistakes to avoid. You’ll find practical code snippets.</p><p><strong>I. Understanding Side Effects in Jetpack Compose</strong></p><p>Side effects are actions that reach beyond the confines of a composable’s pure function. Examples include:</p><ul><li>Displaying a Toast</li><li>Writing data to local storage</li><li>Logging user activity</li><li>Launching coroutines</li><li>Observing app lifecycle changes</li></ul><p>Because composables recompose often, performing these actions inside them without proper handling can lead to issues like repeated network calls or duplicated logs. Jetpack Compose offers specialized APIs to manage these side effects predictably.</p><p><strong>I. Side Effect APIs Explained</strong></p><ol><li><strong>SideEffect { }</strong></li></ol><p><strong>Purpose:</strong> Runs code after every successful recomposition.<br><strong>Use Case:</strong> Ideal for logging, analytics, or UI-related side updates.</p><pre>@Composable<br>fun Logger() {<br>    SideEffect {<br>        Log.d(&quot;SideEffect&quot;, &quot;This runs after every recomposition&quot;)<br>    }<br>}</pre><p>2. <strong>LaunchedEffect(key)</strong><br><strong>Purpose:</strong> Starts a coroutine when a key changes.<br><strong>Use Case:</strong> Useful for triggering tasks like API calls during state changes.</p><pre>@Composable<br>fun fetchUserData(userId: String) {<br>    LaunchedEffect(userId) {<br>        val user = fetchUser(userId)<br>        // Update state<br>    }<br>}</pre><p>3. <strong>rememberCoroutineScope()</strong><br><strong>Purpose:</strong> Provides a coroutine scope linked to a composable’s lifecycle.<br><strong>Use Case:</strong> Launching coroutines from user interactions like button clicks.</p><pre>@Composable<br>fun SubmitButton() {<br>    val scope = rememberCoroutineScope()<br><br>    Button(onClick = {<br>        scope.launch {<br>            submitForm()<br>        }<br>    }) {<br>        Text(&quot;Submit&quot;)<br>    }<br>}</pre><p>4. <strong>DisposableEffect(key)</strong><br><strong>Purpose:</strong> Handles setup and cleanup tasks.<br><strong>Use Case:</strong> Register or remove observers, sensors, or listeners.</p><pre>@Composable<br>fun RegisterLifecycleObserver() {<br>    val lifecycle = LocalLifecycleOwner.current.lifecycle<br><br>    DisposableEffect(lifecycle) {<br>        val observer = MyObserver()<br>        lifecycle.addObserver(observer)<br><br>        onDispose {<br>            lifecycle.removeObserver(observer)<br>        }<br>    }<br>}</pre><p>5. <strong>rememberUpdateState(newValue)</strong></p><p><strong>Purpose:</strong> Keeps the latest value across recompositions.<br><strong>Use Case:</strong> Show a Snackbar after a delay, but ensure the most recent message is always shown (even if recomposed before delay ends).</p><pre>@Composable<br>fun SnackbarWithUpdatedMessage(message: String, showSnackbar: (String) -&gt; Unit) {<br>    val currentMessage = rememberUpdatedState(message)<br><br>    LaunchedEffect(Unit) {<br>        delay(2000) // Delay before showing<br>        showSnackbar(currentMessage.value) // Always latest message<br>    }<br>}</pre><blockquote>🧠 rememberUpdatedState is perfect when you launch a coroutine only once, but the data inside might change.</blockquote><p>6. <strong>produceState{}</strong></p><p><strong>Purpose:</strong> Converts a suspending function into a state object.<br><strong>Use Case:</strong> Fetch live match scores every 5 seconds and show updated data.</p><pre>@Composable<br>fun LiveScoreBoard(): State&lt;String&gt; {<br>    return produceState(initialValue = &quot;Loading...&quot;) {<br>        while (true) {<br>            value = fetchLiveScore() // Your suspend API call<br>            delay(5000) // refresh every 5 seconds<br>        }<br>    }<br>}<br><br>@Composable<br>fun ScoreScreen() {<br>    val score by LiveScoreBoard()<br>    Text(text = &quot;Live Score: $score&quot;)<br>}</pre><blockquote>🔁 produceState shines when you need to convert a coroutine-based flow into Compose-friendly state.</blockquote><p>7. <strong>derivedStateOf{}</strong></p><p><strong>Purpose:</strong> Creates optimized derived values from other states.<br><strong>Use Case:</strong> Only show items that match an active filter. Avoid recomputing unless allItems or filterQuery changes.</p><pre>@Composable<br>fun FilteredList(allItems: List&lt;String&gt;, filterQuery: String) {<br>    val visibleItems by remember(allItems, filterQuery) {<br>        derivedStateOf {<br>            allItems.filter {<br>                it.contains(filterQuery, ignoreCase = true)<br>            }<br>        }<br>    }<br><br>    LazyColumn {<br>        items(visibleItems) { item -&gt;<br>            Text(text = item)<br>        }<br>    }<br>}</pre><blockquote>⚡️ derivedStateOf is great for optimizing expensive operations based on other states, like sorting, filtering, or calculations.</blockquote><p>8. <strong>snapshotFlow{ }</strong></p><p><strong>Purpose:</strong> Converts Compose state to a Flow for reactive streams.<br><strong>Use Case:</strong> Perfect for combining Compose state with debounce or similar operators.</p><pre>@Composable<br>fun DebouncedSearch(query: String) {<br>    LaunchedEffect(Unit) {<br>        snapshotFlow { query }<br>            .debounce(300)<br>            .collect { performSearch(it) }<br>    }<br>}</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c837c3d57543be415accff8ff76fb9d/href">https://medium.com/media/6c837c3d57543be415accff8ff76fb9d/href</a></iframe><h3>Conclusion</h3><p>Handling side effects correctly in Jetpack Compose is essential to keep your app robust, efficient, and bug-free. Compose gives you the tools — you just need to choose the right one for the job.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3336708b216" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>