<?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>DEV Community: Rajasekar Elango</title>
    <description>The latest articles on DEV Community by Rajasekar Elango (@erajasekar).</description>
    <link>https://dev.to/erajasekar</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%2F103138%2F2937da8e-9a85-449c-aa62-843a020aabab.jpeg</url>
      <title>DEV Community: Rajasekar Elango</title>
      <link>https://dev.to/erajasekar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/erajasekar"/>
    <language>en</language>
    <item>
      <title>How to Create Diagrams Directly in ChatGPT</title>
      <dc:creator>Rajasekar Elango</dc:creator>
      <pubDate>Thu, 02 Apr 2026 00:06:54 +0000</pubDate>
      <link>https://dev.to/erajasekar/how-to-create-diagrams-directly-in-chatgpt-1e65</link>
      <guid>https://dev.to/erajasekar/how-to-create-diagrams-directly-in-chatgpt-1e65</guid>
      <description>&lt;p&gt;You can have a genuinely useful architecture discussion in &lt;code&gt;ChatGPT&lt;/code&gt;, get the idea clear in your head, and then immediately hit the annoying part: now you need to turn it into a diagram.&lt;/p&gt;

&lt;p&gt;That is usually where momentum drops. You leave the conversation, open another tool, start dragging boxes around, and spend the next twenty minutes formatting instead of finishing the thought.&lt;/p&gt;

&lt;p&gt;This tutorial shows a cleaner workflow. You will connect &lt;code&gt;AI Diagram Maker&lt;/code&gt; to &lt;code&gt;ChatGPT&lt;/code&gt; with &lt;code&gt;MCP&lt;/code&gt;, generate your first diagram from a plain-English prompt, and then make a few quick visual edits only if you want them.&lt;/p&gt;

&lt;h2&gt;
  
  
  MCP in plain English
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;MCP&lt;/code&gt; stands for &lt;code&gt;Model Context Protocol&lt;/code&gt;. The simplest way to think about it is &lt;code&gt;USB for AI tools&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;USB&lt;/code&gt; gives your computer a standard way to connect to external devices. &lt;code&gt;MCP&lt;/code&gt; gives &lt;code&gt;ChatGPT&lt;/code&gt; a standard way to connect to external tools. In this setup, the external tool is &lt;code&gt;AI Diagram Maker&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That is the whole reason this workflow works. Instead of explaining an idea in chat and then rebuilding it somewhere else, &lt;code&gt;ChatGPT&lt;/code&gt; can call the diagram tool directly.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this integration gives you
&lt;/h2&gt;

&lt;p&gt;The benefit is straightforward: you can create diagrams without leaving &lt;code&gt;ChatGPT&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For this tutorial, the setup happens in the OpenAI platform chat because that flow supports the MCP connector configuration we need right now. Once it is connected, the workflow is simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;get an API key from &lt;code&gt;AI Diagram Maker&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;connect the MCP server in the OpenAI platform chat&lt;/li&gt;
&lt;li&gt;prompt &lt;code&gt;ChatGPT&lt;/code&gt; to create a diagram&lt;/li&gt;
&lt;li&gt;open the result in &lt;code&gt;AI Diagram Maker&lt;/code&gt; if you want to refine it&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you want the full written setup guide alongside this walkthrough, start with the &lt;a href="https://www.aidiagrammaker.com/user-guide#manage-api-mcp-server" rel="noopener noreferrer"&gt;AI Diagram Maker MCP setup guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Get your API key
&lt;/h2&gt;

&lt;p&gt;Open &lt;code&gt;AI Diagram Maker&lt;/code&gt;, go to &lt;code&gt;Settings&lt;/code&gt;, then &lt;code&gt;Integrations -&amp;gt; API Keys&lt;/code&gt;, and create a new key. Give it a label like &lt;code&gt;ChatGPT&lt;/code&gt; so you can recognize it later.&lt;/p&gt;

&lt;p&gt;Copy the key as soon as it is created. You will use it in the next step, and it will not be shown again after that.&lt;/p&gt;

&lt;p&gt;If you want a slower, screenshot-by-screenshot version of this part, the &lt;a href="https://www.aidiagrammaker.com/user-guide#manage-api-mcp-server" rel="noopener noreferrer"&gt;API key guide&lt;/a&gt; is useful to keep open in another tab.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Open the ChatGPT setup screen
&lt;/h2&gt;

&lt;p&gt;Go to &lt;a href="https://platform.openai.com/chat" rel="noopener noreferrer"&gt;OpenAI platform chat&lt;/a&gt; and sign in.&lt;/p&gt;

&lt;p&gt;This is where you will add the MCP server and use it in chat.&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%2Fkduorjw7odosdharlfpa.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%2Fkduorjw7odosdharlfpa.png" alt="OpenAI platform chat landing screen" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Add the MCP server
&lt;/h2&gt;

&lt;p&gt;Click &lt;code&gt;Create&lt;/code&gt;, then &lt;code&gt;Add tool&lt;/code&gt;, then choose &lt;code&gt;MCP server&lt;/code&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%2F7jnk3i9u6qjd0622y6kk.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%2F7jnk3i9u6qjd0622y6kk.png" alt="Create tool page" width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the next screen, choose &lt;code&gt;Other developers&lt;/code&gt;, then &lt;code&gt;Server&lt;/code&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%2F823celxbpe2zpr4ta7wf.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%2F823celxbpe2zpr4ta7wf.png" alt="Add MCP server" width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now enter the server details:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;URL: &lt;code&gt;https://mcp.aidiagrammaker.com/mcp&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Label: &lt;code&gt;ai-diagram-maker&lt;/code&gt; or any name you prefer&lt;/li&gt;
&lt;li&gt;Description: optional&lt;/li&gt;
&lt;li&gt;Authentication: &lt;code&gt;Custom headers&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Header key: &lt;code&gt;X-ADM-API-Key&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Header value: paste your API key&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then click &lt;code&gt;Connect&lt;/code&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%2F4pde7snq4tefdtkl8grq.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%2F4pde7snq4tefdtkl8grq.png" alt="Connect MCP server" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Enable the tools and guide ChatGPT
&lt;/h2&gt;

&lt;p&gt;Once the connection succeeds, you will see the available &lt;code&gt;AI Diagram Maker&lt;/code&gt; tools. Add them to the chat.&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%2Fte3d33iuubnp857i313k.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%2Fte3d33iuubnp857i313k.png" alt="Available tools in AI Diagram Maker MCP" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, add a short developer message so &lt;code&gt;ChatGPT&lt;/code&gt; knows when to use the connector. Keep it simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Use AI Diagram Maker to create diagrams when I ask for a flowchart, sequence diagram, ERD, UML diagram, or architecture diagram.&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%2F5o1l971jcf5c8u92cnme.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%2F5o1l971jcf5c8u92cnme.png" alt="Developer message" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point, the setup is done. You can start prompting like normal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Create your first diagram
&lt;/h2&gt;

&lt;p&gt;Start with something practical and easy to check. A good first example is a business flow:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Diagram the steps from finding a customer to getting paid.&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%2F1g6njr7wy3sgizgn1qzu.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%2F1g6njr7wy3sgizgn1qzu.png" alt="ChatGPT prompt" width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Because the MCP server is connected, &lt;code&gt;ChatGPT&lt;/code&gt; recognizes that it has a diagram tool available. It generates the content, calls &lt;code&gt;AI Diagram Maker&lt;/code&gt;, and returns the result in the conversation.&lt;/p&gt;

&lt;p&gt;In this OpenAI platform flow, you will usually get a link to the diagram rather than a fully rendered visual inline. That is normal.&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%2Fn9t8msq3on73so7zgoxf.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%2Fn9t8msq3on73so7zgoxf.png" alt="ChatGPT diagram output" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The important part is that you stayed in the same workflow. You did not switch to a separate diagramming app just to get the first draft.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Open the diagram and make quick edits
&lt;/h2&gt;

&lt;p&gt;Click the diagram link to open it in &lt;code&gt;AI Diagram Maker&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is where you can make small visual improvements without needing to be especially design-heavy. For example, you can change the layout direction, clean up labels, adjust spacing, or remove one or two unnecessary nodes.&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%2F8u2ps3fjvhba1fc4s2jd.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%2F8u2ps3fjvhba1fc4s2jd.png" alt="Edit diagram in AI Diagram Maker" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I like this split. &lt;code&gt;ChatGPT&lt;/code&gt; handles the fast first draft. &lt;code&gt;AI Diagram Maker&lt;/code&gt; handles the last bit of polish when you actually want it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;That is the full setup:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;create an API key in &lt;code&gt;AI Diagram Maker&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;connect the MCP server in the OpenAI platform chat&lt;/li&gt;
&lt;li&gt;prompt &lt;code&gt;ChatGPT&lt;/code&gt; to create a diagram&lt;/li&gt;
&lt;li&gt;open the result in &lt;code&gt;AI Diagram Maker&lt;/code&gt; for quick edits&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The real win is that you stop breaking your thinking flow. No tool switching, no dragging boxes around, and no spending extra time on layout before you even know whether the diagram is right.&lt;/p&gt;

&lt;p&gt;If you want to try it on your own workflow, start at &lt;a href="https://aidiagrammaker.com" rel="noopener noreferrer"&gt;AI Diagram Maker&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>chatgpt</category>
      <category>mcp</category>
      <category>diagramming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>The Real Reason Architecture Diagrams Go Stale</title>
      <dc:creator>Rajasekar Elango</dc:creator>
      <pubDate>Wed, 01 Apr 2026 00:03:11 +0000</pubDate>
      <link>https://dev.to/erajasekar/the-real-reason-architecture-diagrams-go-stale-35ok</link>
      <guid>https://dev.to/erajasekar/the-real-reason-architecture-diagrams-go-stale-35ok</guid>
      <description>&lt;p&gt;&lt;em&gt;What diagram-as-code teams change in their workflow to keep diagrams useful, current, and easy to review.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Most engineering teams have architecture diagrams that were accurate once and then slowly drifted away from the system they were supposed to explain.&lt;/p&gt;

&lt;p&gt;A service gets split. A queue is introduced. An API boundary changes. The code moves first, and the diagram follows later if anyone remembers. That pattern is usually described as a documentation problem, but the better explanation is workflow friction.&lt;/p&gt;

&lt;p&gt;The teams that keep diagrams useful are not more disciplined than everyone else. They changed where diagrams fit in the work. Their diagrams are cheap enough to update during decisions, not after them. That is why &lt;code&gt;diagram as code&lt;/code&gt; matters. Version control helps, but it is not the whole story.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;: &lt;code&gt;diagram as code&lt;/code&gt; is valuable because it turns architecture diagrams into working artifacts inside the engineering loop. Text-based diagrams are reviewable, diffable, and easy to update in the moment, which makes them useful for design reviews, async discussions, and onboarding. Teams succeed when they treat diagrams as communication tools, not documentation deliverables.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why Architecture Diagrams Die: The Real Pattern
&lt;/h2&gt;

&lt;p&gt;Architecture diagrams usually die for a simple reason: updating them sits outside the normal path of engineering work.&lt;/p&gt;

&lt;p&gt;If the diagram lives in a design tool, a slide deck, or a wiki page, changing it feels like a separate task. You make the system change in code. Then, if you still have energy, you open another tool and try to redraw the system you just changed. That second step is where momentum dies.&lt;/p&gt;

&lt;p&gt;This is why stale diagrams are not really a motivation problem. They are a cost problem.&lt;/p&gt;

&lt;p&gt;When the effort to update a diagram is higher than the value the team gets from that update today, the team delays it. A few delays become a month. A month becomes a diagram nobody fully trusts. Once trust drops, usage drops with it.&lt;/p&gt;

&lt;p&gt;So the problem is not "teams forgot documentation." The problem is that the artifact is too expensive to keep close to reality.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Does Diagram as Code Actually Change?
&lt;/h2&gt;

&lt;p&gt;Diagram as code is the practice of defining diagrams in text instead of drawing them manually in a visual editor. Tools like &lt;a href="https://mermaid.js.org/intro/syntax-reference.html" rel="noopener noreferrer"&gt;Mermaid&lt;/a&gt;, &lt;a href="https://d2-lang.com/releases/intro/" rel="noopener noreferrer"&gt;D2&lt;/a&gt;, and &lt;a href="https://plantuml.com/" rel="noopener noreferrer"&gt;PlantUML&lt;/a&gt; all fit this model.&lt;/p&gt;

&lt;p&gt;First, a diagram becomes reviewable. A pull request can show that a service was split, a dependency was removed, or a queue was added.&lt;/p&gt;

&lt;p&gt;Second, a diagram becomes diffable. You can see what changed instead of re-reading a screenshot and guessing.&lt;/p&gt;

&lt;p&gt;But the bigger shift is not storage. It is timing.&lt;/p&gt;

&lt;p&gt;When diagrams are text, they become cheap enough to create in the middle of a conversation. Someone can open a file, add a message broker, rename a boundary, or remove a dependency while the team is still discussing the change. That is very different from saying, "we should update the diagram later."&lt;/p&gt;

&lt;p&gt;That is why teams that adopt diagram as code often talk about flow, not just version control.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where This Shows Up in Practice
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. During design reviews
&lt;/h3&gt;

&lt;p&gt;The clearest difference shows up in live design conversations.&lt;/p&gt;

&lt;p&gt;With static diagram workflows, the diagram often arrives as a snapshot of a decision that already happened. The discussion moves forward, but the diagram stays fixed.&lt;/p&gt;

&lt;p&gt;With diagram as code, the artifact can change while the discussion is still active. A dependency can be added, a boundary renamed, or a queue introduced without leaving the engineering workflow.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. In async architecture communication
&lt;/h3&gt;

&lt;p&gt;A lot of architecture discussion now happens in pull requests, design docs, and chat threads. Without a good visual artifact, those discussions turn into long paragraphs explaining relationships that would be obvious in a simple diagram.&lt;/p&gt;

&lt;p&gt;Diagram-as-code teams can attach a small diff instead. The discussion becomes easier to review because the change is explicit.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. When the code keeps evolving
&lt;/h3&gt;

&lt;p&gt;The third place this shows up is after the first change is already done.&lt;/p&gt;

&lt;p&gt;A diagram usually does not become stale in one big moment. It drifts through small follow-up changes. A service gets renamed. A new dependency is added. A temporary workaround becomes permanent. If updating the diagram means leaving the code workflow and redrawing everything by hand, the team delays it.&lt;/p&gt;

&lt;p&gt;If the diagram lives in the repo as code, those small corrections can happen in the same pull request as the code change. That is what keeps the system view believable over time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Do AI Tools Add to Diagram as Code?
&lt;/h2&gt;

&lt;p&gt;For many teams, syntax is the last piece of friction.&lt;/p&gt;

&lt;p&gt;Mermaid, D2, and PlantUML are all easier to maintain than screenshots, but they still ask engineers to learn a small syntax. That is fine for people who use it often. It is a blocker for people who only need diagrams occasionally.&lt;/p&gt;

&lt;p&gt;This is where AI-assisted tooling becomes useful. Instead of starting with syntax, teams can start with intent and refine from there.&lt;/p&gt;

&lt;p&gt;Tools like &lt;a href="https://aidiagrammaker.com" rel="noopener noreferrer"&gt;AI Diagram Maker&lt;/a&gt; let you describe a system in plain English, generate D2 code and a rendered diagram, and then iterate on the output. It does not remove the need for architectural judgment. It gives you a usable first draft fast, which is often all a team needs to keep the conversation moving.&lt;/p&gt;

&lt;p&gt;For example, you could prompt it like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Draw a checkout flow: user places an order, it goes through the API, 
then hits the payment service and the order service. 
Show Stripe as an external dependency.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That kind of prompt is specific enough to produce a diagram the reader can understand at a glance.&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%2Ftp43zupuche79e967swh.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%2Ftp43zupuche79e967swh.png" alt="AI Diagram Maker showing a checkout flow prompt on the left and the generated D2 architecture diagram on the right" width="800" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The important point is not that AI replaces diagram as code. It makes the practice easier to start and easier to use while the conversation is still happening.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Practical Shifts That Actually Change Things
&lt;/h2&gt;

&lt;p&gt;Adopting diagram as code is not about switching tools. It is about changing specific habits. Here is where the real difference shows up day to day:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stop updating diagrams after the fact. Start sketching during the decision.&lt;/strong&gt;&lt;br&gt;
If the diagram cannot change during the discussion, it usually will not stay current.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stop keeping diagrams in a separate tool. Start keeping them next to the code.&lt;/strong&gt;&lt;br&gt;
When the diagram lives in the repo, updating it becomes part of the same workflow as the code change.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stop treating diagram reviews as optional. Start reviewing diffs like you review code.&lt;/strong&gt;&lt;br&gt;
Text-based diagrams make structural changes visible, so teams can review them instead of guessing from screenshots.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stop thinking of diagrams as deliverables. Start treating them as thinking tools.&lt;/strong&gt;&lt;br&gt;
A rough diagram that reflects the current system is more useful than a polished one that is already outdated.&lt;/p&gt;

&lt;p&gt;Taken together, those shifts point to the real issue: the problem was never diagram quality on its own. It was the workflow around it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Workflow Was Always the Problem
&lt;/h2&gt;

&lt;p&gt;Architecture diagrams do not go stale because engineers stop caring. They go stale because the tools that produce them exist outside the workflow where the system actually changes.&lt;/p&gt;

&lt;p&gt;Diagram as code closes that gap. It makes diagrams cheap enough to create during a discussion, easy enough to update in the same pull request as the code change, and structured enough to review like any other file.&lt;/p&gt;

&lt;p&gt;The teams that get the most out of it are not the ones with the strictest diagram rules. They are the ones that stopped treating diagrams as deliverables and started treating them as part of how the team thinks together.&lt;/p&gt;

&lt;p&gt;If your team is adopting diagram as code, that is the useful question to ask: is it part of the real workflow yet, or is it still something everyone plans to do later?&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>diagrams</category>
      <category>devops</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Want to become a Happy and Productive Programmer? Use these 5 techniques from Psychology</title>
      <dc:creator>Rajasekar Elango</dc:creator>
      <pubDate>Thu, 04 Apr 2019 15:35:21 +0000</pubDate>
      <link>https://dev.to/erajasekar/want-to-become-a-happy-and-productive-programmer-use-these-5-techniques-from-psychology-58ai</link>
      <guid>https://dev.to/erajasekar/want-to-become-a-happy-and-productive-programmer-use-these-5-techniques-from-psychology-58ai</guid>
      <description>&lt;h3&gt;
  
  
  How Ideas from Human Psychology can help Programmers?
&lt;/h3&gt;

&lt;p&gt;Do you want to program at your peak performance? Do you want to enjoy programming job? What are the tricks to get unstuck from hard problems? How can you push your cognitive capabilities? Turning into Psychology can tell us answers.&lt;/p&gt;

&lt;p&gt;Like a hero of a movie, the programmer’s life has villains, diversions, fights, and emotions. Are you ready to become a programming hero?&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Achieve Flow State
&lt;/h2&gt;

&lt;p&gt;In the famous book &lt;a href="http://www.amazon.com/Flow-Psychology-Experience-Perennial-Classics/dp/0061339202" rel="noopener noreferrer"&gt;Flow: The Psychology of Optimal Experience&lt;/a&gt;, Psychologist Mihaly Csikszentmihalyi reveals that the secret for achieving Peak Performance is doing work in an optimal state called &lt;strong&gt;&lt;em&gt;flow&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Flow is optimal state of consciousness where we feel our best and capable of performing at top level. During flow, people typically experience deep enjoyment, creativity, and completely involved in an activity for its own sake.&lt;br&gt;
Flow also happens when a person’s skills are fully involved in overcoming a challenge that is just about manageable, so it acts as a magnet for learning new skills and increasing challenges.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fedrudf548pfwzxcunj8t.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fedrudf548pfwzxcunj8t.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To achieve a Flow state, you got to balance between the difficulty of the activity and your skills.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learn the skills in advance ✅
&lt;/h3&gt;

&lt;p&gt;If your work requires a new skill (may it be a new language or technology etc..), don’t try to learn and do the work simultaneously. Being familiar with it would avoid anxiety and help attain flow state. So, learn skills in advance to ensure you have the right level of skills for the challenges in the project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Make it work first, then make it perfect ✅
&lt;/h3&gt;

&lt;p&gt;The challenge will be harder if you try to write perfect code and you might get stuck. So to reduce the challenge, just write the first version of the code that works without worrying about it being bad. Then, it will be easier to refactor and make it good.&lt;/p&gt;

&lt;h3&gt;
  
  
  Divide and Conquer ✅
&lt;/h3&gt;

&lt;p&gt;Another trick is to break up your complex work into small manageable tasks so that you will have control.&lt;/p&gt;

&lt;p&gt;So the idea is to level up your skills or decrease the challenge to attain flow state. Game designers use this technique to keep the players hooked. They make the difficulty of game levels appropriate to the player’s skill so that players neither feels frustrated and nor bored. In the flow state, programming will feel like playing a game.&lt;/p&gt;

&lt;p&gt;💡 If you achieve &lt;strong&gt;flow state&lt;/strong&gt; you will be the &lt;strong&gt;hero&lt;/strong&gt;. But wait, there is a &lt;strong&gt;villain&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Win Focus
&lt;/h2&gt;

&lt;p&gt;Flow experience may not occur in the first few moments and you will need to stay focused to get immersed in the work. Cal Newport takes about the importance of focused work in his book &lt;a href="https://www.amazon.com/dp/B00X47ZVXM/ref=cm_sw_em_r_mt_dp_U_RS5nCb9HYPYNE" rel="noopener noreferrer"&gt;Deep Work: Rules for Focused Success in a Distracted World&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Deep Work:&lt;/strong&gt; Professional activities performed in a state of distraction-free concentration that push your cognitive capabilities to their limit. These efforts create new value, improve your skill, and are hard to replicate.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Set aside time for Deep Work ✅
&lt;/h3&gt;

&lt;p&gt;You can set aside some time for focused work. To avoid distractions, turn off all notifications on your computer and phone. If you are not good at self-control, try Pomodoro technique.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pomodoro Technique ✅
&lt;/h3&gt;

&lt;p&gt;Pomodoro technique provides a system to perform deep work.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2Ay_zr56l2yKcPS5SgeDzEgA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2Ay_zr56l2yKcPS5SgeDzEgA.png" alt="Source: [https://name-fame.com/motivation/pomodoro-technique-boost-study-work/](https://name-fame.com/motivation/pomodoro-technique-boost-study-work/)"&gt;&lt;/a&gt;&lt;em&gt;Source: &lt;a href="https://name-fame.com/motivation/pomodoro-technique-boost-study-work/" rel="noopener noreferrer"&gt;https://name-fame.com/motivation/pomodoro-technique-boost-study-work/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Basically, you work on a task for 25 minutes with zero distractions. Then, you take a short 5-minute break and move on to next Pomodoro. After 4 pomodoros, you can take a long break. You can easily find Pomodoro apps on the internet.&lt;/p&gt;

&lt;p&gt;💠 Don’t be too strict with Pomodoro schedule. If you are in a &lt;strong&gt;flow&lt;/strong&gt; state, you don’t have to force a break when the 25 minutes is up. But there are other good times to take a break for a walk which I will discuss later in this post.&lt;/p&gt;

&lt;p&gt;This is great for external distractions. &lt;strong&gt;what about internal mental distractions?&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Commit your thoughts ✅
&lt;/h3&gt;

&lt;p&gt;Our mind usually gets distracted by thoughts of unfinished tasks, regardless of their importance. Because open tasks tend to occupy our short-term memory until they are done.&lt;/p&gt;

&lt;p&gt;But thanks to &lt;a href="https://en.wikiversity.org/wiki/Motivation_and_emotion/Book/2015/Zeigarnik_effect" rel="noopener noreferrer"&gt;Zeigarnik’s&lt;/a&gt; follow-up research. We now know that,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We don’t actually have to finish tasks to convince our brains to stop thinking about them. All we have to do is to write them down in a way that convinces us that it will be taken care of.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After your work, you should not only commit your code to source control — But also write down your thoughts (e.g next steps, todos etc ) in a good place.&lt;/p&gt;

&lt;p&gt;💡 A programmer’s journey not only has &lt;strong&gt;villains&lt;/strong&gt; but also &lt;em&gt;diversions&lt;/em&gt; and &lt;em&gt;interruptions&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A1p815QN8obko--oxUtSw1A.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A1p815QN8obko--oxUtSw1A.jpeg" alt="Source: [https://www.big-red-digital.com/news/general/the-paradox-of-choice-why-the-choosing-a-website-partner-neednt-be-stressful](https://www.big-red-digital.com/news/general/the-paradox-of-choice-why-the-choosing-a-website-partner-neednt-be-stressful)"&gt;&lt;/a&gt;&lt;em&gt;Source: &lt;a href="https://www.big-red-digital.com/news/general/the-paradox-of-choice-why-the-choosing-a-website-partner-neednt-be-stressful" rel="noopener noreferrer"&gt;https://www.big-red-digital.com/news/general/the-paradox-of-choice-why-the-choosing-a-website-partner-neednt-be-stressful&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Minimize Choices
&lt;/h2&gt;

&lt;p&gt;The life of a programmer involves making a lot of decisions and it interferes experiencing the flow state.&lt;/p&gt;

&lt;p&gt;In his book &lt;a href="https://www.amazon.com/dp/B000TDGGVU" rel="noopener noreferrer"&gt;The Paradox of Choice&lt;/a&gt;, Barry Schwartz describes how more choices lead to anxiety. He used numerous examples, from shopping to career options to romance, to show that less choice can not only increase our productivity but also our freedom and make it easier to be in the moment and enjoy it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AQLahnc9tcAw9GVFPesE06w.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AQLahnc9tcAw9GVFPesE06w.jpeg" alt="Source: [http://vpcoder.com/index.php/2016/03/13/how-to-start-learning-coding-effectively/](http://vpcoder.com/index.php/2016/03/13/how-to-start-learning-coding-effectively/)"&gt;&lt;/a&gt;&lt;em&gt;Source: &lt;a href="http://vpcoder.com/index.php/2016/03/13/how-to-start-learning-coding-effectively/" rel="noopener noreferrer"&gt;http://vpcoder.com/index.php/2016/03/13/how-to-start-learning-coding-effectively/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;He was primarily studying the behavior of shoppers but the same principle applies to programmers. We can use some techniques to reduce the number of decisions we have to make.&lt;/p&gt;

&lt;h3&gt;
  
  
  Think about it when picking a language or framework ✅
&lt;/h3&gt;

&lt;p&gt;Many people admire the Go language because there is only one way to do something (like writing loops). Also, one of the reasons that people hate the Perl language is there are too many ways to do the same thing.&lt;/p&gt;

&lt;p&gt;So consider the benefits of flexibility vs restriction when choosing a language or framework. If there is the only way to do something, you don’t need to worry about enforcing best practices.&lt;/p&gt;

&lt;h3&gt;
  
  
  Collect essential materials up front ✅
&lt;/h3&gt;

&lt;p&gt;Programmers often have to look up code examples or documentation to do the work. This not only causes context switching but also creates a burden to pick a right example or API.&lt;/p&gt;

&lt;p&gt;So, collect the necessary materials in advance so that you don’t have to look through the numerous google results and decide the right one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Have a design before writing code ✅
&lt;/h3&gt;

&lt;p&gt;Try to make the important decisions and design before you begin writing your code. This will help you focus on solving the problem at the hand instead of wasting your energy in making decisions.&lt;/p&gt;

&lt;p&gt;💡&lt;em&gt;What If I have procrastination or got stuck on a problem? Do you need a fight?&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Don’t fight against Willpower
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Studies on highly successful people have proven that success is not the result of strong willpower and the ability to overcome resistance, but rather the result of smart working environments that avoid resistance in the first place.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There some techniques to avoid the fighting against willpower.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to avoid Procrastination?
&lt;/h3&gt;

&lt;p&gt;Instead of forcing ourselves to do something we don’t feel like doing, we need to find a way to make us feel like doing what moves our project further along.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Have well-defined tasks&lt;/strong&gt; ✅&lt;/p&gt;

&lt;p&gt;The primary reason for procrastination is defining your goal at high level. Writing down specifics of what will you do, when and where to do it provides far more chance for actually doing it. Also, your brain thinks it’s too hard if there are not enough details. So having a meaningful and well-defined task beats willpower.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Head start on next task&lt;/strong&gt; ✅&lt;/p&gt;

&lt;p&gt;People usually take a break or call it for the day when they are done with a task. But, it's a good idea to begin or make slight progress on the next task. Because you would have a better idea of what to do when you start your work on the next day. This will help you avoid procrastination since you are not starting something new.&lt;/p&gt;

&lt;p&gt;The same idea can be used while reading a book. Instead of closing a book when you are done with a chapter if you just read the first page of next chapter, you are likely to pick up the book again.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Get Unstuck in solving hard problems?
&lt;/h3&gt;

&lt;p&gt;Similar to willpower, you don’t have to think hard to solve a tough problem. You can tune your mind so that solutions can come automatically to you in surprising ways!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Break for a Walk&lt;/strong&gt; ✅&lt;/p&gt;

&lt;p&gt;Letting thoughts linger without focusing on them gives our brains the opportunity to deal with problems in a different, often surprisingly productive way. While we have a walk or a shower or clean the house, the brain cannot help but play around with the last unsolved problem it came across.&lt;/p&gt;

&lt;p&gt;So you will likely get an idea if you simply walk away from your computer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sleep on it&lt;/strong&gt; ✅&lt;/p&gt;

&lt;p&gt;Go home with an unsolved problem. Don’t try to force yourself to solve it, instead just sleep. Your subconscious mind will work on it and you will likely have a solution in the middle of the night or when you wake up in the morning. Many times solutions for my problems appeared in middle of the night or first thing in the morning or during my shower.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try to work on different problem or project.&lt;/strong&gt; ✅&lt;/p&gt;

&lt;p&gt;Sometimes solutions to problems come automatically when you are not thinking about it. So, instead of pushing against a hard problem, redirect your energy towards another productive goal. With this method, to work on different things simultaneously, you never encounter any mental blockages.&lt;/p&gt;

&lt;p&gt;💡 &lt;em&gt;There is still something missing. Life becomes beautiful only if there are also emotions. Similarly programming too.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Practice Empathy
&lt;/h2&gt;

&lt;p&gt;Empathy is an important skill that will lead to greater success and happiness in personal life and profession. Practice empathy in programming too. Programming is not just logic. It is expressive like an art.&lt;/p&gt;

&lt;h3&gt;
  
  
  Write maintainable code ✅
&lt;/h3&gt;

&lt;p&gt;Keep in mind that the code you write will be read and maintained by others.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Programs must be written for people to read, and only incidentally for machines to execute ― Harold Abelson, Structure and Interpretation of Computer Programs&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Follow the best practices of coding style like meaningful variable names, smaller methods etc. You shouldn’t program look like in this comment 😃&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//When I wrote this, only God and I understood what I was doing
//Now, God only knows
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Make sure code you write has a low cognitive load for other developers so that it’s easy to maintain. Write useful comments. Here is a funny comment I came across 😆&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// &lt;br&gt;
// Dear maintainer:&lt;br&gt;
// &lt;br&gt;
// Once you are done trying to 'optimize' this routine,&lt;br&gt;
// and have realized what a terrible mistake that was,&lt;br&gt;
// please increment the following counter as a warning&lt;br&gt;
// to the next guy:&lt;br&gt;
// &lt;br&gt;
// total_hours_wasted_here = 42&lt;br&gt;
//&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Use simplicity in design ✅&lt;br&gt;
&lt;/h3&gt;

&lt;p&gt;Whether you are designing an API or user interface, make it easy for your users. The basic principle you can follow is&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Simple things should be simpler. Complex things should be possible.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Practicing empathy will not only help you but also make your team productive and users happy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;You may be already using these techniques. But knowing reasoning behind them using psychology can help you do them productively.&lt;/p&gt;

&lt;p&gt;If you hate programming or considered quitting, using these ideas from psychology might transform you as a happy programmer.&lt;/p&gt;

&lt;p&gt;When you see programming through the eyes of psychology, you will appreciate it’s beauty and enjoy the art of programming.&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>programming</category>
      <category>psychology</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Java is too old, What should you learn in 2018?</title>
      <dc:creator>Rajasekar Elango</dc:creator>
      <pubDate>Wed, 10 Oct 2018 13:51:23 +0000</pubDate>
      <link>https://dev.to/erajasekar/java-is-too-old-what-should-you-learn-in-2018-45p9</link>
      <guid>https://dev.to/erajasekar/java-is-too-old-what-should-you-learn-in-2018-45p9</guid>
      <description>

&lt;h1&gt;
  
  
  Java is too old, What should you learn in 2018?
&lt;/h1&gt;

&lt;p&gt;Java has become legacy. It can’t evolve in to a modern language while keeping its backward compatibility. But it has given us a wonderful JVM ecosystem and lead to creation of many good languages Groovy, Scala, Clojure, Kotlin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Welcome the newest baby Kotlin
&lt;/h2&gt;

&lt;p&gt;Kotlin was born in 2011, But it gained popularity last year after google announced it as official language for Android. Kotlin has brought powerful features from many other JVM languages. Let take a quick glance at benefits of Kotlin for a Java developer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Never worry about NPEs
&lt;/h3&gt;

&lt;p&gt;Every Java programmer hates Null Pointer Exceptions thrown at Runtime. Kotlin provides first class support to avoid null references at compile time. All objects are non-nullable by default and you have to use ? operator to define nullable types. Compiler will force you to use safe call operator ?. to access nullable objects. You can also use elvis operator ?: to assign default values.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  No need to provide explicit type declaration.
&lt;/h3&gt;

&lt;p&gt;Kotlin automatically infers types, so you don’t need to declare it explicitly. You can simply define variables using val for final variables and var for non-final variables. Note type can be inferred only if both declaration and assignment is done in single statement.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  Avoid convoluted String formatting.
&lt;/h3&gt;

&lt;p&gt;In Kotlin you can use String templates for easier formatting of Strings. $is used to reference a variable and you can use ${} for complex expressions&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  No boiler plate code required to create simple POJOs.
&lt;/h3&gt;

&lt;p&gt;Kotlin provides data classes for objects used to simply hold values. It automatically generates equals , hashCode , toString , copy , getters and setters ( for properties defined as var) methods for data classes. You can also do object deconstruction of data class to extract properties to variables.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  You can avoid Builder classes and redundant method overloads.
&lt;/h3&gt;

&lt;p&gt;Kotlin supports named method parameters so you don’t need to create builders in most cases. Also, Kotlin supports default method parameters so you don’t need to create redundant overloaded methods to pass default values.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  You no longer need guava library to statically initialize collections.
&lt;/h3&gt;

&lt;p&gt;Kotlin provides concise way to initialize collections inline using listOf , mapOf , setOf methods. Maps also support intuitive syntax key to value for initialization. It also provides deconstruction of Map key, values for easy iteration.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  You don’t need a complicated way to create Singletons.
&lt;/h3&gt;

&lt;p&gt;Kotlin supports object declaration to create Singletons in single line.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  You don’t need unnecessary local variables
&lt;/h3&gt;

&lt;p&gt;In Kotlin, constructs like try and when are expressions that returns value. For e.g You can assign result of try to a variable instead of creating a local variable. Similarly for when can be used as expression. when is equivalent to switch in Java, but it is much more powerful.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  You will avoid Class Cast exceptions.
&lt;/h3&gt;

&lt;p&gt;Kotlin provides is operator (equivalent to instanceOf in Java) to check if object is specific type . Using is operator will automatically do casting for you. This will prevent Class Cast exception when you cast to wrong type.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  You don’t need to repeat the variable name to call sequence methods in same object.
&lt;/h3&gt;

&lt;p&gt;Kotlin provides with construct to easily call sequence of methods on same object without having to repeat the variable name. We generally use builder pattern and method chaining to that in Java. Kotlin makes it easy to do similar thing even for non-builder classes.&lt;/p&gt;

&lt;p&gt;Kotlin also provides apply extension function to achieve the same thing.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  You don’t need boilerplate code to use delegation or decorator pattern.
&lt;/h3&gt;

&lt;p&gt;To favor composition over inheritance, we often use delegation or decorator pattern, but we had to duplicate every method of delegated class in wrapper class. Kotlin provides first class support to simplify delegation using by operator. It will automatically implement necessary methods to call methods of delegated class. Of course, you can override specific methods when need to.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  You don’t need to a Class to create static functions.
&lt;/h3&gt;

&lt;p&gt;Kotlin supports functions outside of classes, so you don’t need to create a class just for static utility functions.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  You don’t need a hack to modify non-final variables in lambdas.
&lt;/h3&gt;

&lt;p&gt;Java supports lambda by automatically substituting it with anonymous inner classes, but you can’t modify non-final variable inside lambdas. But in Kotlin you can also modify non-final variables within lambda.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  Lazy loading doesn’t require hard work.
&lt;/h3&gt;

&lt;p&gt;Kotlin provides very simple way to lazily initialize a property using lazy keyword.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  You don’t have to totally switch to a new language.
&lt;/h3&gt;

&lt;p&gt;Kotlin interoperates with Java seamlessly, so you can easily integrate with legacy Java code. You can continue to leverage third party Java libraries and frameworks. Unlike Scala, Kotlin doesn’t have it’s own collection library, but extends JDK collections. So you don’t need to write glue code to convert between Java and Kotlin collection types.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  You can write concise and more readable code.
&lt;/h3&gt;

&lt;p&gt;Kotlin uses method name convention to overload many operators for readability. For e.g method plus is used to overload + operator, minus for - operator, times for * operator, div for / operator and so on. It supports overloading many more operators like %, += , +- , ++,--&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;p&gt;Kotlin provides concise way to define ranges using .. operator. It also provides until keyword for excluding boundaries and step operator for skipping items. It has in operator to check for something in range. We can also overload .. operator and in operator by implementing rangeTo and contains methods.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h3&gt;
  
  
  You can easily extend existing JDK classes.
&lt;/h3&gt;

&lt;p&gt;Kotlin support easy way to add extension functions to existing classes. This is a very power feature that helps us to easily expand core language API.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;h2&gt;
  
  
  Why should you use Kotlin?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  It boosts your productivity by many fold
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It’s statically typed language, so you will catch lot of bugs at compile time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It has great tooling support. No doubt it’s created by an IDE company&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is created by JetBrains a IDE company which cares for developer productivity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid many of day to day frustrations of a Java developer.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  You get benefits of many best practices (Principles from &lt;a href="https://amzn.to/2qi8VRv"&gt;Effective Java Book&lt;/a&gt;) by default.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;All classes are final.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Collections are immutable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Override mandatory keyword instead of optional annotation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No Checked exceptions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No Raw types&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cleaner support for generics.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Non-JVM support.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Kotlin also compiles to Javascript for front end development.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They are also working on adding native runtime to make it run without JVM.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Should you switch to Kotlin?
&lt;/h2&gt;

&lt;p&gt;Kotlin is awesome but it’s not yet perfect. It will take some time to evolve in to a great language. JetBrains and Google are actively behind Kotlin so you can sure be that it will only get better.&lt;/p&gt;

&lt;p&gt;If you are an Android developer, you should start using Kotlin immediately.&lt;/p&gt;

&lt;p&gt;If you are a Java developer, you might have to consider other factors like team members, company adoption etc. But even if you can’t use it immediately, you should definitely learn this modern piece of beauty.&lt;/p&gt;

&lt;p&gt;Finally, As per &lt;a href="https://www.thoughtworks.com/radar/languages-and-frameworks"&gt;thoughtworks technology radar&lt;/a&gt;, companies can adopt using kotlin in projects when appropriate.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/mindorks/should-i-learn-kotlin-or-stick-to-java-3a73c3580ac3"&gt;Should I learn Kotlin or stick to Java?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In GoogleIO 2017 Google announced Kotlin as an official language for Android development. Some famous developer…*medium.com](&lt;a href="https://medium.com/mindorks/should-i-learn-kotlin-or-stick-to-java-3a73c3580ac3"&gt;https://medium.com/mindorks/should-i-learn-kotlin-or-stick-to-java-3a73c3580ac3&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://amzn.to/2qiL8Ro"&gt;Kotlin in Action Book&lt;/a&gt; By &lt;a href="https://www.amazon.com/s/ref=dp_byline_sr_book_1?ie=UTF8&amp;amp;text=Dmitry+Jemerov&amp;amp;search-alias=books&amp;amp;field-author=Dmitry+Jemerov&amp;amp;sort=relevancerank"&gt;Dmitry Jemerov&lt;/a&gt; (Author),‎ &lt;a href="https://www.amazon.com/s/ref=dp_byline_sr_book_2?ie=UTF8&amp;amp;text=Svetlana+Isakova&amp;amp;search-alias=books&amp;amp;field-author=Svetlana+Isakova&amp;amp;sort=relevancerank"&gt;Svetlana Isakova&lt;/a&gt; (Author)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


</description>
      <category>computerscience</category>
      <category>kotlin</category>
      <category>java</category>
      <category>programminglanguages</category>
    </item>
    <item>
      <title>How knowing computer scheduling algorithms can help us to be productive?</title>
      <dc:creator>Rajasekar Elango</dc:creator>
      <pubDate>Thu, 04 Oct 2018 10:14:59 +0000</pubDate>
      <link>https://dev.to/erajasekar/how-knowing-computer-scheduling-algorithms-can-help-us-to-be-productive-fp</link>
      <guid>https://dev.to/erajasekar/how-knowing-computer-scheduling-algorithms-can-help-us-to-be-productive-fp</guid>
      <description>

&lt;p&gt;We all want to get more things done efficiently and quickly. Computers are best at it. So Let's try to understand some computer scheduling algorithms to see how we can apply them to our daily lives to become more productive at our tasks. &lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;First things first! You don't want to be late. &lt;/p&gt;

&lt;h2&gt;How to finish before the deadlines?&lt;/h2&gt;

&lt;p&gt;If you're servicing customers, you would want to serve each customer as quick as possible. Assuming servicing each customer takes almost equal amount of time, then  you can help them in order they arrived. The ideal commitment or due time for a customer is as soon as they walk into your door. &lt;/p&gt;

&lt;p&gt;Applying the same strategy to tasks:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You should start with the task due soonest and work your way toward the task due last.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This strategy, known as &lt;strong&gt;Earliest Due Date.&lt;/strong&gt; which works best for minimizing lateness. But, we have a problem if each tasks takes varying amount of time to complete.&lt;/p&gt;

&lt;h2&gt;How to reduce pending task list?&lt;/h2&gt;

&lt;p&gt;Going back to cutomer servicing example, if serving each customer takes varying amounts of time, then you would want to service most number of customers. Let's say we can split customers by type of service and we know typical completion time for each type of service.  Then, the best approach would be to pick customer who needs type of service with quickest completion time. &lt;/p&gt;

&lt;p&gt;This strategy is based on &lt;strong&gt;Moore’s Algorithm&lt;/strong&gt; which says,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We start out just like with Earliest Due Date— by scheduling tasks as they arrive, but when deciding which task to do next, choose the quickest one and repeat this process.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It’s like focusing above all on reducing the length of your to-do list. Also, each piece of unfinished task could be like a carrying a mental burden. Flying through the easiest items will bring some measure of relief.   &lt;/p&gt;

&lt;p&gt;It's not suprising that this approach is compatible with the recommendation in &lt;a href="http://amzn.to/2CFOsxe"&gt;Getting Things Done&lt;/a&gt; Book to immediately perform any task that takes less than two minutes.              &lt;/p&gt;

&lt;p&gt;This is great way to get more things done, But all work can't be equally important.&lt;/p&gt;

&lt;h2&gt;How get most valuables work done?&lt;/h2&gt;

&lt;p&gt;Putting out an actual fire in the kitchen should probably be done before “putting out a fire” with a quick email to a client, even if the former takes a bit longer. &lt;/p&gt;

&lt;p&gt;In scheduling, this difference of importance is captured in a variable known as &lt;code&gt;weight&lt;/code&gt;. When you’re going through your to-do list, this weight might feel literal — the burden you get off your shoulders by finishing each task. A task’s completion time shows how long you carry that burden, so minimizing the sum of weighted completion times (that is, each task’s duration multiplied by its weight) means minimizing your total oppression as you work through your entire agenda.      &lt;/p&gt;

&lt;p&gt;The optimal strategy for this goal is a simple modification of Moore's algorithm:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Divide the weight of each task by how long it will take to finish, and then work in order from the highest resulting importance-per-unit-time to the lowest. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For eg: If you're a consultant, &lt;em&gt;weight&lt;/em&gt; can be inferred from &lt;em&gt;money you get&lt;/em&gt;. So simply divide each project's fee by its size, and work your way from the hightest hourly rate to the lowest.&lt;/p&gt;

&lt;p&gt;It might be hard to assign a degree of importance to each one of your tasks, but there is a quick rule of thumb:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Only prioritize a task that takes twice as long if it’s twice as important.                &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But if tasks are dependent on other tasks, this will bring us new problems.&lt;/p&gt;

&lt;h2&gt;How to get unstuck?&lt;/h2&gt;

&lt;p&gt;We might get stuck sometimes because an important task can't be done until another less important task is finished. In computer science this problem is called &lt;a href="https://en.wikipedia.org/wiki/Priority_inversion"&gt;priority inversion.&lt;/a&gt; &lt;sup id="fnref1"&gt;1&lt;/sup&gt; &lt;/p&gt;

&lt;p&gt;The practical solution to this problem is &lt;strong&gt;Priority Inheritance&lt;/strong&gt;. That is &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To get unstuck is to treat the unimportant things as being as important as whatever it's blocking. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;How to work through continuous incoming tasks?&lt;/h2&gt;

&lt;p&gt;Life could be easy, if we have finite list of tasks. In reality, it isn't. If assignments get tossed on you at unpredictable moments. The efficient approach is to swtich tasks which is known as &lt;a href="https://en.wikipedia.org/wiki/Preemption_(computing)"&gt;preemption&lt;/a&gt; &lt;sup id="fnref2"&gt;2&lt;/sup&gt; in computer science.  It can be generalized as &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Each time a new piece of work comes in, divide its importance by the amount of time it will take to complete. If the figure is higher than for the task you're currently doing, switch to the new one; otherwise stick with the current task. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But preemption isn't free. It comes at the cost of context switch.&lt;/p&gt;

&lt;h2&gt;How Job burnout happens?&lt;/h2&gt;

&lt;p&gt;Every time you switch tasks, you pay a price, known in computer science as a context switch. When a computer processor shifts its attention away from a given program, there’s always a certain amount of necessary overhead. It needs to effectively bookmark its place and put aside all of its information related to that program. Then it needs to figure out which program to run next. Finally it must haul out all the relevant information for that program, find its place in the code, and get in gear. The repeated rapid context switching would cause the performace of the computer to degrade or collapse. This phenomenon called as &lt;a href="https://en.wikipedia.org/wiki/Thrashing_(computer_science)"&gt;thrashing&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;You can think of as being like juggling a set of balls. If the juggler takes one more ball than he can handle, he doesn't drop &lt;strong&gt;&lt;em&gt;that&lt;/em&gt;&lt;/strong&gt; ball; he drops &lt;strong&gt;&lt;em&gt;everything&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Thrashing is a very recognizable human state. If you’ve ever had a moment where you wanted to stop doing everything just to have the chance to write down everything you were supposed to be doing, but couldn’t spare the time, you’ve thrashed. You are accomplishing nothing at all. You feel exhausted and burned out.&lt;/p&gt;

&lt;h2&gt;How to reduce burden of multitasking?&lt;/h2&gt;

&lt;p&gt;Some tips to reduce context switching burden&lt;/p&gt;

&lt;h3&gt;Don't keep your plates full.&lt;/h3&gt;

&lt;p&gt;The best strategy for getting things done might be, paradoxically, to slow down.  One way to avert thrashing before it starts is to learn the art of saying NO.&lt;/p&gt;

&lt;h3&gt;Sometimes random order is better than perfect schedule&lt;/h3&gt;

&lt;p&gt;One of the biggest sources of metawork in switching contexts is the very act of choosing what to do next. So even doing tasks in the wrong order is better than doing nothing at all in thrashed state. &lt;/p&gt;

&lt;p&gt;Thinking along the same lines, the Linux core team, several years ago, replaced their scheduler with one that was less “smart” about calculating process priorities but more than made up for it by taking less time to calculate them.                &lt;/p&gt;

&lt;p&gt;For eg: Instead of answering the most important emails first—which requires an assessment of the whole picture that may take longer than the work itself—maybe you should just answer them in random order, or in whatever order they happen to appear on-screen. &lt;/p&gt;

&lt;h3&gt;Commit doing single task for minimum amount of time&lt;/h3&gt;

&lt;p&gt;Computer Operating system schedulers typically define a “period” in which every program is guaranteed to run at least a little bit, with the system giving a “slice” of that period to each program.&lt;/p&gt;

&lt;p&gt;To utilize this strategy, you should learn to balance between two principles &lt;strong&gt;&lt;em&gt;responsiveness&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;throughput&lt;/em&gt;&lt;/strong&gt;: how quickly you can respond to things, and how much you can get done overall.&lt;/p&gt;

&lt;p&gt;The general idea is that:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Stay on a single task as long as possible without decreasing your responsiveness below the minimum acceptable limit. Decide how responsive you need to be— and then, if you want to get things done, be no more responsive than that.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The method to achieve this is &lt;a href="https://en.wikipedia.org/wiki/Timeboxing"&gt;Timeboxing&lt;/a&gt; i.e allocatea a fixed time period, called a &lt;strong&gt;time box&lt;/strong&gt;, to each planned activity. &lt;/p&gt;

&lt;p&gt;Another very useful technique is the &lt;a href="https://en.wikipedia.org/wiki/Pomodoro_Technique"&gt;Pomorado&lt;/a&gt; that uses a timer to break down work into intervals, traditionally 25 minutes in length, separated by short breaks. &lt;/p&gt;

&lt;h3&gt;Batch process similiar tasks&lt;/h3&gt;

&lt;p&gt;If you find yourself doing a lot of context switching, you can also employ another idea from computer science:  &lt;a href="https://en.wikipedia.org/wiki/Interrupt_coalescing"&gt;interrupt coalescing&lt;/a&gt;. Computers do this by waiting until some fixed interval and check everything, instead of context-switching to handle separate, uncoordinated interrupts from their various subcomponents.       &lt;/p&gt;

&lt;p&gt;For eg: If you have five credit card bills, don’t pay them as they arrive; take care of them all in one go when the fifth bill comes. &lt;/p&gt;

&lt;p&gt;Another example is — to avoid distraction caused by checking emails often, check it every 4 hours or so.             &lt;/p&gt;

&lt;p&gt;In workplace, holding office hours is a way of coalescing interruptions from co-workers.  Regularly scheduled meetings are one of our best defenses against the spontaneous interruption and the unplanned context switch.                &lt;/p&gt;

&lt;h2&gt;Summary&lt;/h2&gt;

&lt;p&gt;In addition to kind of scheduling problem you want to solve, you also need to choose right metric to optimize. Because the metric we pick will directly affect which scheduling approaches fare best. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In computer science: before you can have a plan, you must first choose a metric. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is the quick guide that summarizes when to choose each strategy based on metrics to optimize.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric to Optimize&lt;/th&gt;
&lt;th&gt;When to choose?&lt;/th&gt;
&lt;th&gt;Strategy&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Minimize lateness&lt;/td&gt;
&lt;td&gt;You have due dates, All tasks need similar amount of time to do.&lt;/td&gt;
&lt;td&gt;Earliest Due Date&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Maximize completed tasks&lt;/td&gt;
&lt;td&gt;Tasks take varying amounts to time to complete.&lt;/td&gt;
&lt;td&gt;Moore's Algorithm.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Maximize the value produced&lt;/td&gt;
&lt;td&gt;Tasks are not equally important.&lt;/td&gt;
&lt;td&gt;Weighed Moore's Algorithm.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Minimize stalling&lt;/td&gt;
&lt;td&gt;Tasks depend on other tasks.&lt;/td&gt;
&lt;td&gt;Priority Inheritance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Increase responsiveness.&lt;/td&gt;
&lt;td&gt;Continous flow of incoming tasks.&lt;/td&gt;
&lt;td&gt;Preemption&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Increase throughput&lt;/td&gt;
&lt;td&gt;Exhausted with multi-tasking.&lt;/td&gt;
&lt;td&gt;Saying NO, Random order, Timeboxing, Pomorado, Coalescing interruptions.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;Credits&lt;/h2&gt;

&lt;p&gt;This article is inspired from the wonderful book &lt;a href="http://amzn.to/2F1ZyLy"&gt;Algorithms to live by&lt;/a&gt;. If you enjoyed this article, consider reading the &lt;a href="http://amzn.to/2F1ZyLy"&gt;book&lt;/a&gt; which provides similar strategies for&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Optimal stopping — When to stop looking?&lt;/li&gt;
&lt;li&gt;Explore new things vs exploit what worked best.&lt;/li&gt;
&lt;li&gt;Sorting &lt;/li&gt;
&lt;li&gt;Caching &lt;/li&gt;
&lt;li&gt;Bayers's Rule — Predicting the future.&lt;/li&gt;
&lt;li&gt;Overfitting — When to think less.&lt;/li&gt;
&lt;li&gt;Relaxation — Let it slide.&lt;/li&gt;
&lt;li&gt;Randomness — When to leave it to chance.&lt;/li&gt;
&lt;li&gt;Networking — How we connect.&lt;/li&gt;
&lt;li&gt;Game theory — The minds of others.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Footnotes&lt;/h2&gt;




&lt;ol&gt;

&lt;li id="fn1"&gt;
&lt;p&gt;&lt;strong&gt;Priority inversion&lt;/strong&gt; is a problematic scenario in scheduling in which a high priority task is indirectly preempted by a lower priority task effectively "inverting" the relative priorities of the two tasks. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn2"&gt;
&lt;p&gt;&lt;strong&gt;Preemption&lt;/strong&gt; is the act of temporarily interrupting a task being carried out by a computer system with the intention of resuming the task at a later time. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;


</description>
      <category>computerscience</category>
      <category>algorithms</category>
      <category>productivity</category>
      <category>tips</category>
    </item>
  </channel>
</rss>
