<?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: Kiril Videlov</title>
    <description>The latest articles on DEV Community by Kiril Videlov (@krlvi).</description>
    <link>https://dev.to/krlvi</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%2F828118%2Fea75816d-c60e-4bfb-ba83-947e2409c2bb.jpeg</url>
      <title>DEV Community: Kiril Videlov</title>
      <link>https://dev.to/krlvi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/krlvi"/>
    <language>en</language>
    <item>
      <title>You are waiting for code review more than you should</title>
      <dc:creator>Kiril Videlov</dc:creator>
      <pubDate>Fri, 05 Aug 2022 06:37:00 +0000</pubDate>
      <link>https://dev.to/krlvi/you-are-waiting-for-code-review-more-than-you-should-3k60</link>
      <guid>https://dev.to/krlvi/you-are-waiting-for-code-review-more-than-you-should-3k60</guid>
      <description>&lt;p&gt;If you are reading this, chances are, you are in some way involved with the creation of software. You are probably well aware that &lt;a href="https://en.wikipedia.org/wiki/Code_review"&gt;code reviews&lt;/a&gt; are considered a best practice.&lt;/p&gt;

&lt;p&gt;What you may not know is that, &lt;strong&gt;64.3%&lt;/strong&gt; of Pull Requests are merged without any code changes as a result of the review. This means that only in 1/3 of reviews yielded a change to the proposed code.&lt;/p&gt;

&lt;h2&gt;
  
  
  🗃 Dataset
&lt;/h2&gt;

&lt;p&gt;We have been collecting open source data for a while, and in this post we will share insights from analyzing &lt;strong&gt;2,340,078&lt;/strong&gt; PRs spread across &lt;strong&gt;7,836&lt;/strong&gt; organizations. The dataset is specifically derived from repositories that exhibit teamwork. Thankfully, with so many software companies embracing open source, there are plenty of examples of different styles of collaboration.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔮 Code review outcomes
&lt;/h2&gt;

&lt;p&gt;Generally speaking, the fate of a PR being reviewed will follow one of these two paths:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Merged as is (aka LGTM'd) — &lt;strong&gt;1,504,914&lt;/strong&gt; PRs in the dataset&lt;/li&gt;
&lt;li&gt;Merged with changes as a result of feedback (comments, suggestions etc.) — &lt;strong&gt;835,164&lt;/strong&gt; PRs in the dataset&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ⏳ Time to merge PRs
&lt;/h2&gt;

&lt;p&gt;Let's look at how much people wait for their PRs to be merged.&lt;/p&gt;

&lt;p&gt;On average, the time between a PR being opened and it being merged is &lt;strong&gt;128 hours&lt;/strong&gt; (~5 days). If we look only at the PRs that were LGTM'd this number is &lt;strong&gt;74 hours&lt;/strong&gt; (~3 days) and for the other 35.7% of PRs the average lead time is &lt;strong&gt;225 hours&lt;/strong&gt; (~9 days).&lt;/p&gt;

&lt;p&gt;Here are two histograms with the probability distributions of merge times for LGTM'd and non-LGTM'd PRs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9g7sw-4e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9pe49lsyni6594h3unsv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9g7sw-4e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9pe49lsyni6594h3unsv.png" alt="Pull Request merge times when no changes were requested during review" width="576" height="384"&gt;&lt;/a&gt; &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r3qa4mnW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q7t05vvuzzvhz3vnqnqn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r3qa4mnW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q7t05vvuzzvhz3vnqnqn.png" alt="Pull Request merge times when changes are added because of the review" width="576" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Of course, the PRs that are LGTM-merged are either simpler, smaller or simply low risk, so the lead time is significantly lower. However, the cumulative wait time for changes that were &lt;strong&gt;already good to go&lt;/strong&gt; is significant.&lt;/p&gt;

&lt;p&gt;In this dataset, the total time waiting for Pull Requests to be merged (without any changes as a result of the review) is &lt;strong&gt;12,718 years&lt;/strong&gt;. For the PRs that got corrections, the time waiting adds up to &lt;strong&gt;21,437 years&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BYsqnusv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/91ivaoiouxfgnw1wfukm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BYsqnusv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/91ivaoiouxfgnw1wfukm.png" alt="Years waited for PRs to be merged" width="880" height="191"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The astronomical absolute values aside, we can see that a whooping &lt;strong&gt;37%&lt;/strong&gt; of the time waited was more or less unnecessary.&lt;/p&gt;

&lt;p&gt;Looking at the trend over the past three years, it is evident lead times are going down.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mFpyPZgg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/esg5mxka3zzf58bgxf6x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mFpyPZgg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/esg5mxka3zzf58bgxf6x.png" alt="PR time to merge trend over three years" width="576" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A very similar trend is also observed by &lt;a href="https://octoverse.github.com/writing-code-faster/#merging-pull-requests"&gt;GitHub themselves&lt;/a&gt;. This is because more and more teams are choosing to ship small and often, adopting techniques like &lt;a href="https://trunkbaseddevelopment.com/"&gt;Trunk based development&lt;/a&gt; and Continuous delivery.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎭 What is code review anyways
&lt;/h2&gt;

&lt;p&gt;Knowledge sharing aside, code review is meant to act as a quality gate. A good review should encompass multiple aspects of the code (e.g. fit for purpose, free of errors etc.), but, let's be honest, in practice, reviews are &lt;strong&gt;transactional&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  As an author:
&lt;/h3&gt;

&lt;p&gt;You need your code reviewed so that you can ship it and continue iterating.&lt;/p&gt;

&lt;h3&gt;
  
  
  As a reviewer:
&lt;/h3&gt;

&lt;p&gt;You want to unblock your teammate and get back to your own code.&lt;/p&gt;

&lt;p&gt;Of course, in both cases, we don't want to compromise on quality, but not all code changes hold the same amount of impact and risk. I'd go as far as claiming that code reviews at most teams are largely &lt;strong&gt;pattern matching&lt;/strong&gt; — e.g.: "Have I seen this pattern succeed before?", "Is the author familiar with this subsystem?" etc. When a sufficient number of mental tick boxes are checked, we are ready to declare LGTM.&lt;/p&gt;

&lt;h2&gt;
  
  
  🤖 Automation
&lt;/h2&gt;

&lt;p&gt;Programmers love to automate their work — think of all the formatters, linters and static analysis tools in existence. Just for fun, here's a &lt;a href="https://codeball.ai/what"&gt;comparison between car automation and code automation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codeball.ai/"&gt;Codeball&lt;/a&gt; is a new and ballsy attempt at taking automation further. It &lt;a href="https://codeball.ai/how"&gt;simulates&lt;/a&gt; the developer intuition and approves &lt;strong&gt;safe&lt;/strong&gt; pull requests, saving teams time.&lt;/p&gt;

&lt;p&gt;The best way of illustrating the impact of such advanced automation is by looking at how it affected the Pull Request merge times for a team using it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZxkGpR4v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m9z9y8ulv39n2lywlyq1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZxkGpR4v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m9z9y8ulv39n2lywlyq1.png" alt="Pull request merge times after adopting Codeball" width="880" height="543"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While there always are tricky Pull Requests that require human review, Codeball identifies and approves a large proportion of PRs that would have been LGTM'd by a human. Naturally, this team spends less time dealing with such PRs.&lt;/p&gt;

&lt;p&gt;If this sounds too good to be true, this is because a technological innovation is upon us! Go and &lt;a href="https://codeball.ai/"&gt;test&lt;/a&gt; it out on your own repository!&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://twitter.com/krlvi"&gt;Kiril&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>codereview</category>
      <category>ai</category>
      <category>programming</category>
    </item>
    <item>
      <title>Can AI do Code Review?</title>
      <dc:creator>Kiril Videlov</dc:creator>
      <pubDate>Wed, 01 Jun 2022 13:38:00 +0000</pubDate>
      <link>https://dev.to/krlvi/can-ai-do-code-review-3a5g</link>
      <guid>https://dev.to/krlvi/can-ai-do-code-review-3a5g</guid>
      <description>&lt;p&gt;So, I've been wondering this —&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How predictable is programming?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With tools like GitHub Copilot being pretty decent at writing code, surely reviewing should be possible too. And if you think about it, reviewing pull requests mainly pattern matching.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TLDR&lt;/strong&gt;: Yep, it can, with crazy accuracy.&lt;/p&gt;

&lt;p&gt;Okay, let's add a little bit of context first. On average, most code contributions (about 65%) get merged without any fixes/changes as a result of the review.&lt;/p&gt;

&lt;p&gt;Most teams aim to ship code in small incremental pull requests, but no matter how seemingly safe a change is, you have to wait for review.&lt;/p&gt;

&lt;h2&gt;
  
  
  But why?
&lt;/h2&gt;

&lt;p&gt;Well, if an AI can &lt;strong&gt;accurately&lt;/strong&gt; predict which contributions would be approved by humans, it can save developers a ton of time. &lt;/p&gt;

&lt;p&gt;Saving review time aside, the part I'm really excited about is this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If we can stop rubber stamping every single PR, we can start paying more attention to the tricky ones.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How + demo
&lt;/h2&gt;

&lt;p&gt;During a hackaton at work we built &lt;a href="https://codeball.ai/"&gt;Codeball&lt;/a&gt; — a code review AI which approves safe Pull Requests that a human would have approved.&lt;/p&gt;

&lt;p&gt;We trained it on over 1M Pull Requests, so it has seen tons of failure &lt;em&gt;(shitty code)&lt;/em&gt; and success &lt;em&gt;(decent code)&lt;/em&gt; patterns, making it really good at telling the difference. &lt;/p&gt;

&lt;p&gt;You can play with it at &lt;a href="https://codeball.ai/"&gt;codeball.ai&lt;/a&gt; where you can do "historical" tests on GitHub repos to see what the AI would have done.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results and what's next
&lt;/h2&gt;

&lt;p&gt;People have been testing Codeball on all sorts of pull requests resulting in around 99% accuracy. To quote a comment from a Hacker News &lt;a href="https://news.ycombinator.com/item?id=31533180"&gt;thread&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Codeball is like a strict bartender who only serves you when they are absolutely sure you're old enough. You may still be overage but Codeball's not serving you.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can add Codeball to your repository as a &lt;a href="https://github.com/sturdy-dev/codeball-action/"&gt;GitHub Action&lt;/a&gt; (takes like 2 minutes).&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;br&gt;
~ Kiril&lt;/p&gt;

</description>
      <category>codereview</category>
      <category>ai</category>
      <category>programming</category>
    </item>
    <item>
      <title>Simple &amp; efficient code collaboration</title>
      <dc:creator>Kiril Videlov</dc:creator>
      <pubDate>Wed, 09 Mar 2022 17:45:50 +0000</pubDate>
      <link>https://dev.to/krlvi/simple-efficient-code-collaboration-5fch</link>
      <guid>https://dev.to/krlvi/simple-efficient-code-collaboration-5fch</guid>
      <description>&lt;p&gt;There is this big debate out in the dev community about collaborating on code —&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Code reviews vs. Pair programming&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Surely though, there must be more alternatives. For the longest time, I have been wondering how a code collaboration tool, specifically designed for teams at work could look like.&lt;/p&gt;

&lt;p&gt;This is what prompted me to build an alternative. I would love to hear what you think!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://getsturdy.com/"&gt;Sturdy&lt;/a&gt; is a low overhead code collaboration platform for fast moving teams. It is, of course, &lt;a href="https://github.com/sturdy-dev/sturdy"&gt;open-source&lt;/a&gt;. Here are the key ideas —&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;👨‍💻 High-level operations around developer intent&lt;/li&gt;
&lt;li&gt;🙌 Enable early &amp;amp; fast feedback on code&lt;/li&gt;
&lt;li&gt;🔌 Compatible with Git and GitHub&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is specifically built for collaborating on code at work, and aims to remove most of the overhead associated with contributing code in a team setting.&lt;/p&gt;

&lt;h2&gt;
  
  
  🙋 Why build a new platform?
&lt;/h2&gt;

&lt;p&gt;I think it's fair to say that the way we code at work is not the same as open-source. The biggest difference is in how closely developers collaborate with one another — at work, we do standups, plan together, and share knowledge. &lt;/p&gt;

&lt;p&gt;On top of that...&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Waiting for code reviews sucks!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For developers adopting DevOps and Continuous Delivery, shipping small, incremental changes is crucial. At the same time, the default pull request workflow has a fixed overhead per contribution — pulling code, creating a branch, staging, committing, pushing etc., not to mention getting a review! This is very pronounced when trying to integrate your code multiple times per day.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧑‍💻 How is Sturdy different from code reviews?
&lt;/h2&gt;

&lt;p&gt;With Sturdy, you work in the open within your team. This means you can discover and interact with draft code in your team as it is written. Those team drafts are a bit like live pull requests (think Figma or Google Docs, but using your local editor).&lt;/p&gt;

&lt;p&gt;You can easily get a copy of someone else's draft code to your computer, explore it in your IDE and edit the code to automatically create suggestions.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;But why? &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This enables early, proactive feedback. It means you can help each other in a meaningful way, communicate better, and when everything goes well, your code is pre-reviewed.&lt;br&gt;
Contributing code should not feel like submitting homework!&lt;/p&gt;
&lt;h2&gt;
  
  
  💁 Sounds a lot like pair programming. How is Sturdy different?
&lt;/h2&gt;

&lt;p&gt;Pair programming is great for knowledge sharing and moving fast, but the tradeoff is flexibility — you have to be there in the moment.&lt;/p&gt;

&lt;p&gt;Some developers describe Sturdy as — &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;asynchronous pair programming&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is because, similar to pairing, everybody in the team can see, try, and give suggestions to draft code. The key difference is that feedback exchange can happen whenever it suits individuals, and doesn't require you to be in a call.&lt;/p&gt;
&lt;h2&gt;
  
  
  🤷 Is this compatible with my existing setup?
&lt;/h2&gt;

&lt;p&gt;Yes! Sturdy uses Git as a database but not as a protocol. This means preserving compatibility of the output, while gaining flexibility to design new ways of interacting with code. &lt;/p&gt;

&lt;p&gt;It also has a GitHub bridge integration, which allows you to use it side by side with your existing setup, CI/CD and other integrations.&lt;/p&gt;
&lt;h2&gt;
  
  
  💻 Can I try it by myself, without involving my team?
&lt;/h2&gt;

&lt;p&gt;Yes, absolutely! Your own workflow will be faster for it. It's not necessary for an entire team to adopt Sturdy to benefit from a more leveraged VCS experience. &lt;/p&gt;

&lt;p&gt;With the GitHub bridge set up, by default, Sturdy follows changes on the default (main) branch and allows you to quickly create pull requests.&lt;/p&gt;
&lt;h2&gt;
  
  
  🐣 Can I try it? How about getting involved?
&lt;/h2&gt;

&lt;p&gt;For sure! You can try the &lt;a href="https://getsturdy.com/"&gt;cloud hosted Sturdy&lt;/a&gt; &lt;strong&gt;or&lt;/strong&gt; run your own instance with this Docker one-liner:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run --interactive \
    --pull always \
    --publish 30080:80 \
    --volume "$HOME/.sturdydata:/var/data" \
    getsturdy/server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you choose to host yourself, be sure to check out &lt;a href="https://getsturdy.com/docs/self-hosted"&gt;the docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Sturdy is &lt;a href="https://github.com/sturdy-dev/sturdy"&gt;open-source&lt;/a&gt; and we love receiving feedback, bug reports, issues, and even code. The project uses some cool tech - &lt;code&gt;Go&lt;/code&gt;, &lt;code&gt;Vue 3&lt;/code&gt;, &lt;code&gt;GraphQL&lt;/code&gt;, be sure to check out the code :). While you are there, consider giving it a star ⭐️, it would make my day 🙏!&lt;/p&gt;

&lt;p&gt;Thanks! I will be happy to answer any questions in the comments. &lt;/p&gt;

&lt;p&gt;— Kiril&lt;/p&gt;

</description>
      <category>git</category>
      <category>productivity</category>
      <category>devops</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
