<?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 Sina Mashini on Medium]]></title>
        <description><![CDATA[Stories by Sina Mashini on Medium]]></description>
        <link>https://medium.com/@sina-mashini?source=rss-e57d41d62a5e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Tg-fobjsX5tgxZBI91TcCg.jpeg</url>
            <title>Stories by Sina Mashini on Medium</title>
            <link>https://medium.com/@sina-mashini?source=rss-e57d41d62a5e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 10:28:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sina-mashini/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[Meet Soundcheck: A Control Layer for AI Coding Agents]]></title>
            <link>https://sina-mashini.medium.com/meet-soundcheck-a-control-layer-for-ai-coding-agents-5d20e3071e5b?source=rss-e57d41d62a5e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d20e3071e5b</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai-coding-agent]]></category>
            <category><![CDATA[agentic-cli]]></category>
            <category><![CDATA[agent-orchestration]]></category>
            <dc:creator><![CDATA[Sina Mashini]]></dc:creator>
            <pubDate>Mon, 02 Nov 2026 11:14:23 GMT</pubDate>
            <atom:updated>2026-11-02T11:14:23.877Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bovW45HdJ9qyLSJ6qDMjNA.png" /></figure><h3>Check your agents, understand their failures, resolve roles, and work with them from the terminal or VS Code.</h3><p>Your AI coding workflow has three agents.</p><p>One is supposed to implement a change. Another reviews it. A third is configured as a fallback.</p><p>The workflow starts, launches the first CLI, and gets exit code 0. Everything looks fine—until the next step discovers that no work was produced. The CLI had printed an authentication error, but the process still reported success.</p><p>You switch to the fallback. It’s installed, but its account has hit a rate limit. The reviewer is available, but the workflow has no clear way to explain why it chose that particular agent or whether the model in its configuration is actually available.</p><p>None of these problems are solved by writing a better prompt.</p><p>They are problems around the agents: installation, authentication, process behavior, output classification, model availability, configuration, and execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MPLts1GR4Of5_Yvs8fyP_Q.png" /></figure><p><strong>Soundcheck is built for that layer.</strong></p><p>It is an open-source tool for checking AI coding CLIs, resolving agent roles, running prompts, and exposing the results through a command-line interface, a dashboard, an MCP server, and a VS Code extension.</p><p>It is designed to work alongside the tools you already use. You can use it as a preflight check before an orchestrator assigns work, as a way to inspect your local agent setup, or as an interface for running a prompt through a configured agent.</p><h3>The problem: an agent is more than a model</h3><p>When people discuss AI coding agents, the conversation usually focuses on model quality:</p><ul><li>Which model writes better code?</li><li>Which one is faster?</li><li>Which one should review the other?</li><li>How large is its context window?</li></ul><p>Those questions matter. But an actual workflow depends on more than model capabilities.</p><p>A coding agent usually arrives as a command-line tool. That tool has to exist on the machine, start correctly, find its configuration, authenticate, contact a provider, and return a result that the calling process can interpret.</p><p>A failure at any of those layers can stop the work before the model meaningfully participates.</p><p>A CLI can be installed but unauthenticated. An authenticated account can be rate-limited. A version command can work while a live request fails. A process can finish with a successful exit code while its output describes an error.</p><p>The situation becomes more complicated when you use several agents together. A workflow needs to know which tools are available, which roles they should fill, and what to do when a candidate cannot perform the task.</p><p>Soundcheck makes those questions explicit.</p><h3>Start with a preflight check</h3><p>The main entry point is the Doctor check:</p><pre>soundcheck doctor</pre><p>Doctor inspects configured adapters and presents a report with agent status, probe results, and resolved roles. The source includes adapters for Claude Code, OpenAI Codex, OpenCode, Antigravity CLI, Gemini CLI, and GitHub Copilot CLI.</p><p>The report helps answer questions such as:</p><ul><li>Is the executable available?</li><li>Which version was detected?</li><li>What did the authentication and other probes report?</li><li>Is the adapter considered functional?</li><li>Is an agent in a cooldown state?</li><li>Which agent and model were selected for each configured role?</li></ul><p>You can also request a machine-readable report:</p><pre>soundcheck doctor --json</pre><p>That matters when Soundcheck is part of a script or another application. A program can consume structured results instead of trying to interpret the colors and layout of terminal output.</p><p>Soundcheck’s Doctor command warns that live smoke probes may use provider quota or incur charges. A deeper run can test further:</p><pre>soundcheck doctor --deep</pre><p>A check is evidence about the current environment, not a guarantee that a later request will succeed. Credentials can expire, quotas can change, and services can become unavailable after the check finishes.</p><h3>Four levels of evidence</h3><p>Soundcheck organizes probes into tiers, from basic presence checks to live model testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lqgiuNd33I1JLjKy9Pg1JA.png" /></figure><h3>L0: Presence</h3><p>Is the CLI executable available? Can its version be detected?</p><p>This is the first thing to check when setting up a machine or debugging a workflow that cannot find an agent. It answers whether the tool is present, not whether it can complete a task.</p><h3>L1: Authentication</h3><p>Is there evidence that the CLI’s authentication state is usable?</p><p>A tool can be installed correctly while its session is missing or expired. An authentication probe helps distinguish a missing binary from an account or session problem.</p><h3>L2: Smoke test</h3><p>Can the CLI perform a basic execution check?</p><p>This moves beyond the existence of a binary or session and looks for evidence that the tool can actually respond.</p><h3>L3: Live model test</h3><p>Can a live model interaction complete?</p><p>This can provide stronger evidence about the current environment, but live requests may consume tokens or quota. It should be used with that tradeoff in mind.</p><p>The tiers are useful because “ready” is not a single universal state. A binary being present is one fact. A live model response is another. Soundcheck makes that distinction visible rather than compressing everything into one vague green checkmark.</p><h3>When exit code zero isn’t the whole story</h3><p>Unix-style command-line tools normally communicate success or failure through their exit code. A zero usually means success; a nonzero value usually means something went wrong.</p><p>That convention is valuable, but it is not always sufficient.</p><p>Some tools can print an error message and still exit with 0. For example, output might indicate that authentication is required or a request was rate-limited even though the process itself reports success.</p><p>Soundcheck includes a classification layer that examines known output patterns alongside process results. It can identify recognized failures and surface them as more useful categories.</p><p>The practical difference is simple:</p><blockquote><em>“The process exited” and “the agent completed useful work” are different claims.</em></blockquote><p>This is not a promise that every failure will be detected. Output formats change, new errors appear, and unfamiliar failures still need investigation. Soundcheck’s goal is to handle known misleading cases more honestly than a workflow that blindly trusts a single exit code.</p><h3>Give each agent a role</h3><p>Once you have several coding agents, the next question is not just whether they work. It is <strong>which one should do what</strong>.</p><p>You might want:</p><ul><li>A primary agent to implement a change.</li><li>A reviewer to inspect the result.</li><li>A subagent for a focused piece of work.</li><li>An auxiliary agent for another supporting task.</li></ul><p>You may also have preferences for which agents and models should fill those roles.</p><p>Soundcheck includes a deterministic resolver for this purpose:</p><pre>soundcheck resolve</pre><p>To inspect a particular role:</p><pre>soundcheck resolve reviewer</pre><p>The resolver evaluates configured candidates and produces role assignments with information such as the selected agent, model, health status, and reasoning. Configuration can express ordered preferences and policies, including a distinct-vendor preference for roles where that matters.</p><p>The important word is <strong>deterministic</strong>. The resolver uses rules and inputs; it does not need to ask an LLM to decide which agent to use.</p><p>That makes the decision easier to inspect. If the preferred candidate is unavailable, you can look at the inputs and configuration instead of treating the selection as a black box.</p><p>Deterministic selection does not mean the environment itself is static. A different health result, model catalog, configuration, or cooldown state can lead to a different resolution. The value is that the decision follows the supplied inputs and rules.</p><h3>Run a prompt and inspect what happened</h3><p>Soundcheck is not limited to diagnostics. It can also execute a prompt headlessly:</p><pre>soundcheck exec &quot;Summarize the repository structure&quot;</pre><p>You can target a role:</p><pre>soundcheck exec --role reviewer &quot;Review the latest changes&quot;</pre><p>Or select a specific adapter:</p><pre>soundcheck exec --adapter codex &quot;Summarize the repository structure&quot;</pre><p>The execution path records attempts and classifies results. Depending on the target and available candidates, Soundcheck can try a fallback after a failed attempt. The result can include the agent used, whether execution succeeded, and whether failover occurred.</p><p>That is useful when a preferred agent is unavailable, but failover should be understood in context. Running a prompt with another agent is still another execution. For tasks that can modify files or trigger external actions, the surrounding workflow should decide when retrying is appropriate.</p><p>For interactive work, Soundcheck also has a run command for launching an adapter in a terminal session. This serves a different purpose from headless execution: you interact with the agent as a terminal application.</p><h3>Inspect capabilities as data</h3><p>A human can read a terminal report. Another program usually needs a stable structure.</p><p>Soundcheck exposes a capability manifest:</p><pre>soundcheck manifest</pre><p>The manifest gives other tools a way to inspect agent and model capability information as JSON. Combined with JSON output from Doctor and role resolution, this makes Soundcheck usable as a component in scripts and larger workflows.</p><p>For example, an existing tool could inspect the preflight report before assigning work. It could stop when a required role is unhealthy or present the result to a developer for a decision.</p><p>The manifest is evidence drawn from the configured and discovered environment. A listed capability should still be interpreted in context: static catalog information and live account discovery are different forms of evidence.</p><p>Soundcheck’s adapter system can use a model-discovery command where one is configured. If live discovery does not succeed, the code preserves the available catalog entries and marks them unverified rather than presenting them as confirmed live account access.</p><p>That distinction is valuable: <strong>known in a catalog</strong> and <strong>verified for this account right now</strong> are not the same thing.</p><h3>Soundcheck inside VS Code</h3><p>Soundcheck also has a VS Code extension. It brings the CLI’s checks and actions into the editor, so you can inspect and operate your agent setup without switching back and forth between separate tools.</p><p>The extension adds a Soundcheck view to the Activity Bar with three areas:</p><ul><li><strong>CLI Adapters</strong> shows detected agents, versions, and probe tiers. You can expand an adapter to inspect individual probe results.</li><li><strong>Resolved Roles</strong> shows the agent and model selected for each role, along with health and available reasoning.</li><li><strong>Quick Actions</strong> provides access to Doctor, prompt execution, role resolution, remediation, alternatives, the dashboard, and interactive terminals.</li></ul><p>A status-bar item summarizes how many adapters are functional. Clicking it opens a menu of Soundcheck actions. When enabled in settings, the extension attempts a Doctor check after VS Code starts and the Soundcheck CLI is available.</p><h3>Run prompts from the editor</h3><p>The extension can prompt you for a task and let you choose:</p><ul><li>The default resolved role chain.</li><li>A primary or reviewer role.</li><li>A specific supported agent.</li></ul><p>It then calls the Soundcheck CLI and shows the execution result in an output panel. When failover is reported, the panel includes the attempts and the final agent used.</p><p>This gives you a way to inspect the execution path from inside the editor: what was requested, which agent was used, whether it succeeded, and whether the result involved failover.</p><h3>Inspect a problem and choose a remediation</h3><p>If an adapter has a problem, the extension offers a remediation action. It asks you to select an adapter and presents the returned description. If a remediation command is available, you can choose to run it in a terminal.</p><p>That user choice matters. The extension’s remediation flow presents the action; it does not silently execute the command merely because a problem was detected.</p><p>The extension also exposes an action for checking alternative candidates, plus a command to open an interactive adapter terminal.</p><h3>Open the dashboard in an editor tab</h3><p>The extension can open the Soundcheck dashboard in a VS Code webview. It checks for the local server and starts it when needed, then displays the dashboard in an editor tab.</p><p>The extension delegates these operations to the Soundcheck CLI. It can locate a configured binary, a workspace binary, a previously installed binary, or soundcheck on the system path. If it cannot find one, it offers an installation action. That installer depends on a published release with the required platform archive and checksum.</p><h3>A dashboard for the same environment</h3><p>If you prefer a visual interface, Soundcheck includes a web dashboard:</p><pre>soundcheck serve</pre><p>The dashboard provides views for inspecting Doctor results, role resolution, and capability information. It also includes a resolver policy editor, where you can review candidate preferences and policies, validate configuration against the current environment, and save configuration.</p><p>There are also views for exploring workflow patterns and examining classification examples. Those visual tools help explain the concepts and inspect configuration; their presence should not be confused with proof that every possible workflow or integration has run successfully.</p><p>The dashboard is another interface to Soundcheck’s capabilities. It is useful when you want to inspect the environment visually instead of working entirely through terminal output.</p><h3>Connect it to an existing workflow</h3><p>Soundcheck’s MCP server exposes tools for Doctor checks, targeted probes, role resolution, and capability manifests:</p><pre>soundcheck mcp</pre><p>This allows a compatible MCP client to request Soundcheck information through that interface. The repository implements those server tools; whether a particular client or agent uses them successfully depends on its integration and configuration.</p><p>That is the broader design: Soundcheck can provide agent readiness and capability information to another tool without requiring that tool to become Soundcheck.</p><p>An orchestrator can remain responsible for planning and coordination. A CI script can remain responsible for its pipeline. A developer can remain responsible for deciding whether a remediation or retry is appropriate.</p><p>Soundcheck contributes the information and controls around the agents.</p><h3>A realistic example</h3><p>Suppose you maintain a project with a primary coding agent and a separate reviewer.</p><p>Before starting a larger change, you run:</p><pre>soundcheck doctor</pre><p>The report shows that your preferred primary agent is installed but has an authentication problem. A second configured agent appears available. Your reviewer is also available.</p><p>You inspect the role assignments:</p><pre>soundcheck resolve</pre><p>The resolver shows which agent and model were selected for the primary and reviewer roles. If the preferred primary was skipped, the resolution gives you information to investigate that decision.</p><p>You have options. You can fix the first agent’s authentication before starting. You can choose to use the configured alternative. Or you can stop and revisit the configuration.</p><p>If you decide to run a prompt through Soundcheck, you can target a role:</p><pre>soundcheck exec --role primary &quot;Inspect the failing test and explain the cause&quot;</pre><p>The execution result tells you what happened, including any failover reported by the run. You still review the output and decide what action to take. A successful preflight does not turn an agent’s answer into a verified result.</p><p>The benefit is not that failures disappear. It is that the workflow has better information before and during execution.</p><h3>Why this layer matters</h3><p>AI coding agents can write code, inspect repositories, run commands, and collaborate through increasingly sophisticated workflows. But those capabilities sit on top of ordinary software systems.</p><p>Processes can return misleading statuses. Credentials expire. Quotas run out. Configuration drifts. Models available in a catalog may not be verified for a particular account. A workflow can select an agent without making the reason clear.</p><p>These problems do not require another model to guess at the answer. They require observable checks, structured results, and decisions that can be inspected.</p><p>Soundcheck brings those pieces together:</p><ul><li>Preflight checks across configured AI coding CLIs.</li><li>Classification for known misleading failures.</li><li>Deterministic resolution of agent roles.</li><li>Headless prompt execution with reported attempts and failover.</li><li>Machine-readable health and capability information.</li><li>A dashboard, MCP server, and VS Code extension for working with the same environment.</li></ul><p>The purpose is not to eliminate uncertainty. It is to make the relevant uncertainty visible before it becomes a broken workflow.</p><p>Soundcheck is open source. Explore the code, report issues, or contribute on <a href="https://github.com/shadowhelper93/Soundcheck">GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d20e3071e5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Wrong Interview: When Questions Miss the Point]]></title>
            <link>https://sina-mashini.medium.com/the-wrong-interview-when-questions-miss-the-point-b93203c5d124?source=rss-e57d41d62a5e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b93203c5d124</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Sina Mashini]]></dc:creator>
            <pubDate>Thu, 06 Nov 2025 22:21:53 GMT</pubDate>
            <atom:updated>2025-11-06T22:39:19.932Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*F2jpOh38Pev7izdL3CinYQ@2x.jpeg" /></figure><p>In today’s software world, too many interviews are built around trivia rather than truth. Instead of learning how candidates think, interviewers often test how well they can recite buzzwords — questions about SOLID principles, design patterns, or the exact syntax of a framework that might not even be used in the actual job.</p><p>But software development isn’t a memory contest. It’s a craft. And the irony is, those who truly understand the craft often apply the principles instinctively — without even knowing the academic names behind them.</p><p>⸻</p><h4>When the Interview Becomes a Performance</h4><p>I once had an interview with a well-known company that had recently been hacked by a group. It was a major incident — one that everyone in the industry knew about. You’d expect that after something like that, their focus in interviews would shift toward real-world problem-solving, security awareness, and architectural thinking.</p><p>But instead, the questions were about textbook definitions and theoretical principles — “Explain the Dependency Inversion Principle,” “Which design pattern would you use for this scenario?” and so on.</p><p>And I couldn’t help but think:</p><blockquote>If you had all these ‘solid’ developers who could name every pattern, how did this happen to your company?</blockquote><blockquote>If the interviewers themselves practiced what they were asking about, why is the system still performing that poorly?</blockquote><p>That experience taught me something deeper about the state of technical hiring — it’s not just that the questions are wrong, but that they often come from people who don’t apply the same principles they demand others to know by heart.</p><p>⸻</p><h4>From Conversation to Interrogation</h4><p>Too often, these interviews feel less like a dialogue and more like an interrogation.</p><p>And while an interrogation is meant to uncover the truth, a job interview should be about assessing a candidate’s abilities.</p><p>This harsh, mechanical approach creates stress and mental pressure that interfere with how the brain and memory work — causing candidates to perform far below their actual level. So what’s the point of such interviews?</p><p>To find out how a programmer would perform under enemy interrogation on the front line?</p><p>It’s absurd, and worse — it’s counterproductive. You don’t discover great developers by intimidating them; you find them by engaging their curiosity and passion.</p><p>⸻</p><h4>Knowing Names Isn’t Knowing Knowledge</h4><p>These interviews reward surface-level familiarity. A candidate who memorizes definitions can appear “prepared,” while another — who has years of real-world experience — might seem “unqualified” just because they don’t label every pattern they use.</p><p>True understanding doesn’t always come wrapped in theory. Developers who have debugged complex issues, refactored tangled systems, and learned through failure often carry the deepest insights. But those insights don’t fit neatly into a quiz.</p><p>⸻</p><h4>What Interviews Should Actually Measure</h4><p>A meaningful interview should be a conversation about experience, not a checklist of theories. Instead of asking someone to explain the Open/Closed principle, ask them:</p><blockquote>“Tell me about a time you improved a system without breaking existing functionality.”</blockquote><p>That one question alone reveals more about how a person thinks and builds than ten theory questions ever could. Because software isn’t about what you can memorize — it’s about how you solve problems when there’s no script.</p><p>⸻</p><h4>The Passion Over Perfection Principle</h4><p>The best interviews make candidates light up. They let people talk about their experiences, their lessons, their thought process. They reward curiosity and love of learning — not rote memory.</p><p>Developers who truly care about what they build — who experiment, learn from mistakes, and keep growing — are the ones who create great systems. Not the ones who can flawlessly quote principles but rarely apply them meaningfully.</p><p>⸻</p><h4>Conclusion</h4><p>The wrong interview tests what’s written in books.</p><p>The right one explores what’s written in experience.</p><p>Maybe it’s time for interviewers to stop asking “Can you name the pattern?” and start asking “How do you think?” Because in the end, companies don’t fail or get hacked because people forgot acronyms — they fail because they stopped questioning, learning, and caring.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b93203c5d124" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seamless Translation: Harnessing Dependency Injection]]></title>
            <link>https://sina-mashini.medium.com/seamless-translation-harnessing-dependency-injection-cce24104cc63?source=rss-e57d41d62a5e------2</link>
            <guid isPermaLink="false">https://medium.com/p/cce24104cc63</guid>
            <category><![CDATA[amazon-translate]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[localization]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sina Mashini]]></dc:creator>
            <pubDate>Tue, 02 Jan 2024 22:53:34 GMT</pubDate>
            <atom:updated>2024-03-13T23:32:19.169Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Old Map" src="https://cdn-images-1.medium.com/max/1024/1*4jY0b8v-0Ukkh9YMV6VzwQ.jpeg" /></figure><p><em>“The only constant in life is change.” — Heraclitus</em></p><h4>Introduction</h4><p>In today’s globalized world, effective communication across cultures and languages is paramount. This includes the ability to translate text from one language to another, a task that can be challenging for developers, especially when working with structured data formats like JSON.</p><p>Dependency injection (DI) is a technique that can be used to make translation code more flexible and maintainable. DI allows us to decouple the translation code from the specific translation service that it uses. This makes it easy to switch between different translation services, or to use multiple translation services at the same time.</p><p>In this article, we’ll explore how to translate slugs and JSON data using JavaScript, Python, and Amazon Translate. We’ll also discuss the importance of translation in various contexts, including businesses and user experience.</p><h4>Importance of Translation</h4><p>For businesses, translation is crucial for reaching a global audience. By translating their content into multiple languages, businesses can:</p><ul><li>Expand their customer base</li><li>Enter new markets</li><li>Foster stronger customer relationships</li></ul><p>Moreover, translation enhances the user experience. When users can access content in their native language, they are more likely to:</p><ul><li>Engage with the content</li><li>Find the information they seek</li></ul><h4>Example: Acme Corp.’s Website Translation</h4><p>Consider Acme Corp., a software development company with a website currently available in English and Spanish. They’ve decided to add a JSON file containing company information, services, and customer testimonials.</p><p>Acme Corp. aims to translate this JSON file into French to:</p><ul><li>Reach a broader audience</li><li>Simplify future language additions</li></ul><p>Here is a sample JSON file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5806a69dff8e9d8ad4d2facecce58402/href">https://medium.com/media/5806a69dff8e9d8ad4d2facecce58402/href</a></iframe><h4>Dependency Injection in Object-Oriented Programming (OOP)</h4><p>Dependency injection is a technique used in OOP to decouple components and provide dependencies from external sources. This approach promotes flexible and maintainable code.</p><p>In the context of JSON data translation, dependency injection can be implemented by creating a `Translator` class that relies on a `TranslationService` interface. We can then inject concrete implementations of the `TranslationService` interface, such as `GoogleTranslateService` or `AwsTranslateService`, into the `Translator` class.</p><p><strong>Here’s an example in JavaScript:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4b26267e30f9fd2c1a6f190638a5b123/href">https://medium.com/media/4b26267e30f9fd2c1a6f190638a5b123/href</a></iframe><p><strong>In Python, it would look like this:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/966dff78a69b4b55a7a8cdc23a89dd58/href">https://medium.com/media/966dff78a69b4b55a7a8cdc23a89dd58/href</a></iframe><h4>Dependency Injection in Functional Programming (FP)</h4><p>Dependency injection is not limited to OOP; it can also be used in FP, where dependencies are passed as arguments to functions.</p><p>Here’s an example of translating JSON data using dependency injection in FP:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/77a4c6733e2a346a1688bbd473fd1614/href">https://medium.com/media/77a4c6733e2a346a1688bbd473fd1614/href</a></iframe><h4>Serverless Architectures</h4><p>Serverless architectures are cloud-computing models where the cloud provider dynamically manages machine resource allocation. This eliminates the need for provisioning or managing servers.</p><p>Serverless architectures are ideal for event-driven applications that require rapid scaling. Translation is a prime example of an application that can benefit from a serverless architecture.</p><p>Here’s an example of implementing a serverless translation function using AWS Lambda and Amazon Translate:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/baa26cd35d93e217ea911f0d889b4b80/href">https://medium.com/media/baa26cd35d93e217ea911f0d889b4b80/href</a></iframe><p>This function can be deployed to AWS Lambda and triggered by an API Gateway event. When a user makes a request to the API Gateway endpoint, the Lambda function will be invoked, translating the JSON data in the request body. The translated JSON data will then be returned to the user.</p><h4>Conclusion</h4><p>In this article, we explored how to translate slugs and JSON data using JavaScript, Python, and Amazon Translate. We also discussed dependency injection for decoupling components and providing dependencies from external sources.</p><p>Additionally, we highlighted the benefits of using a serverless architecture for translation, emphasizing its scalability, cost-effectiveness, and ease of use.</p><p>We also shared the story of Acme Corp., a company that successfully used dependency injection to translate their website and JSON files into French.</p><p>I included the quote <em>“The only constant in life is change.”</em> in the article to emphasize the importance of adaptability in the world of software development. Translation is a task that is constantly changing, as new languages and technologies emerge. By using dependency injection and serverless architectures, we can create translation systems that are adaptable and can easily be changed to meet new requirements.</p><p>If you have any further questions, feel free to leave a comment below.</p><h4>Additional Resources</h4><ul><li><a href="https://cloud.google.com/translate/docs"><strong>Google Cloud Translation API</strong></a></li><li><a href="https://aws.amazon.com/translate/"><strong>Amazon Translate</strong></a></li><li><a href="https://aws.amazon.com/serverless/"><strong>Serverless Architectures</strong></a></li></ul><p><a href="https://sina-mashini.medium.com/the-medical-marvel-of-dependency-injection-a-prescription-for-software-health-31b66581718d">The Medical Marvel of Dependency Injection: A Prescription for Software Health</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cce24104cc63" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Medical Marvel of Dependency Injection: A Prescription for Software Health]]></title>
            <link>https://sina-mashini.medium.com/the-medical-marvel-of-dependency-injection-a-prescription-for-software-health-31b66581718d?source=rss-e57d41d62a5e------2</link>
            <guid isPermaLink="false">https://medium.com/p/31b66581718d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[object-oriented]]></category>
            <dc:creator><![CDATA[Sina Mashini]]></dc:creator>
            <pubDate>Tue, 22 Aug 2023 21:36:37 GMT</pubDate>
            <atom:updated>2024-01-09T02:36:45.895Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mWIaF6NE97pyxbKpd2vRnA.jpeg" /></figure><p>Imagine entering a hospital with a medical concern. The doctor, with a white coat and a stethoscope around their neck, carefully examines your symptoms. They determine that your condition requires a specific medication to treat the underlying problem. But here’s the catch: this medication isn’t ingested orally or applied externally — it needs to be delivered precisely where it’s needed, directly into your bloodstream or muscle. This medical technique, known as dependency injection, parallels a crucial practice in software engineering that promotes flexibility, reusability, and better code organization.</p><h3>Introducing the Code Surgeon</h3><p>In this analogy, you, the developer, don the role of the doctor. You identify the dependencies your code needs to function effectively. However, just as a doctor doesn’t prepare every medication from scratch, you don’t write new code for the same dependencies in every project. Here comes the nurse — or in our software world, dependency injection. This technique enables you to inject these dependencies into your code, promoting modularity, reusability, and separation of concerns.</p><h3>A Prescription for Maintainable Code</h3><p>Imagine you’re building an application with various components that need to interact seamlessly. Instead of letting these components manage their dependencies individually, dependency injection acts as a central pharmacy, providing the right medicine at the right time. This ensures that the components remain loosely coupled, making it easier to modify, test, and maintain each part without affecting the whole system.</p><h3>From Medical Ward to Codebase</h3><p>In medical practice, the same medication can treat diverse conditions, just as a single dependency can serve different parts of your software. Like the versatile drug Propranolol that addresses a range of ailments, dependency injection can solve multiple concerns in your codebase, from data storage to authentication and beyond. By injecting these dependencies strategically, you achieve the twin goals of cleaner, more readable code and efficient, reusable components.</p><h3>Healing the Codebase</h3><p>Just as medical practitioners focus on the patient’s well-being, developers prioritize the health of their codebase. Dependency injection is the prescribed treatment for that nagging “<strong>RepetitiveCodophilia</strong>” condition — writing the same code repeatedly. By injecting dependencies and reusing them intelligently, you break free from the cycle of reinvention, creating a robust and maintainable codebase.</p><h3>Conclusion: A Healthier Software Ecosystem</h3><p>In the grand theater of software development, dependency injection plays the role of both doctor and nurse, ensuring that the right components receive the right dependencies at the right time. Just as modern medicine has revolutionized patient care, dependency injection has transformed the way we build and maintain software systems. So, the next time you’re crafting code, think of those medical injections, and remember the power of dependency injection to deliver a healthy, sustainable software ecosystem.</p><p><strong>Can Dependency Injection be Used in Functional Programming (FP)?</strong></p><p>Absolutely, dependency injection is not limited to object-oriented programming (OOP) alone. While the terminology and implementations might vary, the underlying principle of decoupling components and providing dependencies from the outside is applicable to functional programming as well. In functional programming, you can achieve dependency injection by passing functions or values as arguments to other functions. This allows you to separate concerns and make your code more modular and reusable, just like in OOP.</p><pre>// pseudo code<br><br>type UserDataStorage = (userId) =&gt; User<br>type UserSaver = (user) =&gt; Unit<br>function databaseUserDataStorage(userId):<br> // Retrieve user from the database<br> // …<br>function inMemoryUserDataStorage(userId):<br> // Retrieve user from in-memory data store<br> // …<br>function saveUserToDatabase(user):<br> // Save user to the database<br> // …<br>function saveUserToInMemoryStore(user):<br> // Save user to in-memory data store<br> // …<br>function createUserService(userDataStorage, userSaver):<br> getUser = (userId) =&gt;<br> userDataStorage(userId)<br>createUser = (user) =&gt;<br> userSaver(user)<br>return {<br> getUser,<br> createUser<br> }<br>// In your application logic:<br>databaseStorage = databaseUserDataStorage<br>userServiceWithDatabase = createUserService(databaseStorage, saveUserToDatabase)<br>inMemoryStorage = inMemoryUserDataStorage<br>userServiceWithInMemory = createUserService(inMemoryStorage, saveUserToInMemoryStore)</pre><p>In this pseudocode example:</p><ol><li>We define types <strong>UserDataStorage</strong> and <strong>UserSaver</strong> representing functions that take specific inputs and produce outputs.</li><li>The functions <strong>databaseUserDataStorage</strong> and <strong>inMemoryUserDataStorage</strong> are implementations of the <strong>UserDataStorage</strong> type.</li><li>The functions <strong>saveUserToDatabase</strong> and <strong>saveUserToInMemoryStore</strong> are implementations of the <strong>UserSaver</strong> type.</li><li>The <strong>createUserService</strong> function takes two dependencies, a <strong>UserDataStorage</strong> function and a <strong>UserSaver</strong> function, and returns a service object with functional methods for getting users and creating users.</li><li>Depending on the functions passed to <strong>createUserService</strong>, the resulting service will work with either database storage or in-memory storage.</li></ol><p>Remember that this example is a simplified representation to illustrate the concept<em>. </em><strong><em>Functional programming approaches to dependency injection might involve higher-order functions, currying, or more advanced composition techniques</em></strong><em>. </em>Additionally, error handling, immutability, and other functional programming principles are important in real-world scenarios<em>.</em></p><h3>Reusability and Separation of Concerns: Unveiling the Power of Dependency Injection</h3><p>In the world of software development, where complexity lurks around every corner, the concepts of reusability and separation of concerns are like beacons guiding us toward well-structured, maintainable code. Enter dependency injection, an elegant technique that not only addresses these concerns but also empowers developers to create software that’s robust, flexible, and easier to manage.</p><h3>The Maze of Monolithic Code</h3><p>Imagine constructing a massive building without any clear divisions between its floors, rooms, or sections. Chaos would reign as various functionalities intertwine, making it nearly impossible to find and fix issues, let alone expand or modify the structure. Similarly, in software development, a monolithic codebase lacking separation of concerns can quickly transform into a daunting labyrinth of tangled logic, obscure bugs, and redundant code.</p><h3>Modular Components: The Essence of Reusability</h3><p>Just as architects meticulously design buildings with modular components, developers strive to break down software into manageable, reusable pieces. Consider a real-world scenario where you’re building an e-commerce platform. Instead of baking payment processing code directly into the product catalog, dependency injection encourages creating separate modules for payments, inventory management, and user authentication. By injecting these modules only where needed, you achieve a modular structure that’s not only easier to maintain but also encourages reusability across different projects.</p><h3>The Dependency Injection Symphony</h3><p>Picture a symphony orchestra, where every musician plays a distinct instrument, contributing their unique melodies to create a harmonious composition. Similarly, in your code, each module — thanks to the magic of dependency injection — becomes an instrumental piece that can be orchestrated to perform various tasks. In our e-commerce example, by injecting the payment module only when the checkout process is invoked, you ensure that the concerns of payment processing are elegantly separated from other functionalities. This separation promotes code readability and reduces the chances of unintended side effects when making changes.</p><h3>An Oasis of Readability</h3><p>Remember the joy of reading a well-structured book, where chapters flow seamlessly, each addressing a specific aspect of the story? Your codebase can evoke a similar feeling when dependency injection is utilized. Separating concerns through dependency injection enhances the readability of your code, enabling developers to grasp the purpose and functionality of each module at a glance. In our e-commerce case, someone reviewing the code can immediately identify where payment processing occurs, distinct from browsing products or managing user profiles.</p><h3>Charting a New Course</h3><p>Dependency injection isn’t just a technique; it’s a guiding philosophy that reshapes the way we approach software architecture. By embracing reusability and separation of concerns through dependency injection, developers pave the way for a modular, adaptable, and resilient codebase. With the ability to swap out dependencies effortlessly, accommodate changes without triggering a domino effect, and streamline the development process, we chart a course toward software that’s not just functional, but also sustainable and scalable.</p><pre>class PaymentProcessor:<br>    def process_payment(self, amount):<br>        # Logic to process payment<br>        pass<br><br>class OrderProcessor:<br>    def __init__(self, payment_processor):<br>        self.payment_processor = payment_processor<br><br>    def create_order(self, items):<br>        # Logic to create an order<br>        total_amount = calculate_total(items)<br>        self.payment_processor.process_payment(total_amount)<br>        # More order processing logic<br><br>def calculate_total(items):<br>    # Calculate the total amount of items<br>    pass<br><br># Using dependency injection<br>payment_processor = PaymentProcessor()<br>order_processor = OrderProcessor(payment_processor)<br><br># Creating an order<br>items = [...]<br>order_processor.create_order(items)</pre><p>In this Python example:</p><ol><li>We have a <strong>PaymentProcessor</strong> class responsible for processing payments.</li><li>The <strong>OrderProcessor</strong> class depends on the <strong>PaymentProcessor</strong> for payment processing. It&#39;s injected into the <strong>OrderProcessor</strong> through its constructor.</li><li>The <strong>calculate_total</strong> function is a helper function used within the <strong>OrderProcessor</strong>.</li><li>By using dependency injection, we ensure that the concerns of payment processing are separated from order creation. The <strong>OrderProcessor</strong> doesn&#39;t need to know the specifics of payment processing; it simply relies on the injected <strong>PaymentProcessor</strong> to handle that task.</li><li>The code demonstrates how the <strong>PaymentProcessor</strong> instance is injected into the <strong>OrderProcessor</strong> instance during initialization, creating a clear separation of concerns and allowing each component to be tested and modified independently.</li></ol><h3>Conclusion: Empowering Software Architecture</h3><p>In the intricate dance of software development, where countless lines of code weave together to create meaningful applications, dependency injection emerges as the choreographer that orchestrates harmony and balance. It empowers us to design modular, reusable components, breathing life into the principles of reusability and separation of concerns. So, the next time you find yourself immersed in the world of code, remember that dependency injection isn’t merely a tool — it’s a powerful ally in the quest for cleaner, more efficient software architecture.</p><h3>Stay Tuned for the Next Step</h3><p>As we journey deeper into the realm of software architecture, our exploration of dependency injection continues. In the upcoming article, we’ll take these concepts and put them into action with a real-world example. We’ll craft a simple yet insightful project using Node.js, Express.js, and TypeScript, showcasing how dependency injection enhances our codebase’s modularity and maintainability. Get ready to dive into the practical implementation of these concepts and witness the transformation firsthand!</p><p><strong>Here’s the next step:</strong></p><p><a href="https://sina-mashini.medium.com/seamless-translation-harnessing-dependency-injection-cce24104cc63">Seamless Translation: Harnessing Dependency Injection</a></p><p><a href="https://medium.com/u/c003492cdf0b">Nick Hodges.</a> Has a good article about the different types of dependency injection.</p><p><a href="https://betterprogramming.pub/the-3-types-of-dependency-injection-141b40d2cebc">The 3 Types of Dependency Injection</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31b66581718d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Validated Form in React.js with Next.js, TS, MUI, Formik & Yup]]></title>
            <link>https://sina-mashini.medium.com/create-a-perfect-form-with-validation-by-using-react-js-4b6fee160f?source=rss-e57d41d62a5e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b6fee160f</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[formik]]></category>
            <category><![CDATA[validation]]></category>
            <category><![CDATA[forms]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Sina Mashini]]></dc:creator>
            <pubDate>Fri, 15 Jan 2021 07:25:52 GMT</pubDate>
            <atom:updated>2024-01-09T02:29:42.437Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d8AcmgwqclbOgV1a9v41cQ.jpeg" /></figure><p>In this tutorial, we’ll create a form with validation using React.js, Next.js, TypeScript, Material-UI, Formik, and Yup. We’ll cover the following steps:</p><ol><li>Setting up the project</li><li>Designing the form</li><li>Validating the form</li><li>Submitting the form</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c2040c22f9c98b6ca12b654caf6d1c37/href">https://medium.com/media/c2040c22f9c98b6ca12b654caf6d1c37/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b6fee160f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>