<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Bala K</title>
    <description>The latest articles on Forem by Bala K (@krishnam).</description>
    <link>https://forem.com/krishnam</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F614330%2F4643705a-7834-40db-a61c-40cf43190bb6.jpg</url>
      <title>Forem: Bala K</title>
      <link>https://forem.com/krishnam</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/krishnam"/>
    <language>en</language>
    <item>
      <title>The Cursor Effect: How GitHub Copilot is Responding to Peer Pressure</title>
      <dc:creator>Bala K</dc:creator>
      <pubDate>Sat, 19 Apr 2025 04:08:10 +0000</pubDate>
      <link>https://forem.com/krishnam/the-cursor-effect-how-github-copilot-is-responding-to-peer-pressure-2pm7</link>
      <guid>https://forem.com/krishnam/the-cursor-effect-how-github-copilot-is-responding-to-peer-pressure-2pm7</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Intent&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;The AI Coding Assistant arena is heating up. In recent months, excitement around Cursor IDE has sparked curiosity among developers. Rightfully so—Cursor’s entry into the IDE space with a deeply integrated AI experience turned heads. It hasn’t just plugged in AI; it’s trying to &lt;strong&gt;reshape the entire development experience&lt;/strong&gt; around it, from agentic workflows to seamless chat-first coding.&lt;/p&gt;

&lt;p&gt;Naturally, this raises a question for me: &lt;strong&gt;Is GitHub Copilot keeping up?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before we think about shifting direction or adopting a Multi-IDE working model, we need &lt;strong&gt;a shared understanding of what’s already available&lt;/strong&gt; to us—especially within the latest VS Code + Copilot ecosystem. Otherwise, we risk &lt;strong&gt;comparing tools unfairly&lt;/strong&gt;, based on outdated versions or impressions shaped by trend cycles rather than facts. It's crucial that we evaluate them fairly—not against past memories, but against their &lt;strong&gt;most current, full-featured releases&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Let’s take a step back and look at what GitHub Copilot now brings to the table—especially the &lt;strong&gt;capabilities rolled out in recent months&lt;/strong&gt; that may go unnoticed if your IDE isn’t up to date.&lt;/p&gt;

&lt;p&gt;Along the way, in this post, I will briefly unpack some of the recent concepts shaping AI-assisted development workflows—like &lt;strong&gt;Modes&lt;/strong&gt; of working with Code AI, Next Edit Suggestions (&lt;strong&gt;NES&lt;/strong&gt;), &lt;strong&gt;Model Selection&lt;/strong&gt;, and &lt;strong&gt;AI Rules&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This post is about clarity—not conclusions.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Model Awareness &amp;amp; Flexibility&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;In the past, GitHub Copilot was synonymous with “the OpenAI model behind the curtain.” But that’s no longer the case. Copilot has evolved into a &lt;strong&gt;model-flexible platform&lt;/strong&gt;, supporting a wide range of top-tier models—empowering developers to tailor their experience based on &lt;strong&gt;speed, reasoning depth, task complexity, or preference&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;🧩 Multi-Model Support&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Copilot now gives you the flexibility to &lt;strong&gt;choose, switch, and experiment with models&lt;/strong&gt;—especially useful when balancing latency, reasoning depth, or creative freedom. This shift is critical: just as developers choose libraries or frameworks, &lt;strong&gt;selecting the right model for the task&lt;/strong&gt; is now part of the modern development flow.&lt;/p&gt;

&lt;p&gt;Feel free to &lt;strong&gt;experiment with different models&lt;/strong&gt; for various use cases—and share your observations as a post in our dev blog space!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Each model is known for certain strengths:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI GPT-4.1&lt;/strong&gt; (OpenAI)[April 14, 2025] – Great at instruction following, frontend development, and long-context reasoning&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI GPT-4.5&lt;/strong&gt; (OpenAI) – Latest Copilot model (Apr ’25), tuned for enterprise use&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI o3-mini&lt;/strong&gt; (OpenAI) [April 16, 2025] – Low-latency, fast reasoning for rapid iteration loops&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI o1 models&lt;/strong&gt; (OpenAI) – Early GPT-4 family models with fallback support&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude 3.7 Sonnet&lt;/strong&gt; (Anthropic)[April 16, 2025] – Strong in structured code reasoning, SWE-bench performance, and agentic flows&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude 3.5 Sonnet&lt;/strong&gt; (Anthropic) – Reliable for day-to-day coding support and quick iterations&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Gemini 2.5 Pro&lt;/strong&gt; (Google)[April 16, 2025] – Excels in deep reasoning across code, math, and science (Apr ’25)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemini 2.0 Flash&lt;/strong&gt; (Google) – Fast and multimodal, ideal for lightweight tasks and conversational coding&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Cursor’s perspective on Models:&lt;/strong&gt; Cursor started strong with default high-quality models (GPT-4, Claude) built-in, focused on experience over configuration. While model selection was not always visible, recent updates now allow model switching. Small nitpick—model switching requires resetting the conversation, unlike Copilot’s in-chat model toggle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Copilot gives you granular control per session&lt;/strong&gt;—ideal for experimenting with speed vs depth vs creativity. Cursor simplifies the experience with optimized defaults. Both are converging toward flexible model fluency.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When I first tried Cursor and Copilot, this was before enabling the new models in Copilot. The response styles were noticeably different—not just in tone but also in how they reasoned through problems. Now, when I switch to &lt;strong&gt;Claude in Copilot&lt;/strong&gt;, I can feel the difference. The responses are &lt;strong&gt;more thoughtful and structured&lt;/strong&gt;, and it’s clear: &lt;strong&gt;the model you choose affects the outcome&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;With more model options available in Copilot, it’s finally possible to do &lt;strong&gt;an apples-to-apples comparison&lt;/strong&gt;. It also made me realize that some past comparisons were closer to &lt;strong&gt;apples vs. oranges&lt;/strong&gt;—comparing tools without matching the models beneath them.&lt;/p&gt;

&lt;p&gt;Let’s now turn our attention to another hot topic in the Cursor world—&lt;strong&gt;Agent Mode&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Modes of Working with Code AI&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As AI assistants mature, it’s no longer just about inline completions or answering a question in chat. The real leap is in &lt;strong&gt;how we collaborate with AI across different phases of the coding workflow&lt;/strong&gt;—whether you’re asking a question, refactoring code, or letting an agent handle multi-step tasks.&lt;/p&gt;

&lt;p&gt;Both Cursor and Copilot recognize this shift.&lt;/p&gt;

&lt;p&gt;While Cursor had a head start, GitHub Copilot has rapidly caught up by releasing new capabilities—and in some areas, I’ve noticed Cursor’s also getting influenced.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Cursor’s tab-based workflows set the bar early, but Copilot now matches it with an elegant, integrated UX. Interestingly, Cursor has since updated its interface to align more closely with Copilot’s mode-based structure—a sign of mutual influence and convergence.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you walk through the features chronologically (I skimmed through the release logs for both), you’ll notice it’s not just Copilot learning from Cursor—it’s Cursor learning from Copilot too. &lt;strong&gt;They’re clearly watching each other closely&lt;/strong&gt;, and what we’re witnessing is a &lt;strong&gt;convergence in the capability SKUs&lt;/strong&gt; across both tools.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;🤖 Agent Mode&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Copilot’s &lt;strong&gt;Agent Mode&lt;/strong&gt; was introduced as experimental in response to Cursor &lt;strong&gt;autonomy workflow&lt;/strong&gt; and *&lt;strong&gt;*is now generally available in **VS Code Stable&lt;/strong&gt;. It enables &lt;strong&gt;multi-step, semi-autonomous workflows&lt;/strong&gt;, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Editing files across the workspace&lt;/li&gt;
&lt;li&gt;Running terminal commands with user approval (My guess is it follows a human-in-the-loop principle when executing commands autonomously—mainly from a security standpoint)&lt;/li&gt;
&lt;li&gt;Fetching and inserting web content with &lt;code&gt;#fetch&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;GitHub MCP Server support&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Available Context for Agent in GitHub Copilot got increased dramatically in last two months&lt;/strong&gt; (see the screenshot below)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Switch modes mid-conversation&lt;/strong&gt; (Ask → Edit → Agent) without losing context&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8gdvnorp8mqtzogc7o4m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8gdvnorp8mqtzogc7o4m.png" alt="Image description" width="763" height="489"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The available context list is growing on both sides—as each learns from the other.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;✏️ Edit Mode&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Targeted edits across one or more files—&lt;strong&gt;Edit Mode&lt;/strong&gt; lets you describe a change (e.g., “Convert this to use async/await”), and Copilot will propose updates in diff format, complete with &lt;strong&gt;undo, keep, or refine&lt;/strong&gt; controls. Known as the &lt;strong&gt;Copilot Editor&lt;/strong&gt;, it’s optimized for &lt;strong&gt;structured code transformation&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Describe a change in plain English&lt;/li&gt;
&lt;li&gt;See proposed edits across one or multiple files&lt;/li&gt;
&lt;li&gt;Accept or undo changes granularly with the updated diff UX&lt;/li&gt;
&lt;li&gt;Supports notebooks, comments, and image context&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recent updates:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unified editing experience inside the chat panel&lt;/strong&gt; (March ’25)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edit Mode support extended to JetBrains IDEs&lt;/strong&gt; (March ’25)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-file preview for edits&lt;/strong&gt; (Feb ’25)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image context for vision models&lt;/strong&gt; (Feb–Mar ’25)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Cursor introduced intuitive multi-file edits early on. Copilot now delivers that—and expands it across both VS Code and JetBrains IDEs.&lt;/p&gt;

&lt;p&gt;If I had to nitpick on Copilot, Cursor’s &lt;strong&gt;refactor revert UX&lt;/strong&gt; is more flexible: it treats refactors as checkpoints you can roll forward and backward. In Copilot, you can &lt;strong&gt;undo changes&lt;/strong&gt;, but there’s no native “revert the revert” capability just yet.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;🔍 Ask Mode&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Designed for &lt;strong&gt;exploration, explanation,&lt;/strong&gt; and &lt;strong&gt;problem-solving&lt;/strong&gt;. In Ask Mode, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Query your codebase (e.g., “Where is this class used?”)&lt;/li&gt;
&lt;li&gt;Get explanations or quick-start snippets&lt;/li&gt;
&lt;li&gt;Explore unfamiliar repos with help from chat participants like &lt;code&gt;@workspace&lt;/code&gt; or &lt;code&gt;#codebase&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Recent enhancements include (GitHub Copilot):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub URL pasting as context&lt;/strong&gt; — GitHub issues, discussions, and PRs [April 9, 2025]&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instant semantic indexing&lt;/strong&gt; of the &lt;strong&gt;currently working repo&lt;/strong&gt; (March ’25)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Cursor’s has various ways to build context for question - one of them is linking to Git PRs, Commits; GitHub copilot’s URL pasting context can help achieve the similar behaviour.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;All three modes—&lt;strong&gt;Ask, Edit, and Agent&lt;/strong&gt;—now live in a &lt;strong&gt;unified Chat view&lt;/strong&gt; in VS Code (starting v1.99 - April 4, 2025), allowing you to switch fluidly without losing context.&lt;/p&gt;

&lt;p&gt;(I’ll park the discussion on the &lt;strong&gt;quality&lt;/strong&gt; of these capabilities for another time, we will expreiment more to judge the quality)&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Other Mentions&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Some features in Copilot may not make the headlines but are quietly reshaping how we work with code. Here are a few worth highlighting:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Next Edit Suggestions (NES)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Copilot’s NES predicts the next edit you're likely to make and suggests it proactively—right where it matters in the code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Shows edit suggestions inline, with contextual cues&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Now generally available&lt;/strong&gt; with collapsed view and keyboard navigation&lt;/li&gt;
&lt;li&gt;Designed for low-friction productivity during focused work sessions&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;NES is trying to bring Cursor’s equivalent predictive editing experience.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;AI Rules (Personalization Layer)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;With &lt;code&gt;.github/copilot-instructions.md&lt;/code&gt; and prompt files (&lt;code&gt;*.prompt.md&lt;/code&gt;), you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Define team-wide or project-specific guidance&lt;/li&gt;
&lt;li&gt;Customize response behavior, code style, and structure&lt;/li&gt;
&lt;li&gt;Scope prompts by file type, pattern, or directory&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Cursor introduced a similar feature much earlier via .cursor/rules, allowing project-wide instructions. Copilot is not trying to match this with GitHub-native configurations.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Final Word: The Gap Is Closing&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This isn’t just a feature race—it’s a shift in how we build software.&lt;/p&gt;

&lt;p&gt;Cursor showed industry what’s possible. Copilot has responded with recent rollouts - multi-models, agentic workflows, flexible context, and seamless IDE integration.&lt;/p&gt;

&lt;p&gt;The development experience in &lt;strong&gt;VS Code&lt;/strong&gt; can now be shaped around these capabilities, offering countless combinations to build effective and adaptive developer workflows.&lt;/p&gt;

&lt;p&gt;Now that we have a clearer view of what’s available, we can begin experimenting—shaping our &lt;strong&gt;daily developer workflows&lt;/strong&gt; and &lt;strong&gt;development phases&lt;/strong&gt; to better reflect how we actually code, debug, and ship.&lt;/p&gt;

&lt;p&gt;As I mentioned earlier, the intent of this post is to bring &lt;strong&gt;clarity on what Copilot is capable of today&lt;/strong&gt;—not to decide which tool is better, or which one might win tomorrow. &lt;strong&gt;No sides. No hype.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I’m deliberately &lt;strong&gt;parking the discussion on the quality&lt;/strong&gt; of these capabilities for another time. We will explore case by case. For now, I hope this post helps set a &lt;strong&gt;strong, objective starting point&lt;/strong&gt;—a grounded view to help you make informed comparisons and decisions.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;**P.S.&lt;/em&gt;* Keep your IDE updated regularly to stay in sync with the rapid pace at which new capabilities and features are being rolled out.*&lt;/p&gt;

</description>
      <category>ai</category>
      <category>sdlc</category>
      <category>githubcopilot</category>
      <category>developer</category>
    </item>
    <item>
      <title>Power of Emergent Behaviour in a Complex System</title>
      <dc:creator>Bala K</dc:creator>
      <pubDate>Sun, 25 Jul 2021 09:42:35 +0000</pubDate>
      <link>https://forem.com/krishnam/power-of-emergent-behaviour-in-a-complex-system-1b25</link>
      <guid>https://forem.com/krishnam/power-of-emergent-behaviour-in-a-complex-system-1b25</guid>
      <description>&lt;p&gt;This blog is about understanding how we can tap into the potential of emergent behaviour in a Complex System and what we (IT Org) can learn from Ant Colony&lt;/p&gt;

&lt;p&gt;The ultimate purpose of enterprise architecture is not to design systems; it is to help an enterprise reach specific business goals and solve the enterprise’s core problems, and the designing system is a part of it.&lt;/p&gt;

&lt;p&gt;Ok…If designing a system is part of it, what else the EA is as a whole?&lt;/p&gt;

&lt;p&gt;Before I try to answer that, let me give a tour of complex systems and the emergent behaviour.&lt;/p&gt;

&lt;h2&gt;
  
  
  Complex System
&lt;/h2&gt;

&lt;p&gt;The common assumption is that one person can fully understand the complex interactions among all the elements that make up a modern enterprise. Though we wanted that to be true, we all know the reality.&lt;/p&gt;

&lt;p&gt;In general, the first step in approaching or solving a problem is acknowledging that there is a problem and understanding what the problem is. The problem: even a reasonably large collection of systems interacts in ways that no one person can fully understand all details or accurately predict — there is a name for this system: “Complex System”.&lt;/p&gt;

&lt;p&gt;Enterprise is a complex system; There are many studies and researches to characterize complex systems. One of the influential studies is ‘emergent behaviour’ in a complex adaptive system. Let’s briefly see what CAS is.&lt;/p&gt;

&lt;h2&gt;
  
  
  Complex Adaptive System (CAS)
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;“The complex adaptive system is a collection of independent entities where the individual elements each behave according to their own rules and interests, but when viewed as a whole, this collection of elements functions as a collaborative group whose behaviours benefit the entire group and rapidly adapt to changing environmental conditions as if they were centrally coordinated.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Ok…I got it, I think…But, what are we saying again?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A simple example of a complex adaptive system is a flock of birds. Moving from one place to another, turning in midflight, climbing, and diving all appear to be under the control of one — No single flock leader is instructing every step here.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Are we saying, ‘we don’t need a leader ?’&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;No, that is not what it means; it means — Let me give another example to make the notion apparent in the context of emergent behaviour.&lt;/p&gt;

&lt;h2&gt;
  
  
  Emergent Behaviour
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;“Usually, the individual elements of a complex adaptive system are relatively simple and operate according to a set of similarly simple rules. But when these simple elements are combined into a system, the system exhibits complex behaviours that are not readily predictable by examining the behaviours of the individual pieces. The system as a whole is greater than the sum of its parts and behaves differently.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This phenomenon is known as emergent behaviour and is one of the critical characteristics of a CAS.&lt;/p&gt;

&lt;p&gt;Put more simply, emergent behaviours result from each element of a system pursuing its own interest. Tapping into emergent behaviour is a compelling way to strengthening an organization. We can use the insight developed from CAS system research to improve enterprise architecture practice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ant Colony &amp;amp; IT Org
&lt;/h2&gt;

&lt;p&gt;An ant colony is an example of something scientists call a superorganism.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu37bkd1o4zbvpuizwpny.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu37bkd1o4zbvpuizwpny.png" alt="Alt Text" width="679" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“A superorganism emerges when individuals of the same species become so highly specialized that they cannot survive without being part of a larger group composed of many individuals with complementary specializations.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I know what you are thinking; Yes, the powerful IT organization sounds a lot like a superorganism.&lt;/p&gt;

&lt;p&gt;The key attributes of the superorganism, “complementary specializations” and “moving towards a common goal”, are what makes an Organization powerful. What else can we learn from superorganisms? Let’s walk back to the ant colony.&lt;/p&gt;

&lt;p&gt;The ant colony does many complex tasks, including forage for food, maintaining the nest, caring for eggs and young ants, fighting off predators, and many others tasks. For example, when one ant finds a food source, the ants will collectively find the shortest path to the source.&lt;/p&gt;

&lt;p&gt;Here is how it happens; worker ants leave the colony each day to forage for food. They initially set out without a specific destination, and each wanders the area until it finds a food source. Several ants may find the same food source simultaneously from different routes, and each of the ants will return to the nest independently. On this return journey, the ant releases pheromones, a chemical trail that helps other ants find the source. Those ants that return most quickly will inspire more ants to follow their trail. Over time, the worker ants converge on the shortest routes, and the longer tracks are abandoned. Voilà!&lt;/p&gt;

&lt;p&gt;Let’s dissect and understand what just happened here.&lt;/p&gt;

&lt;p&gt;The goal of the ant colony is not just to find food. Instead, the colony’s goal is to maintain its health and propagate the species; finding food is just one of the tasks necessary to reach that goal. They have to be back in the nest sooner to protect the colony. This is one of the constraints that create the instinct to bring food back more quickly. It makes finding the shortest path as emergent behaviour.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let’s Conclude (for now)…
&lt;/h2&gt;

&lt;p&gt;The leaders/enterprise architects can focus on the following aspects to yield results through emergent behaviours; making the common goals apparent and help make the complex system move towards that through defining a development framework, process, guidelines, and constraints. Instead of focusing more on laying out very detailed instructions for doing everything, take advantage of the CAS system by recognizing the importance of the emergent behaviours that come from these systems. Everything about an enterprise architecture effort should contribute to reaching the enterprise’s goals; tasks that do not support the enterprise’s goals are a waste of resources.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;In short, Building an efficient system requires both top-down (clear vision, goals, guidelines &amp;amp; constraints ) and bottom-up approaches (room for exploration, adaptiveness, autonomy on implementing low-level details).&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Foot Note:&lt;/strong&gt;&lt;/em&gt; Characteristics of CAS systems and their relevance to system design have been recognized for many years. This blog is a summary of my learning in this field of study. In part two of this article, I will expand more on what we concluded in this post. Stay tuned.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>design</category>
      <category>systemthinking</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Multidimensional Scalability Model for Application</title>
      <dc:creator>Bala K</dc:creator>
      <pubDate>Mon, 05 Jul 2021 05:50:20 +0000</pubDate>
      <link>https://forem.com/krishnam/multidimensional-scalability-model-for-application-29ml</link>
      <guid>https://forem.com/krishnam/multidimensional-scalability-model-for-application-29ml</guid>
      <description>&lt;p&gt;This blog is about how to observe scaling problems in a multidimensional way. Scale cube is an influential and straightforward concept that can be a vehicle to focus on scalability-related discussions, approaches, and implementations. Let’s start by going over the different ways of scaling an application, including its benefits and drawbacks. In the end, I will use one of my applications as a case study to demonstrate these dimensions to draw a picture of how they fit in the real world.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzxu6va603kt5h68oyy3u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzxu6va603kt5h68oyy3u.png" alt="Alt Text" width="800" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Scale Cube
&lt;/h2&gt;

&lt;p&gt;The cube model defines three ways to scale our applications: X, Y, and Z. Progress on each axis solve different scalability problems; to bring the right scalability balance for our application, we will move the needle to varying lengths on these three axes.&lt;/p&gt;

&lt;h2&gt;
  
  
  X-axis Scaling: Horizontal Duplication
&lt;/h2&gt;

&lt;p&gt;Here the method of scaling is by cloning or replicating. It is one of the popular ways to scale an application. It involves running multiple application instances doing the same task. The load balancer distributes requests among the N identical instances of the application, and each instance works 1/N of the load.&lt;br&gt;
The x-axis approach is easy to implement in most cases. You take the same code that existed in a single instance implementation and put it on as multiple instances. If your application is “stateless,” you simply load balance all of the inbound requests to any of the N systems. If your application is “stateful,” the implementation is slightly more complex. Making your application cluster-friendly is the demanded effort before cloning.&lt;br&gt;
This approach is an excellent way of improving the capacity and availability of an application. On the downside, x-axis implementations are limited by the growth of a monolithic application, and they do not scale well with increases in data or application size. Further, they do not allow engineering teams to scale well, as the code base is monolithic, and it can become comparatively complex over time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Y-axis Scaling: Functional Decomposition
&lt;/h2&gt;

&lt;p&gt;Y-axis scaling splits your application into multiple services by the separation of work responsibility. Travelling in Y-axis is a journey towards a pure microservices architecture. The common challenge with the idea of microservices architecture is with the term micro. Instead of debating on “What should we define as the size of micro?”, it is better to see this scaling as a functional decomposition to give the application multiple deployable modules. Application complexity and business capability can help decide the modules.&lt;br&gt;
Y-axis scaling has a blind spot. What I mean by this is, at a very high level, it is often possible to implement a y-axis split in production without actually breaking the codebase itself. However, a clean separation at the codebase is needed to get the most benefits of this approach.&lt;br&gt;
“There is only one codebase per app…” — 12factor app.&lt;br&gt;
The Y-axis scaling tends to be more costly to implement for the brownfield application than the X-axis scaling. Still, it solves different kinds of issues than availability issues addressed by X-axis scaling. In addition to handling matters related to increasing development and application complexity, Y-axis splits support creating fault-isolative architectural structures.&lt;br&gt;
Of course, this approach comes with its own set of new challenges to handle. It should be considered while making a trade-off — the number of distinct sub-applications increases the complexity around operations and shared-data management.&lt;br&gt;
In general, when Engineering teams start to lose development velocity, that indicates an opportunity to scale further in the Y-axis. If the application is too large for any developer to understand fully, that is also a signal for decomposition.&lt;/p&gt;

&lt;h2&gt;
  
  
  Z-axis Scaling: Partitioning by Attribute
&lt;/h2&gt;

&lt;p&gt;Z-axis scaling is about scale by splitting similar things based on a “looked up” value, a.k.a attribute. This scaling also runs multiple instances of the application, but unlike X-axis scaling, each instance is responsible for only a subset of the data or the workload. In the later section, we will see this with an example.&lt;br&gt;
Very often, this approach offers a first-class scaling at the fine grain. An increase in fault isolation and scaling at the partition level are the key benefits of this approach. This approach can be combined with x-axis scaling to bring availability along with partition level fault isolation.&lt;br&gt;
Though we may not be creating multiple instances in the z-axis right away, it is best to keep this as a vision or end goal while making significant design decisions for your application. It is very well possible that different customers have a different level of priority and weightage to a different partition of your application. For example, if I have to scale one partition much higher than the other partitions to serve customer-specific usage patterns better, designing application architecture to support z- scaling is essential.&lt;br&gt;
An interesting observation is that: Z-axis is a little easy from a design perspective for a greenfield project. But, this scaling tends to be the most costly for brownfield applications.&lt;br&gt;
(Each scaling axis solution should handle caching strategy differently to get even more out of these approaches. This is another topic for another time)&lt;/p&gt;

&lt;h2&gt;
  
  
  Case Study
&lt;/h2&gt;

&lt;p&gt;This section will demonstrate how the scalability cube perspective helped boost my application scalability needs; let’s call this app App-X (intentionally, I am skipping the business use case here to keep it simple).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flrm42dhz8btp6k2lkirt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flrm42dhz8btp6k2lkirt.png" alt="Alt Text" width="800" height="601"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Y-axis
&lt;/h2&gt;

&lt;p&gt;When the application development team started with a two-pizza size (group small enough to be fed with two pizzas), App-X as one application is a good starting point. When the App-X was relatively small, monolithic architecture had many benefits: simple to develop, easy to make radical changes to the application, and straightforward to deploy. In an initial couple of years, the application went through constant changes to the data model as the requirements start to grow; monolithic made it easy for the high-velocity agility.&lt;br&gt;
However, over time, to manage the growing complexity, decomposition is a necessary step. Functionally decomposing extensive application into multiple independently deployable modules is an ongoing process for any application. The App-X now has numerous components for various work modules — one for computing-unit, one for UI, one for input-extraction, one for calculator services, one for the reuseable internal library, and one for downstream services orchestrator and so on. Even the clear separation at the codebase level is what we achieved.&lt;/p&gt;

&lt;h2&gt;
  
  
  X-axis
&lt;/h2&gt;

&lt;p&gt;The significant benefit of this scaling is to provide high availability. Hence, we started with a user-facing component of App-X. This application is not a simple stateless application. So, it has to go through the pre-step of making the app cluster-friendly. Then, this component has been containerized and enhanced to work with active-active mode. However, for the computation component of App-X, it could use more than this one-dimensional scaling. Y- and Z- axis scaling can be much more beneficial to this component.&lt;/p&gt;

&lt;h2&gt;
  
  
  Z-axis
&lt;/h2&gt;

&lt;p&gt;Similar to how x-axis scaling requires your application to be stateless or cluster-friendly, z-axis scaling also needs pre-step if the application is designed in a traditional N-tier layered architecture with centralized execution control. That was a case in App-X.&lt;br&gt;
To enable the z-axis capability, the computational component should be stripped independently based on the attribute (in App-X, it was partitioned by business attribute); this needs a redesign of the computational-unit-driver to move to hexagonal architecture style from layered architecture style. In that context, a small scale spike was done to make the sub-component of the computation unit to be independently launchable. The idea is to create configurable swim lanes. We will go over this in detail, maybe in another blog. For now, let's see splitting by attribute as just an example to demonstrate how the z-axis scaling will look like.&lt;br&gt;
This approach will enable us to scale computational-unit-internal workload in isolation and on-demand. And, This will provide much more control over the execution of work units and pave a step towards a configurable concurrent model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let’s Conclude…
&lt;/h2&gt;

&lt;p&gt;The cube model is not something new; in fact, this was first published a decade back in ‘The Art of Scalability’ book. However, it is worth rehashing these concepts when tackle scalability needs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For a greenfield project, it is vital to architect your application to support scalability in a multidimensional way, even if you will not launch the n-instances of your app on day one. Because bringing these capabilities later is very costly. So, make it cluster-friendly, make it as modular as possible, make it independently launchable and deployable units by design.&lt;/li&gt;
&lt;li&gt;For a brownfield project, deciding when-to scale, what-direction-to scale, how many splits to create is not straightforward. It is both science and art. However, using incident and production issues history analysis to spot the scale bottlenecks could be a good starting point to figure out the scalability directions.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>scalability</category>
      <category>architecture</category>
      <category>design</category>
      <category>casestudy</category>
    </item>
    <item>
      <title>Continuous Inspection: 3 Steps to Manage Complexity</title>
      <dc:creator>Bala K</dc:creator>
      <pubDate>Tue, 18 May 2021 13:29:04 +0000</pubDate>
      <link>https://forem.com/krishnam/continuous-inspection-3-steps-to-manage-complexity-5ii</link>
      <guid>https://forem.com/krishnam/continuous-inspection-3-steps-to-manage-complexity-5ii</guid>
      <description>&lt;p&gt;The objective of this blog is&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To briefly discuss - What is Continuous Inspection and What are the deadly sins of a developer? &lt;/li&gt;
&lt;li&gt;To throw some insight into how SonarQube computes Code Complexity. It is pretty different from the traditional metric we all are well aware of – Cyclomatic Complexity.&lt;/li&gt;
&lt;li&gt;To emphasize some of the Programming Principles and Refactoring Idioms, which are directly linked with code complexity.&lt;/li&gt;
&lt;li&gt;To share my favourite mind maps related to Continuous Inspection.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Continuous Inspection
&lt;/h1&gt;

&lt;p&gt;What is it? It is a widespread inspection of software to provide early warning of maintainability and other code quality issues. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Continuous Inspection is a process designed to make internal code quality an integral part of the software development life cycle. The key concept in Continuous Inspection is finding problems early–when fixing them is still cheap and easy. Under this model, automated code audits are performed daily and made available within an organization." - SonarQube Whitepaper. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are ten principles of Continuous Inspection defined by SonarQube. Here are my three favourites;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Software Quality must be part of the development process, meaning that meeting quality standards is one of the demanding requirements to declare development complete.&lt;/li&gt;
&lt;li&gt;Software Quality data must be up to date&lt;/li&gt;
&lt;li&gt;All new issues and existing critical issues must be assigned a clear path and timeline for resolution.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's quickly skim through what we call as deadly sins before we see three steps of managing them. &lt;/p&gt;

&lt;h2&gt;
  
  
  The Deadly Sins
&lt;/h2&gt;

&lt;p&gt;Sonar defines the following seven technical axes, which the Sonar team prefers to call them: "The seven deadly sins of a developer."&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnu51gsh6jdjwg74fnpzt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnu51gsh6jdjwg74fnpzt.png" alt="image" width="665" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Coding standards: respect coding standards and follow best practices&lt;/li&gt;
&lt;li&gt;Potential bugs: eliminate code violations to prevent vulnerabilities&lt;/li&gt;
&lt;li&gt;Documentation and comments: provide documentation especially for the Public API, the source code&lt;/li&gt;
&lt;li&gt;Duplicated code: isolates and refines duplication, Don't Repeat Yourself&lt;/li&gt;
&lt;li&gt;Complexity: equalizes disproportionately distributed complexity among components; eliminates complexity if possible. &lt;/li&gt;
&lt;li&gt;Test coverage: writes unit tests, especially for complex parts of the software.&lt;/li&gt;
&lt;li&gt;Design and architecture: minimize dependencies&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Violations/Code Smells
&lt;/h2&gt;

&lt;p&gt;Code-Smells is always my most-liked topic. I did create some mind-map long ago based on few resources on code smells taxonomy; a good shared vocabulary comes very handily while doing code/design review. This picture conveys a lot more than a thousand words – 37264 words to be precise! Check &lt;a href="https://blog.codinghorror.com/code-smells/" rel="noopener noreferrer"&gt;Jeff's blog&lt;/a&gt; and Journal of Empirical Software Engineering to get a summary of what each smell means.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkfjkrvnpdmtpbslsgoom.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkfjkrvnpdmtpbslsgoom.jpg" alt="CodeSmells" width="800" height="638"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;It will be a fun exercise to match the code smell name with its corresponding picture representation. Here is the clue: I used the same colour code for each group, narrowing down the selection.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The newer version of SonarQube started showing bad practice as Code Smells (previously called Violations). It is an excellent strategy to call it smell; The term 'code smell' puts psychological pressure on the code developers. No one wants the results of their work to be "smelly". SonarQube can identify a good amount of Code Smells that are easy to find by the machine. However, the remaining tricky code smells need to code/design reviewers' nose to spot them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continuous Inspection: Step 1&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bring and keep the code smells to zero&lt;/li&gt;
&lt;li&gt;Most of the code smell should be identified in the development and the code review phase even before it goes to the mainline (master branch) &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Test Case Coverage
&lt;/h2&gt;

&lt;p&gt;A quick note on the code coverage is in order. Code coverage is how much code of the application on the test is being exercised by giving a test read. That number may not mean a lot in itself, but it can be interesting to watch the trend. If coverage decreases regularly, you should look into why that is happening. To keep the coverage constant, the number of test cases should correlate with the Cyclomatic Complexity (we will see this later). As you add more complexity, you should also add more test cases (although in TDD, you should add the test cases first). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continuous Inspection: Step 2&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Watch out for the code coverage trend: Bench-marking code coverage of the project at the start and end of the sprint is an excellent way to do it. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What could be the Next Steps?&lt;br&gt;
We all know that, Step 1 and Step 2 should be religiously followed. So, let's introduce Step 3 -- Code Complexity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Code Complexity
&lt;/h2&gt;

&lt;p&gt;Code Complexity is intended to identify the software modules that will be difficult to test or maintain. In other words, it provides the quantitative measure of the Clean Code. Two famous complexity metrics are widely accepted. Let's compare and contrast.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cyclomatic Complexity&lt;/li&gt;
&lt;li&gt;Cognitive Complexity&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cyclomatic Complexity
&lt;/h3&gt;

&lt;p&gt;McCabe's Cyclomatic Complexity is an old and established measurement of the software complexity. It has been the de-facto standard for measuring the complexity of a method's control flow for a long time. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cyclomatic Complexity Algo:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The minimum possible Cyclomatic complexity is one because there's always going to be one path. To measure the complexity of a given block of code, start with one and add one every time you find the keywords such as if, else, case, for, for each, do, while, catch.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Though the Cyclomatic Complexity accurately calculates the minimum number of test cases required to cover a method fully, it is not an adequate measure of understandability. Let's see why,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo4bc9efisln72camcrjl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo4bc9efisln72camcrjl.png" alt="image2018-11-28_21-1-27" width="321" height="237"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8t9a31makrkb3u77u2zq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8t9a31makrkb3u77u2zq.png" alt="image2018-11-28_21-8-7" width="414" height="233"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The mathematical model underlying Cyclomatic Complexity gives these two methods equal weight. However, the control flow of the sum of primes is more challenging to understand than that of getWords. The standard Cyclomatic Complexity algorithm penalizes switch/when statements quite heavily. And also, It doesn't include modern language structures like try/catch and lambdas.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cognitive Complexity
&lt;/h3&gt;

&lt;p&gt;Cognitive Complexity breaks from the practice of using mathematical models to assess software maintainability. It starts from the precedents set by Cyclomatic Complexity but uses human judgment to determine how structures should be counted.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cognitive Complexity Algo:&lt;/strong&gt;&lt;br&gt;
The score is assessed according to three basic rules:&lt;/p&gt;

&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;Ignore structures that allow multiple statements to be readably shorthanded into one, 2. Increment (add one) for each break in the linear flow of the code, 3. Increment when flow-breaking structures are nested&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;Additionally, a complexity score is made up of four different types of increments:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Nesting - assessed for nesting control flow structures inside each other, Structural - considered on control flow structures that are subject to a nesting increment, and that increase the nesting count, Fundamental - assessed on statements not subject to a nesting increment, Hybrid - considered on control flow structures that are not subject to a nesting increment, but which do increase the nesting count.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw4mv799xfgp3kb4sjsul.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw4mv799xfgp3kb4sjsul.png" alt="image2018-11-28_21-17-14" width="304" height="223"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fph0xc2slxd1mfa6x24cu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fph0xc2slxd1mfa6x24cu.png" alt="image2018-11-28_21-18-49" width="415" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Cognitive Complexity algorithm gives these two methods markedly different scores that are far more reflective of their relative understandability. More details on how it computes the Cognitive number can be found at SonarQube Documentation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continuous Inspection Step 3:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use build plugins to check Code complexity whenever we add new class, methods or components and refactor it to see if we can reduce the complexity.&lt;/li&gt;
&lt;li&gt;The number can be tracked at the project level similar to the code coverage to watch the trend. But, the number makes more sense at the individual component level.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, we can compute like &lt;code&gt;the project's complexity = project complexity/project lines of code(LOC)&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;In this way, we should compare the complexity between two major releases by nullifying the increase in LOC.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stay Clean
&lt;/h2&gt;

&lt;p&gt;These are my best-loved books when it comes to Continuous Inspection. The wisdom from these books are like helpline to get clean and stay sober.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.goodreads.com/en/book/show/4099" rel="noopener noreferrer"&gt;The Pragmatic Programmer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.goodreads.com/book/show/44936.Refactoring?from_search=true&amp;amp;from_srp=true&amp;amp;qid=ZxMTJxZW0H&amp;amp;rank=1" rel="noopener noreferrer"&gt;Refactoring: Improving the Design of Existing Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.goodreads.com/book/show/3735293-clean-code?from_search=true&amp;amp;from_srp=true&amp;amp;qid=UwEh5tti3F&amp;amp;rank=1" rel="noopener noreferrer"&gt;Clean Code: A Handbook of Agile Software Craftsmanship&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I just want to end the blog with the summary of code-smells and the summary of refactoring technique and how to put them together to get what we want. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.refactoring.com/catalog/" rel="noopener noreferrer"&gt;Refactorings Catalog&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://mmantyla.github.io/BadCodeSmellsTaxonomy" rel="noopener noreferrer"&gt;Codesmells Taxonomy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://people.scs.carleton.ca/~jeanpier//3004W21/wk5/3-%20Smells%20to%20Refactorings.pdf" rel="noopener noreferrer"&gt;How to put them together&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>codequality</category>
      <category>programming</category>
      <category>productivity</category>
      <category>codereview</category>
    </item>
    <item>
      <title>Why Kotlin: A Note From a Java Developer</title>
      <dc:creator>Bala K</dc:creator>
      <pubDate>Mon, 26 Apr 2021 16:01:43 +0000</pubDate>
      <link>https://forem.com/krishnam/why-kotlin-a-note-from-java-developer-2n6h</link>
      <guid>https://forem.com/krishnam/why-kotlin-a-note-from-java-developer-2n6h</guid>
      <description>&lt;p&gt;This blog is about sharing my experience and what I love about Kotlin. I worked with two applications that are entirely written in Kotlin in a year. I had exposure to two ways of using Kotlin in our applications: Writing a new application from scratch and migrating the existing legacy Java app to Kotlin.&lt;/p&gt;

&lt;p&gt;Let's start with what we love about Kotlin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Kotlin (and why do we use it)?
&lt;/h2&gt;

&lt;p&gt;One of the tangible and essential things is that Kotlin language came from the industry, not academia – It was developed &lt;strong&gt;"to solve programmers' difficulties"&lt;/strong&gt; and operational challenges. We wanted to pay special attention to Kotlin features that Java does not have (at the time of this exercise) to evaluate if it will help the projects. The result is, we could fill an entire book about the things we like about Kotlin. Here is a run-down of highlights.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does It Change the Way We Code (compare to Java)?
&lt;/h2&gt;

&lt;p&gt;Kotlin is really "Java's best practices" put into a language. It solves problems faced by working programmers today.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kotlin &lt;strong&gt;costs nothing to adopt&lt;/strong&gt; in two aspects! 

&lt;ul&gt;
&lt;li&gt;It's Open-Source. &lt;/li&gt;
&lt;li&gt;One-click Java to Kotlin converter tool, and a strong focus on Java binary compatibility.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Lean Syntax:&lt;/strong&gt; Kotlin focuses on readable, at the same time, concise syntax, which makes code-reviews/understanding-the-code painless. &lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Complete Interoperability with Java:&lt;/strong&gt; Kotlin is 100% interoperable with Java, having many similarities in the structuring and functionalities.&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Ease of interchangeability:&lt;/strong&gt; The shift from Java to Kotlin is smooth and swift. One can have Kotlin and Java both alongside each other in the same project. &lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Improved Code Maintainability:&lt;/strong&gt; Being a concise language, Kotlin drastically reduces the boilerplate code required, enhancing productivity and reducing error. Less code makes easy learning.&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Lower Instances of Application Crashes:&lt;/strong&gt; Kotlin is designed on the concept of fail-fast.&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgxfl6d78itwjlvxk3ya6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgxfl6d78itwjlvxk3ya6.png" alt="Alt Text" width="656" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kotlin brings a myriad of language features. It is worth noting that most of the features are meant to bring best practice to the coding (comparable to how frameworks guide developers in the right direction)—listing down the top the fifteen features, which will make a huge difference compared to how we code in Java.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Null Safety: Kotlin as a whole has a much bigger emphasis on overall null safety.
2. Arrays in Kotlin are invariant: Arrays in Kotlin are not built on native types but are instead based on a Java array, which means that an array of a specific type cannot be assigned to an array of its parent type. It is not possible to set Array&amp;lt;Integer&amp;gt; to Array&amp;lt;Any&amp;gt;. 
3. Extension Functions: Ability to extend a class with new functionalities without modifying it
4. No checked exceptions: In Java, exception handling is tedious and controlled by strict rules. Whenever we are dealing with checked exceptions, we can either handle exceptions in try…catch blocks or be declared to be thrown. In this case, the code is repeated. 
5. Data Class: Unlike in Java, where, when creating classes only meant to hold data (models or POJOs to be specific), we are required to write all of the fields, setters, getters as well as a constructor; In Kotlin, we can define all of these things on a single line.
6. Default Arguments: Removes a lot of the need for overloaded methods with the introduction of default arguments
7. Named Arguments: Avoids Client confusion in passing Parameters to Method or Constructor calls. It improves the readability of the code.
8. Delegation: Provides native support for the delegation pattern
9. When Expression: Provides the better version of Switch Statement 
10. Function Literals: Provides the concise version of Function Interfaces
11. Operator Overloading: This allows you to simulate a DSL
12. Immutability: Native support for making things immutable
13. Type Aliases: Improves readability and makes code succinct
14. String Interpolation: Easier way to concatenate a string together without excessive syntax
15. Better Generics &amp;amp; Coroutines
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I know what you're thinking at this moment; &lt;em&gt;"Wait! this is just a bunch of key distinctive features, and anything new gives something like that. Still, why Kotlin? You can't just sell it by showing a fancy list of features ".&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I will tell you this, &lt;em&gt;"There is a way to look beyond just features."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let's change the scenery now and go to &lt;strong&gt;defensive programming valley&lt;/strong&gt;, then it will be evident 'Why Kotlin'.&lt;/p&gt;

&lt;h2&gt;
  
  
  Defensive Programming
&lt;/h2&gt;

&lt;p&gt;Think of defensive programming as analogous to "defensive driving", which would help if the term is not very familiar.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa0uvr08ihi4782y88r5z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa0uvr08ihi4782y88r5z.png" alt="Alt Text" width="300" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you drive defensively, you assume that the other drivers are not careful. You must be cautious yourself: you must give yourself extra room on the road to make emergency manoeuvres. You assume other drivers may ignore red lights and stop signs; therefore, you look both ways and are ready to stop when you approach intersections. You anticipate problem areas up ahead – dense traffic, impaired visibility, and other potential impediments. In any case, you devote a lot of time, energy, and resources to the infrequent and unlikely event that you will encounter a dangerous situation.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"Okay, I got it"&lt;/em&gt;. &lt;em&gt;"Adding NULL checks and other checks is Defensive programming"&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;&lt;em&gt;"No! Please stop that thought&lt;/em&gt; – we are not giving enough credit to the &lt;strong&gt;art of defensive programming&lt;/strong&gt; if we are thinking that way".&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"Okay, then, what is defensive programming?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As I said, it is an art. what I believe to be the motto of defensive programming is: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"If you have to defend, you already had lost the battle."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example, adding Null-Checks is Defensive-Coding; instead, coding so that you do not need to check for null is the real art. This comparison is just one example to illustrate defensive programming; there are many – we can have an exclusive blog for visiting that valley later. Let's get back to Kotlin Valley now.&lt;/p&gt;

&lt;p&gt;When we use Kotlin, without the developer being aware, they use many defensive programming styles naturally. It is by design as a default setting; e.g. all classes are final unless stated otherwise, the default behaviour of type is non-nullable…etc…&lt;/p&gt;

&lt;h2&gt;
  
  
  Dev Journal
&lt;/h2&gt;

&lt;p&gt;In 2018, We worked on a Greenfield project, which allowed us to take a step back to question popular thinking a few years back.&lt;/p&gt;

&lt;p&gt;When we think of developing an application, Java is one of the top programming languages that come to mind for various reasons, including its robust and secure nature and the independence of its platform. Kotlin is designed to be interoperable with Java, meaning Kotlin can seamlessly co-exist with Java. We can add Kotlin to our existing applications, and we can use Java-based frameworks for application development. With this bi-directional use of Kotlin, we can invoke Java constructs from Kotlin or Kotlin constructs from Java.&lt;/p&gt;

&lt;p&gt;Although Java and Kotlin are both JVM-based languages used for application development, there are several differences between them, as covered in an earlier section. Kotlin has addressed some of the limitations previously associated with Java. The more we learn about the things Kotlin support, our pressing question of why-kotlin turned into why-not-kotlin.&lt;/p&gt;

&lt;p&gt;We had exposure to two ways of using Kotlin in our applications:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Moving legacy Java written project to Kotlin language&lt;/li&gt;
&lt;li&gt;Project development on Kotlin from scratch
While developing a new application, in general, when time-limit holds the gun to the head, we tend to copy over the setup from an existing application; sometimes, we don't realize that we are reproducing some legacy stuff along with it. For these projects, we tried not to do that. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;"Is there any impact on the way we test or write the test? "&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;"Yes, very positive one. The two applications built in this stack have around 80+ and 90+ as unit test coverage."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;"Did we notice any significant performance degrade?"&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Though we have not tested the performance of the Kotlin in an experimental condition like implementing the application both in Kotlin &amp;amp; Java and bench-marking it, however, we did compare the performance with legacy (now dead) wherever applicable. The performance was at par, and sometimes it was even better.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;"What is the learning curve (and how did we learn)?"&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are many ways you can build new tech skill; most of us followed the below.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Step 1: 4Hrs Video Training to start the cold engine to enter into the Kotlin Valley &lt;br&gt;
There are a lot of courses available on Pluralsight &amp;amp; Udemy; we started with Pluralsight: kotlin-fundamentals. At that time, when we began learning  Kotlin. Pluralsight course was open for Free. Lucky Us. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 2: Kotlin Koans to get familiar with Kotlin by doing small exercises. Kotlin Documentation is good to look back at any time. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 3 &amp;amp; 4:  Then, Code &amp;amp; Write Unit Tests (have a printout of Quick Reference Card while coding) &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What is the Maintainance overhead post-production ?&lt;/strong&gt;&lt;br&gt;
These two applications are running well in production over the last 3+ years without any technical or maintenance issues related to the stack being Kotlin; thus, we see high stability in these two applications. &lt;/p&gt;

&lt;p&gt;We enjoyed learning something new (in 2018). From a Java developer perspective, the learning curve to Code in Kotlin is close to flat. Once the integration of the stack was ready to provide a skeleton for the project, we managed to gain speed in Kotlin within a week and write more idiomatic code within a couple of weeks. If you find it interesting, learn about best practices and go for it to fit your application nature. &lt;/p&gt;

&lt;h2&gt;
  
  
  Summing-up
&lt;/h2&gt;

&lt;p&gt;Kotlin, &lt;a href="https://youtu.be/Ly3Vs1K_74g" rel="noopener noreferrer"&gt;"You Had Me at Hello"&lt;/a&gt; (here, the Hello means "to solve programmers' difficulties"). Overall, it was a positive experience. &lt;/p&gt;

&lt;p&gt;P.S: This is a page from my devjournal 2018. And, I feel this is still relevant. &lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>java</category>
      <category>devjournal</category>
      <category>jvm</category>
    </item>
    <item>
      <title>Reliability Engineering: Two Mistakes High</title>
      <dc:creator>Bala K</dc:creator>
      <pubDate>Sat, 24 Apr 2021 03:22:25 +0000</pubDate>
      <link>https://forem.com/krishnam/reliability-two-mistakes-high-9hp</link>
      <guid>https://forem.com/krishnam/reliability-two-mistakes-high-9hp</guid>
      <description>&lt;p&gt;This blog is about — What Is "Two Mistakes High"? and How is it relevant to our IT industry?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What does it mean?&lt;/li&gt;
&lt;li&gt;Why TWO mistakes?&lt;/li&gt;
&lt;li&gt;Is it relevant to us?&lt;/li&gt;
&lt;li&gt;How do we apply in an application?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I stumbled on this expression a couple of years back while reading a tech book. When I read it, it sounded OK; nothing too exciting or remarkable about that. Later, I noticed something; it was a seed that started to root stronger. Now I can't get it out; every time I make some decision about reliability/stability, regardless of whether it is for work or for fixing something at home (be it electrical/plumping/carpentry/IoT project), I almost hear someone whispering in my ear &lt;em&gt;"are yooou flying two mistakes high?"&lt;/em&gt;&lt;br&gt;
Hold on ✋, before you call this paranoia, let's see what does it mean to "Flying Two Mistakes High"?&lt;/p&gt;

&lt;h3&gt;
  
  
  What does it mean?
&lt;/h3&gt;

&lt;p&gt;This expression is used while kids are learning to fly remote control aeroplanes.&lt;/p&gt;

&lt;p&gt;When you learn to fly, you will be doing some manoeuvres and learning acrobatics. Of course, you will try out a stunt of some sort. And, quickly, you will learn this lesson: If you make a mistake, your plane will naturally lose some altitude.&lt;br&gt;
And, you will see, mistakes equate to altitude.&lt;/p&gt;

&lt;p&gt;So, keeping your plane "two mistakes high" means keeping it high enough that you have enough altitude to recover from two independent mistakes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why TWO mistakes?
&lt;/h3&gt;

&lt;p&gt;While you are recovering from the first mistake — and you are now already lower in altitude — what happens if you make another slip-up? If your plane isn't high enough to recover from the second mistake, well, it's terrible news. And, if you lose too much altitude, you know what happens — broken toy at worst.&lt;/p&gt;

&lt;p&gt;In that event, you always want to stay high enough to recover from a mistake, even while you are still recovering from the first mistake. As a result, you don't crash, no matter what goes wrong.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is it relevant to us (IT)?
&lt;/h3&gt;

&lt;p&gt;We saw where the expression came from. And, this is a good analogy for maintaining availability in our most critical applications.&lt;br&gt;
In our critical modern applications, It means that even when something is going wrong with our application, we want to keep our application running reliably enough so that we can afford for something else to go wrong while we are still recovering from the main problem. Think about it: during our recovery process, we are typically stressed and perhaps in a tricky situation doing potentially ad-hoc things — just the type of situation that can cause us to make another mistake.&lt;/p&gt;

&lt;p&gt;While I was researching more on this topic (just a glorified way of saying "I googled it"), I was able to find only a handful of info that relates this philosophy with the IT field — most of them are about how it can be connected to availability.&lt;br&gt;
But, to me, it is more than that. It applies to many more scenarios.&lt;/p&gt;

&lt;p&gt;I believe, inherently, most of us are risk-takers, and we would like to push the envelope now and then test our limit (in this case, try our application limit — keeping the error budget in mind). I consider the R/C plane analogy as a meta-thinking tool. It makes you take calculated risks in any given situation.&lt;/p&gt;

&lt;p&gt;It is a lesson about redundancy, and it's a lesson about resiliency, and it is a lesson about …you get the idea. It effectively applies to modern application development, change management, operation. It even applies in many other aspects: from dealing with hardware failures to data redundancy, capacity planning, performing retries in your service calls, reducing toil, risk management, and disaster planning.&lt;/p&gt;

&lt;p&gt;For those curious minds who might ask, "Why stop at two? Why not three or more mistakes high?"&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Short answer: To keep it simple, I don't want to go Inception experience here to avoid Limbo. To start with, two sounds reasonable enough.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How do we apply in an application?
&lt;/h3&gt;

&lt;p&gt;For starters, when we identify the failure scenarios that we anticipate, we should walk through the ramifications of those scenarios and our recovery plan for them. We make sure the recovery plan itself does not have the potential for mistakes or other shortcomings built into it — in short, we check that the recovery plan can work, and it has backup for shortcomings.&lt;br&gt;
Sounds simple, right?…. Big No, it is easier said than done. But we can practice wherever/whenever we should to make it a habit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;A few years back, when one of the applications was facing relatively high stability issues, my mentor gave me the advice to bring things under control. This is the gist of what he said: "Hey Bala, it is ALL about asking the right questions, and there is no need to get overwhelmed".&lt;/p&gt;

&lt;p&gt;I can firmly say, "are you flying two mistakes high?" comes under that list of right-questions-to-ask.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For site reliability engineering, the word "mindset" is critical. Being an effective SRE is as much about how you think as it is about your technical skills.&lt;br&gt;
— Kevin Casey&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>sre</category>
      <category>design</category>
      <category>developer</category>
      <category>reliability</category>
    </item>
    <item>
      <title>tmux: 13 Cool Tweaks to Make It Personal and Powerful</title>
      <dc:creator>Bala K</dc:creator>
      <pubDate>Tue, 20 Apr 2021 18:07:20 +0000</pubDate>
      <link>https://forem.com/krishnam/tmux-13-cool-tweaks-to-make-it-personal-and-powerful-487p</link>
      <guid>https://forem.com/krishnam/tmux-13-cool-tweaks-to-make-it-personal-and-powerful-487p</guid>
      <description>&lt;p&gt;&lt;strong&gt;Intended Audience:&lt;/strong&gt; tmux users (beginner) or who read &lt;a href="https://dev.to/krishnam/dev-productivity-command-line-happiness-with-terminal-multiplexing-5067"&gt;the part one&lt;/a&gt; of my "Command Line Happiness" post or looking for best tips &amp;amp; tricks. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why do you want to tweak the default setup ?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Keyboard shortcuts in tmux are a bit of &lt;strong&gt;a stretch, both physically and sometimes mentally&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;tmux has a lot of &lt;strong&gt;less-than-stellar default&lt;/strong&gt; setting&lt;/li&gt;
&lt;li&gt;Moreover, the configuration is fun, especially when you personalize it to &lt;strong&gt;suit your needs&lt;/strong&gt;; after all, that's what it's for!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In general, I prefer using the default setting with any tech/tools that I use as long as it serves its purpose well. However, tmux is different. It is designed to be customizable. On top of that, these are my reasons why you should tweak it.&lt;/p&gt;

&lt;p&gt;Follow along, and let's make your tmux friendly. Along the way, do not forget to put more comments in your configuration file; they'll jog your memory later. Treat your tmux config as a living document; Learn, practice, and update.&lt;/p&gt;

&lt;p&gt;Here is your ready-to-use valuable tmux tips-&amp;amp;-tweaks. Try these to improve your day-to-day development while using tmux. Let's start with the biggie ! [prefix]&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Prefix Should be Simple
&lt;/h4&gt;

&lt;p&gt;By default, all key bindings will demand a "prefix" key before they are active. It is similar to a [leader] key in vim. The default is &lt;code&gt;Ctrl-b&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The default is a little hard to trigger as the keyboard button is pretty far. Most prefer the &lt;code&gt;Ctrl-a&lt;/code&gt; as prefix key:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It puts your prefix in the home row.&lt;/li&gt;
&lt;li&gt;CapsLock can be remapped with a Ctr key, and A sits just next to it.&lt;/li&gt;
&lt;li&gt;If you have already used the GNU screen, &lt;code&gt;Ctrl-a&lt;/code&gt; is already the standard key for you.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;unbind-key C-b              # free the original bind-key key
set-option -g prefix C-a    # setting the prefix from C-b to C-a
bind-key C-a send-prefix    # ensure that we can send Ctrl-A to other apps or the shell that your interacting
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Just Reload the Config
&lt;/h4&gt;

&lt;p&gt;Considering you will be doing config tweaks and testing often, it is good to introduce the shortcut here.&lt;/p&gt;

&lt;p&gt;By default, there are two ways of reloading&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;shutting down all tmux sessions and start them&lt;/li&gt;
&lt;li&gt;executing 'source-file ~/.tmux.conf' on all the sessions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Who on earth want to follow the above approaches all the time! let's create the shortcut - &lt;code&gt;Ctr+r&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bind-key C-r source-file ~/.tmux.conf \; display "Config Reloaded !"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3. This is How I Want to Start
&lt;/h4&gt;

&lt;p&gt;If you do not want to use your default shell and prefer something else, it is easy to set in tmux.&lt;/p&gt;

&lt;p&gt;Let me set my default to my fav shell - zsh. Macs now use zsh as the default login shell across the operating system. It is for a reason. Give it a try if you don't already use zsh as your default shell.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;set-option -g default-shell /usr/bin/zsh        # login shell for new windows/pane
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  4. I Can't See Enough !
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;By default, the message that comes in the status bar disappears in the blink of an eye and the pane number display time also too short to notice. Tweak the time as you wish.&lt;/li&gt;
&lt;li&gt;If you feel your default history limit is not good enough for your case, crank that up too.&lt;/li&gt;
&lt;li&gt;Lock the session after x mins of inactivity. Sometimes, it is good to protect your screen to make sure other's should not see enough.&lt;/li&gt;
&lt;li&gt;Default names given to the window are based on what runs in the pane. Hi tmux, let me name it.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;set-option -g display-time 2000            # By default, status msg disappears in the blink of an eye (750ms)
set-option -g display-panes-time 2000      # By default, pane number disappears in 1 s
set-option -g history-limit 50000          # maximum number of lines held in window history - crank it up from 2k default
set-option -g lock-after-time 3600         # lock the session after 60 mins of inactivity. Sometimes, it is good to protect your screen to make sure other's can't see enough.
set-option -wg automatic-rename off        # default names are too vague to see. Let me name it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  5. Count like Human
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;By default, the windows or panes start with index 0 (silly programmers!). Though tmux is one of those "created by and for programmers", this indexing makes it challenging to do switching windows; window 0 will be all the way to left in the status bar and the 0 in keyboard is all way to the right, then 1 key comes in the left...it messes with you.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Let's imagine you have three windows. If we removed the second window, the default result would be two remaining windows, numbered 1 and 3. but, tmux could automatically renumber the windows to 1 and 2 with the right setting.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ok, Let's make tmux a human for a bit,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;set-option -g base-index 1                # window index will start with 1
set-window-option -g pane-base-index 1    # pane index will start with 1
set-option -g renumber-windows on         
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  6. Kill it with X-Force !
&lt;/h4&gt;

&lt;p&gt;By default, if you press  x, tmux will ask if you're sure you want to kill a pane before it does it. That's nice and all, but what if you'd rather just kill it? Let's do that. And, while we’re at it, let’s create a custom key combo for killing the entire session too.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;unbind-key x               # unbind-key “x” from it’s current job of “ask and then close”
bind-key x kill-pane       # rebind-key it to just “close”
bind-key X kill-session    # key combo for killing the entire session - &amp;lt;prefix&amp;gt; + shift + x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  7. Make Splitting Panes Intuitive
&lt;/h4&gt;

&lt;p&gt;Splitting a window in panes are currently bound to  % and  ”&amp;gt;, which are hard to remember. It is much easier to remember if you use &lt;code&gt;|&lt;/code&gt; for vertical splits and &lt;code&gt;_&lt;/code&gt; for horizontal splits. For now, I will leave the default binding as it is since I don’t have any other use for these weird key commands.&lt;/p&gt;

&lt;p&gt;Additionally, you could also mention the directory to open in the new pane when you split.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bind-key | split-window -h -c "#{pane_current_path}" # let's open pane with current directory with -c option
bind-key _ split-window -v -c "#{pane_current_path}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  8. Make Movements Quick
&lt;/h4&gt;

&lt;p&gt;One of the main reasons for using tmux is because it’s keyboard-centric and plays well with Vim, another my favourite keyboard-centric tool. If you use Vim, you’re probably familiar with its use of h, j, k, and l for movement keys. This way, you do not have to take your fingers off the home row to move to anywhere else.&lt;/p&gt;

&lt;p&gt;Let's make movements in pane, window, &amp;amp; command prompt much familiar and faster,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Pane: Vim Style Movements
bind-key -r h select-pane -L              # go left
bind-key -r j select-pane -D              # go down
bind-key -r l select-pane -R              # go right
bind-key -r k select-pane -U              # go up

# Pane: Arrow Movements
bind-key Up select-pane -U
bind-key Down select-pane -D
bind-key Left select-pane -L
bind-key Right select-pane -R

# Window: Movements
bind-key L last-window
bind-key -r C-h select-window -t :-              # cycle through the windows for quick window selection
bind-key -r C-l select-window -t :+

# word separators for automatic word selection
set-window-option -g word-separators ' @"=()[]'  # default =&amp;gt; ‘ -_@’.

# tmux adds a short, almost imperceptible delay between the commands that can cause funny behavior when running vim inside tmux.
set-option -s escape-time 0

# Command Prompt Movements:  within the tmux command prompt and the command prompt is accessed using &amp;lt;P&amp;gt;: (in the status line)
set-option -g status-keys vi                 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  9. Resizing Panes
&lt;/h4&gt;

&lt;p&gt;The default key binding are &lt;code&gt;Ctr+ Up/Down/Left/Right&lt;/code&gt; for one row movements , &lt;code&gt;Alt + Up/Down/Left/Right&lt;/code&gt; for five row movements.&lt;/p&gt;

&lt;p&gt;Let's add one more to the set (Vim way)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Vim Style
bind-key -r H resize-pane -L 2         # resize a pane two rows at a time.
bind-key -r J resize-pane -D 2
bind-key -r K resize-pane -U 2
bind-key -r L resize-pane -R 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  10. Copying and Pasting Text
&lt;/h4&gt;

&lt;p&gt;We will do multiple custom setting here. This tweak can be a real productivity boost if you happen to do a lot of copying and pasting between windows.&lt;/p&gt;

&lt;p&gt;We will do these;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigating through output in a quick way like vi&lt;/li&gt;
&lt;li&gt;Vim Style in Copy-Mode&lt;/li&gt;
&lt;li&gt;Setup keys (install xclip if you don't already have it)

&lt;ul&gt;
&lt;li&gt;To copy from the current buffer to the sys clipboard &lt;code&gt;Alt+c&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;To paste text from sys clipboard into current buffer &lt;code&gt;Alt+v&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;To copy to the sys clipboard directly from the selection &lt;code&gt;Ctr+c&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;To paste text from sys clipboard into the view &lt;code&gt;Ctr+v&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Take a screenshot of the pane and store it with timestamp &lt;code&gt;Alt+s&lt;/code&gt;
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# To navigating through output in quick way, enable vim navigation keys
set-window-option -g mode-keys vi

# Vim Style in Copy-Mode "&amp;lt;prefix&amp;gt; ["
# Interacting with Paste Buffer
bind-key Escape copy-mode
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection            -N "start visual mode for selection"
bind-key -T copy-mode-vi 'y' send-keys -X copy-selection-and-cancel  -N "yank text into the buffer"
bind-key C-b choose-buffer # view the buffer stack
unbind-key p
bind-key p paste-buffer # default "&amp;lt;prefix&amp;gt; ]"

# Alt+C: To copy from the current buffer to the sys clipboard .
bind-key M-c run "tmux save-buffer - | xclip -i -sel clipboard"

# Alt+V: To paste text from sys clipboard into current buffer
bind-key M-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\""

# Ctr+C: Make it even better -just one step to move from sys-&amp;gt;buffer-&amp;gt;editor vice versa
bind-key -Tcopy-mode-vi C-c send -X copy-pipe "xclip -i -sel p -f | xclip -i -sel c" \; display-message "copied to system clipboard"

# Ctr+V: To paste text from sys clipboard into the view
bind-key C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\";tmux paste-buffer"

# To take ASCII screenshots (tmux-resurrect uses C-s for saving, here binding to Alt-s ) .
# create the dir for storing screenshots
bind-key M-s run "tmux capture-pane; tmux save-buffer ~/.mytmux/pane_screenshots/\"$(date +%FT%T)\".screenshots"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  11. Visual Styling: Configuring Colors
&lt;/h4&gt;

&lt;p&gt;Once the proper colour mode is set, you'll find it much easier to use Vim, Emacs, and other full-colour programs from within tmux, especially when you are using more complex colour schemes shell or syntax highlighting.&lt;/p&gt;

&lt;p&gt;What you can do here is up to your preference. It goes beyond just colour to your eyes. Let me demo with a few of my tricks;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let's dim out any pane that's not active. It is a lot easier to see the active pane this way than looking for * in the status bar.&lt;/li&gt;
&lt;li&gt;Customize pane divider to make it subtle but distinct.&lt;/li&gt;
&lt;li&gt;Make the message colour not harmful to your eyes
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Set the default terminal mode to 256color mode
set -g default-terminal "screen-256color"

# Pane divider
set-window-option -g pane-border-style fg=colour11,bg=colour234
set-window-option -g pane-active-border-style fg=colour118,bg=colour234

# Cool trick: Let's dim out any pane that's not active.
set-window-option -g window-style fg=white,bg=colour236
set-window-option -g window-active-style fg=white,bg=colour235

# Command / Message line
set-window-option -g message-style fg=black,bold,bg=colour11
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  12. Dress Up the Status Line
&lt;/h4&gt;

&lt;p&gt;This is how you tailor up the dress for your status line  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update Status bar colour and window indicator colour&lt;/li&gt;
&lt;li&gt;Update What do you want to see on the left side &amp;amp; right side of the status line &lt;/li&gt;
&lt;li&gt;Setup soft activity alerts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of going fancy here, I just focused on what can help me during my work and less resource-intensive operation. Below is my status bar config;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Status Bar
set-option -g status-style fg=white,bg=colour04
set-option -g status-justify centre
set-window-option -g window-status-style fg=colour118,bg=colour04
set-window-option -g window-status-current-style fg=black,bold,bg=colour011
set-window-option -g window-status-last-style fg=black,bold,bg=colour011
set-window-option -g window-status-separator |

# Left Side
# Show my active session, window, pane name or id  
set-option -g status-left-length 50   # default 10
set-option -g status-left "[#[fg=white]S: #S, #[fg=colour11]W #I-#W, #[fg=colour3]P: #P #[fg=white]]"
# set-option -g status-left-style

# Right Side
set-option -g status-right-length 50   # default 50
set-option -g status-right "#[fg=grey,dim,bg=default] uptime: #(uptime | cut -f 4-5 -d\" \" | cut -f 1 -d\",\")"

# Enable Activity Alerts
set-option -g status-interval 60           # Update the status line every 60 seconds (15 is default)
set-window-option -g monitor-activity on   # highlights the window name in the status line
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  13. Extending tmux with Plugins
&lt;/h4&gt;

&lt;p&gt;There are many tmux &lt;a href="https://github.com/tmux-plugins?q=&amp;amp;type=&amp;amp;language=&amp;amp;sort=stargazers" rel="noopener noreferrer"&gt;plugins&lt;/a&gt; available. If I have to choose one, that would be 'tmux-resurrect'.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This plugin restores the tmux environment after system restart. This plugin goes to great lengths to save and restore all the details from your tmux environment. See &lt;a href="https://github.com/tmux-plugins/tmux-resurrect" rel="noopener noreferrer"&gt;doc&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;If you setup resurrect, then the next logical thing to do is set up 'continuum' to make the saving and restoring as an automatic step&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is the step to setup tmux plugin management;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

# Last saved environment is automatically restored when tmux is started.
set -g @continuum-boot 'on'  

# terminal window will go fullscreen
set -g @continuum-boot-options 'fullscreen' 

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
# run-shell "mkdir -p ~/.tmux/plugins/"
# run-shell "git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm"

run '~/.tmux/plugins/tpm/tpm'

# Hit prefix + I to install plugins for the first time. 
# It takes few seconds. So, wait before panic.
# 
# resurrect key bindings:
#   prefix + Ctrl-s - save
#   prefix + Ctrl-r - restore
# 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note: All of these tweaks are tested and working in Ubuntu.20.10 and tmux3.1b&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You could access my tmux config &lt;a href="https://github.com/krishnam-eng/ohmy-linux/tree/main/tmux" rel="noopener noreferrer"&gt;here&lt;/a&gt; &lt;/p&gt;

</description>
      <category>linux</category>
      <category>productivity</category>
      <category>tmux</category>
      <category>developer</category>
    </item>
    <item>
      <title>Productivity Booster: Command Line Happiness with tmux</title>
      <dc:creator>Bala K</dc:creator>
      <pubDate>Wed, 14 Apr 2021 16:07:19 +0000</pubDate>
      <link>https://forem.com/krishnam/dev-productivity-command-line-happiness-with-terminal-multiplexing-5067</link>
      <guid>https://forem.com/krishnam/dev-productivity-command-line-happiness-with-terminal-multiplexing-5067</guid>
      <description>&lt;p&gt;&lt;em&gt;Who Should Read It:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Anyone who uses the command line daily and not yet explored tmux in-depth, this blog is for you.&lt;/li&gt;
&lt;li&gt;If you are already using tmux, check out 'beyond basics' section.&lt;/li&gt;
&lt;li&gt;Others, check out the 'why should you care' section to see if it can be a valuable addition to your toolbox.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flyc8bs2wkp9lrjgcjdt5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flyc8bs2wkp9lrjgcjdt5.jpg" alt="quote" width="800" height="309"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You do not really need this blog to use tmux; If you want a technical guidebook, you could look at the manpage for tmux. However, manpages are seldom adequate to wrap your brain around concepts (why &amp;amp; when); they're there for reference (how-to) sorted alphabetically instead of logically. Here, We will see 'why tmux', some of its practical uses, and how to quickly start using it in your day-to-day workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Should You Care
&lt;/h2&gt;

&lt;p&gt;Suppose you are working on many projects or many contexts (DevOps, development, exploring, etc.). In that case, each needs a set of terminals to control various activities, "creating more tabs &amp;amp; windows and using a mouse to organize them" isn't the best solution. This process is typically slow, and the context-switching between different kinds of work is very unproductive (especially if you end up redoing the same setup afresh).&lt;/p&gt;

&lt;p&gt;Of course, there are other ways of managing multi-tasking, like using simple &lt;em&gt;bg&lt;/em&gt; &amp;amp; &lt;em&gt;fg&lt;/em&gt; commands or using the GNU &lt;em&gt;screen&lt;/em&gt;. However, Tmux is considered to be the next evolutionary step forward. I am not overstating; even the screen packages have been &lt;a href="https://access.redhat.com/solutions/4136481" rel="noopener noreferrer"&gt;replaced by tmux in RHEL8&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"T"erminal "mu"ltiple"x"ing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I am writing this in a github-managed .md file from vim running in a pane, inside a window, in a session managed by a tmux server, through a client running in my zsh terminal in Ubuntu VM using VirtualBox that installed in win10.&lt;/p&gt;

&lt;p&gt;Tmux is a powerful tool; It is one of those things that at first sounds peculiar, involved and intensive; you can't quite grasp what the heck they do, how they can be valuable or why anybody even wants to use them. Nonetheless, it is one of those things that will turn out to be a fantastic swiss-army-knife when given a chance. Let's give a chance for the below reasons.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Tmux?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;tmux help solves the weaknesses of standard terminal emulators. The followings are some of the reasons why I became a tmux fan:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It expedites the creation and management of terminal windows and pane

&lt;ul&gt;
&lt;li&gt;Once you get familiarized with working within sessions, windows, panes, you are into an excellent developer environment.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;It provides the ability to connect to existing local and remote sessions

&lt;ul&gt;
&lt;li&gt;It uses a client-server model, which lets you pause and resume your work where everything is exactly how you left it.&lt;/li&gt;
&lt;li&gt;It makes it easy for context-switching between multiple themes of your work&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;It is totally customizable and gives the ability to automate creating a specific layout

&lt;ul&gt;
&lt;li&gt;It comes with the heavy load of built-in commands that let you build your script to automate your dev env&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;It provides 100% mouse-free control&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Overall, it can be an incredible productivity booster once you get the hang of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basics
&lt;/h2&gt;

&lt;p&gt;Ok, Let's break down tmux by its objects, from servers down to panes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Server&lt;/strong&gt; is what powering tmux behind the scenes. It is so streamlined, and zero-config needed from you. It runs in the background; you will hardly notice it is there. When you execute a tmux command, a tmux server is launched. Every activity that is launched in the tmux happen within the server. What you see in your shell is merely a client connection. The server holds sessions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Session&lt;/strong&gt; is essentially the base unit holding windows. You can have multiple sessions also. e.g., you could have one session for each application your developing or a session for work and a session for your cool side project or exploration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Window&lt;/strong&gt; is what you see when tmux is open in front of you. Think of it as a tab in your browser. The window layout is customizable, and tmux has many preset layouts also to arrange panes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Panes&lt;/strong&gt; are a terminal in a terminal, or you could call it pseudoterminals. The panes let you divide the screen horizontally and vertically within the same window. A window and a pane are perfect analogies to their real-world counterparts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sessions, Windows &amp;amp; Panes: These are good to logically organize multiple activities (totally mouse-free).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F69mupucxk4ec0l0py5cr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F69mupucxk4ec0l0py5cr.png" alt="session.window.pane" width="800" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I think we got the basic concepts covered. Now, Let's see the general usage of the tool in the context of typical dev workflow.&lt;/p&gt;

&lt;h3&gt;
  
  
  Typical Workflow
&lt;/h3&gt;

&lt;p&gt;This flow is how tmux-using developers' day looks like. First things first, one grabs a coffee ☕ and bossily command GoogleHome to play &lt;a href="https://open.spotify.com/track/7kCQHbrTpu7lzm22uGMKMG?si=caab7dc2fd454728" rel="noopener noreferrer"&gt;Mozart&lt;/a&gt; 🎵 on Spotify. Then, let's say that we are starting the work on project A.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Step 1:&lt;/strong&gt; You can start just by invoking

&lt;code&gt;$ tmux&lt;/code&gt;

. However, I suggest that you always begin by creating a session with a name; it is better than a default session name. The name could be the project or a theme you are working on, so it will be easy to recognize and switch between them.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; $ tmux                 # Launch tmux with defalut session    
 $ tmux new-session –s  # Launch tmux with a named session
*[prefix] X            Closing Session

# By default, all key bindings will require a "prefix" key before they are active. It is like a &amp;lt;leader&amp;gt; key in vim. The default is Ctrl-b; I changed to Ctrl-a. 

* this is a custom key-binding
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Step 2:&lt;/strong&gt; Now, You can create as many panes as needed (typically, the most user go with three panes in a window; one editor in the main terminal and two other terminals for running processes like interacting with git, running tests, a web server, etc.…)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#### Pane Management
*[prefix] _            Split the window into two vertical panes
*[prefix] |            Split the window into two horizontal panes (horizontal )

 [prefix] q            Show the pane number in each pane briefly.
 [prefix] arrow-keys   Switch focus to different pane
 C-d                   Close the pane just like how you will close a terminal

#### Layout Management
[prefix] &amp;lt;space&amp;gt; Rotate through the default layouts
[prefix] &amp;lt;alt&amp;gt;1  Switch to Even Horizontal Layout
[prefix] &amp;lt;alt&amp;gt;2  Switch to Even Vertical Layout
[prefix] &amp;lt;alt&amp;gt;3  Switch to Main Vertical Layout
[prefix] &amp;lt;alt&amp;gt;4  Switch to Main Horizontal Layout
[prefix] &amp;lt;alt&amp;gt;5  Switch to Tiled Layout

### Resizing Panes
[prefix] z             zoom current pane to full window size

[prefix] &amp;lt;ctrl&amp;gt;up      increase the height of this pane by one row
[prefix] &amp;lt;ctrl&amp;gt;down    decrease the height of this pane by one row
[prefix] &amp;lt;ctrl&amp;gt;left    increase the width of this pane by one column
[prefix] &amp;lt;ctrl&amp;gt;right   decrease the width of this pane by one column

*[prefix] H             increase the height of this pane by two row (shift+)
*[prefix] J             decrease the height of this pane by one row
*[prefix] K             increase the width of this pane by one column
*[prefix] L             decrease the width of this pane by one column

[prefix] &amp;lt;alt&amp;gt;up       increase the height of this pane by five rows
[prefix] &amp;lt;alt&amp;gt;down     decrease the height of this pane by five rows
[prefix] &amp;lt;alt&amp;gt;left     increase the width of this pane by five columns
[prefix] &amp;lt;alt&amp;gt;right    decrease the width of this pane by five columns

*this is a custom key-binding
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Step 3:&lt;/strong&gt; Then, you start working, 🎵click-clack clickity-clack🎵, while you'r at it, if a single window can't hold all related terminal works, you can create additional windows as you see fit.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Frequent Use:
 [prefix] c      _C_reate a new window
 [prefix] ,      Rename current window

 [prefix] w      Choose a _w_indow from a menu
 [prefix] 0-9    Switch to window 0-9
 [prefix] p      Cycle to _p_revious window
 [prefix] n      Cycle to _n_ext window
 [prefix] l      Back to the _l_ast window

 [prefix] x      Closing Window

Sporadic Use:
 [prefix] M-p    _p_revious window with activity
 [prefix] M-n    _n_ext window with activity

 [prefix] !      Breaking Window Panes If you have too many panes in a single window.

 $ move-window  –t {target session}         # Move the window from one session to another
 $ link-window –t {target session}          # Link a window between two sessions         
 $ unlink-window                            # Unlink the window from the current session
 $ join-pane -t {session}:{window}          # Join the current pane to a target window
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Step 4:&lt;/strong&gt; Then, you just realized that you need to finish off something for project B; now, you can create a new session for project B and switch out from the first session. You can come back to project A workspace later (maybe tomorrow or next year as long as your tmux server runs).
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[prefix] s      Choose from a list of _s_essions
[prefix] (      Switch to previous session
[prefix] )      Switch to next session
[prefix] L      Switch the attached client back to the _L_ast session.
[prefix] $      Rename the session
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Step 5:&lt;/strong&gt; When it is closing time, you could leave the &lt;strong&gt;working session&lt;/strong&gt; open or detach the session. When you detach a session, it becomes a headless entity running in the background and remain active in the server, ready for whenever you want to resume the work. You can even close the terminal that launched it.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; [prefix] d      _d_etach from your current session
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Step 6:&lt;/strong&gt; The next day, when you reconnect, you can start a new terminal and reattach the still-running background session that contains your work in progress. Tada! You just jumped right back in. Now, you can start making your keyboard sing again 🎵.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ tmux attach-session -t {session-name}   # Start tmux and attach a _t_arget session by name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Beyond Basics: Personalizing Environments &amp;amp; Scripting tmux
&lt;/h3&gt;

&lt;p&gt;With the basics under our belt, let's explore a custom configuration and automation of developer workspace in part two of this blog. It will wrap up with valuable tricks you can use with tmux to improve your day-to-day development. For the Impatient, you could check out my tmux setup &lt;a href="https://github.com/krishnam-eng/ohmy-linux/tree/main/tmux" rel="noopener noreferrer"&gt;here -github&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;tmux is a versatile addition to your terminal toolbelt. No need to grasp everything in a single sitting; efficiently managing workspace with tmux is a skill acquired over a period. Soon you will find yourself becoming more comfortable with this powerful screen-management tool.&lt;/p&gt;

&lt;p&gt;&amp;lt;&amp;lt;à suivre...&amp;gt;&amp;gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>linux</category>
      <category>terminal</category>
      <category>tmux</category>
    </item>
  </channel>
</rss>
