<?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 Farshid Roohi on Medium]]></title>
        <description><![CDATA[Stories by Farshid Roohi on Medium]]></description>
        <link>https://medium.com/@farshidroohi?source=rss-df830860c143------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*x3l2_VxSsQQEJFV5tpuG0w.jpeg</url>
            <title>Stories by Farshid Roohi on Medium</title>
            <link>https://medium.com/@farshidroohi?source=rss-df830860c143------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 11:26:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@farshidroohi/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[Work Efficiently with Coding Agents]]></title>
            <link>https://farshidroohi.medium.com/work-efficiently-with-coding-agents-e8c9fec74dde?source=rss-df830860c143------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8c9fec74dde</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Farshid Roohi]]></dc:creator>
            <pubDate>Wed, 29 Jul 2026 09:28:04 GMT</pubDate>
            <atom:updated>2026-07-29T12:01:57.053Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6-ycjdt2OOOfcxqAom0vpg.png" /></figure><h3>Before We Begin</h3><p>Coding with AI is no longer limited to copying an error message into a chat window and asking, “How do I fix this?”</p><p>Modern coding agents can inspect an entire repository, understand project instructions, edit multiple files, run tests, analyze failures, and verify the final result. However, giving an agent access to the codebase is not enough. Without clear instructions, useful context, and efficient tools, even a capable agent can waste time, consume unnecessary tokens, and make changes that do not match the project’s architecture.</p><p>This article explains how to build a more effective workflow around coding agents. We will use AGENTS.md files, project-level and agent-level configurations, and tools such as Caveman, RTK, and Codebase Memory MCP. We will also see how the same workflow can be used with Codex, Claude Code, and Hermes Agent.</p><p>The goal is simple: stop using AI only as a question-and-answer tool and start using it as a reliable part of the software development process.</p><h3>Key Points</h3><ul><li>Use coding agents to complete tasks, not merely answer questions.</li><li>Give agents access to the repository, terminal, tests, documentation, and version-control history.</li><li>Store permanent project instructions in AGENTS.md, CLAUDE.md, or agent-specific rule files.</li><li>Separate project rules from personal agent preferences.</li><li>Use Codebase Memory MCP to understand repository structure without repeatedly scanning every file.</li><li>Use RTK to reduce noisy terminal output before it enters the model’s context.</li><li>Use Caveman to reduce unnecessary explanations in the agent’s responses.</li><li>Give agents clear completion criteria: implementation, tests, verification, documentation, and a final summary.</li><li>Keep instruction files short and practical. A 900-line manifesto about variable naming will not create intelligence. It will create expensive confusion.</li><li>Always verify generated changes through tests, static analysis, builds, and human review.</li></ul><h3>Stop Chatting and Start Delegating</h3><p>Chatting with an LLM is useful when you need an explanation, an example, or a quick answer.</p><p>You might ask:</p><ul><li>How can I fix this exception?</li><li>What does this class do?</li><li>Write a unit test for this function.</li><li>Is this architecture correct?</li></ul><p>These questions can produce useful answers, but the model remains outside your actual development workflow. It cannot reliably see the complete repository, inspect related implementations, run the project, validate assumptions, or confirm that the suggested code compiles.</p><p>A coding agent works differently.</p><p>Instead of asking:</p><blockquote><em>How should I fix timeout handling in this API client?</em></blockquote><p>Give the agent a task:</p><blockquote><em>Inspect the networking module, identify the current timeout behavior, implement typed timeout errors, update the affected tests, run the networking test suite, and report any remaining risks.</em></blockquote><p>The coding agent can then perform a complete loop:</p><ol><li>Read the repository instructions.</li><li>Explore the relevant architecture.</li><li>Find the affected classes and call chains.</li><li>Create a plan.</li><li>Modify the code.</li><li>Run tests and static analysis.</li><li>Investigate failures.</li><li>Correct the implementation.</li><li>Review the final diff.</li><li>Summarize what changed.</li></ol><p>Claude Code, for example, is designed to read codebases, edit files, run commands, and integrate with development tools rather than functioning only as a chat interface.</p><p>The important difference is simple:</p><p><strong>A chat response gives you suggestions. An agent produces and validates a change.</strong></p><h3>Build a Working Environment for the Agent</h3><p>A strong model with poor context will still produce poor work, only with greater confidence and more expensive vocabulary.</p><p>An effective coding-agent environment needs four layers:</p><ol><li><strong>Instructions:</strong> How the project should be changed.</li><li><strong>Code intelligence:</strong> How the repository is structured.</li><li><strong>Tools:</strong> How the agent reads, edits, builds, and tests.</li><li><strong>Validation:</strong> How the agent proves the work is complete.</li></ol><p>The three tools discussed in this article improve different parts of that environment:</p><ul><li><strong>Caveman:</strong> Compresses what the agent says.</li><li><strong>RTK:</strong> Compresses what terminal commands return.</li><li><strong>Codebase Memory MCP:</strong> Reduces how much repository exploration the agent must perform.</li></ul><p>They are complementary. One reduces output, one reduces command noise, and one reduces repeated code discovery.</p><h3>Use AGENTS.md as the Project Contract</h3><p>The standard filename is AGENTS.md, plural. Do not use AGENT.md unless a particular tool explicitly supports it. Codex automatically discovers AGENTS.md files before starting work.</p><p>A project-level AGENTS.md should contain information such as:</p><ul><li>Project architecture</li><li>Important module boundaries</li><li>Build commands</li><li>Test commands</li><li>Coding conventions</li><li>Security requirements</li><li>Documentation expectations</li><li>Definition of done</li><li>Files or directories that must not be modified</li><li>Required review steps</li></ul><p>For example:</p><pre># AGENTS.md</pre><pre>## Architecture</pre><pre>- UI modules depend on domain modules.<br>- Domain modules must not depend on Android APIs.<br>- Data modules implement repository interfaces defined in domain.<br>- Use Kotlin Coroutines and Flow for asynchronous operations.</pre><pre>## Implementation Rules</pre><pre>- Keep changes limited to the requested feature.<br>- Do not introduce a new dependency without approval.<br>- Preserve backward compatibility for public APIs.<br>- Add tests for changed behavior.<br>- Do not suppress compiler or lint warnings without documenting the reason.</pre><pre>## Validation</pre><pre>Run the following before completing a task:</pre><pre>```bash<br>./gradlew test<br>./gradlew lint<br>./gradlew assembleDebug</pre><h3>Completion Report</h3><p>Include:</p><ul><li>Files changed</li><li>Tests added or updated</li><li>Commands executed</li><li>Remaining risks</li></ul><pre>### Nested Project Instructions</pre><pre>Large repositories can have more specific instructions inside individual modules:</pre><pre>```text<br>project/<br>├── AGENTS.md<br>├── app/<br>├── core/<br>└── features/<br>    └── payment/<br>        └── AGENTS.override.md</pre><p>Codex loads instructions from the project root down to the current working directory. Instructions closer to the working directory take precedence. It supports global AGENTS.md, repository-level files, and nested AGENTS.override.md files.</p><p>This lets the root file define general rules while a payment module adds stricter requirements:</p><pre># features/payment/AGENTS.override.md</pre><pre>- Never log card, token, or payment-response data.<br>- All payment-result states must be represented with typed models.<br>- Run `./gradlew :features:payment:test` after each behavioral change.<br>- Do not modify callback URLs without explicit approval.</pre><h3>Separate Project-Level and Agent-Level Instructions</h3><p>Project rules should travel with the repository. Personal preferences should remain in the developer’s local agent configuration.</p><p>ScopePurposeExamplesProject levelShared architecture, commands and quality rulesAGENTS.md, project CLAUDE.md, .claude/rules/Module level Rules for one feature or directory Nested AGENTS.md, AGENTS.override.mdAgent level Personal workflow preferences~/.codex/AGENTS.md, ~/.claude/CLAUDE.mdTool configuration MCP servers, hooks, permissions and modelsconfig.toml, settings.json, config.yaml, .mcp.jsonSkills: Reusable task-specific procedures; Agent skill directories</p><h3>Codex</h3><p>Codex supports:</p><pre>~/.codex/AGENTS.md<br>~/.codex/AGENTS.override.md<br>~/.codex/config.toml<br>project/AGENTS.md<br>project/module/AGENTS.override.md</pre><p>Use the global file for reusable personal preferences:</p><pre># ~/.codex/AGENTS.md</pre><pre>- Inspect existing implementations before introducing abstractions.<br>- Prefer small, reviewable changes.<br>- Run targeted tests before the entire test suite.<br>- Do not modify generated files manually.<br>- Keep final reports concise.</pre><p>Use the repository file for project-specific facts.</p><h3>Claude Code</h3><p>Claude Code uses CLAUDE.md for persistent instructions. It supports project, user, and organizational scopes. It also supports .claude/rules/ for rules limited to particular file types or areas. Claude treats these files as context rather than guaranteed enforcement, so hooks should be used for actions that must always be blocked or modified.</p><p>A practical structure is:</p><pre>~/.claude/CLAUDE.md<br>project/CLAUDE.md<br>project/.claude/rules/kotlin.md<br>project/.claude/rules/testing.md<br>~/.claude/settings.json</pre><p>Use CLAUDE.md for instructions and settings.json for permissions, hooks, plugins, and tool configuration.</p><h3>Hermes Agent</h3><p>Hermes supports workspace instructions, reusable skills, plugins, memory, and a user configuration file. Skills are stored under ~/.hermes/skills/ and loaded on demand. Hermes skills follow a progressive-disclosure approach, so only relevant instructions need to enter the active context.</p><p>A practical Hermes setup is:</p><pre>project/AGENTS.md<br>~/.hermes/config.yaml<br>~/.hermes/skills/<br>~/.hermes/plugins/</pre><p>Use:</p><ul><li>AGENTS.md for repository rules.</li><li>config.yaml for agent and plugin configuration.</li><li>skills/ for reusable workflows.</li><li>Hermes memory for knowledge learned across sessions.</li></ul><p>Hermes also supports subagents, persistent memory, tool use, multiple model providers, and skill creation from previous work.</p><h3>1. Use Caveman to Reduce Agent Output</h3><p>Coding agents often explain far more than necessary.</p><p>You ask them to rename a function. They respond with the literary history of naming, a meditation on maintainability, and three paragraphs congratulating themselves for changing twelve characters.</p><p>Caveman is a skill and plugin that instructs coding agents to respond with compressed, direct language while preserving code, commands, file paths, and error messages. It supports Claude Code, Codex, Hermes Agent, and many other coding tools.</p><h3>Why Use It?</h3><p>Caveman helps with:</p><ul><li>Shorter agent responses</li><li>Lower output-token usage</li><li>Less conversational filler</li><li>Faster review of agent progress</li><li>Smaller persistent instruction and memory files</li><li>More room in the context window for actual code</li></ul><p>Caveman only reduces how the agent communicates. It does not improve the model’s reasoning, repository understanding, or implementation quality. That distinction matters. Making an incorrect answer shorter still leaves you with an incorrect answer, only now it wastes less time.</p><h3>Installation</h3><p>For Claude Code:</p><pre>claude plugin marketplace add JuliusBrussee/caveman<br>claude plugin install caveman@caveman</pre><p>For Codex:</p><pre>npx skills add JuliusBrussee/caveman -a codex</pre><p>Activate it in a Codex session:</p><pre>/caveman</pre><p>For Hermes Agent:</p><pre>npx -y github:JuliusBrussee/caveman -- --only hermes</pre><p>The Hermes installation uses its native skills system and enables the skill when loaded.</p><h3>Best Use</h3><p>Use Caveman for:</p><ul><li>Implementation summaries</li><li>Progress reports</li><li>Code-review comments</li><li>Commit-message generation</li><li>Routine debugging sessions</li><li>Long-running tasks with many agent updates</li></ul><p>Do not force extreme compression when you need:</p><ul><li>Architecture explanations</li><li>Incident analysis</li><li>Security findings</li><li>Migration documentation</li><li>Important trade-off discussions</li></ul><p>The goal is not to make the agent cryptic. The goal is to remove filler.</p><h3>2. Use RTK to Reduce Terminal Noise</h3><p>A large part of an agent’s context can be consumed by command output:</p><ul><li>Thousands of passing test lines</li><li>Large directory listings</li><li>Verbose Git diffs</li><li>Repeated build logs</li><li>Full stack traces containing duplicated frames</li><li>Package-manager progress messages</li><li>Docker output with irrelevant columns</li></ul><p>RTK intercepts shell commands and filters their output before the coding agent reads it. It can compact directory trees, group search matches, reduce Git output, collapse successful tests, and preserve failures.</p><p>For example:</p><pre>git status</pre><p>may be rewritten as:</p><pre>rtk git status</pre><p>Similarly:</p><pre>./gradlew test</pre><p>can return a compact result focused on failures rather than feeding every successful test into the model.</p><h3>Why Use It?</h3><p>RTK helps agents:</p><ul><li>Spend fewer tokens reading terminal output</li><li>Find failures faster</li><li>Avoid filling the context window with successful test logs</li><li>Keep long-running sessions usable</li><li>Run more validation commands within the same context budget</li></ul><p>RTK’s reported shell-output reduction is not equal to the same percentage of total API cost. Prompts, conversation history, model output, and other tool results also consume tokens. The project documentation explicitly distinguishes compressed Bash output from total billing reduction.</p><h3>Installation</h3><p>On macOS:</p><pre>brew install rtk</pre><p>For Codex:</p><pre>rtk init --global --codex</pre><p>This adds RTK guidance to the global Codex AGENTS.md. Codex does not expose the same transparent command hook as some other agents, so this integration depends on the model following the instructions.</p><p>For Claude Code:</p><pre>rtk init --global</pre><p>Claude Code uses a PreToolUse hook that can transparently rewrite supported Bash commands. Built-in tools such as Claude’s native Read, Grep, and Glob do not pass through the Bash hook.</p><p>For Hermes Agent:</p><pre>rtk init --agent hermes</pre><p>This creates a Hermes plugin under ~/.hermes/plugins/rtk-rewrite/ and enables it through the Hermes configuration. The plugin modifies supported terminal commands before execution.</p><h3>Use Raw Output When Necessary</h3><p>RTK intentionally filters, groups, truncates, and deduplicates output.</p><p>Bypass it when the task depends on exact output, including:</p><ul><li>Parsing raw JSON</li><li>Comparing byte-level output</li><li>Investigating ordering problems</li><li>Inspecting complete stack traces</li><li>Piping output into another parser</li><li>Diagnosing output that RTK itself may have transformed</li></ul><p>Efficiency should reduce noise, not remove evidence.</p><h3>3. Use Codebase Memory MCP for Repository Intelligence</h3><p>Without code intelligence, an agent often explores a repository like this:</p><ol><li>List directories.</li><li>Search for a class name.</li><li>Open several files.</li><li>Search for usages.</li><li>Open more files.</li><li>Search for interfaces.</li><li>Repeat the entire process after context compaction.</li><li>Repeat it in the next session, because apparently rediscovering architecture is a respected software-engineering tradition.</li></ol><p>Codebase Memory MCP indexes a repository into a persistent knowledge graph. It represents functions, classes, call chains, routes, dependencies, and cross-service relationships. Agents can query that structure instead of repeatedly exploring files one by one.</p><h3>Why Use It?</h3><p>It can help answer questions such as:</p><ul><li>Which classes call this function?</li><li>What implements this interface?</li><li>What will be affected if this method changes?</li><li>Which route reaches this service?</li><li>Where is this data model transformed?</li><li>Is this function unused?</li><li>What modules depend on this component?</li><li>Which files belong to this call chain?</li></ul><p>This is particularly useful in:</p><ul><li>Large legacy repositories</li><li>Multi-module Android projects</li><li>Monorepos</li><li>Microservice systems</li><li>Projects with several coding agents</li><li>Long-running refactoring tasks</li><li>Repositories with limited documentation</li></ul><p>The server supports Codex, Claude Code, Hermes, and many other clients. Its installer can configure detected agent MCP files, instructions, skills, and lifecycle hooks.</p><h3>Installation</h3><p>On macOS or Linux:</p><pre>curl -fsSL \<br>  https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh \<br>  | bash</pre><p>Restart the coding agent and request:</p><pre>Index this project.</pre><p>The installer can configure Codex through its config.toml, Claude Code through its MCP configuration, and Hermes through config.yaml.</p><h3>Query the Graph Before Reading Files</h3><p>A good agent workflow is:</p><ol><li>Query the graph to identify the likely code path.</li><li>Inspect the exact source files returned by the graph.</li><li>Verify important relationships directly in the code.</li><li>Make the change.</li><li>Query impact again.</li><li>Run tests and static analysis.</li></ol><p>Do not treat a graph result as unquestionable truth. Generated code, unsupported syntax, ignored directories, stale indexes, and dynamic behavior can create gaps. The project itself defines Scout, Verify, and Auditor levels that combine graph evidence with direct source checks and index-coverage validation.</p><p>Use the graph for navigation and impact analysis. Use the source code and tests as final evidence.</p><h3>One Practical Workflow with Codex, Claude Code, and Hermes</h3><p>Assume the task is:</p><blockquote><em>Add typed timeout handling to an Android networking module. Preserve the public API, add unit tests, and verify all call sites.</em></blockquote><h3>Step 1: Add Project Instructions</h3><p>Create this file in the repository root:</p><pre># AGENTS.md</pre><pre>## Project Context</pre><pre>- This is a multi-module Android project.<br>- Networking code is located under `core/networking`.<br>- Repository interfaces belong in domain modules.<br>- Data modules implement domain repository interfaces.<br>- Kotlin is the primary language.<br>- Minimum Android SDK is 21.</pre><pre>## Coding Rules</pre><pre>- Preserve source and binary compatibility for public APIs.<br>- Use sealed interfaces for typed networking failures.<br>- Do not expose Ktor-specific exceptions outside the networking module.<br>- Use Coroutines for asynchronous code.<br>- Do not add dependencies without approval.</pre><pre>## Agent Workflow</pre><pre>1. Query Codebase Memory MCP before broad repository searches.<br>2. Verify graph results by reading the relevant source files.<br>3. Use RTK for noisy shell commands.<br>4. Use raw commands when exact output is required.<br>5. Add or update unit tests for behavioral changes.<br>6. Review the final Git diff before completion.</pre><pre>## Validation</pre><pre>Run:</pre><pre>```bash<br>./gradlew :core:networking:test<br>./gradlew lint<br>./gradlew assembleDebug</pre><h3>Completion Criteria</h3><p>Report:</p><ul><li>Root cause</li><li>Files changed</li><li>API compatibility</li><li>Tests executed</li><li>Remaining risks</li></ul><pre>For Claude Code, either reuse the same content through a short `CLAUDE.md` that imports or references the project instructions, or place Claude-specific rules in `.claude/rules/`.</pre><pre>### Step 2: Install the Common Tools</pre><pre>```bash<br>brew install rtk</pre><pre>curl -fsSL \<br>  <a href="https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh">https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh</a> \<br>  | bash</pre><h3>Step 3: Configure Codex</h3><pre>npx skills add JuliusBrussee/caveman -a codex<br>rtk init --global --codex</pre><p>Start Codex:</p><pre>codex</pre><p>Then run:</p><pre>/caveman</pre><pre>Index this project using Codebase Memory MCP.</pre><pre>Implement typed timeout handling in core/networking.</pre><pre>First identify the public API, implementations, callers, and existing tests.<br>Then provide a short plan.<br>Preserve compatibility, implement the change, add tests, run the required<br>validation commands, inspect the final diff, and report remaining risks.<br>Do not stop after suggesting code.</pre><h3>Step 4: Configure Claude Code</h3><pre>claude plugin marketplace add JuliusBrussee/caveman<br>claude plugin install caveman@caveman<br>rtk init --global</pre><p>Start Claude Code inside the repository:</p><pre>claude</pre><p>Use the same task:</p><pre>Use Codebase Memory MCP to map the timeout-related call chain before editing.</pre><pre>Implement typed timeout handling in core/networking.<br>Preserve the public API, update unit tests, run the commands from AGENTS.md,<br>review the diff, and finish only when the completion criteria are satisfied.</pre><p>Claude Code will use its project instructions, MCP tools, terminal access, and hooks. Caveman reduces its replies, while RTK reduces supported Bash output before it reaches the model.</p><h3>Step 5: Configure Hermes Agent</h3><pre>npx -y github:JuliusBrussee/caveman -- --only hermes<br>rtk init --agent hermes</pre><p>Start Hermes in the repository:</p><pre>hermes</pre><p>Then run:</p><pre>Use the repository AGENTS.md as the task contract.</pre><pre>Use Codebase Memory MCP to find the timeout implementation, its callers,<br>repository boundaries, and related tests.</pre><pre>Implement typed timeout handling without exposing networking-library exceptions.<br>Add tests, execute the validation commands, review the final diff, and provide<br>a concise completion report.</pre><p>Hermes can load Caveman as a skill, use the RTK terminal plugin, access its MCP configuration, and preserve useful knowledge through its own skills and memory system.</p><h3>Give Agents Tasks with Completion Contracts</h3><p>Weak prompt:</p><pre>Fix the timeout problem.</pre><p>Better prompt:</p><pre>Investigate the timeout problem in core/networking.</pre><pre>Before editing:<br>- Identify the public API.<br>- Find all implementations and callers.<br>- Find current timeout tests.<br>- Explain the root cause in no more than five lines.</pre><pre>Implementation:<br>- Add typed timeout handling.<br>- Preserve API compatibility.<br>- Do not expose Ktor exceptions outside the module.<br>- Add tests for timeout, cancellation, and non-timeout failures.</pre><pre>Validation:<br>- Run the networking tests.<br>- Run lint.<br>- Build the debug application.<br>- Review the final Git diff.</pre><pre>Finish with:<br>- Files changed<br>- Commands executed<br>- Test results<br>- Compatibility impact<br>- Remaining risks</pre><p>This prompt defines both the work and the evidence required to consider the work complete.</p><h3>Final Recommendations</h3><p>Do not judge coding-agent performance only by how impressive its explanation sounds.</p><p>Judge it by:</p><ul><li>Whether it found the correct code path</li><li>Whether it respected the architecture</li><li>Whether the implementation compiles</li><li>Whether tests cover the changed behavior</li><li>Whether the final diff is focused</li><li>Whether it documented important decisions</li><li>Whether it can show evidence for its conclusions</li></ul><p>Use:</p><ul><li>AGENTS.md to define project expectations.</li><li>Agent-level files to define your personal workflow.</li><li>Skills to package reusable procedures.</li><li>Codebase Memory MCP to navigate repository structure.</li><li>RTK to reduce terminal noise.</li><li>Caveman to reduce response noise.</li><li>Tests, builds, lint, and review to verify the result.</li></ul><p>The best coding-agent workflow is not a longer conversation.</p><p>It is a repeatable system in which the agent receives the right context, uses the right tools, performs the work, validates the result, and reports only what matters.</p><h3>Thanks for Reading</h3><p>Coding agents become truly useful when they are treated as part of the engineering workflow, not just as smarter chat windows.</p><p>Start with a clear AGENTS.md, add the tools your project actually needs, and define how every task should be verified. Keep the process simple, measure the results, and improve your setup over time.</p><p>Thanks for reading, and happy coding with agents.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8c9fec74dde" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why do we get involved in dirty code and spaghetti projects!!?]]></title>
            <link>https://farshidroohi.medium.com/why-do-we-get-involved-in-dirty-code-and-spaghetti-projects-d1d25a617ca0?source=rss-df830860c143------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1d25a617ca0</guid>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[technical-debt]]></category>
            <dc:creator><![CDATA[Farshid Roohi]]></dc:creator>
            <pubDate>Sat, 24 Feb 2024 04:58:01 GMT</pubDate>
            <atom:updated>2024-02-24T09:19:37.089Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OjgH0KbTfl723EjZ" /><figcaption>Photo by <a href="https://unsplash.com/@kristastucchio?utm_source=medium&amp;utm_medium=referral">Krista Stucchio</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Introduction:</strong></p><p>In this article, we’ll discuss the factors that contribute to dirty code and how it can eventually transform our software project into a messy “spaghetti” project. We’ll also explore potential solutions.</p><h3><strong>What is dirty code?</strong></h3><ul><li><strong>Unreadable:</strong> Unnecessarily complex and poorly structured</li><li><strong>Repetitive:</strong> Code duplication without considering reusability (functions, classes, …)</li><li><strong>Untestable:</strong> Difficult or impossible to write tests for</li><li><strong>Unreliable:</strong> Full of bugs and difficult to debug and fix</li></ul><p><strong>Why do projects turn into spaghetti?</strong></p><ul><li><strong>Lack of skills:</strong> Developers lack the necessary skills or understanding of the project’s size and scope.</li><li><strong>Poor time management:</strong> Setting unrealistic deadlines without considering the complexity of the work and ignoring the hidden challenges of each project or task.</li><li><strong>Lack of coding standards:</strong> When there is no standard or team agreement for a project, there is a high probability that each developer will code in their own style, leading to disorganization and inconsistency in the project’s code.</li><li><strong>Too many changes:</strong> Often, we get involved in projects where the product manager doesn’t have a clear definition of the project and lacks transparency. As a result, we are unintentionally forced to make many changes within a short time frame, which leads to the accumulation of technical debt.</li><li><strong>Weak management:</strong> Lack of sufficient documentation, lack of proper communication between teammates and between teams.</li></ul><p><strong>What is a spaghetti software project?</strong></p><p>The output of the above is a spaghetti-like software project that lacks structure and has its components intertwined and complex.</p><p><strong>Problems with spaghetti projects:</strong></p><ul><li><strong>Difficult to develop:</strong> Adding any new feature becomes extremely time-consuming and difficult, to the point where it costs less time to build a new project than to develop a dirty and spaghetti project.</li><li><strong>Difficult to maintain:</strong> Every software project needs maintenance and bug fixing, but in this type of project, finding and fixing a software problem becomes extremely difficult, and it makes more sense to rewrite a class or module than to find a problem in the maze that has been created.</li><li><strong>Increased cost:</strong> Developing and maintaining a spaghetti project can be much more expensive than a well-structured project.</li><li><strong>Reduced quality:</strong> Unfortunately, in these types of projects, the quality of coding is reduced to a minimum, and the output will probably not be good either.</li></ul><p><strong>What is the solution?</strong></p><ul><li><strong>Building a new project:</strong> The simplest and most common decision, but we may run into the same problems again.</li><li><strong>Cleaning up the current dirty project:</strong> It can be challenging and costly for the project owner, but it has advantages that are worth considering.</li></ul><p><strong>Benefits of cleaning up the project:</strong></p><ul><li><strong>Experience:</strong> The biggest advantage of refactoring software projects is the experience it can provide, which can greatly benefit the team technically.</li><li><strong>Technical learning opportunity:</strong> Many technical debts can be seen as an opportunity for learning and experience, which ultimately leads to the technical growth of the team and the individual.</li><li><strong>Opportunity for change:</strong> Many of the rewrites that happen allow developers to get involved with new technologies and move away from old codebases.</li><li><strong>Team skill growth:</strong> Solving technical debt requires inter-team and intra-team communication and addressing existing weaknesses, which leads to team improvement.</li></ul><p><strong>Conclusion:</strong></p><p>Technical debt, dirty code, and spaghetti projects are issues we deal with daily. It’s important to recognize them, understand the problems in our projects, and make sure the whole team is on board. We need to have short-term and long-term plans to address these issues because if there is no plan to solve them, the team will be stuck in a development loop that will have long-term negative effects such as developers leaving the team and individuals falling behind in their technical growth. The product or project owner will also have to bear additional costs for project development and maintenance.</p><p>More explanation about technical debt:</p><p><a href="https://farshidroohi.medium.com/technical-debt-what-it-is-why-it-happens-and-how-to-deal-with-it-13ad047bcb8b">Technical Debt: What it is, why it happens, and how to deal with it</a></p><p>References:</p><p><a href="https://en.wikipedia.org/wiki/Technical_debt">https://en.wikipedia.org/wiki/Technical_debt</a></p><p><a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself">https://en.wikipedia.org/wiki/Don%27t_repeat_yourself</a></p><p><a href="https://en.wikipedia.org/wiki/Code_smell">https://en.wikipedia.org/wiki/Code_smell</a></p><p><a href="https://stackoverflow.blog/2023/12/27/stop-saying-technical-debt/">https://stackoverflow.blog/2023/12/27/stop-saying-technical-debt/</a></p><p><a href="https://en.wikipedia.org/wiki/Spaghetti_code">Spaghetti code - Wikipedia</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1d25a617ca0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Technical Debt: What it is, why it happens, and how to deal with it]]></title>
            <link>https://farshidroohi.medium.com/technical-debt-what-it-is-why-it-happens-and-how-to-deal-with-it-13ad047bcb8b?source=rss-df830860c143------2</link>
            <guid isPermaLink="false">https://medium.com/p/13ad047bcb8b</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[technical-debt]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Farshid Roohi]]></dc:creator>
            <pubDate>Wed, 01 Nov 2023 10:22:32 GMT</pubDate>
            <atom:updated>2023-11-01T10:51:11.202Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rm2OsMB2O4AvUqqY" /><figcaption>Photo by <a href="https://unsplash.com/@punttim?utm_source=medium&amp;utm_medium=referral">Tim Gouw</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction:</h3><p>In this article, I will try to explain technical debt and discuss its pros and cons. We will see what problems it can cause in the long run and what benefits it can have in the short term.</p><blockquote>What is technical debt and why does it occur?</blockquote><blockquote>Advantages and disadvantages?</blockquote><blockquote>Code Smell?</blockquote><blockquote>How can we deal with technical debt?</blockquote><p>Technical debt is the cost of additional rework caused by choosing an easy solution now instead of using a better approach that would take longer. It can be caused by a number of factors, including:</p><p><strong>Time constraints:</strong> Let me explain this with an example. Suppose the implementation of a software project named X with features a, b, and c is estimated to take 6 months based on the requirements analysis and the capabilities of the team. However, the project manager, due to constraints and not wanting to miss the market release time, requests that the project be completed in 3 months, which is half the estimated time.</p><p><strong>Lack of experience of the team or individual:</strong> This happens when everything is going according to plan, but during the implementation of the project, wrong decisions are made due to lack of experience. These wrong decisions can be the wrong choice of architecture or even the wrong choice of technology or framework for that specific project, which can be seen in the long run.</p><blockquote>Technical debt can have both positive and negative consequences.</blockquote><p>Technical debt can have short-term benefits for a product, which can even play a winning role for the product team. Let’s say there is an idea that has the potential to generate revenue for the company in this time frame. Assuming this, if the programming team wants to develop this feature or project in their ideal time, the product team is likely to face a major opportunity loss. Because of this, the technical team manager will move forward with software development, accepting the consequences of technical debt that will likely haunt the technical team in the future.</p><p>Technical debt problems usually show themselves in the long term and in the product development process, which also brings with it a lot of costs. For example, when not enough time is spent on the architecture of a software project and we don’t have the right choice in implementation, we will probably have a lot of cost for product development in the future, which with the growth of the project, the pace of work will go slower and slower than before. Or, assume that a new person has joined the team or project, because the project has a lot of technical debts, good unit tests have not been written, not enough time has been spent on architecture, design patterns, etc., in this case, both the speed of development is affected, and the complexity of the project’s code base is added.</p><h3>What is code smell?</h3><p>Code smell is a term used in software development to describe any characteristic of a program’s source code that indicates a deeper problem. Code smells are not necessarily errors, but they can make code more difficult to maintain, understand, and extend.</p><p><strong>Some of the most common code smells include:</strong></p><ul><li><strong>Duplicate code:</strong> Code that is repeated in multiple places in the program.</li><li><strong>Dead code:</strong> Code that is not executed by the program.</li><li><strong>Long methods:</strong> Methods that are too long and complex.</li><li><strong>Long parameter lists:</strong> Methods with too many parameters.</li><li><strong>Magic numbers:</strong> Hard-coded values that are not explained.</li><li><strong>Feature envy:</strong> Classes that contain code that is more relevant to another class.</li><li><strong>Divergent change:</strong> Classes that change frequently and in different ways.</li><li><strong>Shotgun surgery:</strong> Classes that change in multiple places for a single change.</li></ul><h3>How to deal with technical debt</h3><p>There is no exact solution for all programming teams and projects, and it depends a lot on the type of project and the state of the product. However, there are two common solutions that cover most of the problems:</p><ul><li><strong>Building a new project and learning from past mistakes</strong></li><li><strong>Refactoring different parts of the project over time</strong></li></ul><p>The first case happens when the project has reached a level of complexity and technical debt that is no longer operable. The least expensive solution can be the option of building a new project and paying close attention to the weaknesses of the previous project.</p><p>The second case is refactoring different parts of the project while meeting product requirements. Let me explain with an example:</p><p>Suppose you are working on a project that has technical debt in terms of project architecture and structure, and no tests have been written for different parts of the project. At the same time, the product team needs features to be developed.</p><p>In this case, there is probably no possibility of building a new project, and on the other hand, there are also many technical debts. One of the available solutions could be for the programming team to explain the reality of technical debt to the product team or project manager and get them time to solve these problems. The work description would be like this: in each period (month, week, every Scrum sprint, …) a few percent of the time would be allocated to refactoring and solving technical debts, and a few percent of the team’s time would be allocated to implementing the product team’s requirements.</p><p>With this solution, solving all the technical debts is probably going to take a long time. However, we can refactor the existing codes with these conditions, and meet the business needs, which usually leads to a gradual progress of the project and the business.</p><h3>Conclusion</h3><p>Technical debt is not necessarily good or bad. Software projects can have many technical debts, but we can deal with them as long as they do not affect product development. In this case, we can focus on more important tasks, such as solving important problems, refactoring, or even using newer technologies.</p><p>If you are starting a new project and have time constraints, you need to carefully consider the costs of technical debt in the future. Building a new project is not always the best solution for solving technical debt. In some cases, it is more feasible to refactor the code gradually while meeting business requirements.</p><p>We should always be aware of code smells to prevent technical debt from growing over time. Dirty code can lead to more dirty code, which can eventually make the project more difficult to maintain and update.</p><p><strong>References:</strong></p><ul><li><a href="https://en.wikipedia.org/wiki/Code_smell"><strong>https://en.wikipedia.org/wiki/Code_smell</strong></a></li><li><a href="https://en.wikipedia.org/wiki/Shotgun_surgery"><strong>https://en.wikipedia.org/wiki/Shotgun_surgery</strong></a></li><li><a href="https://martinfowler.com/bliki/CodeSmell.html"><strong>https://martinfowler.com/bliki/CodeSmell.html</strong></a></li><li><a href="https://www.youtube.com/watch?v=w9YhmMPLQ4U"><strong>https://www.youtube.com/watch?v=w9YhmMPLQ4U</strong></a></li><li><a href="https://en.wikipedia.org/wiki/SOLID">https://en.wikipedia.org/wiki/SOLID</a></li><li><a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself"><strong>https://en.wikipedia.org/wiki/Don%27t_repeat_yourself</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13ad047bcb8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Strings in Kotlin and JVM]]></title>
            <link>https://farshidroohi.medium.com/strings-in-kotlin-and-jvm-19e6cebdab4?source=rss-df830860c143------2</link>
            <guid isPermaLink="false">https://medium.com/p/19e6cebdab4</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[string-builder]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[androiddev]]></category>
            <dc:creator><![CDATA[Farshid Roohi]]></dc:creator>
            <pubDate>Sat, 23 Sep 2023 01:56:01 GMT</pubDate>
            <atom:updated>2023-09-23T02:05:12.085Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8yieDrFbHMqXPQkq" /><figcaption>Photo by <a href="https://unsplash.com/@brunus?utm_source=medium&amp;utm_medium=referral">Bruno Martins</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>In this article, we’ll talk about these subjects about Strings:</p><p>What are Strings?</p><ul><li>Immutable String</li><li>String Pool and memory allocation</li><li>Performance of working with strings</li></ul><h3>What are Strings?</h3><p>As we know Strings are a sequence of characters like letters, numbers, and symbols, used to represent texts. As official docs say:</p><blockquote>Strings in Kotlin are represented by the type <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/">String</a>. Generally, a string value is a sequence of characters in double quotes (&quot;)</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3dd294550ad76dcdd0a0aad50dcb5023/href">https://medium.com/media/3dd294550ad76dcdd0a0aad50dcb5023/href</a></iframe><h3>Are Strings mutable or<strong> immutable?</strong></h3><p>My short answer is in Kotlin and Java, Strings are <strong>immutable</strong>.</p><p>But why?</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FMZQkUm97KTI1gI8sUj%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FMZQkUm97KTI1gI8sUj%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FMZQkUm97KTI1gI8sUj%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/e397281981231b6af464d851349b7193/href">https://medium.com/media/e397281981231b6af464d851349b7193/href</a></iframe><p>Answering this question lets us know how memory works in Android.</p><p>We have two types of memory:</p><ul><li>Heap Memory</li><li>Stack Memory</li></ul><p><strong>Heap Memory:</strong></p><p>Java Heap space is where memory is allocated for objects and JRE classes, and it’s the global storage for objects in an Android application. Garbage Collection cleans up memory by removing unreferenced objects from the Heap.</p><p><strong>Stack Memory:</strong></p><p>Java Stack memory is where thread execution occurs, holding short-lived method values and <strong>references</strong> to objects in the Heap, following a Last-In-First-Out order. It has a limited size compared to Heap memory.</p><p>You can find more info here if you are interested in this topic: <a href="https://www.digitalocean.com/community/tutorials/java-heap-space-vs-stack-memory">Java Heap Space vs Stack — Memory Allocation in Java</a></p><p><strong>Check Strings value and reference in Kotlin:</strong></p><blockquote>== Equal sign check character by character</blockquote><blockquote>=== Equal sign check references</blockquote><h3><strong>String Pool:</strong></h3><p>In Java, the String pool is a special area in the memory heap where the JVM (Java Virtual Machine) stores a pool of String objects to optimize memory usage and improve performance. When you create a String using double quotes (e.g., &quot;Hello&quot;), the JVM checks if an equivalent String already exists in the pool. If it does, it returns a reference to the existing String, rather than it creates a new one. This process is called string interning.</p><p>In Kotlin, the concept of the String pool is the same as in Java because Kotlin runs on the Java Virtual Machine (JVM) and shares many features with Java, including how Strings are handled.</p><p>Using the String pool can save memory and improve efficiency when dealing with String objects that have the same content. However, it’s important to note that not all String objects go into the pool. Strings created using the new keyword (e.g., new String(&quot;Hello&quot;)) will not be interned and will result in a new String object, even if the content matches an existing one in the pool.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f626b8161015f02c62f63f738f47638e/href">https://medium.com/media/f626b8161015f02c62f63f738f47638e/href</a></iframe><p>When we create <strong><em>str1</em></strong> JVM adds this to the String Pool and after that, we create <strong><em>str2</em></strong> and do not allocate a new string because the same string is contained in the pool, and <strong><em>str1</em></strong>, <strong><em>str2</em></strong>, pointed to the same string in the pool.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9d2af7446735074824467f84af29af6/href">https://medium.com/media/f9d2af7446735074824467f84af29af6/href</a></iframe><p>Let’s answer our main question. Why Strings are immutable<strong>?</strong></p><p>Strings can’t be mutable because if you change some variable you change all variables containing the same String.</p><p>Because you have <strong><em>str1</em></strong> and <strong><em>str2</em></strong> pointers to the same memory address.</p><p>If we change the value of str2, the JVM adds a new String in the pool (if there is no similar String in the pool) and makes the str2 variable point to the reference of the newly added String. Also, the JVM doesn’t change the value of the previous String.</p><h3>Performance of working with strings</h3><p>It often happens that we want to work with strings.</p><p>When you work with simple strings, not CPU-intensive CPU usage will also depend on the size and complexity of the strings involved.</p><p>It’s important to note that modern JVMs and Java libraries are highly optimized, and they often provide efficient implementations for common string operations. Additionally, Java provides the StringBuilder class for efficiently building and modifying strings when you need to perform multiple operations on a string within a loop or a similar scenario, as it reduces the overhead associated with creating new string objects.</p><p>It’s very important to use StringBuilder or StringBuffer if we want to manipulate strings frequently to prevent creating a new String in the heap memory by each manipulation.</p><p>Here’s a bad practice when using Strings:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0654c487a6e4f3218239fbbd8f1cd935/href">https://medium.com/media/0654c487a6e4f3218239fbbd8f1cd935/href</a></iframe><p>When we change <strong>1000</strong> to <strong>100,000</strong> the snipped code takes <strong>5.3</strong> seconds to complete in Apple M1 Pro :| Imagine how much it takes to complete on smartphones with their limited resources.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F7VHV66bRjGRSo%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F7VHV66bRjGRSo%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F7VHV66bRjGRSo%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="253" frameborder="0" scrolling="no"><a href="https://medium.com/media/9caa4fbd65a700d3b69abb4b023ed76d/href">https://medium.com/media/9caa4fbd65a700d3b69abb4b023ed76d/href</a></iframe><p>To fix the issue we can use StringBuilder:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5dcbfc0adc4a121c5b85db7c482782fd/href">https://medium.com/media/5dcbfc0adc4a121c5b85db7c482782fd/href</a></iframe><h3>Conclusion</h3><p>When we use Strings in Android we should more attention to old devices with more limited resources. In case we must generate Strings frequently we can use either StringBuilder or StringBuffer (thread-safe).<br>The final important thing is that smartphones have a lot of processes, background tasks or apps running, network calls, and memory use(classes, image loaders, etc.). So we must be careful about GPU and memory usage.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19e6cebdab4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>