<?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: Vlad Dubrovskis</title>
    <description>The latest articles on DEV Community by Vlad Dubrovskis (@vladdubrovskis).</description>
    <link>https://dev.to/vladdubrovskis</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%2F86767%2F7ca6425f-675a-4648-b067-b347f37eae09.jpeg</url>
      <title>DEV Community: Vlad Dubrovskis</title>
      <link>https://dev.to/vladdubrovskis</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vladdubrovskis"/>
    <language>en</language>
    <item>
      <title>When you encounter hard to understand code</title>
      <dc:creator>Vlad Dubrovskis</dc:creator>
      <pubDate>Sun, 20 Sep 2020 17:01:00 +0000</pubDate>
      <link>https://dev.to/vladdubrovskis/when-you-encounter-hard-to-understand-code-1p3f</link>
      <guid>https://dev.to/vladdubrovskis/when-you-encounter-hard-to-understand-code-1p3f</guid>
      <description>&lt;p&gt;YouTube: &lt;iframe width="710" height="399" src="https://www.youtube.com/embed/wEdjRtTcAac"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Trying something different on this occasion, some video content 😱🤞&lt;/p&gt;

&lt;p&gt;Recently have rejoined a company where I have worked in the past and this reflects my experiences quite accurately 😁&lt;/p&gt;

&lt;p&gt;Has something like this ever happen to you?&lt;/p&gt;

</description>
      <category>video</category>
      <category>fun</category>
      <category>git</category>
      <category>blame</category>
    </item>
    <item>
      <title>Introduction to Practical Test-Driven Development with JavaScript for beginners</title>
      <dc:creator>Vlad Dubrovskis</dc:creator>
      <pubDate>Fri, 24 Apr 2020 12:18:44 +0000</pubDate>
      <link>https://dev.to/vladdubrovskis/introduction-to-practical-test-driven-development-with-javascript-for-beginners-1p3h</link>
      <guid>https://dev.to/vladdubrovskis/introduction-to-practical-test-driven-development-with-javascript-for-beginners-1p3h</guid>
      <description>&lt;p&gt;The idea behind Test-Driven Development (TDD) is that you always write your tests first instead of leaving it until the end of a coding task.&lt;/p&gt;

&lt;p&gt;It helps you to think and decide on how your piece of software will behave before you write it, which helps you stay laser-focused on the task at hand and not let the mind wander off and invent some big wonderful solution. Once you are done with your piece of software you are working on, the best part is you automatically have got some level of test coverage. Although this in itself is not an answer to all of the testing requirements your system may need, it provides quite a good starting point.&lt;/p&gt;

&lt;p&gt;Test-Driven Development is a very powerful tool in the arsenal of a developer. We will try to learn and understand it using the basics of JavaScript without the world of NodeJS or &lt;code&gt;npm&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Instead, we are going to use good plain JavaScript and something like &lt;a href="https://jsbin.com/"&gt;JSBin&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Test Driven Development: Why do it?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Quality
&lt;/h3&gt;

&lt;p&gt;One of the main reasons to write tests is to increase the quality of the software you are writing. TDD makes you think about how the code can be used and how it should behave in different scenarios based on different inputs which should lead to a lower number of bugs in code. &lt;/p&gt;

&lt;h3&gt;
  
  
  Helps document code
&lt;/h3&gt;

&lt;p&gt;Tests can be a great way to document an intent behind the code and will help new developers get on board with the code a lot faster as well as allow them to change it with confidence.&lt;/p&gt;

&lt;h3&gt;
  
  
  Helps produce cleaner code
&lt;/h3&gt;

&lt;p&gt;As the tests are not an after-thought but more of a first-class citizen it becomes harder to over-engineer a solution and mix concerns. This is all due to the simplicity of the rules and focus.&lt;/p&gt;

&lt;h3&gt;
  
  
  Enables refactoring
&lt;/h3&gt;

&lt;p&gt;When you have tests in place they give you confidence to change implementation details safe in the know that the tests will tell when you are about to break something.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Driven Development: What is it?
&lt;/h2&gt;

&lt;p&gt;Test-Driven Development is a practice that helps you navigate a problem and come its solution using code.&lt;/p&gt;

&lt;p&gt;The workflow is the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Write a test - Red (write an assertion that will fail)&lt;/li&gt;
&lt;li&gt;Make it pass - Green (write some code to pass the assertion)&lt;/li&gt;
&lt;li&gt;Refactor the code - Refactor (change the code you are testing without changing behaviour)&lt;/li&gt;
&lt;li&gt;Repeat until done&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You will often hear people refer to it as:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Red -&amp;gt; Green -&amp;gt; Refactor -&amp;gt; Repeat&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It is that simple in its core. So to get our head into the right headspace let's dive into an example.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test-Driven Development: Practice
&lt;/h2&gt;

&lt;p&gt;Now we are going to dive into some practice, and the task at hand is the following:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Write a function that returns a sum of numbers passed to it&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As we learned so far, the first thing we have to do is write a failing test. Just before we do that we need to understand what "test" means and how it works.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the code is tested
&lt;/h2&gt;

&lt;p&gt;So what happens when we run a test?&lt;/p&gt;

&lt;p&gt;When a test is running, it will execute a piece of code, capture the output, and will verify that the output is equal to what it is expected to be. &lt;/p&gt;

&lt;p&gt;When the result meets the expectation, it is marked as green or passing.&lt;/p&gt;

&lt;p&gt;When the result does not meet the expectation, it fails and it is marked as red or failing.&lt;/p&gt;

&lt;h3&gt;
  
  
  The code that is testing our code needs to know 3 things:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Test description - to communicate intent&lt;/li&gt;
&lt;li&gt;Expected result&lt;/li&gt;
&lt;li&gt;Result of executing our code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And at the very basic level that is all there is to a test. Now to help us remember this we will write the test function that we will use going forward in this tutorial to test the code we will write.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code to test code
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;expectedResult&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now we need to make that function tell us if our expectation matched the result or if it failed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;expectedResult&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;expectedResult&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; passed`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; failed. Expected &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; to be &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;expectedResult&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Check the test can fail
&lt;/h3&gt;

&lt;p&gt;First, let's write something that is a "Red" or failing test:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;result is 2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// description: result is 2&lt;/span&gt;
&lt;span class="c1"&gt;// expectedResult: 2&lt;/span&gt;
&lt;span class="c1"&gt;// result: 3&lt;/span&gt;
&lt;span class="c1"&gt;// Output: result is 2 failed. Expected 3 to be 2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Test can succeed
&lt;/h3&gt;

&lt;p&gt;Now let us write a "Green" or passing test:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;result is 2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// description: result is 2&lt;/span&gt;
&lt;span class="c1"&gt;// expectedResult: 2&lt;/span&gt;
&lt;span class="c1"&gt;// result: 2&lt;/span&gt;
&lt;span class="c1"&gt;// Output: result is 2 passed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As you can see we now have a simple test function that can validate if the result was what we expected it to be, and if it fails, also tells us what the outcome was meant to be.&lt;/p&gt;

&lt;p&gt;Now that we have a function that can test our code, let's get back to our task at hand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Driven Development Practice
&lt;/h2&gt;

&lt;p&gt;As mentioned earlier the requirement we have is the following:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Write a function that returns a sum of numbers passed to it&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  First failing test: sum of 2 and 2
&lt;/h3&gt;

&lt;p&gt;As per TDD rules, let's write our first failing test. Let's say because we need to return a sum of the numbers we are going to call our function &lt;code&gt;sum&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,2" is 4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// Output: Uncaught ReferenceError: sum is not defined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Make it pass
&lt;/h3&gt;

&lt;p&gt;This is a great start, we have our first test and what it is telling us is that we are trying to call &lt;code&gt;sum&lt;/code&gt; but it is not defined. Let's go and define it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If we try and run all of this code now the outcome will be different:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,2" is 4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// sum of following numbers: "2,2" is 4 failed. Expected undefined to be 4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;At this point, you may be tempted to go ahead and implement the function parameters and add them up, but that is not what we are going to do.&lt;/p&gt;

&lt;p&gt;What we need to do instead is to write the minimum amount of code to make the test pass. And at this point, the code does not have to be pretty.&lt;/p&gt;

&lt;p&gt;So what we are going to do is update our function to just return &lt;code&gt;4&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;When we run our test now it will say the following&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,2" is 4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// sum of following numbers: "2,2" is 4 passed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This is great, we have our test passing, but we are not done just yet. We know the code is only good to handle the sums where it comes to &lt;code&gt;4&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Next failing test: sum of 2 and 3
&lt;/h3&gt;

&lt;p&gt;So let's write the next test where the result is something but &lt;code&gt;4&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,3" is 5&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// output: sum of following numbers: "2,3" is 5 failed. Expected 4 to be 5 &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Making second test pass
&lt;/h3&gt;

&lt;p&gt;We have a new failing test. Now in order to make this pass, we have to update the &lt;code&gt;sum&lt;/code&gt; to take in some parameters and add them up for us.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;number1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;number2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;number1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;number2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Run the test again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,3" is 5&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "2,3" is 5 passed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Where are we so far
&lt;/h3&gt;

&lt;p&gt;Wonderful! We have 2 passing tests now! The code we have written so far should look something like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;expectedResult&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;expectedResult&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; passed`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; failed. Expected &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; to be &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;expectedResult&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;number1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;number2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;number1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;number2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,2" is 4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,3" is 5&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "2,2" is 4 passed&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "2,3" is 5 passed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You can play around with this code on JSBin: &lt;a href="https://jsbin.com/yahubukane/edit?js,console"&gt;https://jsbin.com/yahubukane/edit?js,console&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Next test: sum of more than two numbers
&lt;/h3&gt;

&lt;p&gt;However, what happens if I pass more than two numbers? Remember we did not specify how many numbers we need to sum, we may need to sum more than two. With this said let's go ahead and write a test where we pass three numbers to the function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "1,2,3" is 6&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "1,2,3" is 6 failed. Expected 3 to be 6&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Working out how to access all function parameters
&lt;/h3&gt;

&lt;p&gt;So how can we make the next piece work? The number of parameters can be anything, so passing a bunch of named arguments is not going to work. Well, you could add 100+ of them but that code would be quite hard to follow.&lt;br&gt;
Luckily in JavaScript, a function has access to all the arguments that have been passed to it, even if they were not named (see &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments"&gt;Function arguments&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;If you open that link and read, you will see that the &lt;code&gt;arguments&lt;/code&gt; inside a function is an Array-like parameter that does not support any array methods or properties apart from &lt;code&gt;length&lt;/code&gt;. As we can be sure we will need to iterate on the values in some form, a real array could be quite useful.&lt;br&gt;
Luckily for us, there is a piece of code on that page that tells how to convert the &lt;code&gt;arguments&lt;/code&gt; to a real Array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Let's add this to our &lt;code&gt;sum&lt;/code&gt; function and remove the named parameters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If we run all our tests now we will see that they all fail:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,2" is 4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,3" is 5&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "1,2,3" is 6&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "2,2" is 4 failed. Expected 2,2 to be 4&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "2,3" is 5 failed. Expected 2,3 to be 5&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "1,2,3" is 6 failed. Expected 1,2,3 to be 6&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now although we do not have the right result yet, we can see that we get back an array of parameters, which is a step in the right direction. What we need to do now is to find a way to sum up all numbers in an array.&lt;br&gt;
As we have now converted our parameters to an array, we can use &lt;code&gt;forEach&lt;/code&gt; to iterate.&lt;/p&gt;

&lt;p&gt;Let's update our code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now let's run our tests one more time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,2" is 4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,3" is 5&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "1,2,3" is 6&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "2,2" is 4 passed&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "2,3" is 5 passed&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "1,2,3" is 6 passed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Testing edge cases
&lt;/h3&gt;

&lt;p&gt;Now to be completely happy that we have done the right thing, let's try to add 2 more tests. One where we pass only a single number. And another one where we pass let's say... 7 numbers. Something that covers a case for a single number and a lot of numbers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "1" is 1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "1,2,3,4,5,6,7" is 28&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "1" is 1 passed&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "1,2,3,4,5,6,7" is 28 passed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;One more edge case we could test is what would happen if you would pass no numbers at all?&lt;br&gt;
How would you do that? In theory, the total number of no numbers is equal to &lt;code&gt;0&lt;/code&gt;&lt;br&gt;
So we can go ahead and write the following test:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "" is 0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "" is 0 passed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Refactoring
&lt;/h2&gt;

&lt;p&gt;Now comes the best part of Test-Driven Development. We have our function, we have our tests, but we want to update the code to use ES6 syntax like all the cool kids.&lt;br&gt;
On the arguments documentation, it suggests that to access arguments in ES6 we can use &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters"&gt;rest parameters&lt;/a&gt;.&lt;br&gt;
Let's go ahead and do that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Run all the tests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,2" is 4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,3" is 5&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "1,2,3" is 6&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "" is 0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "1" is 1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "1,2,3,4,5,6,7" is 28&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "2,2" is 4 passed&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "2,3" is 5 passed&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "1,2,3" is 6 passed&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "" is 0 passed&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "1" is 1 passed&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "1,2,3,4,5,6,7" is 28 passed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;All the tests are green! That was nice, we updated our code syntax and still know that the code behaves the same as before.&lt;/p&gt;

&lt;p&gt;Now, finally, curiosity has taken over and we decide to turn to StackOverflow to tell us about how to sum numbers in an array in Javascript:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/1230233/how-to-find-the-sum-of-an-array-of-numbers"&gt;StackOverflow - How to find the sum of an array of numbers&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's go ahead and update our function with the suggested answer implementation using &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce"&gt;&lt;code&gt;Array.reduce&lt;/code&gt;&lt;/a&gt;&lt;br&gt;
(Interesting that an example of summing numbers can be seen implemented here too: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters"&gt;Function rest parameters&lt;/a&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;accumulator&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;currentValue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;accumulator&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;currentValue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And run tests one more time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,2" is 4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "2,3" is 5&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "1,2,3" is 6&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "" is 0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "1" is 1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sum of following numbers: "1,2,3,4,5,6,7" is 28&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "2,2" is 4 passed&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "2,3" is 5 passed&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "1,2,3" is 6 passed&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "" is 0 passed&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "1" is 1 passed&lt;/span&gt;
&lt;span class="c1"&gt;// Output: sum of following numbers: "1,2,3,4,5,6,7" is 28 passed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The final outcome of our exercise can be found here: &lt;a href="https://jsbin.com/vakikudomu/1/edit?js,console"&gt;https://jsbin.com/vakikudomu/1/edit?js,console&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see we can make changes to our code and be confident that it still works the way we intended it to in the first place.&lt;br&gt;
Arguably the readability of the final example is not as good, but the main point here is that we can change code confidently!&lt;/p&gt;

&lt;h2&gt;
  
  
  Homework
&lt;/h2&gt;

&lt;p&gt;Before we part:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Think of other examples that we may have missed.&lt;/li&gt;
&lt;li&gt;Think about how you would approach a scenario where the inputs can contain letters or strings and not just numbers.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>codequality</category>
      <category>testing</category>
      <category>tdd</category>
    </item>
    <item>
      <title>Caring for future developers</title>
      <dc:creator>Vlad Dubrovskis</dc:creator>
      <pubDate>Mon, 06 Apr 2020 13:03:54 +0000</pubDate>
      <link>https://dev.to/vladdubrovskis/caring-for-future-developers-355f</link>
      <guid>https://dev.to/vladdubrovskis/caring-for-future-developers-355f</guid>
      <description>&lt;p&gt;Picture this: You join a new team and you start to get to know the codebase. After some time you see some suggestions you would like to make to the system and some of the design principles make no sense at all.&lt;/p&gt;

&lt;p&gt;You bring this up to your teammates and eventually get shot down with some generic phrases like, “it just works this way” or “we have looked at it before and it’s very difficult”. Maybe someone has implemented it a while ago, left the company and no one is brave enough to try and change it.&lt;/p&gt;

&lt;p&gt;It seems like nobody quite knows why things are a certain way, but there is a reason.&lt;/p&gt;

&lt;p&gt;Or in another scenario when you suggest improvements to the design people say that they have tried it already, it was hard, and it did not work so there’s no point wasting time on it again.&lt;/p&gt;

&lt;p&gt;Have you ever found yourself in such situations? I would be surprised and somewhat jealous if you are a software developer and the answer is no.&lt;/p&gt;

&lt;p&gt;Unfortunately, there is no easy way to get those historical answers. For the first scenario, your best bet is version control history, but even then trying to find answers may prove to be a challenge as this will depend on a number of factors. One of them being how well people communicated their intentions in their commit messages. Also, I have seen first-hand a migration of repository with all history lost. &lt;/p&gt;

&lt;p&gt;There are plenty of things we can try and do to help our future self and future software engineers that will have to maintain the code we have written and systems we have designed. Let’s take a look.&lt;/p&gt;

&lt;h2&gt;
  
  
  Commit messages
&lt;/h2&gt;

&lt;p&gt;Your commit messages are probably the most basic way to provide extra context as to why the code has changed and what you are trying to achieve with it. Most importantly, try to commit a little and often, which helps the reviewer understand the thinking process behind the change.&lt;/p&gt;

&lt;p&gt;This is just an opinion but ideally, I would not squash my commits when merging pull requests. Mainly to have better historical reasoning as mentioned in the previous paragraph.&lt;/p&gt;

&lt;p&gt;Most importantly try and make sure your commit messages are meaningful and useful. It is not an easy task and you may find it difficult at times, but like with most things the more you practice the easier it becomes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Change-logs 
&lt;/h2&gt;

&lt;p&gt;Change-logs are great as they provide history in one wonderful document. There are numerous ways to automate them. Ideally you want this automated but there is nothing wrong with doing it manually if it makes sense to your team. It is highly likely at some point someone will get fed up with the manual task and automate it anyway.&lt;/p&gt;

&lt;p&gt;One of the techniques you could do is use something like Conventional Commits to help you automate the process. Even if initially developers may find it frustrating, I would suggest that this helps them write better commit messages as it enforces some guidelines in doing it.&lt;/p&gt;

&lt;p&gt;Now you don’t have to use conventional commits or follow semantic versioning as there are other ways to achieve the same result. Having an easy to access human-readable document with some sort of versioning can prove to be very useful especially when it comes to supporting your application in production and you need to easily understand what changes are live in front of your users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Documentation
&lt;/h2&gt;

&lt;p&gt;You have to write documentation no matter your personal preferences, as the reason you do it is not for yourself but for other people. In the case with documentation, there are always at least two consumers of that documentation: The developers that may contribute to the codebase and may need some information around how the project is set up, and the consumers of your application or API.&lt;/p&gt;

&lt;p&gt;Common topics to include in the documentation are things like: How to configure the application, what APIs does it provide, examples of how it can be configured, and most importantly examples of how can you test it if it’s relevant. The content and the shape your documentation will take will depend on the target reader, so you may need to provide two or more sets aimed at different audiences. Think how Facebook provides help pages for regular users and a whole separate site for developers. This of course all depends on the scale of your application.&lt;/p&gt;

&lt;p&gt;Avoid putting low-level or implementation details in the documentation. Similarly to how you would not test implementation details in your tests as these can change and become obsolete.&lt;/p&gt;

&lt;h2&gt;
  
  
  Developer experience 
&lt;/h2&gt;

&lt;p&gt;This is a somewhat hot topic that is coming up more often where people finally realise that developers are also human beings that have a need for a good experience when using all sorts of tools for their job.&lt;/p&gt;

&lt;p&gt;When it comes to developer experience, documentation is a big part of it. However, an often overlooked way to provide a good developer experience is to help and navigate the developer on the right path using meaningful error messages, examples and links to other relevant pieces of information in those error messages.&lt;/p&gt;

&lt;p&gt;For documentation, think about examples like BrowserStack or Sentry that provide snippets with your secrets embedded into them when you are logged in to the website, so all you have to do is copy and paste it across. This saves an action and has always put a smile on my face and made me notice that extra little help.&lt;/p&gt;

&lt;p&gt;When it comes to errors or warnings, do not just leave cryptic messages and instead spend some effort and give suggestions as to why things may not be working. A good example is the React team that have done a really good job with these over the last few years.&lt;/p&gt;

&lt;p&gt;Good user experience is something that is widely accepted as a given these days. When it comes to developers the experience they have using your platform, API, module or any other piece of software can make a huge difference and most importantly may make life easier for new developers that come to our industry.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decision logs
&lt;/h2&gt;

&lt;p&gt;Something I have started doing recently, over the course of the last few years, is write decision logs when we are choosing something that we think someone may question in the future. For example, what state management library or front-end framework to use and why. &lt;/p&gt;

&lt;p&gt;You have to add a list of pros and cons for each of the options considered. Also if anything was not a consideration ideally have a part that explains why.&lt;/p&gt;

&lt;p&gt;Crucially this document needs to have a date of when this was written so that future teams can easily understand why things were done and when. For example, some show stoppers may have been resolved by the time a new member of the team has joined and it makes sense to actually move to another state management or testing library.  In terms of where to keep this document I would suggest in your Wiki or your repository. Anything relating to specific code should live closer to it. Alternatively, you could have them in Confluence decision logs, it all depends on what works best for your team.&lt;/p&gt;

&lt;h2&gt;
  
  
  Diagrams
&lt;/h2&gt;

&lt;p&gt;This may be a personal bias creeping in but I love diagrams. Nothing helps me understand how the system interacts better than pictures that explain how requests flow through your system. &lt;/p&gt;

&lt;p&gt;Keep this someplace where you can version it so you can see the evolution of the system. Version numbers are good but things like dates are really important too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Be kind to people who will be there after you
&lt;/h2&gt;

&lt;p&gt;In summary, you have to create some sort of documentation and historical audit trail for future teams. As well as spend some effort in helping any developers who will be working on the code after you have long left the company. You may not witness this directly but I am sure it will make some developer pretty happy someday.&lt;/p&gt;

&lt;p&gt;Now I am not suggesting for you to necessarily do all the things I have mentioned, as it may not always make sense due to the size of the project and other factors, but at least try and do some of them.  Unfortunately, there is little accountability in our industry. I have to work on some projects that were neglected and had to spend days and weeks working things out. Let’s try and be kinder to one another and to future developers.&lt;/p&gt;

&lt;p&gt;My two parting thoughts that I think will help teach a little bit of empathy for those who have made decisions before us are:&lt;/p&gt;

&lt;p&gt;“Always assume best intentions”&lt;/p&gt;

&lt;p&gt;“Teams make decisions based on the best understanding they have at the time”&lt;/p&gt;

&lt;p&gt;Cover photo by &lt;a href="https://unsplash.com/@juanparodriguez"&gt;Juan Pablo Rodriguez&lt;/a&gt;&lt;/p&gt;

</description>
      <category>documentation</category>
      <category>leadership</category>
      <category>agile</category>
      <category>legacy</category>
    </item>
    <item>
      <title>Continuous improvement and feedback loops</title>
      <dc:creator>Vlad Dubrovskis</dc:creator>
      <pubDate>Mon, 09 Mar 2020 19:19:38 +0000</pubDate>
      <link>https://dev.to/vladdubrovskis/continuous-improvement-and-feedback-loops-inl</link>
      <guid>https://dev.to/vladdubrovskis/continuous-improvement-and-feedback-loops-inl</guid>
      <description>&lt;p&gt;Do you ever wonder how anyone knows if what they are building is right, important or adds value to their customers? What about the companies that just starting, how do they know if what they will become will be a success? I don’t think anyone truly knows, or at least not at the beginning of the journey and even more so when you start doing something brand new. After all, if everything was that simple we would not know what “pivot” even means in the technology world.&lt;/p&gt;

&lt;p&gt;So what is it that can help you understand your idea better and help and guide your way to success, or at least validate some of the assumptions and hypotheses you may have? In it’s purest form it’s quite simple:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;“Build something - Measure it - Learn from it”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This feedback loop is the basic principle of how you can focus on the right things and course-correct as you move along. A lot of what we call agile boils down to it. You have to test your ideas out and get some quantified feedback that you can use to put forward a better idea or dismiss some of the other ones you may have had. &lt;/p&gt;

&lt;p&gt;The problem is that this is a rather high-level feedback loop that does not provide us with much practical advice, and let’s be honest it’s not even groundbreaking.&lt;/p&gt;

&lt;p&gt;However, if you start digging deeper into modern ways of working, you will find that there are a lot more types of feedback loops. What is more important is if you try and see the purpose they serve you may be able to advance them to serve you better.&lt;/p&gt;

&lt;p&gt;So let’s have a look at the different types of feedback loops and how we can try and improve them, starting with the lowest level one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tests
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Purpose: Code behaves as expected&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Different types of tests give you different levels of feedback.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unit - function behaves as expected&lt;/li&gt;
&lt;li&gt;Integration - number of moving parts interacting and behaving as expected&lt;/li&gt;
&lt;li&gt;End-to-end - the system as a whole is behaving as expected&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How can we make it better?
&lt;/h3&gt;

&lt;p&gt;As long as you are doing some sort of testing you are probably on the right track. Regardless of the level of tests you are writing remember to always test the behaviour and not implementation. If you test implementation this may stop you from refactoring effectively. How do you know if you are testing implementation? Do you have an assertion where a function has called another function with specific parameters? Try and avoid tests like this if possible.&lt;/p&gt;

&lt;p&gt;When it comes to test-driven development on unit-level only, it is not a testing strategy, it is a tool that helps you stay laser-focused and navigate the problem in bite-sized chunks.&lt;/p&gt;

&lt;p&gt;Speaking of higher-level tests, especially end-to-end tests it is a universal understanding that they are slow to run, but in modern-day technology, you can run them in parallel which can marginally reduce the run time and the feedback loop for you.&lt;/p&gt;

&lt;p&gt;Finally, when you run your top-level tests, always run these against a deployed environment, ideally a copy of production or as close as possible. The main reason for this is if you skip certain steps in your infrastructure (for example API Gateway, some proxy or another part of infrastructure) you may let some bugs slip through that could have been avoided.&lt;/p&gt;

&lt;p&gt;Your main aim is to have confidence that everything will work fine if your tests tell complete with no failures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Standup
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Purpose: This is how I and everyone else on the team is getting on with their current work&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Daily progress feedback usually in the form of an early morning meeting to make sure that things are progressing along well without any issues or blockers.&lt;/p&gt;

&lt;h3&gt;
  
  
  How can we make it better?
&lt;/h3&gt;

&lt;p&gt;Did you notice how this usually turns into a list of justifications for your existence on the team? If not I am truly happy for you. &lt;/p&gt;

&lt;p&gt;The idea of talking about blockers and progress once a day is inefficient and I am pretty sure that the majority of people should and would raise those issues as soon as they occur. You can notify people of changes and progress during the day too without having to wait a whole night for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Refinement
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Purpose: Purpose: Is the next set of stories in a good state and ready to be worked on&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A refinement is usually happening on a scheduled basis to get together as a team or three amigos to refine a set of stories so they meet the definition of ready. This should allow the team to pick up the tickets and work on implementation.&lt;/p&gt;

&lt;h3&gt;
  
  
  How can we make it better?
&lt;/h3&gt;

&lt;p&gt;Instead of scheduled refinement, get into the habit of doing it when needed with a few relevant people. Do the basics well, make sure it meets the definition of ready, that the required designs are linked, then let the teamwork out the details when they work on the feature. If someone has done a spike around some uncertainty help them create those stories and do not bring people that do not need to be there.&lt;br&gt;
And remember: A story is a promise of a conversation, it should capture the problem, not the solution.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demos
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Purpose: Look what we have done and learned&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Depending on how often you have your demos it is is a good opportunity to show off completed work and talk about the challenges and what you have learned. It creates group feedback and allows the sharing of experience that may help other teams learn along the way.&lt;/p&gt;

&lt;h3&gt;
  
  
  How can we make it better?
&lt;/h3&gt;

&lt;p&gt;However often you do demos and how you approach them, there is always room for improvement. You can always demo smaller pieces even just with your product person or team as soon as you have done the feature. There is no need to wait a whole week as they may notice some flaws in it and provide immediate feedback.&lt;/p&gt;

&lt;h2&gt;
  
  
  Continuous Integration/Continuous Delivery/Continuous Deployment
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Purpose: New code behaves and works with the rest of the system, code works in a deployed environment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hopefully, the codebase is constantly changing, so you need to make sure the feature you have just completed does not break another feature or take the whole system down. If something does not work or the code has diverged it feeds back to the developer when things break and require their attention.&lt;/p&gt;

&lt;p&gt;This makes sure the code behaves as expected in a deployed environment and is ready to be shipped to customers. If you are doing Continuous Delivery it may also provide feedback that the latest features are out for customers to enjoy.&lt;/p&gt;

&lt;h3&gt;
  
  
  How can we make it better?
&lt;/h3&gt;

&lt;p&gt;A solid CI/CD pipeline requires a solid testing strategy for whatever that you are building. Following on the advice from the first section on tests, always think about how you can run the tests in a way that you prioritise the most important checkpoints first. &lt;br&gt;
The order could be: Static analysis, unit tests, once the app or container is deployed hit a health-check endpoint, then end-to-end tests, etc. If the health check fails then there is no point in going further as something is wrong. &lt;/p&gt;

&lt;p&gt;The more complex your system becomes the more tests you will have, and to have an efficient pipeline, you need to be able to run all sorts of tests fast. Keep track overtime on how long it takes to build, test and deploy. If the time is going up, have a look and review what is going on and see if you can drop some tests that may no longer be as valuable, or run more tests in parallel.&lt;/p&gt;

&lt;p&gt;Finally, give continuous deployment a go. Until you have tried it you will not be able to fully appreciate how wonderful and liberating it is. Most importantly, having continuous delivery forces everyone to care about quality because to deploy on the merge of the code your quality and automation have to be solid.&lt;/p&gt;

&lt;h2&gt;
  
  
  Retrospective
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Purpose: Team works&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the more important feedback loops that highlight the team dynamics and shows how well everyone is doing together.&lt;/p&gt;

&lt;h3&gt;
  
  
  How can we make it better?
&lt;/h3&gt;

&lt;p&gt;This is similar to demos in the sense that although the team should have a scheduled time for a collective reflection sometimes you should just raise issues as they occur. You may be able to resolve them before the retro even happens. If you wait weeks for a retrospective you may just forget something that may be truly important.&lt;/p&gt;

&lt;h2&gt;
  
  
  Customer
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Purpose: Are your customers happy with the service and experience they receive?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Customer satisfaction feedback is a crucial feedback loop. When customers are not happy you need to address it and attempt to resolve the situation. I cannot stress this enough: You need to be able to speak to your customers and be able to have access to their feedback regularly. &lt;/p&gt;

&lt;h3&gt;
  
  
  How can we make it better?
&lt;/h3&gt;

&lt;p&gt;Customer feedback is crucial! You may be lucky to have a good UX department that will do a great job and present findings on some weekly/bi-weekly schedule. However ask yourself - how accessible is all of the feedback that the company generates from users to anyone else within the company? &lt;/p&gt;

&lt;p&gt;Is there a filter like a research team - do you need permission to access the raw research data? What happens if they make wrong assumptions? Try and make it easier for people to live and breathe the customer feedback. It should be accessible to everyone. People should be able to easily show interest and attend user interviews, review research outcomes and see direct user feedback. The latter can be implemented as a public Slack channel that has all of the feedback from the product automatically posted to it.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Velocity
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Purpose: How quick team is going&lt;/strong&gt; &lt;br&gt;
This is feedback on how efficient your team is. It can also provide feedback on the team’s health. If the velocity drops there must be a reason: Impediments, people leaving, general low morale.  &lt;/p&gt;

&lt;h3&gt;
  
  
  How can we make it better?
&lt;/h3&gt;

&lt;p&gt;Every Scrum master’s dream is to quadruple the velocity of the team. Joking aside I think this metric is not useful. All it tells you in terms of numbers is how much work a team can do in an arbitrary amount of time.&lt;br&gt;
What it does not tell you is what sort of value the team creates. What you should do instead is define and constantly measure better metrics that matter for each of the teams. An example of this can be: The amount of quality leads generated (that probably is better than just a sheer number).&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The list of feedback loops could go on and you could include things like: Analytics, Monitoring tools, Log aggregators, etc. A lot of these are just patterns that I have noticed while working with some of the most performant teams in my career so far.&lt;/p&gt;

&lt;p&gt;Remember that feedback loops are all around us and all too often we follow a recipe without questioning it. If you take a good look around and keep an eye open for opportunities to improve you may find some interesting ways of improving your team’s flow too.&lt;/p&gt;

&lt;p&gt;Best of luck in your improvement and discovery endeavours and please do share your observations with me along the way.&lt;/p&gt;

</description>
      <category>agile</category>
      <category>technology</category>
      <category>leadership</category>
      <category>improvement</category>
    </item>
    <item>
      <title>How do you help your teams manage tech debt?</title>
      <dc:creator>Vlad Dubrovskis</dc:creator>
      <pubDate>Sun, 23 Feb 2020 15:11:46 +0000</pubDate>
      <link>https://dev.to/vladdubrovskis/how-do-you-help-your-teams-manage-tech-debt-58cc</link>
      <guid>https://dev.to/vladdubrovskis/how-do-you-help-your-teams-manage-tech-debt-58cc</guid>
      <description>&lt;p&gt;Does your team struggle with technical debt? Or are you always on top of it with the full support of the business?&lt;/p&gt;

&lt;p&gt;Are you a leader/product person on the team? Do you help the team with keeping on top of things? Or does the tech debt take a back seat?&lt;/p&gt;

&lt;p&gt;Tell me your stories/ideas and experiences.&lt;/p&gt;

&lt;p&gt;One of the tips I have and use for teams that use estimation is the following:&lt;br&gt;
If you know that there is tech debt that needs addressing as it has been slowing you down a lot, you can always increase your estimates to allow for that time. As in theory developers use estimates to communicate how long certain features will take, so use the tools available to you to communicate technical debt.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>debt</category>
      <category>techdebt</category>
    </item>
    <item>
      <title>What is after being a senior developer?</title>
      <dc:creator>Vlad Dubrovskis</dc:creator>
      <pubDate>Sun, 09 Feb 2020 16:05:41 +0000</pubDate>
      <link>https://dev.to/vladdubrovskis/what-is-after-being-a-senior-developer-4703</link>
      <guid>https://dev.to/vladdubrovskis/what-is-after-being-a-senior-developer-4703</guid>
      <description>&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@stereophototyp"&gt;Sara Kurfeß&lt;/a&gt; on &lt;a href="https://unsplash.com/"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have been doing web development for the last... around 14 years. Have worked with a variety of technologies, companies, projects. &lt;/p&gt;

&lt;p&gt;Last few years have been feeling that have reached some glass ceiling in being a developer and wanted to give it a go in more leadership position which I had a chance to do. Of course the challenges where different and at some point I have reverted back to being a developer as that is known and comfortable.&lt;/p&gt;

&lt;p&gt;However now that I am back in developer shoes realise that I want to have a wider impact than just an individual contributor and to a degree all development works feels very much the same.&lt;/p&gt;

&lt;p&gt;What was your path after being senior developer? Tech lead? Development manager? Head of engineering? Tell me about it and how you got there. Also any advice is appreciated.&lt;/p&gt;

&lt;p&gt;I love tech, good practices and thing that makes me the happiest is when the teams work well together, achieving goals, shipping features, support and perform well together.&lt;/p&gt;

&lt;p&gt;I need to think about some next steps in my career and feeling a little lost.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>career</category>
      <category>help</category>
    </item>
    <item>
      <title>Switching career to software development</title>
      <dc:creator>Vlad Dubrovskis</dc:creator>
      <pubDate>Thu, 30 Jan 2020 19:18:38 +0000</pubDate>
      <link>https://dev.to/vladdubrovskis/switching-career-to-software-development-130e</link>
      <guid>https://dev.to/vladdubrovskis/switching-career-to-software-development-130e</guid>
      <description>&lt;p&gt;Cover image by &lt;a href="https://unsplash.com/@l42y?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Biao Xie&lt;/a&gt; on &lt;a href="https://unsplash.com/?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I originally wanted to get some extra input from wider audiences and reached out on Twitter, LinkedIn and even here. But did not get any extra replies.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/vladdubrovskis" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Lb8Szdmp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--_CJbSVK7--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/86767/7ca6425f-675a-4648-b067-b347f37eae09.jpeg" alt="vladdubrovskis image"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/vladdubrovskis/switching-careers-to-software-development-1hk1" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Switching careers to Software Development&lt;/h2&gt;
      &lt;h3&gt;Vlad Dubrovskis ・ Jan 29 ・ 1 min read&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#career&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#discuss&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#advice&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#switchingcareers&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;I am posting an article I published originally on my site - but it first came about as email to someone who asked me for that advice.&lt;br&gt;
I believe this may help someone out there.&lt;/p&gt;




&lt;p&gt;I am a software engineer working with web technologies for a good chunk of my life. Recently I have been approached for some advice about switching career to software development.&lt;/p&gt;

&lt;p&gt;Firstly it is worth mentioning that the software world is vast: Web, mobile applications, data, AI, etc. this article is not aimed at providing advice on which specialty to go down, this is for you to decide personally.&lt;br&gt;
The following advice is meant to be generic but is heavily influenced by my work with web development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Persevere
&lt;/h2&gt;

&lt;p&gt;This is probably the most important piece of advice. &lt;/p&gt;

&lt;p&gt;When you start on this wonderful journey you may find yourself feeling silly, or not good enough, or that you just don't get it, this is just anxiety setting in. Remember this is a natural reaction to being outside of your comfort zone. I cannot tell you how many times I experienced this, feeling stupid until it clicks. Panic is over and life goes on. Some things that I would consider basic now would throw me into a child-like behaviour when I was first starting.&lt;/p&gt;

&lt;p&gt;Just stick at it and it will become easier. You got this!&lt;/p&gt;

&lt;h2&gt;
  
  
  Different ways of learning to code
&lt;/h2&gt;

&lt;p&gt;One of the things to consider is to look back and think about what learning approach works best for you.&lt;br&gt;
Do you prefer being in a class environment or would you rather be on your own doing the research, watching videos and trying to write the code. &lt;/p&gt;

&lt;p&gt;The ideal scenario is of course both. Having a teacher or mentor may aid the learning but you will have to put in the practice outside the class.&lt;/p&gt;

&lt;h3&gt;
  
  
  Class Environment
&lt;/h3&gt;

&lt;p&gt;Classes may be more expensive but you reap the benefits when you are in a class with a teacher - some research into some local courses in your area may be beneficial.&lt;/p&gt;

&lt;p&gt;Have a look at local colleges or even universities that offer courses that may last a year (my wife took one for her Masters degree when she decided to switch from the field of law).&lt;/p&gt;

&lt;p&gt;You may find smaller courses that teach you the basics that may set you on the right path.&lt;/p&gt;

&lt;p&gt;And of course there are Code Academies that promise to help you take the first steps in the software development world. It normally involves an intensive course followed by a project, then they help you find your first entry level job.  I am not specifically advocating for this and you will have to do your own research - but I have worked with some very talented people that were graduates of such programmes (UK specifically).&lt;/p&gt;

&lt;p&gt;The course you may choose will depend on your financial situation - even those courses that allow you to pay the fees once you find your first job - be careful and think hard before you commit. I was in a similar situation with my student loan. It wasn’t until the monthly repayments starting coming out that I realised what a large chunk of my pay check was being taken.&lt;/p&gt;

&lt;p&gt;If you decide to go for a course, it is worth looking on LinkedIn or other similar platforms to find graduates of such courses and reach out to them. They will have been in a similar situation regarding their career so they may provide some useful insights.&lt;/p&gt;

&lt;p&gt;Finally there are meet-ups that help people learn. One of such gatherings is &lt;a href="https://codebar.io/events"&gt;CodeBar&lt;/a&gt;. Check out the events page to see if there is one near you or there may be alternatives with similar idea behind.&lt;/p&gt;

&lt;h3&gt;
  
  
  Online Courses
&lt;/h3&gt;

&lt;p&gt;This section is useful regardless if you decide to go down the course path. As mentioned earlier, you will have to put in the effort and practice. As a developer, being able to learn and find the information online will come in handy in the long run. &lt;/p&gt;

&lt;p&gt;The following is a list of resources I use to keep up with new trends and frameworks. Some have video courses aimed at different levels.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://egghead.io/"&gt;Egghead&lt;/a&gt; - web technologies -  - a lot of courses on all things web. React, Vue, TypeScript, Node, etc. &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.udemy.com/"&gt;Udemy&lt;/a&gt; - courses on all sorts of topics. They often have promotions on and may even have promo codes out there? If you are just getting into this - those codes may come in really useful.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://acloud.guru/"&gt;A Cloud Guru&lt;/a&gt; - everything AWS and Cloud related - &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/"&gt;Dev.To community&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/t/beginners"&gt;Dev.To - Posts aimed at beginners&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/t/explainlikeimfive"&gt;Dev.to - Explain like I am five&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/channel/UCO1cgjhGzsSYb1rsB4bFe4Q"&gt;FunFunFunction&lt;/a&gt; on Youtube&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.freecodecamp.org/"&gt;FreeCodeCamp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;And many more out there on either YouTube or your favourite search engine. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Creating your own personal website
&lt;/h2&gt;

&lt;p&gt;Creating your own website is perfect as you can write about what you learn on it and also test out any new skills you acquire. It will force you to learn how to: Buy a domain name, build a website, deploy, host a website and create content, amongst other things. This will also give you a chance to try out different hosting platforms. &lt;/p&gt;

&lt;p&gt;When you have a website there is always a project on your hands. You will always find ways to make things better or opportunities to learn new techniques and try them out. It’s like a builder’s house - never finished.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do not work for free or exposure
&lt;/h2&gt;

&lt;p&gt;You will always come across people who will need a website or an app and will ask you to do something for a very low price or even free. They will promise that they know other people who they can introduce you to. Myself and my fellow peers never got introduced to anyone or benefited from this.&lt;/p&gt;

&lt;p&gt;Exposure is tempting and it seems to makes sense, but always be reminded of this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OMHd59GJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s3.amazonaws.com/theoatmeal-img/comics/exposure/exposure.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OMHd59GJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s3.amazonaws.com/theoatmeal-img/comics/exposure/exposure.png" alt="The Oatmeal Comic - Exposure"&gt;&lt;/a&gt;&lt;br&gt;
Source: &lt;a href="https://theoatmeal.com/comics/exposure"&gt;The Oatmeal&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Transferable skills from your previous career
&lt;/h2&gt;

&lt;p&gt;This one is probably applicable further down the line when you’re looking for your first job in software development. Think about the skills you have from your previous career and work experience and see how they can be transferable. For example, if you worked in the service industry your people skills most likely deserve a medal. This can be a separate topic on its own but remember do not dismiss your previous experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  The web development path
&lt;/h2&gt;

&lt;p&gt;Finally if you choose to go down the web development path, my advice would be to learn the basics of this as it will help you grasp other development concepts. This is not a requirement but it helped me in my career. The basics are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML&lt;/li&gt;
&lt;li&gt;CSS&lt;/li&gt;
&lt;li&gt;JavaScript - pure Javascript as opposed to frameworks like React etc. This will cover the basics: How to write simple logic, how to manipulate data, how to access and manipulate the DOM (Document Object Model - I know this sounds scary, but really once it clicks, it's not that bad) and how to get data from a server or submit a form.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After you get the basics from the above I’d then recommend learning JavaScript frameworks and libraries: React or Vue (these are most in demand)&lt;/p&gt;

&lt;p&gt;And finally once you get a better grasp of all that, look into Web servers such as NodeJS (JavaScript for server side). Other languages are available, but if you already learning JavaScript this will help you with learning the concepts for server side development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;Changing careers may seem daunting but there are more and more people taking the plunge and finding satisfaction in their new career in development. It gives you a chance to work for all sorts of industries, for example, publishing, streaming, journalism, sports, travel, fashion, property etc. Just make informed decisions based on your situation and your best way of learning. Persevere. You will get there!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>advice</category>
      <category>career</category>
      <category>startingout</category>
    </item>
    <item>
      <title>Switching careers to Software Development</title>
      <dc:creator>Vlad Dubrovskis</dc:creator>
      <pubDate>Wed, 29 Jan 2020 20:46:46 +0000</pubDate>
      <link>https://dev.to/vladdubrovskis/switching-careers-to-software-development-1hk1</link>
      <guid>https://dev.to/vladdubrovskis/switching-careers-to-software-development-1hk1</guid>
      <description>&lt;p&gt;Recently I have been approached for some advice about switching career to software development.&lt;br&gt;
I have come up with a list of suggestions, but thought it is worth tapping into collective thinking.&lt;/p&gt;

&lt;p&gt;If someone would approach you, what would you say?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Where to start?&lt;/li&gt;
&lt;li&gt;Which part of software industry to get to? Web, Apps, AI, Data? &lt;/li&gt;
&lt;li&gt;What is a good starting point for each of those starting points?&lt;/li&gt;
&lt;li&gt;What advice would you give to people thinking of changing their careers to software development?&lt;/li&gt;
&lt;li&gt;Meet-ups for newbies?&lt;/li&gt;
&lt;li&gt;Codebar? &lt;a href="https://codebar.io/"&gt;https://codebar.io/&lt;/a&gt; Any alternatives or more meet ups with similar goals?&lt;/li&gt;
&lt;li&gt;Coding academy? This is quite a big financial investment that may not be affordable by many&lt;/li&gt;
&lt;li&gt;Mentorship?&lt;/li&gt;
&lt;li&gt;University? College?&lt;/li&gt;
&lt;li&gt;What else?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What would your advice be to someone who is coming from a different career? Anything goes.&lt;/p&gt;

</description>
      <category>career</category>
      <category>discuss</category>
      <category>advice</category>
      <category>switchingcareers</category>
    </item>
    <item>
      <title>Test Driven Development - not Unit Test Driven Development</title>
      <dc:creator>Vlad Dubrovskis</dc:creator>
      <pubDate>Sat, 25 Jan 2020 19:42:45 +0000</pubDate>
      <link>https://dev.to/vladdubrovskis/test-driven-development-not-unit-test-driven-development-3b2b</link>
      <guid>https://dev.to/vladdubrovskis/test-driven-development-not-unit-test-driven-development-3b2b</guid>
      <description>&lt;p&gt;A lot of us in software development would have heard of Test Driven Development. Some swear by it - some hate it and say it is fully unnecessary. &lt;/p&gt;

&lt;p&gt;In my opinion people often attribute TDD to the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Write unit test -&amp;gt; Red -&amp;gt; Write code to make it pass -&amp;gt; Green -&amp;gt; Refactor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now although this is one of the approaches that is very common I think the focus is too often given to the lowest level of testing: “unit”.&lt;/p&gt;

&lt;p&gt;The practice is called Test Driven Development and not Unit Test Driven Development and a more accurate and common example of flow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Test case -&amp;gt; Red -&amp;gt; Write code -&amp;gt; Green -&amp;gt; Refactor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unit tests are a wonderful technique in our toolbox to help us navigate the problem and keep us laser-focused, but it’s not an antidote to all coding problems. Sometimes in smaller pieces of software it is a lot more valuable and straight forward to write an Integration test first or even an end-to-end test.&lt;/p&gt;

&lt;p&gt;Example: In AWS Lambda it is easier to have an end-to-end test that will not only test the result of the function but can catch any permission issues, this is a more likely scenario of something going wrong in AWS world :)&lt;/p&gt;

&lt;p&gt;Of course you could argue that what I am describing is Acceptance Test Driven Development (ATDD) - and you would be right. But my main point I am trying to put across: Unit tests are useful when you break down bigger pieces of problem to help find a solution, but at some point the higher level tests are more useful - especially on smaller codebases. For example a small service.&lt;/p&gt;

&lt;p&gt;To do Test Driven Development you don’t have to concentrate on “unit” as long as you understand the trade-offs that come with it, for example, less granular feedback of test cases and risk of over-engineering a solution.&lt;/p&gt;

&lt;p&gt;One thing for sure: quality and tests are important. Make sure that whatever you do it helps you deploy your code with confidence.&lt;/p&gt;

</description>
      <category>tdd</category>
      <category>codequality</category>
      <category>testing</category>
      <category>discuss</category>
    </item>
    <item>
      <title>My view on roadmaps</title>
      <dc:creator>Vlad Dubrovskis</dc:creator>
      <pubDate>Sat, 18 Jan 2020 14:51:50 +0000</pubDate>
      <link>https://dev.to/vladdubrovskis/my-view-on-roadmaps-4li2</link>
      <guid>https://dev.to/vladdubrovskis/my-view-on-roadmaps-4li2</guid>
      <description>&lt;p&gt;I have been a software developer for a good chunk of my life. And as I have progressed in my career and started working for bigger companies - trying to tackle bigger challenges - one thing that sprung into my world was roadmaps.&lt;/p&gt;

&lt;p&gt;In the past I was one of the people who would always ask for and on some degree even advocate on getting a roadmap. Main reason was to understand what work was coming up - and often would get back a plan for next 12 months. Sometimes even longer.&lt;/p&gt;

&lt;h1&gt;
  
  
  How it usually goes
&lt;/h1&gt;

&lt;p&gt;First - myself and the team would get excited - there is clarity,a plan - and sooo much work to do and so many challenges to face.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/rVbAzUUSUC6dO/source.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/rVbAzUUSUC6dO/source.gif" alt="Picture of a man clapping and rubbing his hands"&gt;&lt;/a&gt;&lt;/p&gt;
Yay! Roadmaps!



&lt;p&gt;However about 2 months down the line it becomes apparent that the roadmap is hardly fit for purpose anymore - the world has moved on - priorities have changed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/5HyVZlZYxJPy7IC5Cz/source.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/5HyVZlZYxJPy7IC5Cz/source.gif" alt="Picture of a man very asking why"&gt;&lt;/a&gt;&lt;/p&gt;
Dammit! Why do you have to change?



&lt;p&gt;This often would lead to very frustrated teams - which somehow made it feel a lot more annoying and a lot worse that it really was.&lt;/p&gt;

&lt;h2&gt;
  
  
  Today
&lt;/h2&gt;

&lt;p&gt;These days I am not a big fan of roadmaps anymore. I believe if you want to be quite competitive and do the right thing - you cannot plan too far ahead. Just focus on the next most important thing.&lt;/p&gt;

&lt;p&gt;You may be wondering how then the team aligns then on priorities - and I would suggest that team mission would serve you better than any roadmap. &lt;/p&gt;

&lt;p&gt;At the end of each sprint/feature/goal - reflect on what you learn and see what is the next most important thing. &lt;/p&gt;

&lt;h2&gt;
  
  
  Why most roadmaps are not useful
&lt;/h2&gt;

&lt;p&gt;In my opinion it is because majority of them are just Gantt charts under a mask. A lot of them have dates and expectations - and reality is that as soon as you slot something else in - all of your dates go out of the window.&lt;/p&gt;

&lt;p&gt;Unfortunately the dates are never truly meaningful and things get pushed back further and further. &lt;/p&gt;

&lt;p&gt;In more extreme cases you also end up moving your whole roadmap to your ticketing system and pollute backlog with stories that will never get implemented - or create a backlog that would take the team year(s) to complete. That in turn creates even more waste of time for the teams.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is all is lost?
&lt;/h2&gt;

&lt;p&gt;When I brought this subject up with colleagues and in my network - although few voices shared my concerns, one person has suggested to use something called &lt;em&gt;"Now, Next, Later"&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Now, Next, Later
&lt;/h2&gt;

&lt;p&gt;As simple as it is named, the principles for what they are can be summarised in the following way:&lt;/p&gt;

&lt;h3&gt;
  
  
  Now
&lt;/h3&gt;

&lt;p&gt;Tasks that need your attention right now. There may be quite a few items here, maybe a scope of larger feature spanning a number of weeks - but one thing sure - you have to work on it right now.&lt;/p&gt;

&lt;h3&gt;
  
  
  Next
&lt;/h3&gt;

&lt;p&gt;Tasks that may need some final refinement before they are ready to be move to the &lt;em&gt;Now&lt;/em&gt; area. &lt;/p&gt;

&lt;p&gt;Refined ideas and requirements that come from user and market research that you will be working on whenever things in Now are done. Or just think of these as tasks that need some final touches before they require immediate attention.&lt;/p&gt;

&lt;h3&gt;
  
  
  Later
&lt;/h3&gt;

&lt;p&gt;This may be fresh ideas that need a lot more refinement - think of a fresh idea that needs some validation beforehand, maybe some research done ahead of time. Maybe they will never even make it to the Next bucket.&lt;/p&gt;

&lt;p&gt;And that is it. It creates a wonderful flow that should be constantly changing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Video explanation
&lt;/h2&gt;

&lt;p&gt;One of the things that I been reminder recently is that different people may learn new information better if it is presented in a different format. So here is a short video I found explaining the concept:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/-Z3sDUGAN2U"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  One more tip
&lt;/h2&gt;

&lt;p&gt;In conversation with my fellow colleagues a good point came up around dates and roadmaps that I thought is definitely worth sharing.&lt;/p&gt;

&lt;p&gt;You might need a roadmap for things that you MUST do at a certain point such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;legal requirements (example: cookie banner, GDPR changes)&lt;/li&gt;
&lt;li&gt;maybe a feature is crucial to reach market before some big promotion for season sales&lt;/li&gt;
&lt;li&gt;I struggle to think of more examples but hopefully you get the gist.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final words
&lt;/h2&gt;

&lt;p&gt;If you see or learn some amazing opportunity for your product - take it and run with it.&lt;/p&gt;

&lt;p&gt;The software and product landscape is changing rapidly - you have to be able to move fast too.&lt;/p&gt;




&lt;p&gt;The post originally published on my personal blog: &lt;a href="https://digitalroast.com/my-view-on-roadmaps/"&gt;Digital Roast - My view on Roadmaps&lt;/a&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>roadmap</category>
      <category>advice</category>
      <category>planning</category>
    </item>
    <item>
      <title>Simple truths: Sustainable pace</title>
      <dc:creator>Vlad Dubrovskis</dc:creator>
      <pubDate>Sat, 11 Jan 2020 14:02:52 +0000</pubDate>
      <link>https://dev.to/vladdubrovskis/simple-truths-sustainable-pace-bc8</link>
      <guid>https://dev.to/vladdubrovskis/simple-truths-sustainable-pace-bc8</guid>
      <description>&lt;p&gt;Feel like now we are in the first week of the year and the reality may be settling in after the holiday season - and maybe you like myself find yourself a little down.&lt;/p&gt;

&lt;p&gt;You may also be a little disappointed with yourself - as you had great plans for this year and yet somehow managed to start failing in some of the goals you have set yourself.&lt;/p&gt;

&lt;p&gt;One of the crucial pieces of advice I would give to anyone is - whatever you do, always think about how sustainable is the pace at which you are moving. This applies not only individuals - but to software teams too.&lt;/p&gt;

&lt;p&gt;It is better to work out a pace that will last - rather than go all out and burn out after a few weeks or months.&lt;/p&gt;

&lt;p&gt;And by all means - do dream big - just start with smaller, achievable, realistic steps.&lt;/p&gt;

&lt;p&gt;Do you want to learn new language? Why not start by watching some video tutorials?&lt;/p&gt;

&lt;p&gt;You want to write more blog posts? Start with writing one a month. Or just writing a paragraph every few days.&lt;/p&gt;

&lt;p&gt;And most importantly - for anyone who needs to read/hear this: you can achieve your goals if you stick at it. I believe in you! :)&lt;/p&gt;

&lt;p&gt;P.S. This was meant to be a very short piece of writing, no longer than 2 paragraphs wrong - but I got a little carried away :)&lt;/p&gt;

&lt;p&gt;Cover Image Source: &lt;a href="https://unsplash.com/@hope_house_press_leather_diary_studio?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Photo by Hope House Press - Leather Diary Studio on Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sustainable</category>
      <category>simpletruths</category>
      <category>advice</category>
      <category>goals</category>
    </item>
  </channel>
</rss>
