<?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/"
	>

<channel>
	<title>Refactoring &#8211; CS@Worcester</title>
	<atom:link href="https://cs.worcester.edu/category/refactoring/feed/" rel="self" type="application/rss+xml" />
	<link>https://cs.worcester.edu</link>
	<description>Worcester State University Computer Science Department</description>
	<lastBuildDate>Sun, 22 Sep 2019 15:21:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
<site xmlns="com-wordpress:feed-additions:1">236835116</site>	<item>
		<title>Refactoring: Spring Cleaning for Code</title>
		<link>https://wurmpress.wordpress.com/2019/09/22/refactoring-spring-cleaning-for-code/</link>
		
		<dc:creator><![CDATA[wurmpress]]></dc:creator>
		<pubDate>Sun, 22 Sep 2019 15:21:48 +0000</pubDate>
				<category><![CDATA[CS-343]]></category>
		<category><![CDATA[CS@Worcester]]></category>
		<category><![CDATA[cswsu]]></category>
		<category><![CDATA[Refactoring]]></category>
		<category><![CDATA[software design]]></category>
		<category><![CDATA[Week 3]]></category>
		<guid isPermaLink="false">http://wurmpress.wordpress.com/?p=86</guid>

					<description><![CDATA[Depending upon the subject, some of us are lucky to finish a functioning project so the thought of improving code after the fact &#8211; especially if there&#8217;s a new project due soon &#8211; is a distant one. However, they may be tricked into refactoring their code if asked when you say the magic words: &#8220;Refactoring [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Depending upon the subject, some of us are lucky to finish a functioning project so the thought of improving code after the fact – especially if there’s a new project due soon – is a distant one. However, they may be tricked into refactoring their code if asked when you say the magic words: “Refactoring is not rewriting code”. The definition, as defined by its creator is:</p>
<hr class="wp-block-separator is-style-dots" />
<p><em>“a change [or changes] made to the<br />
internal structure of software to make it easier to understand and cheaper to<br />
modify without changing observable behavior.”</em> </p>
<hr class="wp-block-separator is-style-dots" />
<p>In<br />
reality, the process may involve:</p>
<ul>
<li>new<br />
code, but it must not change the behavior of the original code;</li>
<li>ensuring<br />
the system works before and after each refactor, including original unit tests;</li>
<li>creating<br />
unit tests to verify our refactoring has not changed system behavior;</li>
<li>changes<br />
that individually are minute, but combined lead to a healthier program;</li>
<li>eliminating<br />
duplicate code, potentially changing variable names, and more.</li>
</ul>
<p>It is not<br />
simply cleaning up code, but rather reorganizing it in order to make it easier<br />
to trace and understand, as well as add functionality to in the future. </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For our purposes, this may be a very<br />
important concept to learn but it may be some time before we get to implement<br />
it, unless we’re coding or maintaining an entire program for our capstone; however,<br />
it is important to understand when to do so. According to my sources, the best<br />
time to do so is before you add new features to an existing program, or right<br />
after you’ve already shipped it. For the former, it makes these new features much<br />
easier to add when the program is much more readable and makes the program better<br />
for having made the changes. As for the latter, it makes a lot of sense to<br />
snoop around for ways to reorganize code after you’ve spent so much time on it,<br />
and in a mad dash to finish it towards the end no doubt. Years’ worth of work<br />
is no doubt going to have some inconsistencies that fell through the cracks in<br />
the course of development.</p>
<p>              As for implementing these changes, there are several methods, including Red-Green-Refactor, Abstraction, Simplifying Methods, as well as many others we won’t cover. In R-G-R, <strong>red</strong> means stop and determine what to develop – usually with a new test that fails, getting this new development to pass tests (<strong>green</strong>), and finally <strong>refactoring</strong> to optimize. Abstraction is used to address duplicate code and can be done by restructuring hierarchies using the <strong>Pull-Up</strong> [pulling up code into a superclass to be shared more effectively] or <strong>Push-Down</strong> [pushing down code to more subclasses from a superclass] method. Finally, Simplifying Methods is an effort to simplify older code by consolidation and reducing interclass complexity. Hopefully this helps develop an understand of refactoring, in fact, I had to do quite a lot of refactoring to this blog to get it down to size!</p>
<hr class="wp-block-separator is-style-wide" />
<h3 class="has-text-align-center">Sources:</h3>
<p><a href="https://www.refactoring.com/">Refactoring – Martin Fowler</a><br /><a href="https://www.agilealliance.org/glossary/refactoring/#q=~(infinite~false~filters~(postType~(~'page~'post~'aa_book~'aa_event_session~'aa_experience_report~'aa_glossary~'aa_research_paper~'aa_video)~tags~(~'refactoring))~searchTerm~'~sort~false~sortDirection~'asc~page~1)">Refactoring – Agile Alliance</a><br /><a href="https://www.altexsoft.com/blog/engineering/code-refactoring-best-practices-when-and-when-not-to-do-it/">Code Refactoring Best Practices: When (and When Not) to Do It</a></p>

<p class="syndicated-attribution"><em>From the blog <a href="https://wurmpress.wordpress.com">CS@Worcester – Press Here for Worms</a> by <a href="https://cs.worcester.edu/author/0/" title="Read other posts by wurmpress">wurmpress</a></em> and used with permission of the author. All other rights reserved by the author.</p>]]></content:encoded>
					
		
		<enclosure url="https://0.gravatar.com/avatar/09b084adfb2a20f1a1e9ebddd2b0482b?s=96&#038;d=identicon&#038;r=G" length="0" type="" />

		<post-id xmlns="com-wordpress:feed-additions:1">11919</post-id>	</item>
	</channel>
</rss>
