<?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: Nicolas Mattia</title>
    <description>The latest articles on DEV Community by Nicolas Mattia (@nmattia).</description>
    <link>https://dev.to/nmattia</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%2F131804%2F5b9c32bc-8eee-4c11-9faa-65cbb32393f5.png</url>
      <title>DEV Community: Nicolas Mattia</title>
      <link>https://dev.to/nmattia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nmattia"/>
    <language>en</language>
    <item>
      <title>Hunt bugs down before they are merged!</title>
      <dc:creator>Nicolas Mattia</dc:creator>
      <pubDate>Thu, 07 Mar 2019 08:52:18 +0000</pubDate>
      <link>https://dev.to/nmattia/hunt-bugs-down-before-they-are-merged-1259</link>
      <guid>https://dev.to/nmattia/hunt-bugs-down-before-they-are-merged-1259</guid>
      <description>&lt;p&gt;I discuss a few reasons why catching bugs in master is more expensive than&lt;br&gt;
before they are merged, try to explain why some people think this isn't true,&lt;br&gt;
and talk a bit about merge queues.&lt;/p&gt;


&lt;h1&gt;
  
  
  Hunt bugs down before they are merged!
&lt;/h1&gt;

&lt;p&gt;Here's something I heard a few times from recalcitrant coworkers after I've&lt;br&gt;
asked them to write more tests in one of my signature uptight PR reviews:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The cost of fixing a bug &lt;strong&gt;after it has been merged&lt;/strong&gt; into the master branch&lt;br&gt;
is &lt;strong&gt;the same&lt;/strong&gt; as that of fixing it &lt;strong&gt;before it has been merged&lt;/strong&gt; into the&lt;br&gt;
master branch.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I beg to differ! Catching a bug once it has landed in the main codebase has a&lt;br&gt;
huge associated cost. It boils down to the following reasons, which I'll&lt;br&gt;
describe individually in the next few sections:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When someone hits a bug in the main code base, they were most likely
not looking for one, but trying to get work done.&lt;/li&gt;
&lt;li&gt;Whomever is tasked with fixing the bug may have lost context relevant to the
faulty code, or maybe they never had any to start with.&lt;/li&gt;
&lt;li&gt;Reporting a bug creates noise in the form of tickets and pull requests (PRs).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's jump right in!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;story time&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You are a frontend engineer for a company that stores online notes. You're&lt;br&gt;
tasked with writing an autocomplete function allowing the user to find notes&lt;br&gt;
more quickly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
+-----------------------+  +------+
| Gr|                   |  | open |
+-----------------------+  +------+
|                       |
| Great minds.txt       |
|                       |
| Grocery list          |
|                       |
| Grrr! said the lion   |
|                       |
| ...                   |
+-----------------------+

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

&lt;/div&gt;



&lt;p&gt;The following HTTP call returns the list of all of a user's notes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /users/&amp;lt;user&amp;gt;/notes?query=&amp;lt;prefix&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  It gets in the way
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;story time&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnmattia.com%2Fimages%2Fpeanut_butter_cookies_nola.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnmattia.com%2Fimages%2Fpeanut_butter_cookies_nola.jpg" alt="Rated #1 in NOLA"&gt;&lt;/a&gt;And #2 in America!&lt;/p&gt;

&lt;p&gt;You've been doing amazing work. You got the flow. Mind like water. You're done&lt;br&gt;
with your frontend changes. You spin up a local instance of the server.&lt;/p&gt;

&lt;p&gt;You try it out and realize that the server segfaults when there are no matches.&lt;/p&gt;

&lt;p&gt;You despair. There goes your flow. The name of the backend engineers flash&lt;br&gt;
before your eyes. You consider not inviting them to your wedding. You make a&lt;br&gt;
mental list of who's most likely to have introduced the bug. You consider&lt;br&gt;
quitting your job and becoming a barista in a different country -- maybe even&lt;br&gt;
in New Orleans.  You'll need a specialty, maybe peanut butter cookies. You'll&lt;br&gt;
kill it with your peanut butter cookies. People will know about them from New&lt;br&gt;
England to New Mexico. You'll become famous and, in a few years, run for&lt;br&gt;
president of the United States. Then you consider the logistics: your fiancée&lt;br&gt;
will need to quit her job, you'll need to hire a moving service, your dog may&lt;br&gt;
not survive the flight.&lt;/p&gt;

&lt;p&gt;You stash your local changes and set out to write a test case reproducing the&lt;br&gt;
issue.&lt;/p&gt;



&lt;p&gt;Unless you're a quality analyst, you probably don't go around trying to find&lt;br&gt;
bugs for fun. Most of us discover bugs while trying to get something done:&lt;br&gt;
maybe you're simply using the server, or you're writing a new feature that&lt;br&gt;
depends on a different feature or function. Discovering wrong behavior in a&lt;br&gt;
codebase is almost always more of an annoyance than a nice surprise.&lt;/p&gt;

&lt;p&gt;Had the bug been caught before merge, the bug reporter would most likely have&lt;br&gt;
been the person who introduced the faulty behavior, and would have most likely&lt;br&gt;
been expecting to encounter "some" bug (correct software on the first attempt&lt;br&gt;
is a myth, sorry).&lt;/p&gt;
&lt;h3&gt;
  
  
  It creates noise
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;story time&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;you&amp;gt; @channel I'm experiencing server crashes when there are no matches on&lt;br&gt;
&lt;code&gt;/users/foo/notes?query=bar&lt;/code&gt;, anybody knows anything about this?&lt;/p&gt;

&lt;p&gt;tom&amp;gt; please use &lt;a class="mentioned-user" href="https://dev.to/here"&gt;@here&lt;/a&gt; instead of @channel&lt;/p&gt;

&lt;p&gt;pat&amp;gt; &lt;a class="mentioned-user" href="https://dev.to/tom"&gt;@tom&lt;/a&gt; please don't use "at" channel&lt;/p&gt;

&lt;p&gt;jen&amp;gt; &lt;a class="mentioned-user" href="https://dev.to/you"&gt;@you&lt;/a&gt; yes I think this is related to #2551&lt;/p&gt;

&lt;p&gt;mol&amp;gt; &lt;a class="mentioned-user" href="https://dev.to/jen"&gt;@jen&lt;/a&gt; #2551 was fixed last week&lt;/p&gt;

&lt;p&gt;jen&amp;gt; okay nevermind, no idea &lt;a class="mentioned-user" href="https://dev.to/you"&gt;@you&lt;/a&gt; :(&lt;/p&gt;

&lt;p&gt;mkt&amp;gt; @channel lunch?&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p&gt;Whether you are reporting issues on Slack, GitHub, JIRA, you name it, reporting&lt;br&gt;
a bug creates some noise. Some people will need to label the ticket, will try&lt;br&gt;
to help you figure out the cause, others may simply get distracted because of&lt;br&gt;
the extra Slack/GitHub/JIRA notifications.&lt;/p&gt;

&lt;p&gt;All this can be avoided if bugs are caught before they are merged to master:&lt;br&gt;
bugs are typically not reported before the code is part of the mainstream&lt;br&gt;
codebase.&lt;/p&gt;


### The Hunt


&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnmattia.com%2Fimages%2Fmads_the_hunt.jpg" alt="Mads “Hunter” Mikkelsen"&gt;Mads “Hunter” Mikkelsen


This one should be pretty straightforward. Finding a bug that's been introduced
by a diff before merge into the master branch limits the search space to that
diff only. Trying to find a bug on master means potentially having to consider
the whole codebase, unless your codebase lends itself to things like bisecting.


&lt;h3&gt;
  
  
  Lack of context
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;story time&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The VP of engineering comes to you, in his typical nonchalant tread:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;VP: You'll need to fix that server crash bug.&lt;/p&gt;

&lt;p&gt;You: But!&lt;/p&gt;

&lt;p&gt;VP: I know it's not your area of expertise, but we need this fixed before&lt;br&gt;
release.&lt;/p&gt;

&lt;p&gt;You: But!&lt;/p&gt;

&lt;p&gt;VP: See the bright side: you'll get to learn some Rust!&lt;/p&gt;

&lt;p&gt;You: But... wait what?&lt;/p&gt;

&lt;p&gt;VP: Yeah Andy rewrote the backend in rust last week. He's on holiday now&lt;br&gt;
though.&lt;/p&gt;

&lt;p&gt;You: ...&lt;/p&gt;

&lt;p&gt;VP: Good luck! Don't forget about Engineering breakfast tomorrow.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As the VP leaves, you sing to yourself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;... there's a moooooon over bourbon street ...&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p&gt;Most of the time no one knows where the bug is and who introduced it. This&lt;br&gt;
means that the odds of picking the right engineer to hunt down a bug are about&lt;br&gt;
the same as trying to guess who in your team got their tonsils removed last --&lt;br&gt;
if anybody actually got their tonsils removed.&lt;/p&gt;

&lt;p&gt;The person tasked with fixing the bug then is not particularly likely to know&lt;br&gt;
about the part of the codebase that is at fault. Even if the person who&lt;br&gt;
introduced the bug is working on hunting it and fixing it, that person might&lt;br&gt;
not have worked on that part of the codebase for a while. The context is either&lt;br&gt;
absent or has been lost with time, which make debugging longer and more&lt;br&gt;
frustrating.&lt;/p&gt;

&lt;p&gt;This can be avoided by catching the bugs right after they've been written, and&lt;br&gt;
before they've been merged.&lt;/p&gt;
&lt;h3&gt;
  
  
  Moar noise
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;story time&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;you&amp;gt; @channel I've got a fix for the server crash issue, anybody care to&lt;br&gt;
review #2578?&lt;/p&gt;

&lt;p&gt;tom&amp;gt; please use &lt;a class="mentioned-user" href="https://dev.to/here"&gt;@here&lt;/a&gt; instead of @channel&lt;/p&gt;

&lt;p&gt;pat&amp;gt; &lt;a class="mentioned-user" href="https://dev.to/tom"&gt;@tom&lt;/a&gt; please don't use "at" channel&lt;/p&gt;

&lt;p&gt;jen&amp;gt; &lt;a class="mentioned-user" href="https://dev.to/you"&gt;@you&lt;/a&gt; yes I'll have a look in a sec&lt;/p&gt;

&lt;p&gt;mol&amp;gt; &lt;a class="mentioned-user" href="https://dev.to/you"&gt;@you&lt;/a&gt; sure np&lt;/p&gt;

&lt;p&gt;mkt&amp;gt; @channel coffee break?&lt;/p&gt;
&lt;/blockquote&gt;



&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnmattia.com%2Fimages%2Fwhere_does_it_end.jpg" alt="Where does it end"&gt;Where does it end?

Fixed the issue? A new round of PRs and reviews creates even more noise. At
best this justifies hiring the intern whose job it is to move JIRA tickets
around. Most likely it's a waste of time for everyone involved.

&lt;h3&gt;
  
  
  Why the fallacy?
&lt;/h3&gt;

&lt;p&gt;So &lt;em&gt;why&lt;/em&gt; do some people tend to think that it's more efficient to merge new&lt;br&gt;
code and do damage control later (a.k.a shoot-from-the-hip coding)? Well, in&lt;br&gt;
the short term, it may save time for the implementer (let's call a spade a&lt;br&gt;
spade: the culprit) by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Not writing tests or coming up with enough test cases.&lt;/li&gt;
&lt;li&gt;Potentially merging without review.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These may save time to one person in the short term by allowing them to merge&lt;br&gt;
faster and move on to other things; in the greater scheme of things however&lt;br&gt;
time and energy is wasted.&lt;/p&gt;

&lt;p&gt;Another reason why people tend to believe that fixing a bug in master isn't&lt;br&gt;
necessarily worse than catching it before it is merged is that people often&lt;br&gt;
don't realize that there's a cost associated with reporting bugs. And this cost&lt;br&gt;
grows linearily with the number of people subscribed to the bug tracker,&lt;br&gt;
involved in triage, and QA.&lt;/p&gt;

&lt;p&gt;If you like your team, please make sure you catch your bugs before others find&lt;br&gt;
them themselves!&lt;/p&gt;
&lt;h2&gt;
  
  
  Appendix: merge queues for greater good
&lt;/h2&gt;

&lt;p&gt;Bugs are not the only way to break master, race conditions also apply to&lt;br&gt;
software process. They may happen when a CI system only runs tests on a branch,&lt;br&gt;
without rebasing on master first (note: some CI systems, like &lt;a href="https://travis-ci.org/" rel="noopener noreferrer"&gt;Travis&lt;/a&gt; and&lt;br&gt;
&lt;a href="https://circleci.com" rel="noopener noreferrer"&gt;CircleCI&lt;/a&gt;, will test both your branch as it is &lt;em&gt;and&lt;/em&gt; after having rebased it&lt;br&gt;
on or merged it into master). The following diagram lists three branches,&lt;br&gt;
&lt;code&gt;master&lt;/code&gt;, &lt;code&gt;bob&lt;/code&gt; and &lt;code&gt;alice&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
bob master alice
 .    ✓      .   master is green :)
      |
 .    +------+   Alice uses `makeRainbow()`
      |      |
 .    |      ✓   branch alice is green :)
      |      |
 +----+      |   Bob removes `makeRainbow()`
 |    |      |
 ✓    |      |   branch `bob` is green :)
 |    |      |
 +----&amp;gt;      |   branch "bob" is merged
      |      |
      ✓      |   master is green :)
      |      |
      &amp;lt;------+   branch "alice" is merged
      |
      x          master is red :(
      |
      v

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

&lt;/div&gt;



&lt;p&gt;Alice forks a branch and used the function &lt;code&gt;makeRainbow()&lt;/code&gt;. No bug introduced,&lt;br&gt;
CI is green, everyone's happy. Around the same time Bob decides to do some&lt;br&gt;
clean up, forks master, and removes the function &lt;code&gt;makeRainbow()&lt;/code&gt;. From his&lt;br&gt;
point of view, no one is using it, CI is green, everyone's happy.&lt;/p&gt;

&lt;p&gt;Regardless of who merges first -- Alice or Bob -- the end result can't be good:&lt;br&gt;
Alice's feature makes use of a function that doesn't exist in the codebase&lt;br&gt;
anymore after Bob's changes. The solution to avoid those issues is to always&lt;br&gt;
rebase a branch before running CI tests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
bob master alice
 .    ✓      .   master is green :)
      |
 .    +------+   Alice uses `makeRainbow()`
      |      |
 .    |      ✓   branch "alice" is green :)
      |      |
 +----+      |   Bob removes `makeRainbow()`
 |    |      |
 &amp;lt;----+      |   branch "bob" is rebased on master
 |    |      |
 ✓    |      |   branch "bob" is green and ready for merge :)
 |    |      |
 +----&amp;gt;      |   branch "bob" is merged
      |      |
      |      ?   merge is prevented on branch alice :|
      |      |
      +------&amp;gt;   branch "alice" is rebased on master
      |      |
      |      x   branch "alice" is red :(
      |      |
      |      |   Alice writes a new implementation of `makeRainbow()`
      |      |
      |      ✓   branch "alice" is green and ready for merge :)
      |      |
      &amp;lt;------+   branch "alice" is merged
      |
      ✓          master is green :)
      |
      v

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

&lt;/div&gt;



&lt;p&gt;The only thing you have to do is to ensure that no branch is merged without&lt;br&gt;
being strictly on top of master. The simplest solution is to manually keep&lt;br&gt;
track of the branches that should be merged:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Whenever someone wants to merge, their branch is enqueued.&lt;/li&gt;
&lt;li&gt;Exactly one person pops branches from the queue, rebases them, and
merges them if CI is happy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a very tedious process and is better automatized by tools like &lt;a href="https://github.com/bors-ng/bors-ng" rel="noopener noreferrer"&gt;bors-ng&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Poor Man's Merge Queue
&lt;/h3&gt;

&lt;p&gt;Merge queues need not be fancy. The first time we realized that we were wasting&lt;br&gt;
a lot of time fixing rebase issues, my team and I came up with a very simple&lt;br&gt;
solution: keep the PR numbers in a Slack channel's "topic" field. Got a PR you&lt;br&gt;
want to merge? Add it to the right of the list. The left-most PR has either&lt;br&gt;
been merged or failed CI? Remove it from the list, and rebase the new left-most&lt;br&gt;
PR.&lt;/p&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnmattia.com%2Fimages%2Fslack-topic-merge-queue.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnmattia.com%2Fimages%2Fslack-topic-merge-queue.png" alt="Where does it end"&gt;&lt;/a&gt;Save some cost! DIY merge queue.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>testing</category>
      <category>agile</category>
      <category>coding</category>
    </item>
    <item>
      <title>The 5 Raisons d'Être of Testing</title>
      <dc:creator>Nicolas Mattia</dc:creator>
      <pubDate>Tue, 26 Feb 2019 09:18:12 +0000</pubDate>
      <link>https://dev.to/nmattia/the-5-raisons-dtre-of-testing-1kk6</link>
      <guid>https://dev.to/nmattia/the-5-raisons-dtre-of-testing-1kk6</guid>
      <description>&lt;h1&gt;
  
  
  The 5 Raisons d'Être of Testing
&lt;/h1&gt;

&lt;p&gt;I describe five of the reasons why I think tests are important:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure that the code you've written works.&lt;/li&gt;
&lt;li&gt;Ensure that the code you've written works tomorrow.&lt;/li&gt;
&lt;li&gt;Ensure that the code you've written works elsewhere.&lt;/li&gt;
&lt;li&gt;Spot usability issues early on.&lt;/li&gt;
&lt;li&gt;Show how your feature is supposed to work, and how it should be used.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;important&lt;/strong&gt;: None of the animals used in the examples were harmed in the&lt;br&gt;
making of this post.&lt;/p&gt;



&lt;p&gt;First, let's get in the mood (or skip ahead):&lt;/p&gt;



&lt;p&gt;&lt;em&gt;story time&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You are a backend engineer at &lt;code&gt;MyCuteThings.com&lt;/code&gt;, the famous website of cute&lt;br&gt;
things. Your boss comes to you and Tommy (your frontend sidekick) one Wednesday&lt;br&gt;
morning and declares:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;There shall be a &lt;code&gt;"breed"&lt;/code&gt; dropdown listing two cat breeds: Persian and&lt;br&gt;
Siamese. When the user selects a breed in &lt;code&gt;"breed"&lt;/code&gt; a picture of a cat of&lt;br&gt;
that breed shall be displayed to the user. Feature codename: "ninja".&lt;/p&gt;

&lt;p&gt;-- your boss&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Tommy will deal with the HTML, CSS, and whatever else frontend people use. Your&lt;br&gt;
job is to provide an API endpoint that will return the bytes of the correct&lt;br&gt;
picture. You find a picture of a very cute Persian cat that you save as&lt;br&gt;
&lt;code&gt;cat.png&lt;/code&gt;. You take a picture of your very own Siamese cat that you save as&lt;br&gt;
&lt;code&gt;CAT.png&lt;/code&gt;. You settle on the following REST call:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /cats?breed=&amp;lt;nameOfTheBreed&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The usage is &lt;em&gt;straightforward&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if &lt;code&gt;nameOfTheBreed&lt;/code&gt; is &lt;code&gt;persian&lt;/code&gt; then you read &lt;code&gt;cat.png&lt;/code&gt;, return the
resulting bytes and &lt;code&gt;200 OK&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;if &lt;code&gt;nameOfTheBreed&lt;/code&gt; is &lt;code&gt;siamese&lt;/code&gt; then you read &lt;code&gt;CAT.png&lt;/code&gt;, return the
resulting bytes and &lt;code&gt;200 OK&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;if &lt;code&gt;nameOfTheBreed&lt;/code&gt; is anything else, you return zero bytes and &lt;code&gt;200 OK&lt;/code&gt;
(company policy GTE-421-f, introduced in 2003, forbids you from using
&lt;code&gt;404&lt;/code&gt;s).&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Because we're dealing with software, anything that can go wrong will go wrong.&lt;br&gt;
We'll go over the five reasons I listed above in more details and we'll see how&lt;br&gt;
tests can help you damage control.&lt;/p&gt;
&lt;h2&gt;
  
  
  Ensure that the code you've written works
&lt;/h2&gt;

&lt;p&gt;This may be the most straightforward reason to write tests. However, while it's&lt;br&gt;
valuable to know that whatever you've just written works, it's probably the&lt;br&gt;
least important reason.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Testing that code works is the &lt;em&gt;raison d'être&lt;/em&gt; of tests!!! How dare you say&lt;br&gt;
that it's not important???&lt;/p&gt;

&lt;p&gt;-- Jimmy from Nebraska&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Don't get it twisted Jimmy, I didn't say it was unimportant: the other reasons&lt;br&gt;
are just &lt;em&gt;more&lt;/em&gt; important. Most of the time you'll eventually try the feature&lt;br&gt;
(open the website, click &lt;code&gt;Siamese&lt;/code&gt;, watch in awe as your cat appears on the&lt;br&gt;
screen) after having written the code -- which is as much information as you'll&lt;br&gt;
get from a test. You will catch bugs like "trying to open &lt;code&gt;cat.jpg&lt;/code&gt; instead of&lt;br&gt;
&lt;code&gt;cat.png&lt;/code&gt;" straight away anyway.&lt;/p&gt;

&lt;p&gt;Running tests as you write the code is mostly a time saver when you develop a&lt;br&gt;
feature, as you (usually) have a single command to run in order to check that&lt;br&gt;
you've done things correctly. Also, by writing tests close to your spec, it&lt;br&gt;
acts as a deadline (once your tests are green, you're done, you can move on to&lt;br&gt;
something else). Moreover by &lt;em&gt;first&lt;/em&gt; writing a (failing) test when tasked with&lt;br&gt;
fixing a bug you ensure that the bug actually exists. This is typical&lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/Test-driven_development"&gt;TDD&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Ensure that the code you've written works elsewhere
&lt;/h2&gt;



&lt;p&gt;&lt;em&gt;story time&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You wrote your feature and Tommy wrote his part. Feature "ninja" got merged&lt;br&gt;
into the master branch, after you diligently tested it out by hand. You go home&lt;br&gt;
that evening, and as you're about to start watching the third season of The&lt;br&gt;
Wire (for the second time, because you first assumed you didn't need English&lt;br&gt;
subtitles) you get an angry phone call from Jason, the sales rep working late&lt;br&gt;
nights because he's demoing the product to people in another timezone. Jason&lt;br&gt;
explains that he can only get a picture of the Persian cat. Even when he picks&lt;br&gt;
the Siamese option from the dropdown. The debugging process goes like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You: What OS are you using?&lt;/p&gt;

&lt;p&gt;Jason: What's an &lt;em&gt;awe-hess&lt;/em&gt;?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;At which point you realize that Jason is running your code on his Windows&lt;br&gt;
machine. Which, unfortunately enough, cannot tell the difference between&lt;br&gt;
&lt;code&gt;cat.png&lt;/code&gt; and &lt;code&gt;CAT.png&lt;/code&gt;. You sigh, put the remote down and go back to the&lt;br&gt;
drawing board.&lt;/p&gt;



&lt;p&gt;Test suites are particularly important in projects that run in several&lt;br&gt;
environments. You've written code that works on your machine? Great, but it's&lt;br&gt;
likely that you forgot to update some config and that the component you just&lt;br&gt;
wrote will break once it's deployed somewhere else, because you relied on&lt;br&gt;
something specific to your (highly tuned, very particular) system.&lt;/p&gt;

&lt;p&gt;If you have a unit test, you'll make sure it also works on the CI machine(s).&lt;br&gt;
If you have an integration test for it, you'll make sure it works on the CI&lt;br&gt;
machine(s) and on the various clusters that a deploy goes through.&lt;/p&gt;
&lt;h2&gt;
  
  
  Ensure that the code you've written works tomorrow
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;story time&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A month has passed, and not only are you relieved that Season 3 was much better&lt;br&gt;
that Season 2, but you've also forgotten all about feature "ninja". You're&lt;br&gt;
sitting at your desk at 5pm, eyeing the clock on the wall more and more&lt;br&gt;
frequently. Your boss comes out of his office, forehead sweating, cheeks&lt;br&gt;
blushed from anger. He scans the engineering room and his eyes lock on you. He&lt;br&gt;
starts walking in your direction. You think to yourself: "This can't be good.".&lt;/p&gt;

&lt;p&gt;Twenty minutes later, somewhat happy that your Saturday evening has freed up&lt;br&gt;
(your boss and his wife were supposed to come over for dinner), you're going&lt;br&gt;
through git logs with one goal in mind: trying to find who to blame for&lt;br&gt;
removing the cat pictures from the repository, thereby breaking feature&lt;br&gt;
"ninja".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;commit 45d2fcd272a273c57033a493ca3df47a67f9bf01
Author: Jenny Marshalls &amp;lt;jen@mycutethings.com&amp;gt;
Date:   Tue Aug 21 01:15:33 2018 +0300

    Remove unused kitten pictures
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You start walking to her desk, coming up with as many irrational patriarchal&lt;br&gt;
arguments as possible to justify the lack of tests around your feature.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Say you write a feature that works (objectively) perfectly, although doesn't&lt;br&gt;
have any associated tests. Then tomorrow I come around, and tweak your code to&lt;br&gt;
add a new feature, inadvertently breaking yours.  Then you blame me for&lt;br&gt;
breaking my code. Don't blame me.&lt;/p&gt;

&lt;p&gt;You can't expect anyone else to anticipate all the implications when they're&lt;br&gt;
tweaking your code, because most likely even &lt;em&gt;you&lt;/em&gt; can't. Hence it is your&lt;br&gt;
responsibility to add a test spec-ing the correct behavior of your feature --&lt;br&gt;
today and tomorrow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SIDE NOTE:&lt;/strong&gt; it goes without saying that commenting out tests is not the&lt;br&gt;
right way to shoehorn my new feature into your existing code, but that kind of&lt;br&gt;
stuff is hopefully caught during review.&lt;/p&gt;

&lt;h2&gt;
  
  
  Spot usability issues early on
&lt;/h2&gt;

&lt;p&gt;When you decide to write a test for your new feature you might realize that&lt;br&gt;
your interface is awkward to work with. This is really the simplest usability&lt;br&gt;
check that you can perform, namely eating your own dog food.&lt;/p&gt;

&lt;p&gt;Catching those issues before they've been merged, and before other code relies&lt;br&gt;
on it, means that other people will appreciate working with your code more (and&lt;br&gt;
thereby making people more inclined to try and understand and reuse your&lt;br&gt;
feature -- rather than duplicating it) and it will ease the learning process for&lt;br&gt;
newcomers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Show how your feature is supposed to work and how it should be used
&lt;/h2&gt;


&lt;br&gt;
It's been three weeks since you blew your chance at a promotion. In order to&lt;br&gt;
avoid similar situations in the future, you've added tests. Feature "ninja" has&lt;br&gt;
been working seamlessly ever since.

&lt;p&gt;Your sidekick Tommy tells you that Jenny needs help using a backend feature&lt;br&gt;
that you wrote. Things have been weird with Jenny, you still feel guilty for&lt;br&gt;
blaming her for the missing pictures and for the way you reacted to the&lt;br&gt;
situation. You've tried your best to avoid a confrontation since then.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Tell her to look at the tests&lt;/em&gt;, you tell Tommy.&lt;/p&gt;




&lt;p&gt;Reading tests is a great way to figure out how something is supposed to work.&lt;br&gt;
It shows what the input should look like, and what the output will look like.&lt;br&gt;
It shows what your feature can do as well.&lt;/p&gt;

&lt;p&gt;If your feature has no associated examples or tests, the user has to rely on&lt;br&gt;
the source code and on potentially out-of-date documentation to figure out how&lt;br&gt;
it should (and should &lt;em&gt;not&lt;/em&gt;) be used. A test is so much nicer.&lt;/p&gt;




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

&lt;p&gt;The bottom line is that there's more than one dimension to having a working&lt;br&gt;
codebase: it should be future proof, function in different environments, be&lt;br&gt;
usable, and be self-describing. Tests are a great way to achieve this, and when&lt;br&gt;
you pair them with a &lt;a href="https://nmattia.com/posts/2019-01-08-hunt-bugs-down-before-they-are-merged.html"&gt;good process&lt;/a&gt; you'll become king of the world. Or at least a happy and efficient programmer, part of&lt;br&gt;
a happy team.&lt;/p&gt;

</description>
      <category>testing</category>
      <category>programming</category>
      <category>agile</category>
      <category>coding</category>
    </item>
    <item>
      <title>Parallel Computing with DNA</title>
      <dc:creator>Nicolas Mattia</dc:creator>
      <pubDate>Mon, 18 Feb 2019 10:24:25 +0000</pubDate>
      <link>https://dev.to/nmattia/parallel-computing-with-dna-jk4</link>
      <guid>https://dev.to/nmattia/parallel-computing-with-dna-jk4</guid>
      <description>&lt;p&gt;DNA. Everybody knows that DNA is the blueprint by which our cells replicate.&lt;br&gt;
Everybody knows that Horatio Caine uses it to catch bad guys. &lt;strong&gt;But... what if&lt;br&gt;
we used DNA to build supercomputers?&lt;/strong&gt; That is definitely science-fiction... or&lt;br&gt;
is it? As I was working on DNA computing, I got my fair share of people staring&lt;br&gt;
at me like I was crazy. Someone even asked me if I could find a way to take a&lt;br&gt;
bird's DNA to grow an optimal plane out of it. &lt;strong&gt;I thought I would demystify it&lt;br&gt;
a bit.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnmattia.com%2Fimages%2Fblueprint.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnmattia.com%2Fimages%2Fblueprint.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  A bit of history
&lt;/h3&gt;

&lt;p&gt;In 1994, &lt;a href="https://en.wikipedia.org/wiki/Leonard_Adleman" rel="noopener noreferrer"&gt;Leonard Adleman&lt;/a&gt; (which you may know as the &lt;em&gt;A&lt;/em&gt; in &lt;em&gt;&lt;a href="https://en.wikipedia.org/wiki/RSA_(cryptosystem)" rel="noopener noreferrer"&gt;RSA&lt;/a&gt;&lt;/em&gt;) showed that it was possible to &lt;strong&gt;solve&lt;/strong&gt; some pretty &lt;strong&gt;difficult problems&lt;/strong&gt;, just by &lt;strong&gt;using DNA&lt;/strong&gt; and other cell-reproduction related stuff. &lt;em&gt;Wait, what?&lt;/em&gt; Did he just recreate a Primordial-Soup-like environment, and waited until an organic supercomputer evolved from it, somehow following the rules of natural selection? Well, not exactly. But we'll come to how things work in a minute.&lt;/p&gt;

&lt;h5&gt;
  
  
  DNA... but why?
&lt;/h5&gt;

&lt;p&gt;It is important to understand the reasons &lt;em&gt;why&lt;/em&gt; people came to study DNA Computing. The problem Adleman was trying to solve was &lt;a href="https://en.wikipedia.org/wiki/NP-complete" rel="noopener noreferrer"&gt;&lt;em&gt;really&lt;/em&gt; difficult&lt;/a&gt;. It is called the &lt;em&gt;&lt;a href="https://en.wikipedia.org/wiki/Hamiltonian_path_problem" rel="noopener noreferrer"&gt;Hamiltonian Path Problem&lt;/a&gt;&lt;/em&gt; (but let's call it &lt;em&gt;The Roadtrip Problem&lt;/em&gt;), and it goes something like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Take a map&lt;/li&gt;
&lt;li&gt;Cut out a part of the map, and you'll be left with a few cities, linked by roads&lt;/li&gt;
&lt;li&gt;Grab a pen. Can you trace a &lt;strong&gt;path&lt;/strong&gt; that goes through &lt;strong&gt;every city exactly once&lt;/strong&gt;, following the roads?
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnmattia.com%2Fimages%2Fhamilton.jpg"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Roadtrip problem. Alright. The idea is this: &lt;strong&gt;the more cities&lt;/strong&gt; you have, &lt;strong&gt;the longer&lt;/strong&gt; it will take you to find out. And unfortunately, if you double the number of cities, you will probably need more than twice the amount of time to solve the new problem. And that means that if you just &lt;strong&gt;try every solution&lt;/strong&gt; one after another, it is going to take an awful amount of time. Wouldn't it be nice if you could try &lt;strong&gt;several&lt;/strong&gt; of those possibilities &lt;strong&gt;at once&lt;/strong&gt;?&lt;/p&gt;

&lt;p&gt;This is basically the reason why computers nowadays have more that one core working at a time. It usually goes from two to eight, the latter more often than the former. Still, if a problem takes one year to be solved on a single core, using 8-cores instead would still take a month and a half. Not that cool if you need the results to do something else, huh? Well, that's why super computers exist, hosting 250k+ cores. Your one-year-problem now takes about two minutes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnmattia.com%2Fimages%2Fcities-comarison.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnmattia.com%2Fimages%2Fcities-comarison.jpg"&gt;&lt;/a&gt;&lt;br&gt;
Sometimes even that is not sufficient (which is kind of a good thing in regards to &lt;a href="https://en.wikipedia.org/wiki/Public-key_cryptography" rel="noopener noreferrer"&gt;cryptography&lt;/a&gt;, for instance). One of the &lt;strong&gt;fastest algorithms&lt;/strong&gt; for solving our roadtrip problem runs in O(n^2 2^n). Basically that means that if a computer takes two thousandths of a second to solve the problem with eight cities, the same computer will need two minutes with sixteen cities, and a bit less than &lt;strong&gt;a week to compute a result&lt;/strong&gt; for thirty-two cities. Most of that huge growth in time in regards of the number of cities comes from the exponential term 2^n, and the multiplication by n^2 does not help at all.&lt;/p&gt;

&lt;p&gt;When scenarios like that show up, it drives some scientists mad, and sometimes gives them weird ideas. Among those is trying to solve NP-Complete problems with DNA.&lt;/p&gt;

&lt;h3&gt;
  
  
  DNA algorithms
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;DNA strands&lt;/strong&gt; are like little strings (or sentences) containing &lt;strong&gt;information&lt;/strong&gt;, in the form of four &lt;a href="https://en.wikipedia.org/wiki/Nucleobase" rel="noopener noreferrer"&gt;characters&lt;/a&gt;: &lt;strong&gt;A&lt;/strong&gt;, &lt;strong&gt;T&lt;/strong&gt;, &lt;strong&gt;C&lt;/strong&gt; and &lt;strong&gt;G&lt;/strong&gt;. It happens that the characters &lt;strong&gt;A&lt;/strong&gt; and &lt;strong&gt;T&lt;/strong&gt; attract each other, and the same goes for &lt;strong&gt;C&lt;/strong&gt; and &lt;strong&gt;G&lt;/strong&gt; (if like me you can never remember which goes with which, it's &lt;a href="http://www.amazon.com/G%C3%B6del-Escher-Bach-Eternal-Golden/dp/0465026567" rel="noopener noreferrer"&gt;very simple&lt;/a&gt;: &lt;strong&gt;A&lt;/strong&gt;chilles and the &lt;strong&gt;T&lt;/strong&gt;ortoise form a pair, and so do the &lt;strong&gt;C&lt;/strong&gt;rab and his &lt;strong&gt;G&lt;/strong&gt;enes). Characters of such pairs are called &lt;em&gt;&lt;a href="https://en.wikipedia.org/wiki/Complementarity_(molecular_biology)" rel="noopener noreferrer"&gt;complementary&lt;/a&gt;&lt;/em&gt; to one another. If two DNA strands happen to contain sequences of complementary characters, they will attract each other, and clamp together, giving long&lt;br&gt;
&lt;strong&gt;DNA&lt;/strong&gt; strands their &lt;strong&gt;&lt;a href="https://en.wikipedia.org/wiki/Nucleic_acid_double_helix" rel="noopener noreferrer"&gt;sexy shape&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Now, let's be serious, it's 2015. And in 2015 you can &lt;strong&gt;design your DNA&lt;/strong&gt; strands and have them produced. Let's do exactly that (at least the design part). Bear with me for a minute, and imagine that we have our own DNA-strand-printer. Let's design a simple DNA strand, containing a &lt;strong&gt;&lt;em&gt;G&lt;/em&gt;&lt;/strong&gt; character followed by &lt;strong&gt;9&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;A&lt;/em&gt;&lt;/strong&gt; characters:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;GAAAAAAAAA&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(a DNA strand, not somehow's death throe)&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Alright. Let's call that strand &lt;strong&gt;&lt;em&gt;N&lt;/em&gt;&lt;/strong&gt;. Also, let's print it two thousand times. Now let's create an other strand. It is composed of &lt;strong&gt;3&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;T&lt;/em&gt;&lt;/strong&gt; characters, surrounded by a &lt;strong&gt;&lt;em&gt;C&lt;/em&gt;&lt;/strong&gt; and a &lt;strong&gt;&lt;em&gt;G&lt;/em&gt;&lt;/strong&gt; :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;CTTTG&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We'll print that one... let's say ten thousand times (by the way, DNA is very tiny). Those strands we call &lt;strong&gt;&lt;em&gt;d&lt;/em&gt;&lt;/strong&gt;. Now we'll go to the kitchen, grab a bucket, fill it up with water, and throw our twelve thousand DNA strands in it. &lt;strong&gt;Congratulations&lt;/strong&gt;, you just built and programmed &lt;strong&gt;your first DNA computer&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnmattia.com%2Fimages%2Fnine-minus-three.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnmattia.com%2Fimages%2Fnine-minus-three.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's get that straight, right now: &lt;strong&gt;you won't be running Minecraft on it anytime soon&lt;/strong&gt;. But what exactly happens in the bucket? First of all, both strands contain complementary characters. The sequence &lt;strong&gt;&lt;em&gt;TTT&lt;/em&gt;&lt;/strong&gt; in &lt;strong&gt;d&lt;/strong&gt; (our second strand) will tend to be attracted to any three &lt;strong&gt;&lt;em&gt;A&lt;/em&gt;&lt;/strong&gt;s in our first DNA strand &lt;strong&gt;N&lt;/strong&gt;. Yet, it can do even better: the first four characters of &lt;strong&gt;d&lt;/strong&gt;, namely &lt;strong&gt;&lt;em&gt;CTTT&lt;/em&gt;&lt;/strong&gt;, are a perfect complement to the first four characters of &lt;strong&gt;N&lt;/strong&gt;: &lt;strong&gt;&lt;em&gt;GAAA&lt;/em&gt;&lt;/strong&gt;. They will clamp together, and leave out two tails: a simple &lt;strong&gt;&lt;em&gt;G&lt;/em&gt;&lt;/strong&gt; on one side, and &lt;strong&gt;6&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;A&lt;/em&gt;&lt;/strong&gt;s on the other side. Wait, &lt;strong&gt;this looks almost familiar...&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Indeed, since DNA strands are flexible, the two tails will act as a new DNA strand &lt;strong&gt;&lt;em&gt;GAAAAAA&lt;/em&gt;&lt;/strong&gt;, which has the same structure as &lt;strong&gt;N&lt;/strong&gt;, but with &lt;strong&gt;6&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;A&lt;/em&gt;&lt;/strong&gt;s instead of nine. You see where this is heading: &lt;strong&gt;the process will repeat itself!&lt;/strong&gt; Another &lt;strong&gt;d&lt;/strong&gt; strand will float by, and its leading &lt;strong&gt;C&lt;/strong&gt; character will get hooked. Every time this happens, the number of &lt;strong&gt;&lt;em&gt;A&lt;/em&gt;&lt;/strong&gt; characters on our main string will be &lt;strong&gt;reduced by three!&lt;/strong&gt; Eventually, there won't be any &lt;strong&gt;&lt;em&gt;A&lt;/em&gt;&lt;/strong&gt; left on our strand, all covered with &lt;strong&gt;&lt;em&gt;T&lt;/em&gt;&lt;/strong&gt;s.&lt;/p&gt;

&lt;p&gt;What we just implemented is a division of &lt;strong&gt;9&lt;/strong&gt; by &lt;strong&gt;3&lt;/strong&gt;, effectively giving zero. The strand &lt;strong&gt;N&lt;/strong&gt; encoded the number &lt;strong&gt;9&lt;/strong&gt; with nine &lt;strong&gt;&lt;em&gt;A&lt;/em&gt;&lt;/strong&gt; characters, and the strand &lt;strong&gt;d&lt;/strong&gt; encoded the subtraction by &lt;strong&gt;3&lt;/strong&gt;, with three &lt;strong&gt;&lt;em&gt;T&lt;/em&gt;&lt;/strong&gt; characters. This is easily extended to any numbers, can be used e.g. for checking if a number is prime or not. The truly amazing part is that all the computations are &lt;strong&gt;(almost) completely parallel&lt;/strong&gt;: you have &lt;strong&gt;thousands of pairs&lt;/strong&gt; forming,  &lt;strong&gt;independently&lt;/strong&gt; of others!&lt;/p&gt;

&lt;p&gt;Of course, this is very theorethic, even though some succesful experimentation was &lt;a href="http://www.dna.caltech.edu/~winfree/" rel="noopener noreferrer"&gt;done already&lt;/a&gt;. It is still the very beginning of DNA computing, and the time it takes to run an algorithm exceeds by far that of a computer (if you can run the given algorithm in a first place). Yet, it is promising, and in the end theoricists don't care that much if it will work one day.&lt;/p&gt;

&lt;h3&gt;
  
  
  My contributions
&lt;/h3&gt;

&lt;p&gt;In February 2015 I completed a research project as part of my Master's studies. I was able to provide solutions to several problems using &lt;strong&gt;&lt;em&gt;DNA algorithms&lt;/em&gt;&lt;/strong&gt;, like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Checking if a number is &lt;strong&gt;prime&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Computing the &lt;strong&gt;square root&lt;/strong&gt; of a number&lt;/li&gt;
&lt;li&gt;Implementing &lt;strong&gt;binary inputs&lt;/strong&gt; for DNA problems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and also did some analysis on how fast/how reliable such algorithms were. The improvements compared to other DNA based computing are that&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;it is more scalable (at least theoretically)&lt;/li&gt;
&lt;li&gt;it only uses DNA strands (Adleman, for instance, also used enzymes).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you are hungry for DNA algorithm knowledge, have any questions, or want to &lt;br&gt;
complain about anything: just drop me a word in the comments below!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;There are many problems (and solutions!) related to computing with DNA, and&lt;br&gt;
 some of the following might be interesting to the reader:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adleman, L.M.: Molecular computation of solutions to combinatorial problems. In: Science Magazine. (November 2009)&lt;/li&gt;
&lt;li&gt;Zhang, D.Y., Winfree, E.: Control of dna strand displacement kinetics using toehold exchange. In: J A C S Articles. (June 2009)&lt;/li&gt;
&lt;li&gt;Qian, L., Winfree, E.: Scaling up digital circuit computation with dna strand displacement cascades. In: Science Magazine. (June 2011)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Also, Microsoft developed &lt;a href="http://research.microsoft.com/en-us/projects/dna/" rel="noopener noreferrer"&gt;a tool&lt;/a&gt; for visualizing DNA computing. Have fun!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>computerscience</category>
      <category>explainlikeimfive</category>
    </item>
  </channel>
</rss>
