<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>Attitude Archives - Fluent C++</title>
	<atom:link href="https://www.fluentcpp.com/category/attitude/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/category/attitude/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Wed, 17 Feb 2021 17:38:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.3</generator>
<site xmlns="com-wordpress:feed-additions:1">214950964</site>	<item>
		<title>How to Quickly Understand the Code of a Function</title>
		<link>https://www.fluentcpp.com/2021/11/30/how-to-quickly-understand-the-code-of-a-function/</link>
		
		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Tue, 30 Nov 2021 01:00:55 +0000</pubDate>
				<category><![CDATA[Attitude]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[legacy]]></category>
		<category><![CDATA[read code]]></category>
		<category><![CDATA[understand]]></category>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=3941</guid>

					<description><![CDATA[<p>A lot of people struggle with legacy code because it&#8217;s hard to understand. It&#8217;s not expressive. One way to reduce the gap between code writer and code reader so that they reach an understanding is to write expressive code indeed. In all cases, you need to be able to read code quickly. The more expressive, [&#8230;]</p>
<p>The post <a href="https://www.fluentcpp.com/2021/11/30/how-to-quickly-understand-the-code-of-a-function/">How to Quickly Understand the Code of a Function</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>A lot of people struggle with legacy code because it&#8217;s hard to understand. It&#8217;s not expressive. One way to reduce the gap between code writer and code reader so that they reach an understanding is to write expressive code indeed.</p>
<p>In all cases, you need to be able to read code quickly. The more expressive, the easier to read. The less expressive&#8230; well here are some heuristics that should help you figure out what a piece of code is doing, in particular the code of a function. Even if that function looks like it doesn&#8217;t want you to understand it.</p>
<h3><span style="color: #ff6600;">Reading code is like reading a book</span></h3>
<p>How to read a book? If it&#8217;s a fiction book, chances are you&#8217;re reading it to have a good time. In this case reading it line by line, cover to cover, is what makes the most sense.</p>
<p><img fetchpriority="high" decoding="async" class="alignright wp-image-3943 size-medium" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/squirrel-304021_640.png?resize=300%2C256&#038;ssl=1" alt="understand code of a function" width="300" height="256" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/squirrel-304021_640.png?resize=300%2C256&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/squirrel-304021_640.png?resize=150%2C128&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/squirrel-304021_640.png?resize=32%2C27&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/squirrel-304021_640.png?resize=117%2C100&amp;ssl=1 117w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/squirrel-304021_640.png?resize=201%2C172&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/squirrel-304021_640.png?resize=350%2C300&amp;ssl=1 350w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/squirrel-304021_640.png?resize=468%2C400&amp;ssl=1 468w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/squirrel-304021_640.png?resize=515%2C440&amp;ssl=1 515w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/squirrel-304021_640.png?resize=632%2C540&amp;ssl=1 632w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/squirrel-304021_640.png?w=640&amp;ssl=1 640w" sizes="(max-width: 300px) 100vw, 300px" data-recalc-dims="1" />But in the case of non-fiction books, you&#8217;re reading to acquire knowledge and understanding. And as explained in the classic <a href="https://www.amazon.com/gp/product/0671212095/ref=as_li_qf_asin_il_tl?ie=UTF8&amp;tag=fluentcpp-20&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=0671212095&amp;linkId=1dbd2cb8e99abee729ded546c1568946">How to read a book</a>, you never ever want to read them cover to cover. Rather, you want to run an &#8220;inspectional reading&#8221; first, to achieve two things:</p>
<ul>
<li>decide whether this book is indeed relevant for you,</li>
<li>get an idea of the main message and parts of the book.</li>
</ul>
<p>An inspectional reading consists in skimming through the book, looking for places that sum up the information (table of contents, beginning and end of chapters, main messages&#8230;). And inspectional reading is <em>fast</em>.</p>
<p>Going back to source code, what sort of book do you think source code relates the most: fiction, or non-fiction?</p>
<p>Unless you&#8217;re fond enough of a piece of code to enjoy its reading like you would a good novel, source code is read for knowledge and understanding. Like non-fiction books. For this reason, you don&#8217;t want to start by reading a function &#8220;cover to cover&#8221;, that is to understand its code line after line starting from the first and going to the last.</p>
<p>Instead, you want to skim through lines of code, looking for the main information. You want to perform an inspectional reading on code for the same two reasons as for a book:</p>
<ul>
<li>deciding whether this piece is code is relevant for you and deserves a deeper analysis,</li>
<li>getting a general idea of its meaning before getting into the details.</li>
</ul>
<p>Now how to extract the relevant information during the inspectional reading of a function?</p>
<h3><span style="color: #ff6600;">A function is like a story: get spoiled</span></h3>
<p>Before delving into its implementation, the first thing to look at a function is its name. If it&#8217;s well named, it should give a general meaning and orient you for what to look for when you inspect the body.</p>
<p>Or better yet, the name, parameters and return type should be enough together to indicate everything you need to know about this function.</p>
<h4><span style="color: #ff6600;">The main character dies at the end</span></h4>
<p>However, not all functions are created equal, and some of them require you to get a peek under the hood. Or sometimes, it feels more like a descent in a cave. Or a propulsion into a black hole, in the worst cases.</p>
<p>When you&#8217;re inside the cave, what should you start looking for? The first thing to look inside a function is <strong>what it returns</strong>. All the rest of the function is oriented towards returning that value, because it&#8217;s the point of that function.</p>
<p><img decoding="async" class="alignleft wp-image-3945 size-medium" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/pop-corn-312386_640.png?resize=171%2C300&#038;ssl=1" alt="understand code of a function" width="171" height="300" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/pop-corn-312386_640.png?resize=171%2C300&amp;ssl=1 171w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/pop-corn-312386_640.png?resize=86%2C150&amp;ssl=1 86w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/pop-corn-312386_640.png?resize=18%2C32&amp;ssl=1 18w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/pop-corn-312386_640.png?resize=57%2C100&amp;ssl=1 57w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/pop-corn-312386_640.png?resize=115%2C201&amp;ssl=1 115w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/06/pop-corn-312386_640.png?w=200&amp;ssl=1 200w" sizes="(max-width: 171px) 100vw, 171px" data-recalc-dims="1" />So get a big spoiler, skip to the end of the function&#8217;s story, and start from the last line. It should look like <code>return something</code>. In this case, <code>something</code> is one of the main characters of the function.</p>
<p>Some functions have multiple return statements. If that&#8217;s the case, look at all of them, and try to see what they have in common, to get a feel for what that function is returning. Unfortunately, even if functions should <a href="https://www.fluentcpp.com/2016/11/22/make-your-functions-functional/">return their outputs via their return type</a>, some functions modify their parameters, so that counts as &#8220;returns&#8221; too.</p>
<p>Since anything can happen in a black hole, some functions go as far as modifying global variables, which also count as output then. And let&#8217;s not talk about the functions that return values via exceptions because that&#8217;s a whole other dimension.</p>
<p>Anyway, however unfortunate the form the of the output, this is what you should be looking for first if there is one.</p>
<h4><span style="color: #ff6600;">Locating main characters and secondary characters</span></h4>
<p>In a traditional plot, the main character is helped by secondary characters to achieve its quest. It is the same in code: a function has intermediary objects, that are not returned from the function but play a key role in its implementation.</p>
<p>Main characters and secondary characters have something in common: you get to see them often. So to know what the function is about, <strong>note the objects that appear the most frequently in its code</strong>. The function is probably about them.</p>
<p>This technique is also useful if you&#8217;re only inspecting a portion of a larger function. If nothing gets returned in that portion, finding the objects that appear the most often helps identity what that portion of code is about.</p>
<h4><span style="color: #ff6600;">Skip to the action</span></h4>
<p>Once you&#8217;ve located the main and secondary objects of the function, the next thing you want to know is what&#8217;s happening to them.</p>
<p>In a function, <strong>not all lines are the main action</strong>, sometimes far from that. Some lines are merely secondary quests, like getting a value, logging a piece of information, or preparing a secondary character. You don&#8217;t want to dwell on those details when inspecting the function. Instead, you want to skip to the main action first.</p>
<p>To locate the main action, you can quickly scan every line of the function, and determine if it looks like the main action, even if with a gut feeling. The point it to do this check really fast. And if it doesn&#8217;t feel like the main action, don&#8217;t dwell on it, even if you don&#8217;t understand all it does. It will become clearer later.</p>
<p>In some cases, you&#8217;ll reach the end of the function without having found the main action, because it didn&#8217;t looked like it. In this case, make a second pass with the same technique. Now that you&#8217;ve considered every line of the function, even if at a glance, the main action should stand out better than the first time.</p>
<p>Identifying the main action may be slow at the beginning. But the scanning of each line becomes much faster and more reliable with practice. With time, your eyes will scan blocks of code rather than individual lines.</p>
<p>This is particularly true if you work on the same codebase for a period of time, because you get used to its style. The coding style of the main action doesn&#8217;t look like the coding style of the other bookkeeping stuff of the function.</p>
<h3><span style="color: #ff6600;">So what is that function about?</span></h3>
<p>When you perform an inspectional reading first, understanding what a function does becomes like a little game. Find what objects the function revolves around, and what happens to them by filtering out the secondary causes.</p>
<p>This should increase your code reading speed, allow you to read more code, and make it easier to work with legacy code.</p>
<p>Do you have other techniques to understand a function, or code in general? If you do, or if you try the technique presented here, please leave a comment to let us know how it went!</p>
<h3>You may also like</h3>
<ul>
<li><a href="https://www.fluentcpp.com/2018/06/05/10-techniques-that-will-make-you-understand-other-peoples-code-better/">10 Techniques That Will Make You Understand Other People’s Code Better</a></li>
</ul>
Don't want to miss out ? <strong>Follow:</strong> &nbsp&nbsp<a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Follow me on twitter" href="https://twitter.com/joboccara" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img decoding="async" alt="twitter" title="Follow me on twitter" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Find us on Linkedin" href="https://www.linkedin.com/in/jonathan-boccara-23826921/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Find us on Linkedin" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-rss nolightbox" data-provider="rss" target="_blank" rel="nofollow" title="Subscribe to our RSS Feed" href="https://www.fluentcpp.com/feed/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="rss" title="Subscribe to our RSS Feed" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/rss.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><br/>Share this post!<a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox" data-provider="facebook" target="_blank" rel="nofollow" title="Check out this post from Fluent C++" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F11%2F30%2Fhow-to-quickly-understand-the-code-of-a-function%2F&#038;t=How%20to%20Quickly%20Understand%20the%20Code%20of%20a%20Function&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F11%2F30%2Fhow-to-quickly-understand-the-code-of-a-function%2F&#038;p&#091;images&#093;&#091;0&#093;=https%3A%2F%2Fwww.fluentcpp.com%2Fwp-content%2Fuploads%2F2018%2F06%2Fsquirrel-304021_640-300x256.png&#038;p&#091;title&#093;=How%20to%20Quickly%20Understand%20the%20Code%20of%20a%20Function" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="Facebook" title="Check out this post from Fluent C++" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Tweet about this" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F11%2F30%2Fhow-to-quickly-understand-the-code-of-a-function%2F&#038;text=Check%20out%20this%20post%20from%20Fluent%20C%2B%2B" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Tweet about this" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Share on Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F11%2F30%2Fhow-to-quickly-understand-the-code-of-a-function%2F&#038;title=How%20to%20Quickly%20Understand%20the%20Code%20of%20a%20Function" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Share on Linkedin" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><p>The post <a href="https://www.fluentcpp.com/2021/11/30/how-to-quickly-understand-the-code-of-a-function/">How to Quickly Understand the Code of a Function</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3941</post-id>	</item>
		<item>
		<title>A Case Study for the Quickest Way to Find the Source of a Bug</title>
		<link>https://www.fluentcpp.com/2021/09/27/a-case-study-for-the-quickest-way-to-find-the-source-of-a-bug/</link>
		
		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Mon, 27 Sep 2021 01:00:42 +0000</pubDate>
				<category><![CDATA[Attitude]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[case study]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[fast]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[quick]]></category>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=3449</guid>

					<description><![CDATA[<p>In the previous post, I went through the most efficient method I know to find the source of a bug. Here it is, summed up: 0) Don&#8217;t start by looking at the code 1) Reproduce the bug 2) Do differential testing __2a) Start with a tiny difference __2b) Continue with larger differences 3) Formulate hypotheses [&#8230;]</p>
<p>The post <a href="https://www.fluentcpp.com/2021/09/27/a-case-study-for-the-quickest-way-to-find-the-source-of-a-bug/">A Case Study for the Quickest Way to Find the Source of a Bug</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In the previous post, I went through the most efficient method I know to find the source of a bug. Here it is, summed up:</p>
<p>0) Don&#8217;t start by looking at the code<br />
1) Reproduce the bug<br />
2) Do differential testing<br />
__2a) Start with a tiny difference<br />
__2b) Continue with larger differences<br />
3) Formulate hypotheses and check them in the code</p>
<hr />
<p>As laying out the method can look a little abstract, we&#8217;re going to go through a case study where we identify the cause of a bug in a concrete example.</p>
<p>It&#8217;s inspired from a bug that I&#8217;ve seen once in an application. I&#8217;ve simplified the domain and the environment to present it more synthetically, but the mechanics of the bug is all there.</p>
<p><img loading="lazy" decoding="async" class="alignright wp-image-3455 size-medium" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/harmonica-2619860_640.jpg?resize=300%2C199&#038;ssl=1" alt="harmonica find bugs quickly" width="300" height="199" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/harmonica-2619860_640.jpg?resize=300%2C199&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/harmonica-2619860_640.jpg?resize=150%2C100&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/harmonica-2619860_640.jpg?resize=32%2C21&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/harmonica-2619860_640.jpg?resize=151%2C100&amp;ssl=1 151w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/harmonica-2619860_640.jpg?resize=201%2C133&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/harmonica-2619860_640.jpg?resize=350%2C232&amp;ssl=1 350w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/harmonica-2619860_640.jpg?resize=602%2C400&amp;ssl=1 602w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/harmonica-2619860_640.jpg?w=640&amp;ssl=1 640w" sizes="(max-width: 300px) 100vw, 300px" data-recalc-dims="1" />So here&#8217;s the story: you&#8217;re a software developer working for the International School of Harmonica, which is a thriving establishment that delivers harmonica lessons to people around the world, that want to be able to master the subtleties of this musical instrument.</p>
<p>As a hat tip to some of my C++ blogging buddies, we&#8217;ll say that the International School of Harmonica has sites in</p>
<ul>
<li><a href="https://arne-mertz.de/about-me/">Hamburg, Germany</a></li>
<li><a href="https://foonathan.net/about.html">Aachen, Germany</a></li>
<li><a href="http://www.modernescpp.com">Rottenburg, Germany</a></li>
<li><a href="https://blog.tartanllama.xyz/">Edinburgh, Scotland</a></li>
<li><a href="http://www.bfilipek.com/p/about.html">Cracow, Poland</a></li>
<li>and <a href="https://www.fluentcpp.com/about-me/">Paris, France</a></li>
</ul>
<p>Seems that a lot of folks in Germany like to play the harmonica then.</p>
<p>As a software developer for the International School of Harmonica, you have to maintain a large system that tracks what&#8217;s going on in the school. And one day, you get a bug report. It&#8217;s in the module that deals with lessons subscriptions.</p>
<p>Let&#8217;s see how that feature works (it&#8217;s simple) and the bug report. Then we&#8217;ll apply the above method to find the source of the bug as quickly as possible.</p>
<h3><span style="color: #ff6600;">Lessons subscriptions</span></h3>
<p>When a student subscribes for harmonica lessons, the school inserts a subscription via a form in the system. The form looks like this:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3460" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup1.png?resize=366%2C281&#038;ssl=1" alt="find bugs quickly" width="366" height="281" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup1.png?w=366&amp;ssl=1 366w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup1.png?resize=150%2C115&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup1.png?resize=300%2C230&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup1.png?resize=32%2C25&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup1.png?resize=130%2C100&amp;ssl=1 130w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup1.png?resize=201%2C154&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup1.png?resize=350%2C269&amp;ssl=1 350w" sizes="(max-width: 366px) 100vw, 366px" data-recalc-dims="1" /></p>
<p>It contains the name of the student, the name of the school (which we&#8217;ll identify with its city for simplicity here), and a button &#8220;Lesson dates&#8230;&#8221; that leads to the calendar of lessons that this student is subscribed to. Let&#8217;s click on that &#8220;Lesson date&#8230;&#8221; button. We see the following screen open:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3462" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup2-2.png?resize=521%2C267&#038;ssl=1" alt="find bugs quickly" width="521" height="267" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup2-2.png?w=521&amp;ssl=1 521w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup2-2.png?resize=150%2C77&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup2-2.png?resize=300%2C154&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup2-2.png?resize=32%2C16&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup2-2.png?resize=195%2C100&amp;ssl=1 195w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup2-2.png?resize=201%2C103&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup2-2.png?resize=350%2C179&amp;ssl=1 350w" sizes="(max-width: 521px) 100vw, 521px" data-recalc-dims="1" /></p>
<p>The left hand side of this screen is taken up by the lesson schedule: these are the dates where the student is supposed to show up and learn how to express a myriad of emotions with their harmonica for an incredibly intense hour. For simplicity we leave out the time in the day of the lessons here.</p>
<p>The user can fill out the schedule manually, or they can use the right hand side of the screen to generate dates automatically:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3473" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?resize=520%2C268&#038;ssl=1" alt="find bugs quickly" width="520" height="268" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?w=520&amp;ssl=1 520w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?resize=150%2C77&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?resize=300%2C155&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?resize=32%2C16&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?resize=194%2C100&amp;ssl=1 194w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?resize=201%2C104&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?resize=350%2C180&amp;ssl=1 350w" sizes="(max-width: 520px) 100vw, 520px" data-recalc-dims="1" /></p>
<p>For simplicity&#8217;s sake we assume that lessons are always weekly. Note that the 7th of April is Good Friday in Germany in 2034, but since the configuration of the right hand side of the screen says that a lesson falling on a public holiday should be held the &#8220;day before&#8221; instead, the second date is the 6th of April.</p>
<p>That&#8217;s it for the feature. Let&#8217;s now have a look at that bug report.</p>
<h4><span style="color: #ff6600;">The bug report</span></h4>
<p>The bug report goes like this:</p>
<hr />
<p>When we duplicate an existing lesson subscription and select another school of the newly created subscription, we observe that the lesson dates disappear.</p>
<p>But we expect the duplicate to make a carbon copy of the subscription, which means also copying the dates.</p>
<p>Note that if we only duplicate the subscription without changing the country, then the lesson dates remain.</p>
<hr />
<p>Let&#8217;s now apply the above method to find the source of that bug without trudging with pain into the code.</p>
<h3><span style="color: #ff6600;">Let&#8217;s find the source of that bug, quickly</span></h3>
<p>As a reminder, the method we&#8217;ll follow is this:</p>
<p>0) Don&#8217;t start by looking at the code<br />
1) Reproduce the bug<br />
2) Do differential testing<br />
__2a) Start with a tiny difference<br />
__2b) Continue with larger differences<br />
3) Formulate hypotheses and check them in the code</p>
<h4><span style="color: #ff6600;">Step #0: Don&#8217;t start by looking at the code</span></h4>
<p>Let&#8217;s go ahead and do 0) Don&#8217;t start by looking at the code.</p>
<p>That&#8217;s the easiest one, we don&#8217;t do anything. Ok, done.</p>
<p>Now let&#8217;s do 1) Reproduce the bug.</p>
<h4><span style="color: #ff6600;">Step #1: Reproduce the bug</span></h4>
<p>The test case contains a lesson subscription, let&#8217;s see what&#8217;s in it:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3467" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=369%2C284&#038;ssl=1" alt="find bugs quickly" width="369" height="284" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?w=369&amp;ssl=1 369w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=150%2C115&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=300%2C231&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=32%2C25&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=130%2C100&amp;ssl=1 130w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=201%2C155&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=350%2C269&amp;ssl=1 350w" sizes="(max-width: 369px) 100vw, 369px" data-recalc-dims="1" /></p>
<p>And the lessons dates look like this:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3468" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=518%2C263&#038;ssl=1" alt="find bugs quickly" width="518" height="263" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?w=518&amp;ssl=1 518w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=150%2C76&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=300%2C152&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=32%2C16&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=197%2C100&amp;ssl=1 197w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=201%2C102&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=350%2C178&amp;ssl=1 350w" sizes="(max-width: 518px) 100vw, 518px" data-recalc-dims="1" /></p>
<p>Those are entered manually and don&#8217;t use the automatic generation.</p>
<p>Now we duplicate the subscription (say there is a UI action to perform that), give the duplicate a new name and change its country:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3469" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup6.png?resize=371%2C285&#038;ssl=1" alt="find bugs quickly" width="371" height="285" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup6.png?w=371&amp;ssl=1 371w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup6.png?resize=150%2C115&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup6.png?resize=300%2C230&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup6.png?resize=32%2C25&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup6.png?resize=130%2C100&amp;ssl=1 130w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup6.png?resize=201%2C154&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup6.png?resize=350%2C269&amp;ssl=1 350w" sizes="(max-width: 371px) 100vw, 371px" data-recalc-dims="1" /></p>
<p>Let&#8217;s now open the dates:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3470" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?resize=518%2C264&#038;ssl=1" alt="find bugs quickly" width="518" height="264" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?w=518&amp;ssl=1 518w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?resize=150%2C76&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?resize=300%2C153&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?resize=32%2C16&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?resize=196%2C100&amp;ssl=1 196w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?resize=201%2C102&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?resize=350%2C178&amp;ssl=1 350w" sizes="(max-width: 518px) 100vw, 518px" data-recalc-dims="1" /></p>
<p>The dates are gone! Excellent, we reproduce the issue. At this point, we can rejoice since the rest is only a matter of time.</p>
<p>Indeed, this is really a great position because things get harder when you <strong>don&#8217;t</strong> reproduce the issue. Indeed, so many kind of things can have gone wrong in that case (configuration of your dev environment, wrong version in the version control system, misunderstanding of the test case, the test case can only be reproduced once in a given environment and you need to find a backup of the DB to restore&#8230; lovely stuff).</p>
<p>Let&#8217;s assume that the issue is confined now. Let&#8217;s hunt it down with 2) Do differential testing.</p>
<h4><span style="color: #ff6600;">Step #2: Perform differential testing</span></h4>
<p>The bug report says that the issue happened when duplicating the lesson subscription. Is it specific to duplicates, or can it happen by simply inserting a subscription from scratch? The only way to know is to test it.</p>
<p>So let&#8217;s insert a new subscription:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3471" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup9.png?resize=369%2C285&#038;ssl=1" alt="find bugs quickly" width="369" height="285" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup9.png?w=369&amp;ssl=1 369w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup9.png?resize=150%2C116&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup9.png?resize=300%2C232&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup9.png?resize=32%2C25&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup9.png?resize=129%2C100&amp;ssl=1 129w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup9.png?resize=201%2C155&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup9.png?resize=350%2C270&amp;ssl=1 350w" sizes="(max-width: 369px) 100vw, 369px" data-recalc-dims="1" /></p>
<p>Let&#8217;s fill out some dates:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3468" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=518%2C263&#038;ssl=1" alt="find bugs quickly" width="518" height="263" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?w=518&amp;ssl=1 518w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=150%2C76&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=300%2C152&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=32%2C16&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=197%2C100&amp;ssl=1 197w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=201%2C102&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=350%2C178&amp;ssl=1 350w" sizes="(max-width: 518px) 100vw, 518px" data-recalc-dims="1" /></p>
<p>Now let&#8217;s go back and change the country:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3475" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup10.png?resize=373%2C286&#038;ssl=1" alt="find bugs quickly" width="373" height="286" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup10.png?w=373&amp;ssl=1 373w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup10.png?resize=150%2C115&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup10.png?resize=300%2C230&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup10.png?resize=32%2C25&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup10.png?resize=130%2C100&amp;ssl=1 130w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup10.png?resize=201%2C154&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup10.png?resize=350%2C268&amp;ssl=1 350w" sizes="(max-width: 373px) 100vw, 373px" data-recalc-dims="1" /></p>
<p>And reopen he dates:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3470" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?resize=518%2C264&#038;ssl=1" alt="find bugs quickly" width="518" height="264" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?w=518&amp;ssl=1 518w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?resize=150%2C76&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?resize=300%2C153&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?resize=32%2C16&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?resize=196%2C100&amp;ssl=1 196w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?resize=201%2C102&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup8.png?resize=350%2C178&amp;ssl=1 350w" sizes="(max-width: 518px) 100vw, 518px" data-recalc-dims="1" /></p>
<p>Gone.</p>
<p>So the issue has in fact nothing to do with the duplication. This is important because it represents a whole chunk of code we won&#8217;t have to look at, because we&#8217;re now pretty sure it doesn&#8217;t contain the source of the issue. Had we started with the code we may have debugged the duplication, which would have been a complete waste of time. Hence the interest of Step #0 above.</p>
<p>To be even more sure, we can try to change the country of an <strong>existing </strong>subscription. We won&#8217;t get into the mockups for that test here, but it turns out that the bug is reproduced in this case too (it was in the story).</p>
<p>So the bug happens when we change the country and open the dates screen.</p>
<p>But are those two steps really necessary to reproduce the bug?</p>
<p>To check, we&#8217;re going to do each of them separately and see if we reproduce the bug in each case. Let&#8217;s start by changing the country without opening the dates.</p>
<p>To do this, we pick up the subscription from the test case:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3467" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=369%2C284&#038;ssl=1" alt="find bugs quickly" width="369" height="284" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?w=369&amp;ssl=1 369w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=150%2C115&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=300%2C231&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=32%2C25&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=130%2C100&amp;ssl=1 130w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=201%2C155&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=350%2C269&amp;ssl=1 350w" sizes="(max-width: 369px) 100vw, 369px" data-recalc-dims="1" /></p>
<p>We change its country:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3476" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?resize=371%2C284&#038;ssl=1" alt="find bugs quickly" width="371" height="284" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?w=371&amp;ssl=1 371w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?resize=150%2C115&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?resize=300%2C230&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?resize=32%2C24&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?resize=131%2C100&amp;ssl=1 131w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?resize=201%2C154&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?resize=350%2C268&amp;ssl=1 350w" sizes="(max-width: 371px) 100vw, 371px" data-recalc-dims="1" /></p>
<p>And we save it. Note that we didn&#8217;t open the dates screen.</p>
<p>Now let&#8217;s reopen the subscription and click to open the dates screen:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3468" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=518%2C263&#038;ssl=1" alt="find bugs quickly" width="518" height="263" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?w=518&amp;ssl=1 518w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=150%2C76&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=300%2C152&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=32%2C16&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=197%2C100&amp;ssl=1 197w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=201%2C102&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=350%2C178&amp;ssl=1 350w" sizes="(max-width: 518px) 100vw, 518px" data-recalc-dims="1" /></p>
<p>The dates are there, the bug is not reproduced, so it was necessary to open the dates screen right after changing the country. Opening the dates screen then flushes the dates.</p>
<p>But then, do we really need to change the country? Yes, because when we open a subscription and directly open the dates, we see that the dates are here, so the bug is not reproduced then. We saw that in the initial presentation of the feature.</p>
<p>We can deduce that opening the dates screen flushes the dates, but only if we&#8217;ve changed the country beforehand.</p>
<p>Now the question is: why? What&#8217;s going on when we perform those two actions in a row? It&#8217;s time to 3) Formulate hypotheses and check them in the code.</p>
<h3><span style="color: #ff6600;">Step #3: Formulate hypotheses and check them in the code</span></h3>
<p>Let&#8217;s think: what is the link between a country and some dates? The first answer that comes to mind is public holidays. Indeed, each country has its public holidays.</p>
<p>To validate this hypothesis, we won&#8217;t even have to look in the code. Looking in the code is typically slower than looking in the application, so let&#8217;s save it for when there is nothing else we can do.</p>
<p>Different countries have different public holidays, but different <strong>cities</strong> in the same country have the same public holidays. Let&#8217;s try to change the city without changing the country and see if we reproduce the issue.</p>
<p>We start again with the subscription of the test case:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3467" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=369%2C284&#038;ssl=1" alt="find bugs quickly" width="369" height="284" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?w=369&amp;ssl=1 369w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=150%2C115&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=300%2C231&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=32%2C25&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=130%2C100&amp;ssl=1 130w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=201%2C155&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=350%2C269&amp;ssl=1 350w" sizes="(max-width: 369px) 100vw, 369px" data-recalc-dims="1" /></p>
<p>Note that we use the minimal test case that we obtained with differential testing. In particular, no need to go through duplication. So we select another city in Germany:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3477" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup12.png?resize=371%2C286&#038;ssl=1" alt="find bugs quickly" width="371" height="286" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup12.png?w=371&amp;ssl=1 371w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup12.png?resize=150%2C116&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup12.png?resize=300%2C231&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup12.png?resize=32%2C25&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup12.png?resize=130%2C100&amp;ssl=1 130w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup12.png?resize=201%2C155&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup12.png?resize=350%2C270&amp;ssl=1 350w" sizes="(max-width: 371px) 100vw, 371px" data-recalc-dims="1" /></p>
<p>And open the dates screen:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3468" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=518%2C263&#038;ssl=1" alt="find bugs quickly" width="518" height="263" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?w=518&amp;ssl=1 518w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=150%2C76&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=300%2C152&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=32%2C16&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=197%2C100&amp;ssl=1 197w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=201%2C102&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup5.png?resize=350%2C178&amp;ssl=1 350w" sizes="(max-width: 518px) 100vw, 518px" data-recalc-dims="1" /></p>
<p>The dates are still there! The bug is not reproduced when we change city, only when we change country. This raises the probability that the bug is somehow related to public holidays.</p>
<p>The other feature that is related to public holidays is the automatic generation of dates. Let&#8217;s see if we reproduce the issue with the generation parameters filled out.</p>
<p>So we start again from the lesson subscription of the test case:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3467" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=369%2C284&#038;ssl=1" alt="find bugs quickly" width="369" height="284" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?w=369&amp;ssl=1 369w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=150%2C115&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=300%2C231&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=32%2C25&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=130%2C100&amp;ssl=1 130w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=201%2C155&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup4.png?resize=350%2C269&amp;ssl=1 350w" sizes="(max-width: 369px) 100vw, 369px" data-recalc-dims="1" /></p>
<p>But this time we fill the generation parameters:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3473" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?resize=520%2C268&#038;ssl=1" alt="find bugs quickly" width="520" height="268" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?w=520&amp;ssl=1 520w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?resize=150%2C77&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?resize=300%2C155&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?resize=32%2C16&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?resize=194%2C100&amp;ssl=1 194w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?resize=201%2C104&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup3-3.png?resize=350%2C180&amp;ssl=1 350w" sizes="(max-width: 520px) 100vw, 520px" data-recalc-dims="1" /></p>
<p>Now let&#8217;s go back and change the country:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3476" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?resize=371%2C284&#038;ssl=1" alt="find bugs quickly" width="371" height="284" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?w=371&amp;ssl=1 371w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?resize=150%2C115&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?resize=300%2C230&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?resize=32%2C24&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?resize=131%2C100&amp;ssl=1 131w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?resize=201%2C154&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup11.png?resize=350%2C268&amp;ssl=1 350w" sizes="(max-width: 371px) 100vw, 371px" data-recalc-dims="1" /></p>
<p>And reopen the dates screen:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-3478" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup14.png?resize=520%2C264&#038;ssl=1" alt="find bugs quickly" width="520" height="264" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup14.png?w=520&amp;ssl=1 520w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup14.png?resize=150%2C76&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup14.png?resize=300%2C152&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup14.png?resize=32%2C16&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup14.png?resize=197%2C100&amp;ssl=1 197w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup14.png?resize=201%2C102&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/mockup14.png?resize=350%2C178&amp;ssl=1 350w" sizes="(max-width: 520px) 100vw, 520px" data-recalc-dims="1" /></p>
<p>The dates are there, but not exactly the same. Contrary to Germany, Poland doesn&#8217;t have the 7th of April as a public holiday in 2034.</p>
<p>We can deduce that opening the dates screen is working out the dates, based on the country and on the generation parameters.</p>
<p>We can now formulate a hypothesis about the source of the bug: when we open the dates screen, the system tries to work out the generated dates if the country has changed. And something is going wrong when there is no generation parameters.</p>
<p>Now we can check this hypothesis in the code, and there is just a couple of lines that can confirm of infirm the hypothesis. We go check that targeted portion of code, and it takes only a few minutes to realize that the system is trying to generate with an empty generator, which gives an empty set of dates, and it uses this empty set regardless.</p>
<p>The source of the bug has been identified.</p>
<p>Now we should think of a fix, but that&#8217;s another story, that uses another method.</p>
<h3><span style="color: #ff6600;">The more time you spend in the application, the less time you spend in total</span></h3>
<p>Even if I&#8217;ve never worked for a school of harmonica, the bug I had seen in real life looked essentially like this one, and all the above reasoning is very close to how the analysis went down. With this method, we could diagnose the bug in a matter of <strong>minutes</strong>.</p>
<p>When you do maintenance, don&#8217;t start by looking at the code. Rather, play around with the application and reason about what test can help you narrow down the source of the issue. You&#8217;ll save a lot of time and frustration in your life as a software developer.</p>
<h3>You may also like</h3>
<p>Software maintenance can be fun &#8211; The quickest way to find the source of a bug</p>
Don't want to miss out ? <strong>Follow:</strong> &nbsp&nbsp<a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Follow me on twitter" href="https://twitter.com/joboccara" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Follow me on twitter" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Find us on Linkedin" href="https://www.linkedin.com/in/jonathan-boccara-23826921/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Find us on Linkedin" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-rss nolightbox" data-provider="rss" target="_blank" rel="nofollow" title="Subscribe to our RSS Feed" href="https://www.fluentcpp.com/feed/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="rss" title="Subscribe to our RSS Feed" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/rss.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><br/>Share this post!<a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox" data-provider="facebook" target="_blank" rel="nofollow" title="Check out this post from Fluent C++" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F09%2F27%2Fa-case-study-for-the-quickest-way-to-find-the-source-of-a-bug%2F&#038;t=A%20Case%20Study%20for%20the%20Quickest%20Way%20to%20Find%20the%20Source%20of%20a%20Bug&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F09%2F27%2Fa-case-study-for-the-quickest-way-to-find-the-source-of-a-bug%2F&#038;p&#091;images&#093;&#091;0&#093;=https%3A%2F%2Fwww.fluentcpp.com%2Fwp-content%2Fuploads%2F2018%2F03%2Fharmonica-2619860_640-300x199.jpg&#038;p&#091;title&#093;=A%20Case%20Study%20for%20the%20Quickest%20Way%20to%20Find%20the%20Source%20of%20a%20Bug" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="Facebook" title="Check out this post from Fluent C++" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Tweet about this" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F09%2F27%2Fa-case-study-for-the-quickest-way-to-find-the-source-of-a-bug%2F&#038;text=Check%20out%20this%20post%20from%20Fluent%20C%2B%2B" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Tweet about this" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Share on Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F09%2F27%2Fa-case-study-for-the-quickest-way-to-find-the-source-of-a-bug%2F&#038;title=A%20Case%20Study%20for%20the%20Quickest%20Way%20to%20Find%20the%20Source%20of%20a%20Bug" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Share on Linkedin" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><p>The post <a href="https://www.fluentcpp.com/2021/09/27/a-case-study-for-the-quickest-way-to-find-the-source-of-a-bug/">A Case Study for the Quickest Way to Find the Source of a Bug</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3449</post-id>	</item>
		<item>
		<title>3 Steps to Find the Source of a Bug Quickly</title>
		<link>https://www.fluentcpp.com/2021/09/22/3-steps-to-find-the-source-of-a-bug-quickly/</link>
		
		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Wed, 22 Sep 2021 01:00:41 +0000</pubDate>
				<category><![CDATA[Attitude]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[maintenance]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[quickly]]></category>
		<category><![CDATA[software]]></category>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=3439</guid>

					<description><![CDATA[<p>Do you like doing maintenance as a software activity? Most people don&#8217;t. Maintenance is often associated with trudging through lines of code with the debugger in a desperate search for bugs, in software that someone else wrote. All in all, maintenance gets the reputation of being an unrewarding activity, with low intellectual stimulation and not [&#8230;]</p>
<p>The post <a href="https://www.fluentcpp.com/2021/09/22/3-steps-to-find-the-source-of-a-bug-quickly/">3 Steps to Find the Source of a Bug Quickly</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Do you like doing maintenance as a software activity? Most people don&#8217;t. Maintenance is often associated with trudging through lines of code with the debugger in a desperate search for bugs, in software that someone else wrote.</p>
<p>All in all, maintenance gets the reputation of being an unrewarding activity, with low intellectual stimulation and not as worthy of a developer&#8217;s time as building a new feature, for example.</p>
<p>I love doing maintenance. Not because I like feeling lost in code that I don&#8217;t know. And neither because I like spending hours running in circles. And even less because I like the feeling of the touch of the F10 key.</p>
<p>I love doing maintenance because, if you have the right technique, maintenance can be <em>fun</em>.</p>
<p>In this article I try to explain that technique, with the goal that you come to like fixing bugs in the application you&#8217;re working on too (if you do, please leave a comment!). It&#8217;s not rocket science, and a part of it is in <a href="https://www.amazon.com/gp/product/0735619670/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0735619670&amp;linkCode=as2&amp;tag=fluentcpp-20&amp;linkId=d5740a1b637d19f7324be8302bc12b6b">Code Complete</a>. But it has enormous value because it can save you a large amount of time and frustration when working on that unjustly ill-famed activity.</p>
<p>Now if you&#8217;re wondering why we talk about that on Fluent C++, which is normally concerned with expressive code, the link is that this technique will save you from looking at a lot of code. So even if that code is not expressive and has poor design, it won&#8217;t be in your way to slow you down.</p>
<h3><span style="color: #ff6600;">The slowest way to find the source of a bug</span></h3>
<p>Before getting to the best way to identify the source of a bug, let&#8217;s see the natural way. The natural way goes like this: you get a bug report related feature X, you look around the code of feature X, potentially step through the codeline with the debugger, looking for the cause of the problem.</p>
<p>This is about the least efficient approach to finding the cause of a bug. But this is what we do naturally, and like pretty much everyone that&#8217;s what I was doing as a young sprout.</p>
<p>Why is this approach doomed to failure (or to a very long and painful road to eventual success)? It&#8217;s because <strong>if you start by looking at the code, you don&#8217;t know what you&#8217;re looking for</strong>. You hope to stumble upon the source of the problem by chance. It&#8217;s like looking for a specific street in a city, just by methodically walking around town until you run into that street.</p>
<p>And if you&#8217;re in a large codebase, it&#8217;s like walking in a big city. You may find it, but chances you&#8217;ll be dehydrated before then.</p>
<p>So the first piece of advice is <strong>don&#8217;t start by looking at the code.</strong> In fact, you want to spend as much time of your analysis as possible <strong>in the application</strong>.</p>
<p>But what to look for in the application then?</p>
<h3><span style="color: #ff6600;">The quickest way to find the source of a bug</span></h3>
<h4><span style="color: #ff6600;">Step #1: Reproduce the issue</span></h4>
<p>The first thing you want to look at in the application is <strong>checking that the bug is there</strong>. It sounds stupid, but it happens that the development environment is not quite in the same configuration as the one where the bug appears, and any further analysis would be a waste of time.</p>
<h4><span style="color: #ff6600;">Step #2: Do d</span><span style="color: #ff6600;">ifferential testing</span></h4>
<p>Ok now let&#8217;s assume that you do reproduce the bug. The next step is then to <strong>reduce the test case</strong>. This consists in trying <strong>slight variations</strong> of the original test case in order to refine the scope of the bug.</p>
<h5><span style="color: #ff6600;">Step #2a: Start with a tiny difference</span></h5>
<p>It&#8217;s going to be a little abstract here, but we&#8217;ll get to a concrete example later on. Say that the bug is appearing in feature X when it is in config A1. Other possible configs of the feature X are A2, which is very close to A1, and B which is fairly different from A1. And A2 is simpler than A1.</p>
<p>Since A1 and A2 are so close, the bug will likely be reproduced with A2 too. But let&#8217;s test A2 anyway.</p>
<p>If the bug is NOT reproduced in A2 then great, it means that the bug is specific to A1, and lies in the difference between A1 and A2. If you can refine the test by checking another config A11 versus A12, then by all means do. But say that you can&#8217;t go further that A1 versus A2. Go to Step #3.</p>
<p>But if the bug is also reproduced in A2, you know that the bug is not specific to A1 nor lies in the difference between A1 and A2. But you don&#8217;t know where the source of the bug is yet.</p>
<h5><span style="color: #ff6600;">Step #2b: Continue with larger differences</span></h5>
<p>So you test less close configs, and<strong> simpler ones if possible</strong>. B, for example. Since B is not close to A1, it&#8217;s likely that you don&#8217;t reproduce the bug in B.</p>
<p>But if you DO reproduce the bug in B, it means that you&#8217;ve been lied to: the bug has nothing to do with A1. But it&#8217;s ok, business people didn&#8217;t do it on purpose.</p>
<p>This discovery brings you two things:</p>
<ul>
<li>it simplifies the test case, if you did find a simpler config B where you reproduce the issue,</li>
<li>it tells you that the bug is probably not related to feature X after all. So you need to do differential testing between feature X and another, close feature X2. And then a remote feature Y. And so on.</li>
</ul>
<h4><span style="color: #ff6600;">Step #3: Formulate and check a h</span><span style="color: #ff6600;">ypothesis</span></h4>
<p>You now have a pretty accurate location for the bug. This is now the time to <strong>formulate a hypothesis</strong> about what is causing the incorrect behaviour. What could go wrong in this confined space of the application? If you see several things that go wrong, what&#8217;s your gut feeling for which one is the most likely?</p>
<p><strong>Then, and only then, you can look at the code</strong>. The point of looking at the code is to confirm (or infirm) your hypothesis. So you go directly to the portion of code that your differential testing pinpointed. It should be fairly small. Fire up the debugger (or run the code mentally if you can), check if your hypothesis is confirmed.</p>
<p>If it is, congratulations, you identified the source of the bug. If it&#8217;s not, do Step #3 again until a hypothesis is confirmed.</p>
<h3><span style="color: #ff6600;">A binary search for the root cause of a bug</span></h3>
<p>If you don&#8217;t practice this technique or something resembling it yet, it probably sounds somewhat complicated. In that case, a nice analogy is to compare this with <strong>linear search versus binary search</strong>.</p>
<p>Starting by looking at the code and searching for what&#8217;s wrong in it is like <strong>linear search</strong>: you walk your way through the code, function by function or line by line, until you encounter the source of the issue.</p>
<p>However, with the method we described, that is operating with differential testing and hypotheses is like <strong>binary search</strong>: it consists in making checks at some targeted locations, and decide each time for a new direction to look into. And the same way binary search eliminates huge chunks of the collection from the analysis, differential testing and hypotheses discard huge portions of the codebase that you won&#8217;t have to look into.</p>
<p>Sure enough, binary search takes more mental effort to implement than linear search. But the method has two advantages: A) it&#8217;s way faster and B) <strong>it requires you to think</strong>.</p>
<p>This latest advantage is what makes maintenance fun. Every bug becomes a challenge for your mind, a sort of puzzle. But one for which you have a method, and of which the resolution is only a matter of time.</p>
<p>Next up, we will go through a concrete example of bug-finding to get some practice at applying that method.</p>
Don't want to miss out ? <strong>Follow:</strong> &nbsp&nbsp<a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Follow me on twitter" href="https://twitter.com/joboccara" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Follow me on twitter" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Find us on Linkedin" href="https://www.linkedin.com/in/jonathan-boccara-23826921/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Find us on Linkedin" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-rss nolightbox" data-provider="rss" target="_blank" rel="nofollow" title="Subscribe to our RSS Feed" href="https://www.fluentcpp.com/feed/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="rss" title="Subscribe to our RSS Feed" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/rss.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><br/>Share this post!<a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox" data-provider="facebook" target="_blank" rel="nofollow" title="Check out this post from Fluent C++" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F09%2F22%2F3-steps-to-find-the-source-of-a-bug-quickly%2F&#038;t=3%20Steps%20to%20Find%20the%20Source%20of%20a%20Bug%20Quickly&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F09%2F22%2F3-steps-to-find-the-source-of-a-bug-quickly%2F&#038;p&#091;images&#093;&#091;0&#093;=&#038;p&#091;title&#093;=3%20Steps%20to%20Find%20the%20Source%20of%20a%20Bug%20Quickly" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="Facebook" title="Check out this post from Fluent C++" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Tweet about this" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F09%2F22%2F3-steps-to-find-the-source-of-a-bug-quickly%2F&#038;text=Check%20out%20this%20post%20from%20Fluent%20C%2B%2B" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Tweet about this" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Share on Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F09%2F22%2F3-steps-to-find-the-source-of-a-bug-quickly%2F&#038;title=3%20Steps%20to%20Find%20the%20Source%20of%20a%20Bug%20Quickly" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Share on Linkedin" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><p>The post <a href="https://www.fluentcpp.com/2021/09/22/3-steps-to-find-the-source-of-a-bug-quickly/">3 Steps to Find the Source of a Bug Quickly</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3439</post-id>	</item>
		<item>
		<title>Don&#8217;t Let Legacy Code Make You Suffer. Make It Suffer</title>
		<link>https://www.fluentcpp.com/2021/08/04/dont-let-legacy-code-make-suffer-make-suffer/</link>
		
		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Wed, 04 Aug 2021 01:00:25 +0000</pubDate>
				<category><![CDATA[Attitude]]></category>
		<category><![CDATA[big function]]></category>
		<category><![CDATA[incremental]]></category>
		<category><![CDATA[legacy code]]></category>
		<category><![CDATA[refactoring]]></category>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=3286</guid>

					<description><![CDATA[<p>Feeling like the codebase you&#8217;re working on is poorly designed? Wish you could focus on writing good code, rather than trudging through mud code all day long? Would life be easier if only the legacy codebase had a clearer structure? If you answered Yes to any of those questions, be aware that you&#8217;re not alone. [&#8230;]</p>
<p>The post <a href="https://www.fluentcpp.com/2021/08/04/dont-let-legacy-code-make-suffer-make-suffer/">Don&#8217;t Let Legacy Code Make You Suffer. Make &lt;em&gt;It&lt;/em&gt; Suffer</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Feeling like the codebase you&#8217;re working on is poorly designed? Wish you could focus on writing good code, rather than trudging through mud code all day long? Would life be easier if only the legacy codebase had a clearer structure?</p>
<p>If you answered Yes to any of those questions, be aware that you&#8217;re not alone. Quite the opposite, in fact. You only need to talk to people for more than a minute at meetups or conferences to realize that a significant amount of developers suffer from legacy code.</p>
<p>It makes me sad when I see competent and motivated developers losing faith and ending up suffering from the questionable quality of the code they&#8217;re working on. Some resign themselves to it and even spend years suffering from legacy code on a daily basis!</p>
<p>It doesn&#8217;t have to be that way. One of the ways to get out of that spiral is not to let yourself be bullied by bad code.</p>
<p>Instead, show bad code who the boss is.</p>
<h3><span style="color: #ff6600;">Legacy code is a bully</span></h3>
<p><img loading="lazy" decoding="async" class="alignright size-full wp-image-3289" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/bully.png?resize=151%2C300&#038;ssl=1" alt="legacy code" width="151" height="300" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/bully.png?w=151&amp;ssl=1 151w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/bully.png?resize=76%2C150&amp;ssl=1 76w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/bully.png?resize=16%2C32&amp;ssl=1 16w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/bully.png?resize=50%2C100&amp;ssl=1 50w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2018/03/bully.png?resize=101%2C201&amp;ssl=1 101w" sizes="(max-width: 151px) 100vw, 151px" data-recalc-dims="1" />As a young developer, starting to work in a codebase that has been there for a while can be a challenge. Even more so when you just graduated from CS school where you&#8217;ve mostly worked on libraries or ad-hoc projects. Being thrown all of a sudden into a big codebase that has evolved over years can be disorienting, to say the least.</p>
<p>It&#8217;s like you&#8217;re the new kid at school, and the big bullies don&#8217;t plan on making your life easier.</p>
<p>Big functions, big objects, mysterious names, inconsistent and duplicate components, all those bullies firmly oppose themselves to your understanding of the code. They&#8217;ll do all that is in their power to slow you down in your analyses, and even when you make a fix and think you&#8217;re done, they will throw an unexpected regression into your face.</p>
<p>But kids get bigger, bullies end up going out from school, and some kids even grow into the new bullies that will take care of the new generation.</p>
<p>This is where the metaphor breaks down. Even if you can grow as a developer, time doesn&#8217;t make legacy code go anywhere. It&#8217;s waiting for you, day in and day out, trying to get in your way. Some people spend years suffering from it!</p>
<p>If you&#8217;re in that case, I want you to take action by fixing the code. But not any action. I want you to come up with a <strong>targeted strategy</strong>, that aims at making your legacy code less powerful in its ability to make your life miserable.</p>
<h3><span style="color: #ff6600;">Hit it where it hurts</span></h3>
<p>There are so many things you could fix in a legacy codebase, so many places that would deserve a little makeover, or even a total refurbishing.</p>
<p>But you have to face the hard truth: <strong>you won&#8217;t fix be able to fix it all</strong>.</p>
<p>Codebases that took years of active work that involved several to many people are <strong>vast</strong>. Fixing every last issue would take months or years, and you have client requests to satisfy at the same time. Going off to a crusade trying to fix everything that&#8217;s wrong in the codebase is an utopia. Similarly, throwing it all to the bin and rewriting it from scratch is often <a href="https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/" target="_blank" rel="noopener noreferrer">a terrible idea</a>.</p>
<p>However much time your company policy allows for refactoring, you have limited resources. So you need to pick your battles very carefully.</p>
<p>How to evaluate which refactoring is worth your team&#8217;s time? It&#8217;s comes down to a basic economic decision: you want to maximize the value and minimize the costs. But what are the value and costs of such refactorings?</p>
<h4><span style="color: #ff6600;">The costs of a refactoring</span></h4>
<p>The costs of a refactoring include the time to actually change the code, but not only.</p>
<p>Changing obscure code requires you to understand it first. So if you&#8217;re not clear about it already, you need to factor that analysis time in. Also, such changes could cause regressions, so you need to factor in the time you think it will take to stabilize your refactoring.</p>
<p>A refactoring that introduces boundaries and interfaces may give you an opportunity to write some unit tests around it, which may take some time too.</p>
<p>Also, it you&#8217;re tackling a buggy part of the code, chances are that somebody else in the team is currently trying to fix a bug in that same code, and integrating both your fixes will need to solve a merge conflict.</p>
<h4><span style="color: #ff6600;">The value of a refactoring</span></h4>
<p>Here we&#8217;re talking about diminishing the capacity of the codebase to get in your way. So it has to be code that you read &#8211; or debug &#8211; frequently. There is little point in refactoring code that you don&#8217;t interact with often. Even if you see how to make it better, and even if you feel it wouldn&#8217;t be too hard.</p>
<p>This brings up a very important point: why do we strive for good code? For art, because it&#8217;s beautiful? For morality, because it&#8217;s wrong to write bad code?</p>
<p>No. <strong>We write good code because it helps the business</strong>. Good code leads to less bugs, faster integration of new features, less turnover in the company. All those are business reasons. Refactoring a piece of code that doesn&#8217;t pose a problem to the business is tantamount to refactoring the codebase of another company while we&#8217;re at it.</p>
<p>Well, in fact there is another reason to improve code quality: it makes our lives easier, as developers. Sure, this in the interest of business too, but we can see it a goal in itself too. Anyway, refactoring a piece of code that doesn&#8217;t hinder us too much is wasted effort in that respect too.</p>
<p>In particular, and I know it may sound surprising at first, <strong>don&#8217;t do a refactoring just because it&#8217;s cheap</strong>. If it doesn&#8217;t bring enough value, you will have wasted time. You&#8217;ll be more grateful to have spent an afternoon making one big hit to a targeted part of the code, rather than 100 little flicks all over the place.</p>
<p>The most efficient approach in my opinion is to be <strong>value-driven</strong>: pick the 2 or 3 things in your code that slow you down the most or are the most buggy, and that have a reasonable cost of fixing. Conversely, don&#8217;t be <strong>cost-driven</strong>: don&#8217;t pick the cheapest fixes you could do and see which one is the most helpful.</p>
<p>Let&#8217;s now see what sort of hits could have a reasonable value/cost ratio.</p>
<h3><span style="color: #ff6600;">Where does it hurt?</span></h3>
<p>Before giving some suggestions, remember that you&#8217;re the one in the best position to figure out your most valuable refactorings. What annoys you the most in your codebase in a daily basis?</p>
<p>Also, you can survey your team to ask their opinion on that question, and decide together on what to take action on.</p>
<p>Here are some suggestions, and you&#8217;re welcome to suggest other ideas based on your experience:</p>
<h4><span style="color: #ff6600;">Slice up a big function</span></h4>
<p>This is a classic one. Big functions drown readers of the code into low-level details and prevent them to have a big picture of what the function is doing.</p>
<p>Identifying the responsibilities of that function allows to split it in several sub-functions and put explicit names on them, or outsource part of its work to another function or another object.</p>
<p>If you come across that function often, this refactoring can bring a lot of value.</p>
<h4><span style="color: #ff6600;">Slice up a big object</span></h4>
<p>Some objects get extra responsibilities tacked on one by one over time, and evolve into massive behemoths that sit in the middle of the codebase.</p>
<p>Splitting their members allows to manipulate lighter structures that take up less mental space in the mind of a reader.</p>
<p>Sometimes, slicing up a big function leads to slicing up a big object, if the various sub-functions operate on various, but distinct, parts of the object.</p>
<h4><span style="color: #ff6600;">Expose side effects</span></h4>
<p>Big functions making side effects on big objects are notoriously hard to follow. Making it clear what effects a function has on objects helps following along and being less surprised when debugging code.</p>
<p>One way to do this is to make more objects and methods <code>const</code>, and separate the data that is modified from the data that is <code>const</code> in an interface.</p>
<p>Having no side effects is even better but, as a first step on a large function, this is not always realistic to aim for.</p>
<h4><span style="color: #ff6600;">Use names that makes sense</span></h4>
<p>Bad names can send you on a wrong track, and make you waste a lot of time.</p>
<p>The value of changing some names can be high, and its cost varies from low for a local name to higher if the codebase uses the name broadly and you don&#8217;t have appropriate tooling.</p>
<p>What else would you include as refactorings with high value and reasonable cost?</p>
<p>In any case, <strong>don&#8217;t let yourself be bullied by legacy</strong> or otherwise bad code. Talk with your team, identify the painful points and how to fix them at a reasonable cost. Start small, with a couple of bad functions or objects.</p>
<p>And when you&#8217;ve identified you targets, hit them, and hit them hard.</p>
<p>Related articles:</p>
<ul>
<li><a href="https://www.fluentcpp.com/2017/11/21/using-bad-code-learn-write-great-code/">Using Bad Code to Learn How to Write Good Code</a></li>
<li><a href="https://www.fluentcpp.com/2017/06/16/when-you-dont-have-expressiveness-at-least-keep-positiveness/">The Right Attitude to Deal with Legacy Code</a></li>
</ul>
Don't want to miss out ? <strong>Follow:</strong> &nbsp&nbsp<a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Follow me on twitter" href="https://twitter.com/joboccara" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Follow me on twitter" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Find us on Linkedin" href="https://www.linkedin.com/in/jonathan-boccara-23826921/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Find us on Linkedin" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-rss nolightbox" data-provider="rss" target="_blank" rel="nofollow" title="Subscribe to our RSS Feed" href="https://www.fluentcpp.com/feed/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="rss" title="Subscribe to our RSS Feed" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/rss.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><br/>Share this post!<a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox" data-provider="facebook" target="_blank" rel="nofollow" title="Check out this post from Fluent C++" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F08%2F04%2Fdont-let-legacy-code-make-suffer-make-suffer%2F&#038;t=Don%E2%80%99t%20Let%20Legacy%20Code%20Make%20You%20Suffer.%20Make%20It%20Suffer&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F08%2F04%2Fdont-let-legacy-code-make-suffer-make-suffer%2F&#038;p&#091;images&#093;&#091;0&#093;=https%3A%2F%2Fi0.wp.com%2Fwww.fluentcpp.com%2Fwp-content%2Fuploads%2F2018%2F03%2Flegacy_code_suffer.png%3Ffit%3D1280%252C720%26ssl%3D1&#038;p&#091;title&#093;=Don%E2%80%99t%20Let%20Legacy%20Code%20Make%20You%20Suffer.%20Make%20It%20Suffer" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="Facebook" title="Check out this post from Fluent C++" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Tweet about this" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F08%2F04%2Fdont-let-legacy-code-make-suffer-make-suffer%2F&#038;text=Check%20out%20this%20post%20from%20Fluent%20C%2B%2B" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Tweet about this" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Share on Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F08%2F04%2Fdont-let-legacy-code-make-suffer-make-suffer%2F&#038;title=Don%E2%80%99t%20Let%20Legacy%20Code%20Make%20You%20Suffer.%20Make%20It%20Suffer" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Share on Linkedin" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><p>The post <a href="https://www.fluentcpp.com/2021/08/04/dont-let-legacy-code-make-suffer-make-suffer/">Don&#8217;t Let Legacy Code Make You Suffer. Make &lt;em&gt;It&lt;/em&gt; Suffer</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3286</post-id>	</item>
		<item>
		<title>5 Tips to Find Your Way Around A Legacy Codebase</title>
		<link>https://www.fluentcpp.com/2021/06/15/5-tips-to-find-your-way-around-legacy-code/</link>
		
		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Tue, 15 Jun 2021 01:00:10 +0000</pubDate>
				<category><![CDATA[Attitude]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[expressive]]></category>
		<category><![CDATA[legacy]]></category>
		<category><![CDATA[understand]]></category>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1515</guid>

					<description><![CDATA[<p>Have you ever struggled to understand a codebase that was bigger than you? Most of us go through this experience more or less often in our career, and this is not a simple thing to do. Chances are you&#8217;re in this situation right now. During one occurence of the Software Craftsmanship meetup somebody was asking for advice [&#8230;]</p>
<p>The post <a href="https://www.fluentcpp.com/2021/06/15/5-tips-to-find-your-way-around-legacy-code/">5 Tips to Find Your Way Around A Legacy Codebase</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a href="https://www.fluentcpp.com/dailycpp/"><img loading="lazy" decoding="async" class="aligncenter wp-image-1947 size-full" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/09/daily-able-content-e1505330890615.png?resize=120%2C116&#038;ssl=1" alt="Daily C++" width="120" height="116" data-recalc-dims="1" /></a></p>
<p><img loading="lazy" decoding="async" class="alignright size-medium wp-image-1527" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/girl_computer.jpg?resize=300%2C203&#038;ssl=1" alt="understand legacy code" width="300" height="203" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/girl_computer.jpg?resize=300%2C203&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/girl_computer.jpg?resize=150%2C101&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/girl_computer.jpg?resize=32%2C22&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/girl_computer.jpg?resize=148%2C100&amp;ssl=1 148w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/girl_computer.jpg?resize=201%2C136&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/girl_computer.jpg?resize=350%2C236&amp;ssl=1 350w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/girl_computer.jpg?resize=593%2C400&amp;ssl=1 593w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/girl_computer.jpg?w=640&amp;ssl=1 640w" sizes="(max-width: 300px) 100vw, 300px" data-recalc-dims="1" /></p>
<p>Have you ever struggled to understand a codebase that was bigger than you?</p>
<p>Most of us go through this experience more or less often in our career, and this is not a simple thing to do. Chances are you&#8217;re in this situation right now.</p>
<p>During one occurence of the <a href="https://www.meetup.com/fr-FR/paris-software-craftsmanship/" target="_blank" rel="noopener noreferrer">Software Craftsmanship meetup</a> somebody was asking for advice because he had been thrown into a gigantic legacy codebase with no documentation, no architecture and discouraged developers. The total opposite of an expressive codeline.</p>
<p>Well,<strong> even when the code isn&#8217;t expressive, there are ways to understand its meaning.</strong></p>
<p>Lots of developers face this sort of situation, with varying degrees of intensity (his case was pretty bad). Even though the codebase I&#8217;m working on is in better shape than what he was describing, I too have had to figure out the code of a large codebase, with some parts being legacy code. And today I&#8217;m even training younger developers at getting better at this.</p>
<p>Now that you&#8217;ve adopted <a href="https://www.fluentcpp.com/2017/06/16/when-you-dont-have-expressiveness-at-least-keep-positiveness/">the right mindset towards legacy code</a>, let me share with you the most efficient ways I have found to get up to speed with a large codebase, even if its code isn&#8217;t always expressive.</p>
<p>Those tips will help you be more efficient and, I hope, boost your motivation as a software developer.</p>
<h3><span style="color: #ff6600;">1) Choose a stronghold and conquer an empire</span></h3>
<p>Do you remember those strategy games where you start with a little base and then you have to develop and explore the surroundings, which are blacked out when you start the game?</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1516" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/strategy_game.jpg?resize=450%2C338&#038;ssl=1" alt="legacy code" width="450" height="338" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/strategy_game.jpg?w=450&amp;ssl=1 450w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/strategy_game.jpg?resize=150%2C113&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/strategy_game.jpg?resize=300%2C225&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/strategy_game.jpg?resize=32%2C24&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/strategy_game.jpg?resize=133%2C100&amp;ssl=1 133w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/strategy_game.jpg?resize=201%2C151&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/strategy_game.jpg?resize=350%2C263&amp;ssl=1 350w" sizes="(max-width: 450px) 100vw, 450px" data-recalc-dims="1" /></p>
<p>I find that these games are an excellent comparison for a codebase.</p>
<p>One efficient way to start the exploration of a legacy codebase is to <strong>find a place you understand very well</strong>. This will be your stronghold to start the game with. And it doesn&#8217;t have to be big! <strong>It can even be one line of code</strong>.</p>
<p><img loading="lazy" decoding="async" class="alignright wp-image-1517 size-medium" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/linear_interpolation.png?resize=300%2C300&#038;ssl=1" alt="understand legacy code" width="300" height="300" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/linear_interpolation.png?resize=300%2C300&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/linear_interpolation.png?resize=150%2C150&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/linear_interpolation.png?resize=32%2C32&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/linear_interpolation.png?resize=100%2C100&amp;ssl=1 100w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/linear_interpolation.png?resize=201%2C201&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/linear_interpolation.png?resize=400%2C400&amp;ssl=1 400w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/linear_interpolation.png?resize=440%2C440&amp;ssl=1 440w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/linear_interpolation.png?w=480&amp;ssl=1 480w" sizes="(max-width: 300px) 100vw, 300px" data-recalc-dims="1" /></p>
<p>Let&#8217;s take an example. The software I deal with does various sorts of computation, but there is one very simple one: a <strong>linear interpolation</strong>. It consists of estimating a value between two values that are already known.</p>
<p>And we know its formula perfectly well: y = y0 + (x &#8211; x0) * (y1 &#8211; y0) / (x1 &#8211; x0), independantly of any software representation. I&#8217;ll choose this as a stronghold. Therefore I&#8217;ll focus on <strong>locating it in the codeline</strong>.</p>
<p>A good stronghold needs to be a bit specific. For instance, a function that puts a string in upper case in not in itself a good stronghold, because it is typically used in several unrelated places across the codebase. Rather, some business code that calls this function in a context that you know in the application is a better stronghold.</p>
<p>Once you find your stronghold, clutch to it. It constitutes a starting point from which to begin your exploration of the codeline.</p>
<p>Indeed, there is a high chance that you can figure out the immediate surroundings of that one line of code. And little by little things start to make sense. Little by little you&#8217;ll be expanding the area you&#8217;re comfortable with, and the dark area on the map will be shrinking.</p>
<p>I found this technique really helpful for starting out. However it takes time, and it won&#8217;t let you get to the ends of the world very shortly, particularly if your codebase has hundreds of thousands or millions of lines of code. This is why you need more.</p>
<h3><span style="color: #ff6600;">2) Work your way up and down a stack</span></h3>
<p><img loading="lazy" decoding="async" class="alignright wp-image-1519 size-full" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/call_stack-e1498515692420.png?resize=224%2C215&#038;ssl=1" alt="understand legacy code" width="224" height="215" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/call_stack-e1498515692420.png?w=224&amp;ssl=1 224w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/call_stack-e1498515692420.png?resize=150%2C144&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/call_stack-e1498515692420.png?resize=32%2C32&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/call_stack-e1498515692420.png?resize=104%2C100&amp;ssl=1 104w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/call_stack-e1498515692420.png?resize=201%2C193&amp;ssl=1 201w" sizes="(max-width: 224px) 100vw, 224px" data-recalc-dims="1" />For this one you&#8217;re going to need your manager (or someone who&#8217;s familiar with the architecture of the application) to sit down next to you. Or if you&#8217;re the one who knows, sit with your padawans for this one.</p>
<p>The idea here is to fire up the debugger, find a <strong>judicious place in the code to put a breakpoint</strong>, and launch a use case in the application. The experienced person is here to choose the &#8216;judicious&#8217; breakpoint, that is one in a <strong>deep stack of a typical use case of the application</strong>.</p>
<p>Then look at the call stack. It displays in one shot all the layers of the application involved in this use case.</p>
<p>This way you can learn a lot about the architecture of your software: what the main modules and the main frameworks are and how they relate together. A call stack tells a long story. Plus, some debuggers display the module name for each function in the call stack. Visual Studio does it if you do Right click &gt; &#8220;Show module name&#8221; on the call stack.</p>
<p>You can repeat this experiment for several call stacks in the same use case, in order to get a grasp of the sequencing of the calls.</p>
<h3><span style="color: #ff6600;">3) Start from the inputs and outputs of the application</span></h3>
<p>If you don&#8217;t understand the code and no one is there to explain it to you, there is still hope. You can at least find someone who understands the application from a user point of view, or at least partly.</p>
<p>Then focus on something you understand in the application and that you can visualize, in the Graphical User Interface, or in any other form of input and output. Then find where this input comes into the code.</p>
<p>Once you&#8217;ve found it, seize it like a thread and follow it, until you reach the code of one functionality that you recognize, even if this functionality boils down to just one line of code. This will be your stronghold, and then you can apply advice #1 above.</p>
<h3><span style="color: #ff6600;">4) Make a refactoring to decouple the code</span></h3>
<p>Refactoring a piece code is a great way to get familiar with it. But not all refactoring will give you the same amount of knowledge for the same time invested in them.</p>
<p>Indeed, even though the refactorings that clean up the code have value, here I&#8217;m talking about refactorings that <strong>change the structure of the code</strong>. Or sometimes it rather looks like putting a structure into place. And you can achieve that by decoupling components.</p>
<p>But don&#8217;t worry, you don&#8217;t have to revise the architecture of the whole application to do this! You can just tackle a function and split it into sub-functions. This will give you a better overview of the sequencing of actions in this function, as well as a detailed view of the data that comes into play in it.</p>
<p>You can also <strong>decouple data processing from objects</strong>. This one doesn&#8217;t apply in all cases but when it does, you hit it big.</p>
<p>For example, imagine a class that contains data members and methods that operate on them. If this data processing is also used by another class, then the two classes are coupled and the code is weird. In this case you can take the behaviour out of the first class, so that both classes uses this extracted behaviour, and not each other.</p>
<p>The code becomes simpler and more extensible afterwards. But in the process, you&#8217;ve seen all the details of the processing of this particular data. It makes you learn a lot about this part of the program, <strong>both in terms of code and in terms of funtionality</strong>. This was the first refactoring I made on the codebase I&#8217;m working on today, and it made me an <strong>expert</strong> on this part of the application. Special thanks to my fantastic manager Patrice for teaching me this.</p>
<p>If you want to dig more into refactoring, <a href="https://www.amazon.com/gp/product/0201485672/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0201485672&amp;linkCode=as2&amp;tag=fluentcpp-20&amp;linkId=7274d1640b13a586089a3cd1767276ba">Refactoring</a> by Martin Fowler is a classical book on the subject. And refactoring legacy code goes hand in hand with the topic of tests, all of which you can read about <a href="https://www.amazon.com/gp/product/0131177052/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0131177052&amp;linkCode=as2&amp;tag=fluentcpp-20&amp;linkId=51838682a0ea89c919bbbacb47f19807">Working effectively with legacy code</a> by Michael Feathers.</p>
<h3><span style="color: #ff6600;">5) Find a &#8220;padded room&#8221; function</span></h3>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-1520 alignleft" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/padded_room.jpg?resize=300%2C225&#038;ssl=1" alt="understand legacy code" width="300" height="225" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/padded_room.jpg?resize=300%2C225&amp;ssl=1 300w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/padded_room.jpg?resize=150%2C113&amp;ssl=1 150w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/padded_room.jpg?resize=768%2C576&amp;ssl=1 768w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/padded_room.jpg?resize=32%2C24&amp;ssl=1 32w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/padded_room.jpg?resize=133%2C100&amp;ssl=1 133w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/padded_room.jpg?resize=201%2C151&amp;ssl=1 201w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/padded_room.jpg?resize=350%2C263&amp;ssl=1 350w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/padded_room.jpg?resize=533%2C400&amp;ssl=1 533w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/padded_room.jpg?resize=587%2C440&amp;ssl=1 587w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/padded_room.jpg?resize=720%2C540&amp;ssl=1 720w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/06/padded_room.jpg?w=1024&amp;ssl=1 1024w" sizes="(max-width: 300px) 100vw, 300px" data-recalc-dims="1" /></p>
<p>This is a technique that I often use with the younger developers that I manage. I pick a big function in the area they&#8217;re going to work on, that has a complicated implementation, but that has <strong>little to no dependency on anything else</strong>. You have some of those functions in your codebase, don&#8217;t you?</p>
<p>I find they are a great place to sharpen your code reading skills. It takes a little bit of time but you end up understanding and then mastering a least some parts of it. And like in a padded room you can&#8217;t hurt yourself, because the function only goes so far and you don&#8217;t have to get lost into another complex function and another, etc. It is self-contained.</p>
<p>This exercise in the padding room function makes you more familiar with the coding style of the codeline. I&#8217;m not saying that it is always a model for writing your own code, because some legacy codebases don&#8217;t exactly have the best style. Rather, it will make your eyes used to the patterns of the codebase, and you can apply this skill pretty much everywhere else inside it to understand code more quickly.</p>
<h3><span style="color: #ff6600;">It will come with time anyway</span></h3>
<p>Even if tackling a large codebase that you haven&#8217;t written yourself seems like a dauting task at first, it gets easier with time. The bigger the area of code your master and the more you understand what your application is supposed to do, the more quickly you&#8217;ll understand a new part of it.</p>
<p>But this comes with time, and a steady amount of effort. Find your stronghold, analyse your stacks, decouple the code and hone your skills in safe padded room functions. Then conquer the world of your software.</p>
<p>Related articles:</p>
<ul>
<li><a href="https://www.fluentcpp.com/2017/06/16/when-you-dont-have-expressiveness-at-least-keep-positiveness/">The Right Attitude to Deal with Legacy Code</a></li>
</ul>
Don't want to miss out ? <strong>Follow:</strong> &nbsp&nbsp<a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Follow me on twitter" href="https://twitter.com/joboccara" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Follow me on twitter" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Find us on Linkedin" href="https://www.linkedin.com/in/jonathan-boccara-23826921/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Find us on Linkedin" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-rss nolightbox" data-provider="rss" target="_blank" rel="nofollow" title="Subscribe to our RSS Feed" href="https://www.fluentcpp.com/feed/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="rss" title="Subscribe to our RSS Feed" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/rss.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><br/>Share this post!<a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox" data-provider="facebook" target="_blank" rel="nofollow" title="Check out this post from Fluent C++" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F06%2F15%2F5-tips-to-find-your-way-around-legacy-code%2F&#038;t=5%20Tips%20to%20Find%20Your%20Way%20Around%20A%20Legacy%20Codebase&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F06%2F15%2F5-tips-to-find-your-way-around-legacy-code%2F&#038;p&#091;images&#093;&#091;0&#093;=https%3A%2F%2Fi0.wp.com%2Fwww.fluentcpp.com%2Fwp-content%2Fuploads%2F2017%2F06%2Fgirl_computer.jpg%3Ffit%3D640%252C432%26ssl%3D1&#038;p&#091;title&#093;=5%20Tips%20to%20Find%20Your%20Way%20Around%20A%20Legacy%20Codebase" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="Facebook" title="Check out this post from Fluent C++" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Tweet about this" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F06%2F15%2F5-tips-to-find-your-way-around-legacy-code%2F&#038;text=Check%20out%20this%20post%20from%20Fluent%20C%2B%2B" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Tweet about this" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Share on Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F06%2F15%2F5-tips-to-find-your-way-around-legacy-code%2F&#038;title=5%20Tips%20to%20Find%20Your%20Way%20Around%20A%20Legacy%20Codebase" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Share on Linkedin" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><p>The post <a href="https://www.fluentcpp.com/2021/06/15/5-tips-to-find-your-way-around-legacy-code/">5 Tips to Find Your Way Around A Legacy Codebase</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1515</post-id>	</item>
		<item>
		<title>Make Bad Code Look Bad</title>
		<link>https://www.fluentcpp.com/2021/04/23/make-bad-code-look-bad/</link>
		
		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Fri, 23 Apr 2021 01:00:51 +0000</pubDate>
				<category><![CDATA[Attitude]]></category>
		<category><![CDATA[bad code]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[look]]></category>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=5862</guid>

					<description><![CDATA[<p>If you&#8217;re working with legacy code, chances are some of the areas of code you&#8217;re in charge of have a design that is less than ideal. But if you&#8217;ve been working with it for a while, you may be able to navigate this code with ease, and maybe you don&#8217;t even see its little weirdnesses [&#8230;]</p>
<p>The post <a href="https://www.fluentcpp.com/2021/04/23/make-bad-code-look-bad/">Make Bad Code Look Bad</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>If you&#8217;re working with legacy code, chances are some of the areas of code you&#8217;re in charge of have a design that is less than ideal.</p>
<p>But if you&#8217;ve been working with it for a while, you may be able to navigate this code with ease, and maybe you don&#8217;t even see its little weirdnesses any more.</p>
<p>This is a dangerous situation. It makes it easy to overlook some design issues and to fail to recognise that it is difficult to integrate new developers into this code.</p>
<p>There is one thing we can start with: transfer our knowledge into naming.</p>
<h3><span style="color: #ff6600;">Making an impact with your knowledge</span></h3>
<p>Consider the following big class:</p>
<pre class="lang:c++ decode:true">class rvDTP_CLASS
{
public:
    void soGR(int get);
    virtual int getObjectID();
    void evaluate(EvaluationParameters&amp; parameters);
    // ...
    // lots of other member functions...
    // ...
};</pre>
<p>This is inspired from a true story (although the code has been anonymized).</p>
<p>Imagine you&#8217;re inheriting that code. At the beginning, all this means nothing to you. When you join the project you wonder, puzzled, what does <code>soGR</code> means?</p>
<p>After making a few features and fixes in the surrounding code, you come to realise that <code>soGR</code> is the function that interacts with the database. It allows to save or load the contents of the object, and the <code>int</code> it takes indicate whether it should save or load. A bit of the class starts making sense!</p>
<p>And then you live on your life, exploring and working on other unrelated parts of the code.</p>
<p>Later on, you come back to the <code>rvDTP_CLASS</code>, from a code handling UI. This code is asking the class the result of <code>getObjectID()</code>. A bit of code exploration makes you understand that the various derived class from <code>rvDTP_CLASS</code> return their own ID, and this ID correspond to a type of display screen.</p>
<p><code>getObjectID</code> lets the UI layer know which screen to load in order to display the object corresponding to a derived class.</p>
<p>You can now map every class to something in the UI. Great, that gives you a concrete image of what <code>rvDTP_CLASS</code> and its derived classes represents. In fact they represent the product (let&#8217;s assume that &#8220;product&#8221; means something in the domain of this application).</p>
<p>Months pass, and little by little you get a finer and finer understanding of the class, its responsibilities and each of its member functions. You possess knowledge.</p>
<p>New people join the team, and they&#8217;re completely bamboozled when they see the <code>rvDTP_CLASS</code> and its member functions for the first time. To help them make the fix they need, you tell them what you learned back then: <code>soGR</code> interacts with the database!</p>
<p>But this is not a good way to pass knowledge, as I&#8217;ve come to realise, and I&#8217;ve certainly been guilty of giving this &#8220;help&#8221; to more junior developers.</p>
<p>Passing on the knowledge is good. But passing on to the next person is suboptimal. What you want is <strong>passing it on to the code</strong>.</p>
<h4><span style="color: #ff6600;">Naming things for what they are</span></h4>
<p>If you&#8217;ve been working with a given area of code for a long time, you may no longer realise what it looks like to someone seeing it for the first time. But their point of view is crucial to assess how expressive the code is.</p>
<p>So when someones asks: &#8220;what is <code>soGR</code>&#8220;, the best way isn&#8217;t to answer that it handles the interaction with the database to save and load the object. A better way is to bake this in the code:</p>
<pre class="lang:c++ mark:4 decode:true">class rvDTP_CLASS
{
public:
    void loadOrSave(int load);
    virtual int getObjectID();
    void evaluate(EvaluationParameters&amp; parameters);
    // ...
    // lots of other member functions...
    // ...
};</pre>
<p>But this new name can make you cringe. A function called <code>loadOrSave</code>? This looks like a terrible name. It&#8217;s screams that it&#8217;s in charge of two responsibilities!</p>
<p>While you&#8217;re at it, rename everything:</p>
<pre class="lang:c++ decode:true ">class Product
{
public:
    void loadOrSave(int load);
    virtual int getScreenID();
    void evaluate(EvaluationParameters&amp; parameters);
    // ...
    // lots of other member functions...
    // ...
};</pre>
<p>And this makes you cringe even more. A class that mixes DB, UI and business logic? This is the kind of counter-example we see in design books!</p>
<p>The thing is that it&#8217;s been there all along, but it was disguised behind mysterious acronyms.</p>
<p>Now you no longer have to explain what <code>rvDTP_CLASS</code>, <code>soGR</code> or <code>ObjectID</code> means. But you have a new type of problem.</p>
<h3><span style="color: #ff6600;">You unearthed skeletons</span></h3>
<p>Until now, the code looked mysterious. But making the renaming fix made it visible that the code has a poor design. If you&#8217;re in charge of this code (and you should consider yourself in charge of any code you work with), it can make you cringe even more.</p>
<p>But it is important to keep in mind that unveiling problems is a step towards fixing them.</p>
<p>Indeed, now you can better see the big picture of the class. Until now, your knowledge may have been composed of bits and pieces gleaned from individual explorations of the code, but after renaming its members, you see the class for what it is, as a whole.</p>
<p>This is the right time for deciding what to fix and when to fix it. For example in this class we&#8217;ve seen two possible improvements:</p>
<ul>
<li>separate the load from the save function</li>
<li>separate the UI, DB and business logic of the class</li>
</ul>
<p>When you do that, everything should become easier: the code will become easier to understand, explain, and unit test.</p>
<p>But instead of jumping into refactoring, make sure you&#8217;ve renamed as many things as you can in the class. Once you understand the code, renaming is fast. The more you can rename, the more quickly you can get an overview of design issues of the code.</p>
<p>Once you have a list of improvements to make, this constitutes a technical roadmap for this class.</p>
<p>Then comes the step of prioritisation: is this class the most important in your code? Are there other classes for which you should also create a roadmap?</p>
<p>If you&#8217;re working with legacy code, there may be more skeletons than you have the resources to deal with, so you need to choose which ones will bring the most value. To evaluate the value of refactoring projects and choose the best ones, refer to chapter 12 of the <a href="https://leanpub.com/legacycode/">Legacy Code Programmer&#8217;s Toolbox</a>.</p>
<h3><span style="color: #ff6600;">The power of naming</span></h3>
<p>Once you have acquired knowledge, transfer it into correct names in your code. The operation of renaming is typically fast and with very little risk.</p>
<p>Even if naming doesn&#8217;t improve the behaviour of the code per se, it is the first step towards understanding, integrating new joiners, decoupling, modularisation, unit testing, and ultimately an application that evolves faster and has less bugs.</p>
<h3>You will also like</h3>
<ul>
<li><a href="https://www.fluentcpp.com/2018/05/29/a-concrete-example-of-naming-consistency/">A Concrete Example of Naming Consistency</a></li>
<li><a href="https://www.fluentcpp.com/2017/01/30/how-to-choose-good-names/">How to choose good names in your code</a></li>
<li><a href="https://leanpub.com/legacycode/">The Legacy Code Programmer&#8217;s Toolbox</a></li>
<li><a href="https://www.joelonsoftware.com/2005/05/11/making-wrong-code-look-wrong/">Making Wrong Code Look Wrong (Joel on Software)</a></li>
</ul>
Don't want to miss out ? <strong>Follow:</strong> &nbsp&nbsp<a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Follow me on twitter" href="https://twitter.com/joboccara" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Follow me on twitter" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Find us on Linkedin" href="https://www.linkedin.com/in/jonathan-boccara-23826921/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Find us on Linkedin" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-rss nolightbox" data-provider="rss" target="_blank" rel="nofollow" title="Subscribe to our RSS Feed" href="https://www.fluentcpp.com/feed/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="rss" title="Subscribe to our RSS Feed" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/rss.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><br/>Share this post!<a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox" data-provider="facebook" target="_blank" rel="nofollow" title="Check out this post from Fluent C++" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F04%2F23%2Fmake-bad-code-look-bad%2F&#038;t=Make%20Bad%20Code%20Look%20Bad&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F04%2F23%2Fmake-bad-code-look-bad%2F&#038;p&#091;images&#093;&#091;0&#093;=&#038;p&#091;title&#093;=Make%20Bad%20Code%20Look%20Bad" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="Facebook" title="Check out this post from Fluent C++" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Tweet about this" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F04%2F23%2Fmake-bad-code-look-bad%2F&#038;text=Check%20out%20this%20post%20from%20Fluent%20C%2B%2B" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Tweet about this" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Share on Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F04%2F23%2Fmake-bad-code-look-bad%2F&#038;title=Make%20Bad%20Code%20Look%20Bad" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Share on Linkedin" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><p>The post <a href="https://www.fluentcpp.com/2021/04/23/make-bad-code-look-bad/">Make Bad Code Look Bad</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5862</post-id>	</item>
		<item>
		<title>&#8220;Can&#8217;t&#8221; Is No Word for Software Developers</title>
		<link>https://www.fluentcpp.com/2021/03/26/cant-is-no-word-for-software-developers/</link>
		
		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Fri, 26 Mar 2021 01:00:27 +0000</pubDate>
				<category><![CDATA[Attitude]]></category>
		<category><![CDATA[can't]]></category>
		<category><![CDATA[software]]></category>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=5868</guid>

					<description><![CDATA[<p>When I write those words, I&#8217;ve been working 9 years in software development. Those years have taught me technical stuff, but also a few things that are not about code itself but that leads to good code, and to more. Those non-technical things aren&#8217;t taught at school or in C++ books. Nevertheless, I consider them [&#8230;]</p>
<p>The post <a href="https://www.fluentcpp.com/2021/03/26/cant-is-no-word-for-software-developers/">&#8220;Can&#8217;t&#8221; Is No Word for Software Developers</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>When I write those words, I&#8217;ve been working 9 years in software development. Those years have taught me technical stuff, but also a few things that are not about code itself but that leads to good code, and to more.</p>
<p>Those non-technical things aren&#8217;t taught at school or in C++ books. Nevertheless, I consider them just as important to produce good code. They&#8217;re especially valuable since it took a while of professional experience (at least for me) to figure out.</p>
<p>This is one of those few posts of Fluent C++ that doesn&#8217;t show any code snippet, but shows you something necessary be a good software developer, in my opinion.</p>
<p>It&#8217;s about the word &#8220;can&#8217;t&#8221;.</p>
<h3><span style="color: #ff6600;">The C-word</span></h3>
<p>I realised the importance, frequency of usage and impact of the word &#8220;can&#8217;t&#8221; by reading <a href="https://www.amazon.com/gp/product/0062652443/ref=as_li_qf_asin_il_tl?ie=UTF8&amp;tag=fluentcpp-20&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=0062652443&amp;linkId=9e9aefe33c93fafd6cf5de073cbab6d8">Game Changers</a>. It&#8217;s a book which is not about software, but about improving various aspects of one&#8217;s life. It&#8217;s written by Dave Asprey. In this book, Dave synthesised his takeaways from podcast interviews with hundreds of individuals that changed the game in their respective fields.</p>
<p>In one of the first chapters, Dave recommends to ban, partially or completely, some words from our vocabulary. The first one is the word &#8220;can&#8217;t&#8221;, and it&#8217;s to ban completely.</p>
<p>When you say &#8220;can&#8217;t&#8221; you&#8217;re creating a limit, even if an unconscious one. You&#8217;re blocking yourself and others from achieving great things.</p>
<p>There is virtually nothing that we &#8220;can&#8217;t&#8221; achieve. Some things we haven&#8217;t figured out yet. But with thinking, time or energy, a lot of things we deem unreachable are in fact within our reach.</p>
<p>To prove his point, Dave encourages us to watch around us how often we or the people we interact with write or say &#8220;can&#8217;t&#8221;. I&#8217;ve tried, and we do say it a lot. I said it a lot.</p>
<h3><span style="color: #ff6600;">&#8220;We can&#8217;t do that&#8221;</span></h3>
<p>As a team lead one of my roles is to assess the feasibility of developments, break them down into smaller bits and find a path of execution.</p>
<p>I used to say expressions such as &#8220;this we can do&#8221; or &#8220;this we can&#8217;t do&#8221;. But this is a terrible way to express oneself.</p>
<p>If you think you also say &#8220;can&#8217;t&#8221; sometimes, let&#8217;s see how we can do better. Let&#8217;s consider the various situations where a developer says: &#8220;I can&#8217;t do that&#8221; and try to see what we really mean, and how to go beyond the arbitrary limits we fix for ourselves.</p>
<h4><span style="color: #ff6600;">We won&#8217;t have the time to do that</span></h4>
<p>If you think that there is too much to achieve given the constraints you&#8217;re given (time, budget, etc.), say so explicitly but without the word &#8220;can&#8217;t&#8221;.</p>
<p>&#8220;Can&#8217;t&#8221; creates an unnecessary limit. If you think the project you&#8217;re working on won&#8217;t give the desired results, it&#8217;s a time to negotiate with the business people (PO, PM, insert your favourite acronym here) of the company. One way is to identify the features that matter the most and deliver them first. Or check if some features are quick to implement to get their desired outcome.</p>
<p>But in any case, leave the possibilities open.</p>
<h4><span style="color: #ff6600;">We don&#8217;t know how to do that</span></h4>
<p>When you&#8217;re asked to implement a feature or fix a bug, if you tell that you don&#8217;t know how to do it, you convey a completely different message than if you tell that you can&#8217;t.</p>
<p>If you don&#8217;t know how to do something, there are ways to move forward to help you acquire that knowledge. For example you can agree to allocate a time to figure out a way, for example by:</p>
<ul>
<li>analysis the existing code,</li>
<li>brainstorming between developers,</li>
<li>discussing with architects,</li>
<li>finding a similar feature and analysing it,</li>
<li>asking more experienced developers,</li>
<li>etc.</li>
</ul>
<p>But if you say that you &#8220;can&#8217;t&#8221;, you&#8217;re closing the door to any step to move forward and eventually succeed in implementing the desired feature.</p>
<h4><span style="color: #ff6600;">We&#8217;re downright sure that this is impossible</span></h4>
<p>I once had (in essence) the following conversation with an architect called Damien:</p>
<p>&#8211; <strong>Jonathan</strong>: &#8220;I need to implement feature X, but with the framework Y that this code uses, it&#8217;s impossible.&#8221;</p>
<p>&#8211; <strong>Damien</strong>: &#8220;Is it?&#8221;</p>
<p>&#8211; <strong>Jonathan</strong>, thinking that &#8220;impossible&#8221; is in fact not far from &#8220;can&#8217;t&#8221;: &#8220;You know what, let me double check and get back to you.&#8221;</p>
<p>I <em>was</em> convinced that framework Y wouldn&#8217;t support feature X but, for all the above reasons I was also convinced that nothing is impossible for a software developer.</p>
<p>So I dug into framework Y, read more documentation, stepped through the code, thought, stepped through again, read again, thought again, tried, failed, thought again, asked around, tried again, and finally&#8230; succeeded.</p>
<p>I had found a way to implement feature X with framework Y.</p>
<p>This was a delightful experience for me who went beyond what I thought possible, for my PO who got what he was hoping for, and I think that Damien was happy too.</p>
<p>There is nothing specific to me, Damien, framework Y, feature X or my PO. This story can happen to any software developer. Our main tool is our thinking, and it can achieve more that we think (I realise now there is a recursion in this sentence, right?).</p>
<p>If you think something is impossible to achieve, think more and try again. There is a good chance it&#8217;s within your reach.</p>
<h3><span style="color: #ff6600;">&#8220;This can&#8217;t be&#8221;</span></h3>
<p>Another situation where we could be tempted to use the word &#8220;can&#8217;t&#8221; is when looking for the cause of a bug.</p>
<p>Some of the longest bugs to analyse are those where the root cause lies where we don&#8217;t think to look. In those cases, we&#8217;re so convinced of our assumptions that we think, or sometimes say aloud, that some things &#8220;can&#8217;t be&#8221;.</p>
<p>If the problem is that something we thought couldn&#8217;t be actually happened, the longer we stay convinced, the longer the debugging session.</p>
<p>When debugging, it is important to realise that the execution of code is too complex to fit in our brains, that&#8217;s why we have computers in the first place, and everything we think about how the code behave is assumptions.</p>
<p>We need those assumptions, otherwise we&#8217;d spend an infinite amount of time examining each detail. But an efficient mindset for debugging is to assume that everything is possible, and to assess the likelihood of each assumption.</p>
<p>Once again, the word &#8220;can&#8217;t&#8221; doesn&#8217;t help. In debugging, &#8220;can&#8217;t&#8221; can only lead to a waste of time and energy.</p>
<h3><span style="color: #ff6600;">&#8220;Can&#8221; will make you friends</span></h3>
<p>Beyond its dramatic effects on your achievements, the usage of &#8220;can&#8217;t&#8221; can have an impacts on your relationships with other people of the company.</p>
<p>As John Sonmez explains it in his excellent <a href="https://www.amazon.com/gp/product/1617292397/ref=as_li_qf_asin_il_tl?ie=UTF8&amp;tag=fluentcpp-20&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=1617292397&amp;linkId=83a9632f41ced0a80a4f60c5b78e47ae">Soft Skills</a>, the job of software developer is a social one. We spend a sizeable part of our day interacting with other people: other developers, QAs, business people, etc.</p>
<p>Greeting the request of somebody with a &#8220;I can&#8217;t do that&#8221; isn&#8217;t the best way to foster relationships. Compare it with &#8220;I&#8217;d like to help you, but I&#8217;m currently missing X, Y and Z to achieve what you&#8217;re asking, how could we get those?&#8221;. Doesn&#8217;t that sound better?</p>
<p>In conclusion, ban &#8220;can&#8217;t&#8221; from your vocabulary altogether. Pay attention to when you&#8217;re about to say it, or when you write it in an email. If you currently use this word, this change will make you see another aspect of software development.</p>
<h3>You will also like</h3>
<ul>
<li><a href="https://www.fluentcpp.com/2019/07/09/you-should-refuse-to-develop-what-you-dont-understand/">You Should Refuse to Develop What You Don&#8217;t Understand</a></li>
<li><a href="https://leanpub.com/legacycode/">The Legacy Code Programmer&#8217;s Toolbox</a></li>
<li>Copy-paste developments</li>
<li><a href="https://www.fluentcpp.com/2020/01/17/technical-debt-is-like-a-tetris-game/">Technical Debt Is like a Tetris Game</a></li>
</ul>
Don't want to miss out ? <strong>Follow:</strong> &nbsp&nbsp<a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Follow me on twitter" href="https://twitter.com/joboccara" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Follow me on twitter" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Find us on Linkedin" href="https://www.linkedin.com/in/jonathan-boccara-23826921/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Find us on Linkedin" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-rss nolightbox" data-provider="rss" target="_blank" rel="nofollow" title="Subscribe to our RSS Feed" href="https://www.fluentcpp.com/feed/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="rss" title="Subscribe to our RSS Feed" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/rss.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><br/>Share this post!<a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox" data-provider="facebook" target="_blank" rel="nofollow" title="Check out this post from Fluent C++" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F03%2F26%2Fcant-is-no-word-for-software-developers%2F&#038;t=%E2%80%9CCan%E2%80%99t%E2%80%9D%20Is%20No%20Word%20for%20Software%20Developers&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F03%2F26%2Fcant-is-no-word-for-software-developers%2F&#038;p&#091;images&#093;&#091;0&#093;=&#038;p&#091;title&#093;=%E2%80%9CCan%E2%80%99t%E2%80%9D%20Is%20No%20Word%20for%20Software%20Developers" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="Facebook" title="Check out this post from Fluent C++" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Tweet about this" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F03%2F26%2Fcant-is-no-word-for-software-developers%2F&#038;text=Check%20out%20this%20post%20from%20Fluent%20C%2B%2B" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Tweet about this" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Share on Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F03%2F26%2Fcant-is-no-word-for-software-developers%2F&#038;title=%E2%80%9CCan%E2%80%99t%E2%80%9D%20Is%20No%20Word%20for%20Software%20Developers" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Share on Linkedin" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><p>The post <a href="https://www.fluentcpp.com/2021/03/26/cant-is-no-word-for-software-developers/">&#8220;Can&#8217;t&#8221; Is No Word for Software Developers</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5868</post-id>	</item>
		<item>
		<title>6 Tips to Make Your Development Project More Likely to Succeed</title>
		<link>https://www.fluentcpp.com/2021/02/12/6-tips-to-make-your-development-project-more-likely-to-succeed/</link>
		
		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Fri, 12 Feb 2021 01:00:38 +0000</pubDate>
				<category><![CDATA[Attitude]]></category>
		<category><![CDATA[legacy code]]></category>
		<category><![CDATA[plan]]></category>
		<category><![CDATA[refactoring]]></category>
		<category><![CDATA[team]]></category>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=6071</guid>

					<description><![CDATA[<p>With my team we finished a large project that consisted in replacing an old technology by standard C++ patterns across our codebase. This was the largest project I&#8217;ve ever worked on. We were the four of us and it took us several weeks to root out all the usages of this old technology. In the [&#8230;]</p>
<p>The post <a href="https://www.fluentcpp.com/2021/02/12/6-tips-to-make-your-development-project-more-likely-to-succeed/">6 Tips to Make Your Development Project More Likely to Succeed</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>With my team we finished a large project that consisted in replacing an old technology by standard C++ patterns across our codebase.</p>
<p>This was the largest project I&#8217;ve ever worked on. We were the four of us and it took us several weeks to root out all the usages of this old technology. In the end, we managed to decommission it in the estimated time, and our code is now much more expressive.</p>
<p>Although the project was a resounding success, several things could have made it fail.</p>
<p>After the completion of the project we made a retrospective session, where we reflected on what we did that helped us achieve this challenging project, but also on what had set us back and could have made the project a failure.</p>
<p>You&#8217;ll find those reflections synthesised into the following 6 takeaways. They&#8217;re not specific to this project and I think they&#8217;re good practices for any development project to follow.</p>
<h3><span style="color: #ff6600;">1. Don&#8217;t let the same error happen twice</span></h3>
<p>Since our code changes spanned widely across our codebase, many tests came out red. Making a test red is not a problem in itself. After all, if we weren&#8217;t able to break them, tests would be useless.</p>
<p>What matters more is how quickly we can analyse red tests and fix them. When several hundreds of tests are red, you want to spend as much time as possible to analyse and fix each of them.</p>
<p>One way to do that is to make sure not to analyse the same type of root cause twice. Indeed, one given root cause could be repeated in the code, and be responsible for several tests being red. Saving the repeated analysis then saves some precious time.</p>
<p>Whenever you fix a bug, try and think how to make sure the same problem hasn&#8217;t happened somewhere else. And if possible, detected this automatically.</p>
<h4><span style="color: #ff6600;">Compile time detection</span></h4>
<p>The most efficient automatic detection is at compile time.</p>
<p>For example, at one intermediary step of the development, we had some <code>void*</code> pointers coming from the old technology that we had to pass to a function:</p>
<pre class="lang:c++ decode:true">void functionExpectingVoidStar(void* pointer)
{
    // ...
}</pre>
<p>We discovered once by analysing a broken test that a call site passed by mistake a wrong pointer, that happened to be typed. And since in C++ all pointers convert implicitly to a <code>void*</code>, the function accepted it the typed pointer we shouldn&#8217;t have passed it.</p>
<p>After fixing the bug by passing the <code>void*</code> in this context, we changed to interface to this:</p>
<pre class="lang:c++ decode:true ">template&lt;typename T&gt;
void functionExpectingVoidStar(T* pointer) = delete;

void functionExpectingVoidStar(void* pointer)
{
    // ...
}</pre>
<p>This way, the interface no longer accepts typed pointers (in general you want to use typed pointers rather than <code>void*</code>, but in this case we had <code>void*</code> objects to work with in the first place).</p>
<p>When rebuilding the code, all the other call sites that passed wrong pointers bubbled up in compilation errors. Fixing them at this point fixed the corresponding broken tests with no extra analysis time required.</p>
<h4><span style="color: #ff6600;">Runtime detection</span></h4>
<p>One great way to detect errors at runtime is to use asserts. A broken assert is a blessing: it gives you the stack where the problem is happening on a silver plate.</p>
<p>If you can&#8217;t detect a bug at compile time, use an assert to detect it as early as possible as runtime.</p>
<h3><span style="color: #ff6600;">2. Don&#8217;t expect too much of</span><span style="color: #ff6600;"> </span><span style="color: #ff6600;">your dev plan</span></h3>
<p>Large projects require preparation. In this particular project we had spent hours brainstorming about the best way to tackle it, how to break it down into small deliverables, and we had tried to anticipate issue and to anticipate how to solve those issues.</p>
<p>This analysis helped us craft our <strong>dev plan</strong>: the successive steps that were to lead the code from where it was to where we wanted it to be.</p>
<p>And then we started the project.</p>
<p>During the first steps, the dev plan guided us fairly well. But at some point, the reality of the code didn&#8217;t match what we had planned.</p>
<p>In this case, the thing to do immediately (I wish I did it more quickly) is to consider changing the dev plan. Or throw it away altogether if the reality is too far away from it.</p>
<p>As Sir Arthur Conan Doyle makes it say to Sherlock Holmes: “It is a capital mistake to theorize before one has data. Insensibly one begins to twist facts to suit theories, instead of theories to suit facts.”</p>
<p>There is psychological resistance against abandoning a dev plan we spent so much time crafting, and that we based on to provide estimates to the management. But if the dev plan was based on our <em>vision</em> of the code at the time, and that the code is in fact more complex, then the best course of action is to change the plan.</p>
<p>And with legacy code, the code is always more complex that you think it is. So don&#8217;t expect your dev plan to be a guide taking you by the hand to a destination. See it more like a general direction into unmapped territory.</p>
<h3><span style="color: #ff6600;">3. Verify your hypotheses</span></h3>
<p>Like we just saw, we shouldn&#8217;t expect the dev plan to guide us smoothly to the end of the project. But some things can increase the life expectancy of a dev plan. One of them is to check hypotheses.</p>
<p>A dev plan is a thought experiment: you plan the changes in code you will execute to reach an objective. To do this you make hypotheses.</p>
<p>There are at least two types of hypotheses: how the code is now, and how changes will affect it.</p>
<p>If you&#8217;re familiar with the codebase, you may be tempted to consider those hypotheses as facts. The dev plan builds on those hypotheses and if they turn out to be wrong, the dev plan crumbles.</p>
<p>So to give the best shot to your dev plan and to your project, check your hypotheses as much as possible.</p>
<p>To a large extent, you can check how the code is now. However, checking how changes will affect it is more challenging: if you start changing the code to check, then you&#8217;re starting the project itself.</p>
<p>One compromise is to make some targeted changes in a branch that you&#8217;ll throw away. This way you can poke at the code and see how it reacts, as well as the effect of your experiments on the tests.</p>
<p>Two of my structuring hypotheses turned out to be wrong in our development. I&#8217;m lucky we adapted quickly when we realised that. Since then, I&#8217;m much more careful to check my hypotheses when planning.</p>
<h3><span style="color: #ff6600;">4. Don&#8217;t let stuff build up</span></h3>
<p>We programmers love to code. And it&#8217;s easy to get carried away into coding, and focus on improving the code for days in a row.</p>
<p>But there are other things than code to monitor. For example:</p>
<ul>
<li>code reviews of the changes made by other developers on the project,</li>
<li>tests,</li>
<li>CI errors,</li>
<li>&#8230;</li>
</ul>
<p>Be sure to treat those at least on a daily basis. Letting code reviews accumulate leads to frustration for everyone: the authors are waiting for feedback on their changes, and the reviewers end up facing a mountain of code to review.</p>
<p>For other reasons, letting code accumulate without making sure the tests are green makes everything more complicated. Changes checked in recently over code that had failing tests are blocked because of those tests. And the wider the span of commits with red tests, the harder it is to pinpoint the root causes of the regressions.</p>
<p>Have a good hygiene for tests, code reviews, CI errors, and the like. Treat them on a regular basis, and don&#8217;t let them build up.</p>
<h3><span style="color: #ff6600;">5. Communicate intensely and asynchronously</span></h3>
<p>One of the things that made our project move forward quickly is the intense communication between the members of our team.</p>
<p>An interesting note is that we never saw each other during the project: it started after the coronavirus outbreak and we were working from home.</p>
<p>We&#8217;re using Microsoft Teams, and we created a channel dedicated to the project. You can do the same type of channel with Slack too.</p>
<p>The advantage a channel over email is to have all the information located at the same place. Microsoft Teams also allows to have one or more spreadsheets in a Microsoft Excel embedded in the channel itself, in the form of a tab, which is quite convenient.</p>
<p>And the advantage of a channel over sitting next to each other and talking is that we interrupt each other less: you can always finish what you&#8217;re doing before checking the notifications of the channel.</p>
<h3><span style="color: #ff6600;">6. Check in and rebase often</span></h3>
<p>Having several developers working on the same codebase is challenging. Indeed, if two people modify the same line of code, there is a merge conflict. And if one changes the code that the other calls, then there could be passing tests locally for every one, and overall a break in the tests.</p>
<p>There is no magic to solve those problems, but one way to mitigate them is to avoid as much as possible to work on stale versions of the code.</p>
<p>Check in your code often, so that others can work on top of your modifications, and not concurrently. And rebase your code often, so that you have in local the latest changes of your fellow developers.</p>
<h3><span style="color: #ff6600;">Share your tips now</span></h3>
<p>Those are the 6 tips that made the most difference for my team, on this project. I hope they&#8217;ll be useful to you too.</p>
<p>Could you share the tips that made a difference for your team, on a recent project? Leave them a comment below.</p>
<h3>You will also like</h3>
<ul>
<li><a href="https://www.fluentcpp.com/2019/07/09/you-should-refuse-to-develop-what-you-dont-understand/">You Should Refuse to Develop What You Don&#8217;t Understand</a></li>
<li><a href="https://www.fluentcpp.com/2020/03/10/3-types-of-toxic-software-projects/">3 Types of Toxic Software Projects</a></li>
<li><a href="https://www.fluentcpp.com/2019/05/28/better-macros-better-flags/">Better Macros, Better Flags</a></li>
<li><a href="https://www.fluentcpp.com/2018/04/10/maps-vectors-multimap/">Which One Is Better: Map of Vectors, or Multimap?</a></li>
</ul>
Don't want to miss out ? <strong>Follow:</strong> &nbsp&nbsp<a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Follow me on twitter" href="https://twitter.com/joboccara" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Follow me on twitter" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Find us on Linkedin" href="https://www.linkedin.com/in/jonathan-boccara-23826921/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Find us on Linkedin" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-rss nolightbox" data-provider="rss" target="_blank" rel="nofollow" title="Subscribe to our RSS Feed" href="https://www.fluentcpp.com/feed/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="rss" title="Subscribe to our RSS Feed" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/rss.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><br/>Share this post!<a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox" data-provider="facebook" target="_blank" rel="nofollow" title="Check out this post from Fluent C++" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F02%2F12%2F6-tips-to-make-your-development-project-more-likely-to-succeed%2F&#038;t=6%20Tips%20to%20Make%20Your%20Development%20Project%20More%20Likely%20to%20Succeed&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F02%2F12%2F6-tips-to-make-your-development-project-more-likely-to-succeed%2F&#038;p&#091;images&#093;&#091;0&#093;=&#038;p&#091;title&#093;=6%20Tips%20to%20Make%20Your%20Development%20Project%20More%20Likely%20to%20Succeed" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="Facebook" title="Check out this post from Fluent C++" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Tweet about this" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F02%2F12%2F6-tips-to-make-your-development-project-more-likely-to-succeed%2F&#038;text=Check%20out%20this%20post%20from%20Fluent%20C%2B%2B" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Tweet about this" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Share on Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F02%2F12%2F6-tips-to-make-your-development-project-more-likely-to-succeed%2F&#038;title=6%20Tips%20to%20Make%20Your%20Development%20Project%20More%20Likely%20to%20Succeed" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Share on Linkedin" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><p>The post <a href="https://www.fluentcpp.com/2021/02/12/6-tips-to-make-your-development-project-more-likely-to-succeed/">6 Tips to Make Your Development Project More Likely to Succeed</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">6071</post-id>	</item>
		<item>
		<title>Great Developers Don&#8217;t Just Write Great Code</title>
		<link>https://www.fluentcpp.com/2020/06/19/great-developers-dont-just-write-great-code/</link>
		
		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Fri, 19 Jun 2020 01:00:48 +0000</pubDate>
				<category><![CDATA[Attitude]]></category>
		<category><![CDATA[clean code]]></category>
		<category><![CDATA[expressive]]></category>
		<category><![CDATA[good code]]></category>
		<category><![CDATA[good developers]]></category>
		<category><![CDATA[legacy code]]></category>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=4732</guid>

					<description><![CDATA[<p>I&#8217;m assuming that, if you&#8217;re reading this, you are aspiring to become a good developer. But what is a good developer, to begin with? Let&#8217;s reflect on what we need to do in our jobs as software developers to identify what is important&#8211;and therefore what we have to master in order to become &#8220;good developers&#8221;. [&#8230;]</p>
<p>The post <a href="https://www.fluentcpp.com/2020/06/19/great-developers-dont-just-write-great-code/">Great Developers Don&#8217;t Just Write Great Code</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I&#8217;m assuming that, if you&#8217;re reading this, you are aspiring to become a good developer.</p>
<p>But what <em>is</em> a good developer, to begin with?</p>
<p>Let&#8217;s reflect on what we need to do in our jobs as software developers to identify what is important&#8211;and therefore what we have to master in order to become &#8220;good developers&#8221;.</p>
<h3><span style="color: #ff6600;">Good developers write good code</span></h3>
<p>As software developers, our mission is to ship software that works. And what is software made of? Code, of course!</p>
<p>What comes out of this simple analysis is that if you want to be a good developer, you need to be able to write <strong>good code</strong>.</p>
<p>Fine. But now we&#8217;re left with a new question: what is &#8220;good code&#8221;?</p>
<p>To answer this question, let&#8217;s think about what code it useful for. Code is what makes software, and the mission of developers is to make software that works. So following this, good code is code that works.</p>
<p>Except that there is a hundred ways to write code to make a feature work. But all those ways are not as good as each other. Note that in code that &#8220;works&#8221;, I&#8217;m also including the fact that it runs fast enough, so I&#8217;m not talking about which code has the best algorithmic complexity.</p>
<p>The differences between the various pieces of code that all &#8220;work&#8221; is their design. So good code is code that has <strong>good design</strong>.</p>
<p>Bear with me, we&#8217;re getting there. We now need to define what &#8220;good design&#8221; is.</p>
<p>Once we&#8217;ve written a piece of code that works, why does its design matter in the first place? It matters if someone is going to come back to this code. Let&#8217;s call this someone Bill. Bill can be you or can be anyone else in the company. Bill can even be someone who is not here yet but will be recruited in the future.</p>
<p>So a good design is a design that will make Bill&#8217;s life easier. As a result, a good design needs to be understandable. If we unroll the logic we&#8217;ve just built, a good developer can produce code that is <strong>understandable</strong>.</p>
<p>But this is only a part of the picture. To be a good developer you also need to do an great job when you <em>are</em> Bill.</p>
<h3><span style="color: #ff6600;">Good developers can work with any code</span></h3>
<p>How much time do you spend writing code every day? Even if you work as a professional software developer, you probably don&#8217;t spend all day coding. You probably spend more time reading code than writing it.</p>
<p>Indeed, we read code all the time. We read code to analyse it and think about how to integrate new features. We read code when we debug maintenance issues. We read code during code reviews, when writing documentation, or simply when we help out another developer with his task.</p>
<p>As software developers, we read a lot of code. We spend much more time being Bill than writing code.</p>
<p>As a result, we need to embrace our Bill&#8217;s responsibilities. On top of writing expressive code to make Bill&#8217;s life easier, we need to figure out <strong>how to work with existing code</strong>. Because that is what we do the most in our daily work. <strong>We are Bill</strong>.</p>
<h4><span style="color: #ff6600;">Understanding code</span></h4>
<p>On top of giving instructions to the machine, the purpose of code is for a developer to communicate their intent to other developers. Like we said, we write code with good design for Bill to understand.</p>
<p>But there is code out there, that is not easy to understand. A good part of this code is what we collectively call &#8220;legacy code&#8221;. If you&#8217;re a software professional, you probably have to work with legacy code.</p>
<p>I&#8217;ve worked for over 7 years in our industry, I go to a lot of conferences and user groups, some of which I&#8217;m an organizer of, and I have a <a href="https://www.fluentcpp.com">popular blog</a> about writing expressive code. With all this I get to talk with a lot of developers, and I can tell you one thing: <strong>legacy code is everywhere</strong>.</p>
<p>Since a large part of your job is about reading code, and that you get to work on tough code, to be a good developer you need to be able to read code you don&#8217;t know and quickly make some sense out of it.</p>
<p>Fortunately, there are techniques to understand unfamiliar code. Here is a practical one: when you read a function or a method for the first time, <strong>start by looking at its end </strong><b>first</b>.</p>
<p>Indeed, functions often have a progression with intermediate objects and actions, that leads to deliver a final result or effect that is located at its end. If you start by looking at that, you&#8217;ll get an idea of where the function or method is going, and it will make the reading of the rest that much easier. Sometimes, it will even save you from reading the rest at all, because you&#8217;ll have understood what the function is about.</p>
<p>Of course, to know what a function is about, its name and parameters should be enough. But there is code out there where functions don&#8217;t have a name as informative as they &#8220;should be&#8221;.</p>
<p>Peeking at the end of a function or method can save you a great deal of time. This is one of the 10 techniques to understand legacy code that are presented in <a href="https://leanpub.com/legacycode">The Legacy Code Programmer&#8217;s Toolbox</a>.</p>
<h4><span style="color: #ff6600;"><span style="caret-color: #ff6600;">Humility</span></span></h4>
<p>When you&#8217;re Bill, it can be tempting to blame the person who wrote the code you&#8217;re trying to figure out. After all, their job was to write code with good design, and if you can&#8217;t make sense out of their writing, then they didn&#8217;t do such a good job.</p>
<p>You may be right or you may be wrong. Maybe it was a difficult piece of code to write, and that we wouldn&#8217;t have done a better job if we had had to write it ourselves. Maybe we&#8217;re lacking a piece of context. Or maybe the person who wrote it didn&#8217;t find the optimal solution indeed, but who always find the optimal solutions after all?</p>
<p>The thing is that it doesn&#8217;t matter. The code is here, and it&#8217;s what you have to work with. Don&#8217;t think about whether the author did a good job or a poor job designing the code, unless you&#8217;re doing this for the explicit purpose of improving the code or improving your skills.</p>
<h4><span style="color: #ff6600;">Focus on what matters</span></h4>
<p>What does matter in your ability to be efficient when working with existing code is what you know about it. In software engineering like in many places, knowledge is power.</p>
<p>There are plenty of ways to increase your knowledge about your codebase. One of them is to write a piece of documentation on a region of code you don&#8217;t know.</p>
<p>It can seem surprising at first: if you don&#8217;t know a piece of code, how can you write anything about it?</p>
<p>If you start documenting little by little what you discover in a region of code, this will direct your research. By explaining what you just start understanding, you&#8217;ll discover questions to be answered in order to complete your explanation. This is very valuable because it gives you specific things to look for in code.</p>
<p>Little by little, your exploration goes from a random one to a a directed one. Until you know your way around the region of code.</p>
<p>Note that there are plenty of <a href="https://leanpub.com/legacycode">other practical ways</a> to increase your knowledge, and more generally to be more efficient when working with legacy code.</p>
<h3><span style="color: #ff6600;">It&#8217;s still easier to work with good code</span></h3>
<p>If we&#8217;re spending most of our time in the role of Bill, reading and working with existing code, does it matter much to be able to write good new code after all?</p>
<p>The answer is yes, because the code you produced will be used by Bill. And even if it is Bill&#8217;s responsibility to be able to work with any code, you want to make his work as easy as possible.</p>
<p>Writing code is about writing more than about code. You send a clear message, you reader open their eyes wide, and you hope that you guys will meet in the middle.</p>
<h3>You will also like</h3>
<ul>
<li><a href="https://leanpub.com/legacycode/">The Legacy Code Programmer&#8217;s Toolbox</a></li>
<li><a href="https://www.fluentcpp.com/2019/02/01/the-legacy-code-programmers-toolbox-is-out/">The Legacy Code Programmer&#8217;s Toolbox is out</a></li>
<li><a href="https://www.fluentcpp.com/2016/12/15/respect-levels-of-abstraction/">It all comes down to respecting levels of abstraction</a></li>
</ul>
Don't want to miss out ? <strong>Follow:</strong> &nbsp&nbsp<a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Follow me on twitter" href="https://twitter.com/joboccara" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Follow me on twitter" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Find us on Linkedin" href="https://www.linkedin.com/in/jonathan-boccara-23826921/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Find us on Linkedin" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-rss nolightbox" data-provider="rss" target="_blank" rel="nofollow" title="Subscribe to our RSS Feed" href="https://www.fluentcpp.com/feed/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="rss" title="Subscribe to our RSS Feed" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/rss.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><br/>Share this post!<a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox" data-provider="facebook" target="_blank" rel="nofollow" title="Check out this post from Fluent C++" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.fluentcpp.com%2F2020%2F06%2F19%2Fgreat-developers-dont-just-write-great-code%2F&#038;t=Great%20Developers%20Don%E2%80%99t%20Just%20Write%20Great%20Code&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.fluentcpp.com%2F2020%2F06%2F19%2Fgreat-developers-dont-just-write-great-code%2F&#038;p&#091;images&#093;&#091;0&#093;=&#038;p&#091;title&#093;=Great%20Developers%20Don%E2%80%99t%20Just%20Write%20Great%20Code" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="Facebook" title="Check out this post from Fluent C++" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Tweet about this" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.fluentcpp.com%2F2020%2F06%2F19%2Fgreat-developers-dont-just-write-great-code%2F&#038;text=Check%20out%20this%20post%20from%20Fluent%20C%2B%2B" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Tweet about this" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Share on Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.fluentcpp.com%2F2020%2F06%2F19%2Fgreat-developers-dont-just-write-great-code%2F&#038;title=Great%20Developers%20Don%E2%80%99t%20Just%20Write%20Great%20Code" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Share on Linkedin" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><p>The post <a href="https://www.fluentcpp.com/2020/06/19/great-developers-dont-just-write-great-code/">Great Developers Don&#8217;t Just Write Great Code</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4732</post-id>	</item>
		<item>
		<title>How Can Developers Help Fight Coronavirus?</title>
		<link>https://www.fluentcpp.com/2020/03/16/how-can-developers-help-fight-coronavirus/</link>
		
		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Mon, 16 Mar 2020 09:21:21 +0000</pubDate>
				<category><![CDATA[Attitude]]></category>
		<category><![CDATA[coronavirus]]></category>
		<category><![CDATA[developers]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[software]]></category>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=5903</guid>

					<description><![CDATA[<p>Coronavirus is now transforming our lives one a day-to-day basis. As I write these lines, it is killing hundreds, infecting thousands, and scaring billions. Countries are locking down, the stock market is in free fall and all events are getting cancelled. On my end, I&#8217;m currently fighting the spread of the virus by: washing my hands [&#8230;]</p>
<p>The post <a href="https://www.fluentcpp.com/2020/03/16/how-can-developers-help-fight-coronavirus/">How Can Developers Help Fight Coronavirus?</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Coronavirus is now transforming our lives one a day-to-day basis. As I write these lines, it is killing hundreds, infecting thousands, and scaring billions. Countries are locking down, the stock market is in free fall and all events are getting cancelled.</p>
<p>On my end, I&#8217;m currently fighting the spread of the virus by:</p>
<ul>
<li>washing my hands often,</li>
<li>working from home,</li>
<li>limiting my interactions with other people.</li>
</ul>
<p>But apart from that, I&#8217;m sitting on my (carefully washed) hands and doing nothing to help.</p>
<p>The French President told us that the lives of the elderly are threatened. This means that our families are in danger, and in the meantime I&#8217;m just using soap and staying away from people.</p>
<p>On the other hand, we developers have valuable skills:</p>
<ul>
<li>we can read code,</li>
<li>we can write code,</li>
<li>we&#8217;re used to learning stuff.</li>
</ul>
<p>And with code, we can do <em>anything</em>.</p>
<p>For that reason, I am convinced that we can help fight coronavirus with software. I don&#8217;t know how yet, as I&#8217;m not in the medical software industry, and this is the point of sharing this post with you.</p>
<h3><span style="color: #ff6600;">What software projects</span><span style="color: #ff6600;"> fight coronavirus?</span></h3>
<p>What are the software projects that developers can contribute to, in order to fight coronavirus? Maybe&#8230;</p>
<ul>
<li>Epidemiology software, to analyse the spread?</li>
<li>Genetics software, to better understand how the virus works?</li>
<li>ICU software, to help doctors resuscitate people that are in bad condition?</li>
<li>ER software, to handle the massive influx of people needing care?</li>
<li>Any other software?</li>
</ul>
<p>The above are just my layman&#8217;s assumptions, they&#8217;re probably incorrect and incomplete.</p>
<p>What I&#8217;m sure of though, is that some software projects matter out there, and that we&#8217;re thousands of developers that are able to advance those projects.</p>
<p>We&#8217;re representing a considerable workforce with our spare time, and also because I&#8217;m sure some companies will be happy to lend some working time of their developers in order to help them save lives, get us out of this weird period, and restore business as usual.</p>
<p>Healthcare professionals are actively fighting coronavirus, dedicating their lives to it. Most of them are helping individuals. We developers can help with our skills too, as software scales and impacts lots of people.</p>
<h3><span style="color: #ff6600;">Help by sharing</span></h3>
<p>As as see it, you have 3 options now:</p>
<p><strong>Option 1</strong>: you know of a software project that helps fight coronavirus. Be it open source or proprietary, share it with us in the comments section below. And share this post (Twitter, Reddit, HN, LinkedIn, FB, email your colleagues&#8230;) so that more people can contribute.</p>
<p><strong>Option 2</strong>: you don&#8217;t know any software that helps fight coronavirus but you also believe that developers can help. Share this post (Twitter, Reddit, HN, LinkedIn, FB, email your colleagues&#8230;) so that it reaches people working on those projects.</p>
<p><strong>Option 3</strong>: you don&#8217;t think developers can make a significant change in the coronavirus situation. Then wash your hands and stay away from people!</p>
<p>In solidarity with all the cancelled C++ events, and since we&#8217;re all focused on adjusting to protect ourselves and our families, there won&#8217;t be posts on Fluent C++ for a few days (Patrons continue to receive their ebooks and articles though). And also because I want you to come back to this post and check how the comments section grows. Better yet, subscribe to the comments in the discussion, by clicking the Subscribe button at the bottom left of the comments thread.</p>
<p>On Twitter, use the #CodeAgainstCOVID19 hashtag.</p>
<p>This is the first time most of us see such a thing in our life. The world is shutting down. Let&#8217;s do what we do best to help save it: <strong>code</strong>.</p>
Don't want to miss out ? <strong>Follow:</strong> &nbsp&nbsp<a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Follow me on twitter" href="https://twitter.com/joboccara" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Follow me on twitter" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Find us on Linkedin" href="https://www.linkedin.com/in/jonathan-boccara-23826921/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Find us on Linkedin" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-rss nolightbox" data-provider="rss" target="_blank" rel="nofollow" title="Subscribe to our RSS Feed" href="https://www.fluentcpp.com/feed/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="rss" title="Subscribe to our RSS Feed" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/rss.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><br/>Share this post!<a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox" data-provider="facebook" target="_blank" rel="nofollow" title="Check out this post from Fluent C++" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.fluentcpp.com%2F2020%2F03%2F16%2Fhow-can-developers-help-fight-coronavirus%2F&#038;t=How%20Can%20Developers%20Help%20Fight%20Coronavirus%3F&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.fluentcpp.com%2F2020%2F03%2F16%2Fhow-can-developers-help-fight-coronavirus%2F&#038;p&#091;images&#093;&#091;0&#093;=https%3A%2F%2Fi0.wp.com%2Fwww.fluentcpp.com%2Fwp-content%2Fuploads%2F2020%2F03%2Fcoronavirus.png%3Ffit%3D800%252C450%26ssl%3D1&#038;p&#091;title&#093;=How%20Can%20Developers%20Help%20Fight%20Coronavirus%3F" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="Facebook" title="Check out this post from Fluent C++" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Tweet about this" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.fluentcpp.com%2F2020%2F03%2F16%2Fhow-can-developers-help-fight-coronavirus%2F&#038;text=Check%20out%20this%20post%20from%20Fluent%20C%2B%2B" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Tweet about this" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Share on Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.fluentcpp.com%2F2020%2F03%2F16%2Fhow-can-developers-help-fight-coronavirus%2F&#038;title=How%20Can%20Developers%20Help%20Fight%20Coronavirus%3F" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Share on Linkedin" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><p>The post <a href="https://www.fluentcpp.com/2020/03/16/how-can-developers-help-fight-coronavirus/">How Can Developers Help Fight Coronavirus?</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5903</post-id>	</item>
	</channel>
</rss>
