<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Refactoring on about:rileycsillag fka drewcsillag</title>
		<link>https://riley.thecsillags.com/categories/refactoring/</link>
		<description>Recent content in Refactoring on about:rileycsillag fka drewcsillag</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
		
			<lastBuildDate>Mon, 19 Aug 2019 21:55:48 -0400</lastBuildDate>
		
			<atom:link href="https://riley.thecsillags.com/categories/refactoring/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Defunctionalizing Quicksort</title>
				<link>https://riley.thecsillags.com/posts/2019-08-19-defunctionalizing_quicksort/</link>
				<pubDate>Mon, 19 Aug 2019 21:55:48 -0400</pubDate>
				<guid>https://riley.thecsillags.com/posts/2019-08-19-defunctionalizing_quicksort/</guid>
				<description>&lt;p&gt;I&amp;rsquo;ve know for a long time that you could convert any iterative function to be&#xA;recursive and vice versa, but up until recently, I only knew how to go from&#xA;iterative to recursive in a mostly formulaic way.&lt;/p&gt;&#xA;&lt;p&gt;I recently saw a cool &lt;a href=&#34;http://www.pathsensitive.com/2019/07/the-best-refactoring-youve-never-heard.html&#34;&gt;presentation&lt;/a&gt;&#xA;where he shows a refactoring to deterministically (at least AFAICT) go from a&#xA;recursive function to an iterative one. It took me a bit of rewatching and&#xA;fiddling as to how to apply it, but now having done a few exercises, I have a&#xA;good feel for it, and I thought perhaps using a slightly more involved example&#xA;might help explain it to others.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Single Return Considered Harmful</title>
				<link>https://riley.thecsillags.com/posts/2015-09-29-single-return-considered-harmful/</link>
				<pubDate>Tue, 29 Sep 2015 12:00:00 -0400</pubDate>
				<guid>https://riley.thecsillags.com/posts/2015-09-29-single-return-considered-harmful/</guid>
				<description>&lt;p&gt;It&amp;rsquo;s funny sometimes how when you&amp;rsquo;ve done something in a particular&#xA;way for long enough, it&amp;rsquo;s easy to forget why you do it the way you do.&#xA;I&amp;rsquo;ve been a big fan of early return for a long time and was recently&#xA;challenged on my view. The argument I had received in favor of single&#xA;return was dubious to me, but it&amp;rsquo;s always good to recheck why you do&#xA;something when you&amp;rsquo;ve forgotten.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Refactoring Serial Calls To Leaf Calls</title>
				<link>https://riley.thecsillags.com/posts/2014-12-22-serial-to-leaf-refactoring/</link>
				<pubDate>Mon, 22 Dec 2014 12:04:31 -0400</pubDate>
				<guid>https://riley.thecsillags.com/posts/2014-12-22-serial-to-leaf-refactoring/</guid>
				<description>&lt;p&gt;When dealing with the problem of a&#xA;&lt;a href=&#34;http://en.wikipedia.org/wiki/Code_smell&#34;&gt;long method&lt;/a&gt;, the simplest thing&#xA;you can usually do is to break it into it&amp;rsquo;s conceptual pieces and have a&#xA;series of tail called functions that call the next chunk of the computation.&lt;/p&gt;&#xA;&lt;p&gt;So given this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;private&lt;/span&gt; Thing &lt;span style=&#34;color:#268bd2&#34;&gt;methodThatIsTooLong&lt;/span&gt;(TypeThing arg1, OtherType arg2) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   &lt;span style=&#34;color:#586e75&#34;&gt;// chunk1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   &lt;span style=&#34;color:#586e75&#34;&gt;// chunk2&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   &lt;span style=&#34;color:#586e75&#34;&gt;// ....&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   &lt;span style=&#34;color:#586e75&#34;&gt;// chunkN&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You get:&lt;/p&gt;</description>
			</item>
			<item>
				<title>Refactoring Flow Control And Conditionals</title>
				<link>https://riley.thecsillags.com/posts/2014-04-14-refactoring-flow-control-and-conditionals/</link>
				<pubDate>Mon, 14 Apr 2014 16:28:14 -0400</pubDate>
				<guid>https://riley.thecsillags.com/posts/2014-04-14-refactoring-flow-control-and-conditionals/</guid>
				<description>&lt;p&gt;In the course of reading various design patterns and refactoring books&#xA;(like&#xA;&lt;a href=&#34;http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672/ref=sr_1_1?ie=UTF8&amp;amp;qid=1397507462&amp;amp;sr=8-1&amp;amp;keywords=refactoring&#34;&gt;Refactoring&lt;/a&gt;),&#xA;I noticed while flow control is sorta mentioned here and there, it&amp;rsquo;s&#xA;not addressed especially well.  It mostly encourages things like&#xA;&lt;a href=&#34;http://refactoring.com/catalog/replaceConditionalWithPolymorphism.html&#34;&gt;replacing conditional with polymorphism&lt;/a&gt;&#xA;and &lt;a href=&#34;http://refactoring.com/catalog/replaceNestedConditionalWithGuardClauses.html&#34;&gt;replace nested conditional with guard clauses&lt;/a&gt;&#xA;and the like, rather than finding ways to straighten out and clarify&#xA;code that contains flow control and conditionals.&lt;/p&gt;&#xA;&lt;!-- more --&gt;&#xA;&lt;p&gt;One of my thoughts on flow control and conditionals follows one of the rules of the &lt;a href=&#34;http://legacy.python.org/dev/peps/pep-0020/&#34;&gt;Zen of Python&lt;/a&gt;:&lt;/p&gt;</description>
			</item>
			<item>
				<title>The Cult Of Abstraction</title>
				<link>https://riley.thecsillags.com/posts/2014-04-10-cult-of-abstraction/</link>
				<pubDate>Thu, 10 Apr 2014 15:43:55 -0400</pubDate>
				<guid>https://riley.thecsillags.com/posts/2014-04-10-cult-of-abstraction/</guid>
				<description>&lt;p&gt;Given that people can get really touchy on the subject, let me state&#xA;this up front: &lt;strong&gt;I&amp;rsquo;m not saying we should tolerate lousy code&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Over the course of my career, I&amp;rsquo;ve seen something that I will call&#xA;&amp;ldquo;the cult of abstraction.&amp;rdquo;  On the surface, this sounds like a good&#xA;thing, until you need to debug their code.  While on the surface, it&amp;rsquo;s&#xA;all nice and pretty, and uses classic design patterns, when you&#xA;actually want to find out what it does, you discover that:&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
