<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://commons.oreilly.com/wiki/skins/common/feed.css?97"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;action=history&amp;feed=atom</id>
		<title>Structure over Function - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;action=history&amp;feed=atom"/>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;action=history"/>
		<updated>2013-05-24T04:32:03Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.11.0</generator>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=25311&amp;oldid=prev</id>
		<title>Kevlin at 12:17, 17 August 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=25311&amp;oldid=prev"/>
				<updated>2009-08-17T12:17:00Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 12:17, 17 August 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning to program, the function of a piece of code is the most important thing to get right&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, once you have mastered the syntax of the programming language&lt;/del&gt;. It feels great to pass the hurdle of getting a program to actually &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;quot;&lt;/del&gt;run&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;quot; &lt;/del&gt;and do what you intended. Unfortunately, that &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;first &lt;/del&gt;satisfaction with your programming skills can be misleading. Programs that (seem to) work are necessary but not sufficient for your life as a good programmer.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning to program&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, once you have mastered the syntax of the programming language&lt;/ins&gt;, the function of a piece of code is the most important thing to get right. It feels great to pass the hurdle of getting a program to actually &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;run&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/ins&gt;and do what you intended. Unfortunately, that &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;initial &lt;/ins&gt;satisfaction with your programming skills can be misleading. Programs that (seem to) work are necessary but not sufficient for your life as a good programmer.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So what is missing?&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So what is missing?&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;You &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;or &lt;/del&gt;others will have to read, understand, use and modify your program code. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Evolution and change of &lt;/del&gt;code &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;is &lt;/del&gt;inevitable. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Thus, you &lt;/del&gt;need to ensure that your code can evolve while its functionality survives.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;You &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and &lt;/ins&gt;others will have to read, understand, use&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;and modify your program code. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Changes to &lt;/ins&gt;code &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;are &lt;/ins&gt;inevitable. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;You therefore &lt;/ins&gt;need to ensure that your code can evolve while its functionality survives.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;One of the most &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;dominant &lt;/del&gt;barriers to evolution is the code's structure.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;One of the most &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;significant &lt;/ins&gt;barriers to evolution is the code's structure. Significant structure exists at many levels: the number and order of statements in a function, loop and conditional blocks; the nesting within control structures; the functions within a module or class; the relationships between one piece of code and others; the partitioning and dependencies between classes, modules and subsystems &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;its &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;overall &lt;/ins&gt;design and architecture.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Significant structure exists at many levels: the number and order of statements in a function, loop and conditional blocks; the nesting within control structures; the functions within a module or class; the relationships between one piece of code and others; the partitioning and dependencies between classes, modules and subsystems&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;: &lt;/del&gt;its design and architecture.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Bad structure hindering &lt;/del&gt;change comes in many different species. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;An easy &lt;/del&gt;taxonomy of code structure &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;are &lt;/del&gt;the Single Responsibility Principle &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;(high cohesion&lt;/del&gt;) and low coupling. Both are easy to measure and understand &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;but &lt;/del&gt;very hard to achieve. Violation of these principles is contagious, so without an antidote, code &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;using badly &lt;/del&gt;structured code tends to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;get &lt;/del&gt;degenerate &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;structure &lt;/del&gt;as well. Take low cohesion and high coupling or metrics showing structural disorder as symptoms to be remedied.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Hindrance to &lt;/ins&gt;change &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;from poor structure &lt;/ins&gt;comes in many different species. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;The simplest &lt;/ins&gt;taxonomy of code structure &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;is in terms of high cohesion (i.e., &lt;/ins&gt;the Single Responsibility Principle) and low coupling. Both are easy to measure and understand&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, and yet &lt;/ins&gt;very hard to achieve. Violation of these principles is contagious, so without an antidote, code &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;that depends on other, poorly &lt;/ins&gt;structured code tends to degenerate as well. Take low cohesion and high coupling&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;or &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;other &lt;/ins&gt;metrics showing structural disorder&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;as symptoms to be &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;diagnosed and &lt;/ins&gt;remedied.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Refactoring is the treatment to improve code structure. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Test &lt;/del&gt;automation and version control provide safety, so that treatment does no harm or can be easily undone. &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Refactoring is the treatment to improve code structure. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Automated refactoring, test &lt;/ins&gt;automation&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;and version control provide safety, so that treatment does no harm or can be easily undone.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;While the need to refactor is almost inevitable&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/del&gt;because we learn about better solutions while we program&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/del&gt;there are also preventive measures &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;in addition to &lt;/del&gt;make refactoring less expensive and burdensome.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;While the need to refactor is almost inevitable &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;because we learn about better solutions while we program &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;there are also preventive measures &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;that &lt;/ins&gt;make refactoring less expensive and burdensome.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Bad &lt;/del&gt;structure can occur at all levels, good structure &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;starts &lt;/del&gt;from the ground up. Keep your program code clean and understandable from the statement level &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;up&lt;/del&gt;. Consider your code as not &amp;quot;working&amp;quot; unless it is actually working in a way that you and other programmers can easily understand and evolve &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;it&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Initially a &lt;/del&gt;user might not recognize bad structure, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;as &lt;/del&gt;long as functionality is available, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;but &lt;/del&gt;evolving the system might not happen at &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;a &lt;/del&gt;pace the user &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;desired, &lt;/del&gt;once structural decay &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;happens &lt;/del&gt;in &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;its &lt;/del&gt;code.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Where poor &lt;/ins&gt;structure can occur at all levels, good structure &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;builds &lt;/ins&gt;from the ground up. Keep your program code clean and understandable from the statement level &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;to the coarsest partitioning&lt;/ins&gt;. Consider your code as &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;not&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/ins&gt;&amp;quot;working&amp;quot; unless it is actually working in a way that you and other programmers can easily understand and evolve. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;A &lt;/ins&gt;user might not &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;initially &lt;/ins&gt;recognize bad structure, &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;so &lt;/ins&gt;long as functionality is available&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. However&lt;/ins&gt;, evolving the system might not happen at &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;the &lt;/ins&gt;pace the user &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;expects or desires &lt;/ins&gt;once structural decay in &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;the &lt;/ins&gt;code &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;sets in&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Keep your code well organized. Program deliberately. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;Refactor mercilessly towards DRY code. Use &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Patterns &lt;/del&gt;and simplicity to guide your efforts to improve the code's structure. Understand and evolve a system's architecture towards doing more with less code. Avoid too much up-front genericity and refactor away from laborious specific solutions repeating code. &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Keep your code well organized. Program deliberately. Refactor mercilessly towards DRY code. Use &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;patterns &lt;/ins&gt;and simplicity to guide your efforts to improve the code's structure. Understand and evolve a system's architecture towards doing more with less code. Avoid too much up-front genericity and refactor away from laborious specific solutions repeating code. &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;As a professional programmer you will know that function is important, but you need to focus on structural improvement when programming, if your system &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;grows &lt;/del&gt;beyond &amp;quot;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;hello world&lt;/del&gt;&amp;quot;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'s size.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;As a professional programmer you will know that function is important, but you need to focus on structural improvement when programming, if your system &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;is to grow &lt;/ins&gt;beyond &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;the scale of &lt;/ins&gt;&amp;quot;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Hello, World!&lt;/ins&gt;&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;by [[Peter Sommerlad]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;by [[Peter Sommerlad]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:25260:newid:25311 --&gt;
&lt;/table&gt;</summary>
		<author><name>Kevlin</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=25260&amp;oldid=prev</id>
		<title>PeterSommerlad: try rephrasing, do not know if metaphors work?</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=25260&amp;oldid=prev"/>
				<updated>2009-08-14T08:46:24Z</updated>
		
		<summary type="html">&lt;p&gt;try rephrasing, do not know if metaphors work?&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 08:46, 14 August 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning to program, the function of a piece of code is the most important thing to get right once you have mastered the syntax of the programming language. It feels great to pass the hurdle of getting a program to actually &amp;quot;run&amp;quot; and do what you intended. Unfortunately, that first satisfaction with your programming skills can be misleading. Programs that (seem to) work are necessary but not sufficient for your life as a good programmer.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning to program, the function of a piece of code is the most important thing to get right&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;once you have mastered the syntax of the programming language. It feels great to pass the hurdle of getting a program to actually &amp;quot;run&amp;quot; and do what you intended. Unfortunately, that first satisfaction with your programming skills can be misleading. Programs that (seem to) work are necessary but not sufficient for your life as a good programmer.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So what is missing?&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So what is missing?&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;One of the most dominant barriers to evolution is the code's structure.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;One of the most dominant barriers to evolution is the code's structure.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Significant structure exists at many levels: the number and order of statements in a function, loop and conditional blocks; the nesting within control structures; the functions within a module or class; the relationships between one piece of code and others; the partitioning and dependencies between classes, modules and subsystems: its architecture.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Significant structure exists at many levels: the number and order of statements in a function, loop and conditional blocks; the nesting within control structures; the functions within a module or class; the relationships between one piece of code and others; the partitioning and dependencies between classes, modules and subsystems: its &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;design and &lt;/ins&gt;architecture.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Bad structure hindering change comes in many different species. An easy taxonomy of code structure are the Single Responsibility Principle (high cohesion) and low coupling. Both are easy to measure and understand but very hard to achieve. Violation of these principles is contagious, so without an antidote code using badly structured code tends to get degenerate structure as well. Take &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;the Refactoring medicine &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;improve code structure&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Bad structure hindering change comes in many different species. An easy taxonomy of code structure are the Single Responsibility Principle (high cohesion) and low coupling. Both are easy to measure and understand but very hard to achieve. Violation of these principles is contagious, so without an antidote&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;code using badly structured code tends to get degenerate structure as well. Take &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;low cohesion and high coupling or metrics showing structural disorder as symptoms &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;be remedied&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;While bad &lt;/del&gt;structure &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;can occur at all levels, good structure starts from the ground up&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Keep your program code clean &lt;/del&gt;and &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;understandable from the statement level up. Consider your code as not &amp;quot;working&amp;quot; unless it is actually working in a way &lt;/del&gt;that &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;you and other programmers &lt;/del&gt;can easily &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;understand and evolve it&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Refactoring is the treatment to improve code &lt;/ins&gt;structure. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Test automation &lt;/ins&gt;and &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;version control provide safety, so &lt;/ins&gt;that &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;treatment does no harm or &lt;/ins&gt;can &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;be &lt;/ins&gt;easily &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;undone&lt;/ins&gt;. &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Keep your code &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;well organized&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Take low cohesion &lt;/del&gt;and &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;high coupling or metrics showing structural disorder &lt;/del&gt;as &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;symptoms to be remedied&lt;/del&gt;. Refactor mercilessly &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;toward &lt;/del&gt;DRY code. Use Patterns and simplicity to guide your efforts to improve the code's structure. Understand and evolve a system's architecture.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;While the need to refactor is almost inevitable, because we learn about better solutions while we program, there are also preventive measures in addition to make refactoring less expensive and burdensome.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Bad structure can occur at all levels, good structure starts from the ground up. &lt;/ins&gt;Keep your &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;program &lt;/ins&gt;code &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;clean and understandable from the statement level up&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Consider your code as not &amp;quot;working&amp;quot; unless it is actually working in a way that you &lt;/ins&gt;and &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;other programmers can easily understand and evolve it. Initially a user might not recognize bad structure, &lt;/ins&gt;as &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;long as functionality is available, but evolving the system might not happen at a pace the user desired, once structural decay happens in its code.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Keep your code well organized. Program deliberately&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; &lt;/ins&gt;Refactor mercilessly &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;towards &lt;/ins&gt;DRY code. Use Patterns and simplicity to guide your efforts to improve the code's structure. Understand and evolve a system's architecture &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;towards doing more with less code. Avoid too much up-front genericity and refactor away from laborious specific solutions repeating code&lt;/ins&gt;. &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;As a professional programmer you will know that function is important, but you need to focus on structural improvement when programming, if your system grows beyond &amp;quot;hello world&amp;quot;'s size.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;As a professional programmer you will know that function is important, but you need to focus on structural improvement when programming, if your system grows beyond &amp;quot;hello world&amp;quot;'s size.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:25256:newid:25260 --&gt;
&lt;/table&gt;</summary>
		<author><name>PeterSommerlad</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=25256&amp;oldid=prev</id>
		<title>PeterSommerlad: an attempt to finish it</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=25256&amp;oldid=prev"/>
				<updated>2009-08-12T13:54:50Z</updated>
		
		<summary type="html">&lt;p&gt;an attempt to finish it&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 13:54, 12 August 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;You or others will have to read, understand, use and modify your program code. Evolution and change of code is inevitable. Thus, you need to ensure that your code can evolve while its functionality survives.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;You or others will have to read, understand, use and modify your program code. Evolution and change of code is inevitable. Thus, you need to ensure that your code can evolve while its functionality survives.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Code needs &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;be clean to allow smooth &lt;/del&gt;evolution&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. Cleanliness means good &lt;/del&gt;structure. Significant structure exists at many levels: the number and order of statements in a function, loop and conditional blocks; the nesting within control structures; the functions within a module or class; the relationships between one piece of code and others; the partitioning and dependencies between classes, modules and subsystems.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;One of the most dominant barriers &lt;/ins&gt;to evolution &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;is the code's &lt;/ins&gt;structure.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Significant structure exists at many levels: the number and order of statements in a function, loop and conditional blocks; the nesting within control structures; the functions within a module or class; the relationships between one piece of code and others; the partitioning and dependencies between classes, modules and subsystems&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;: its architecture&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;One of the most dominant barriers to evolution is the code's structure. &lt;/del&gt;Bad structure hindering change comes in many different species. An easy taxonomy of code structure are the Single Responsibility Principle (high cohesion) and low coupling. Both are easy to measure and understand but very hard to achieve. Violation of these principles is contagious, so without an antidote code using badly structured code tends to get degenerate structure as well.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Bad structure hindering change comes in many different species. An easy taxonomy of code structure are the Single Responsibility Principle (high cohesion) and low coupling. Both are easy to measure and understand but very hard to achieve. Violation of these principles is contagious, so without an antidote code using badly structured code tends to get degenerate structure as well&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. Take the Refactoring medicine to improve code structure&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Bad &lt;/del&gt;structure can occur at all levels, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;but &lt;/del&gt;good structure starts from the ground up. Keep your program code clean and understandable from the statement level up. Consider your code as not &amp;quot;working&amp;quot; unless it is actually working in a way that you and other programmers can easily understand and evolve it.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;While bad &lt;/ins&gt;structure can occur at all levels, good structure starts from the ground up. Keep your program code clean and understandable from the statement level up. Consider your code as not &amp;quot;working&amp;quot; unless it is actually working in a way that you and other programmers can easily understand and evolve it.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Keep your code well organized. Refactor mercilessly&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, if it needs improvement&lt;/del&gt;. Use Patterns to guide your efforts to improve the code's structure. Understand and evolve a system's architecture.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Keep your code well organized&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. Take low cohesion and high coupling or metrics showing structural disorder as symptoms to be remedied&lt;/ins&gt;. Refactor mercilessly &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;toward DRY code&lt;/ins&gt;. Use Patterns &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and simplicity &lt;/ins&gt;to guide your efforts to improve the code's structure. Understand and evolve a system's architecture.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and limit the number of elements or group them at &lt;/del&gt;a &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;given level of abstraction as a guideline &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;judge &lt;/del&gt;when &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;better structure is needed. Other principles apply as well. After the size&lt;/del&gt;, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;the number of relationships should be minimized. Notice that relationships can be implicit as well as explicit. Understand and manage the number of relationships. Loosen coupling as much as it makes sense. On all levels of abstraction. Refactor &lt;/del&gt;your &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;code to keep its structure within understandable boundaries&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;As &lt;/ins&gt;a &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;professional programmer you will know that function is important, but you need &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;focus on structural improvement &lt;/ins&gt;when &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;programming&lt;/ins&gt;, &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;if &lt;/ins&gt;your &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;system grows beyond &amp;quot;hello world&amp;quot;'s size&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;by [[Peter Sommerlad]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;by [[Peter Sommerlad]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:25255:newid:25256 --&gt;
&lt;/table&gt;</summary>
		<author><name>PeterSommerlad</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=25255&amp;oldid=prev</id>
		<title>PeterSommerlad at 13:33, 12 August 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=25255&amp;oldid=prev"/>
				<updated>2009-08-12T13:33:30Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 13:33, 12 August 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning to program, the function of a piece of code is the most important thing to get right once you have mastered the syntax of the programming language. It feels great pass the hurdle of getting a program to actually &amp;quot;run&amp;quot; and do what you intended. Unfortunately, that first satisfaction with your programming skills can be misleading. Programs that (seem to) work are necessary but not sufficient for your life as a good programmer.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning to program, the function of a piece of code is the most important thing to get right once you have mastered the syntax of the programming language. It feels great &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;to &lt;/ins&gt;pass the hurdle of getting a program to actually &amp;quot;run&amp;quot; and do what you intended. Unfortunately, that first satisfaction with your programming skills can be misleading. Programs that (seem to) work are necessary but not sufficient for your life as a good programmer.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So what is missing?&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So what is missing?&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;You or others will have to read, understand, use and modify your program code. Evolution of code is inevitable. Thus, you need to ensure that your code can evolve while its functionality survives.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;You or others will have to read, understand, use and modify your program code. Evolution &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and change &lt;/ins&gt;of code is inevitable. Thus, you need to ensure that your code can evolve while its functionality survives.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Code needs to be clean to allow smooth evolution. Cleanliness means good structure. Significant structure exists at many levels: the number and order of statements in a function, loop and conditional blocks; the nesting within control structures; the functions within a module or class; the relationships between one piece of code and others; the partitioning and dependencies between classes, modules and subsystems.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Code needs to be clean &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;allow smooth &lt;/del&gt;evolution&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. Cleanliness means good &lt;/del&gt;structure. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Significant &lt;/del&gt;structure &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;exists at &lt;/del&gt;many &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;levels: &lt;/del&gt;the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;number &lt;/del&gt;and &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;order of statements in loop &lt;/del&gt;and &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;conditional blocks; the nesting within control structures; the statements within a function; the functions within a module or class; the relationships between one piece &lt;/del&gt;of code &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and others; the partitioning and dependencies between subsystems&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;One of the most dominant barriers &lt;/ins&gt;to evolution &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;is the code's &lt;/ins&gt;structure. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Bad &lt;/ins&gt;structure &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;hindering change comes in &lt;/ins&gt;many &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;different species. An easy taxonomy of code structure are &lt;/ins&gt;the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Single Responsibility Principle (high cohesion) &lt;/ins&gt;and &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;low coupling. Both are easy to measure &lt;/ins&gt;and &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;understand but very hard to achieve. Violation &lt;/ins&gt;of &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;these principles is contagious, so without an antidote &lt;/ins&gt;code &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;using badly structured code tends to get degenerate structure as well&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Bad structure can occur at all levels, but good structure starts from the ground up. Keep your program code clean and understandable from the statement level up. Consider your code as not &amp;quot;working&amp;quot; unless it is actually working in a way that you and other programmers can easily understand.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Bad structure can occur at all levels, but good structure starts from the ground up. Keep your program code clean and understandable from the statement level up. Consider your code as not &amp;quot;working&amp;quot; unless it is actually working in a way that you and other programmers can easily understand &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and evolve it&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;There are limits to our cognitive capacity depending on our state of mind&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;If you concentrate very hard&lt;/del&gt;, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;you might be able to grasp more individual elements at once&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;However, usually our brain starts &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;group elements implicitly &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;keep some coherent picture of &lt;/del&gt;the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;whole&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Or, just fails to see the wood from the trees&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Keep your code well organized&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Refactor mercilessly&lt;/ins&gt;, &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;if it needs improvement&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Use Patterns &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;guide your efforts &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;improve &lt;/ins&gt;the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;code's structure&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Understand and evolve a system's architecture&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Try to keep your code organized &lt;/del&gt;and limit the number of elements or group them at a given level of abstraction as a guideline to judge when better structure is needed. Other principles apply as well. After the size, the number of relationships should be minimized. Notice that relationships can be implicit as well as explicit. Understand and manage the number of relationships. Loosen coupling as much as it makes sense. On all levels of abstraction. Refactor your code to keep its structure within understandable boundaries.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;and limit the number of elements or group them at a given level of abstraction as a guideline to judge when better structure is needed. Other principles apply as well. After the size, the number of relationships should be minimized. Notice that relationships can be implicit as well as explicit. Understand and manage the number of relationships. Loosen coupling as much as it makes sense. On all levels of abstraction. Refactor your code to keep its structure within understandable boundaries.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;by [[Peter Sommerlad]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;by [[Peter Sommerlad]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:25254:newid:25255 --&gt;
&lt;/table&gt;</summary>
		<author><name>PeterSommerlad</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=25254&amp;oldid=prev</id>
		<title>PeterSommerlad at 13:04, 12 August 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=25254&amp;oldid=prev"/>
				<updated>2009-08-12T13:04:53Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 13:04, 12 August 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning to program, the function of a piece of code is the most important thing to get right once you have mastered the syntax of the programming language. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Many programmers are easily satisfied &lt;/del&gt;with &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;code &lt;/del&gt;that (&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;somehow&lt;/del&gt;) &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;works&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Please&lt;/del&gt;, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;don't stop there&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This early satisfaction with function &lt;/del&gt;can &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;be counterproductive&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning to program, the function of a piece of code is the most important thing to get right once you have mastered the syntax of the programming language. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;It feels great pass the hurdle of getting a program to actually &amp;quot;run&amp;quot; and do what you intended. Unfortunately, that first satisfaction &lt;/ins&gt;with &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;your programming skills can be misleading. Programs &lt;/ins&gt;that (&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;seem to&lt;/ins&gt;) &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;work are necessary but not sufficient for your life as a good programmer&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;So what is missing?&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;You or others will have to read&lt;/ins&gt;, &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;understand, use and modify your program code&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Evolution of code is inevitable. Thus, you need to ensure that your code &lt;/ins&gt;can &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;evolve while its functionality survives&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Code needs to be clean to allow smooth evolution. Cleanliness means good structure. Significant structure exists at many levels: the number and order of statements in loop and conditional blocks; the nesting within control structures; the statements within a function; the functions within a module or class; the relationships between one piece of code and others; the partitioning and dependencies between subsystems.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Code needs to be clean to allow smooth evolution. Cleanliness means good structure. Significant structure exists at many levels: the number and order of statements in loop and conditional blocks; the nesting within control structures; the statements within a function; the functions within a module or class; the relationships between one piece of code and others; the partitioning and dependencies between subsystems.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:23798:newid:25254 --&gt;
&lt;/table&gt;</summary>
		<author><name>PeterSommerlad</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=23798&amp;oldid=prev</id>
		<title>PeterSommerlad at 12:37, 27 March 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=23798&amp;oldid=prev"/>
				<updated>2009-03-27T12:37:18Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 12:37, 27 March 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning to program, the function of a piece of code is the most important thing to get right once you have mastered the syntax of the programming language. Many &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;non-professionals &lt;/del&gt;are easily satisfied with code that (somehow) works. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;But &lt;/del&gt;don't stop there. This early satisfaction with function can be counterproductive.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning to program, the function of a piece of code is the most important thing to get right once you have mastered the syntax of the programming language. Many &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;programmers &lt;/ins&gt;are easily satisfied with code that (somehow) works. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Please, &lt;/ins&gt;don't stop there. This early satisfaction with function can be counterproductive.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Code needs to be clean to allow smooth evolution. Cleanliness means good structure. Significant structure exists at many levels: the number and order of statements in loop and conditional blocks; the nesting within control structures; the statements within a function; the functions within a module or class; the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;relationship &lt;/del&gt;between one piece of code and &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;another&lt;/del&gt;; the partitioning and dependencies between subsystems.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Code needs to be clean to allow smooth evolution. Cleanliness means good structure. Significant structure exists at many levels: the number and order of statements in loop and conditional blocks; the nesting within control structures; the statements within a function; the functions within a module or class; the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;relationships &lt;/ins&gt;between one piece of code and &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;others&lt;/ins&gt;; the partitioning and dependencies between subsystems.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Bad structure can occur at all levels, but good structure starts from the ground up. Keep your program code clean and understandable from the statement level up. Consider your code as not &amp;quot;working&amp;quot; unless it is actually working in a way that you and other &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;professionals &lt;/del&gt;can easily understand.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Bad structure can occur at all levels, but good structure starts from the ground up. Keep your program code clean and understandable from the statement level up. Consider your code as not &amp;quot;working&amp;quot; unless it is actually working in a way that you and other &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;programmers &lt;/ins&gt;can easily understand.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;There &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;is a well-known &lt;/del&gt;cognitive capacity &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;for short-term memory: seven plus or minus two items, meaning that it is easy to grasp between five to nine different things at once but not more&lt;/del&gt;. If you &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;need &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;comprehend &lt;/del&gt;more &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;things &lt;/del&gt;at once&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, you either need to concentrate very hard or&lt;/del&gt;, usually&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, your &lt;/del&gt;brain starts to group elements implicitly to keep some coherent picture of the whole.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;There &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;are limits to our &lt;/ins&gt;cognitive capacity &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;depending on our state of mind&lt;/ins&gt;. If you &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;concentrate very hard, you might be able &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;grasp &lt;/ins&gt;more &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;individual elements &lt;/ins&gt;at once&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. However&lt;/ins&gt;, usually &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;our &lt;/ins&gt;brain starts to group elements implicitly to keep some coherent picture of the whole&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. Or, just fails to see the wood from the trees&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Try to keep your code organized and &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;use this five-to-nine &lt;/del&gt;elements at a given level of abstraction as a guideline to judge when better structure is needed. Other principles apply as well. After the size, the number of relationships should be minimized. Notice that relationships can be implicit as well as explicit. Understand and manage the number of relationships. Loosen coupling as much as it makes sense. On all levels of abstraction. Refactor your code to keep its structure within understandable boundaries.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Try to keep your code organized and &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;limit the number of &lt;/ins&gt;elements &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;or group them &lt;/ins&gt;at a given level of abstraction as a guideline to judge when better structure is needed. Other principles apply as well. After the size, the number of relationships should be minimized. Notice that relationships can be implicit as well as explicit. Understand and manage the number of relationships. Loosen coupling as much as it makes sense. On all levels of abstraction. Refactor your code to keep its structure within understandable boundaries.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;by [[Peter Sommerlad]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;by [[Peter Sommerlad]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:23280:newid:23798 --&gt;
&lt;/table&gt;</summary>
		<author><name>PeterSommerlad</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=23280&amp;oldid=prev</id>
		<title>Kevlin at 11:44, 4 February 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=23280&amp;oldid=prev"/>
				<updated>2009-02-04T11:44:43Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:44, 4 February 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning to program, the function of a piece of code is the most important thing to get right &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;after &lt;/del&gt;the syntax of the programming language &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;is mastered&lt;/del&gt;. Many non-professionals are easily satisfied with code that (somehow) works. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Do not &lt;/del&gt;stop there.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning to program, the function of a piece of code is the most important thing to get right &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;once you have mastered &lt;/ins&gt;the syntax of the programming language. Many non-professionals are easily satisfied with code that (somehow) works. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;But don't &lt;/ins&gt;stop there&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. This early satisfaction with function can be counterproductive&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This early satisfaction with function can be bad. &lt;/del&gt;Code needs to be clean to allow smooth evolution. Cleanliness means good structure. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Good and bad &lt;/del&gt;structure &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;exist &lt;/del&gt;at many levels: the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;amount &lt;/del&gt;and order of statements in &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;a &lt;/del&gt;loop &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;or &lt;/del&gt;conditional; the nesting &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;of such &lt;/del&gt;control structures; the statements within a function; the functions within a module or class; the relationship between one piece of code &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;to &lt;/del&gt;another; the partitioning and dependencies between subsystems.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Code needs to be clean to allow smooth evolution. Cleanliness means good structure. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Significant &lt;/ins&gt;structure &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;exists &lt;/ins&gt;at many levels: the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;number &lt;/ins&gt;and order of statements in loop &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and &lt;/ins&gt;conditional &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;blocks&lt;/ins&gt;; the nesting &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;within &lt;/ins&gt;control structures; the statements within a function; the functions within a module or class; the relationship between one piece of code &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and &lt;/ins&gt;another; the partitioning and dependencies between subsystems.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Bad structure can occur at all levels, but good structure starts from the ground up. Keep your program code clean and understandable from the statement level up. Consider your code as not &amp;quot;working&amp;quot; unless it is actually working in a way that you and other professionals can easily understand.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Bad structure can occur at all levels, but good structure starts from the ground up. Keep your program code clean and understandable from the statement level up. Consider your code as not &amp;quot;working&amp;quot; unless it is actually working in a way that you and other professionals can easily understand.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 7:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 7:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;There is a well-known cognitive capacity for short-term memory: seven plus or minus two items, meaning that it is easy to grasp between five to nine different things at once but not more. If you need to comprehend more things at once, you either need to concentrate very hard or, usually, your brain starts to group elements implicitly to keep some coherent picture of the whole.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;There is a well-known cognitive capacity for short-term memory: seven plus or minus two items, meaning that it is easy to grasp between five to nine different things at once but not more. If you need to comprehend more things at once, you either need to concentrate very hard or, usually, your brain starts to group elements implicitly to keep some coherent picture of the whole.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Try to keep your code organized and use this five-to-nine elements at a given level of abstraction as a guideline to judge when better structure is needed. Other principles apply as well. After the size, the number of relationships should be minimized. Notice that &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;there are not only explicit but often also implicit &lt;/del&gt;relationships. Understand and manage the number of relationships. Loosen coupling as much as it makes sense. On all levels of abstraction. Refactor your code to keep its structure within understandable boundaries.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Try to keep your code organized and use this five-to-nine elements at a given level of abstraction as a guideline to judge when better structure is needed. Other principles apply as well. After the size, the number of relationships should be minimized. Notice that relationships &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;can be implicit as well as explicit&lt;/ins&gt;. Understand and manage the number of relationships. Loosen coupling as much as it makes sense. On all levels of abstraction. Refactor your code to keep its structure within understandable boundaries.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;by [[Peter Sommerlad]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;by [[Peter Sommerlad]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:23277:newid:23280 --&gt;
&lt;/table&gt;</summary>
		<author><name>Kevlin</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=23277&amp;oldid=prev</id>
		<title>Kevlin: Structure over function moved to Structure over Function</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=23277&amp;oldid=prev"/>
				<updated>2009-02-04T11:32:34Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;a href=&quot;/wiki/index.php/Structure_over_function&quot; title=&quot;Structure over function&quot;&gt;Structure over function&lt;/a&gt; moved to &lt;a href=&quot;/wiki/index.php/Structure_over_Function&quot; title=&quot;Structure over Function&quot;&gt;Structure over Function&lt;/a&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:32, 4 February 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;/table&gt;</summary>
		<author><name>Kevlin</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=21858&amp;oldid=prev</id>
		<title>Kevlin at 16:09, 2 December 2008</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=21858&amp;oldid=prev"/>
				<updated>2008-12-02T16:09:35Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 16:09, 2 December 2008&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;how &lt;/del&gt;to program, the function of a piece of code is the most important thing to get right after the syntax of the programming language is mastered. Many non-professionals are easily satisfied with code that (somehow) works. Do not stop there.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning to program, the function of a piece of code is the most important thing to get right after the syntax of the programming language is mastered. Many non-professionals are easily satisfied with code that (somehow) works. Do not stop there.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This early satisfaction with function &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;is &lt;/del&gt;bad. Code &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;must &lt;/del&gt;be clean to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;enable its &lt;/del&gt;evolution. Cleanliness means good structure. Good &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;or &lt;/del&gt;bad structure &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;comes &lt;/del&gt;at many levels&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, from &lt;/del&gt;the amount and order of statements in a loop or conditional&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, through &lt;/del&gt;the nesting of such control structures&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, through &lt;/del&gt;the statements within a function&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/del&gt;the functions within a module or class&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/del&gt;the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;relationships of a &lt;/del&gt;piece of code to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;other pieces up to &lt;/del&gt;the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;architecture: the structure of &lt;/del&gt;and dependencies between subsystems.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This early satisfaction with function &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;can be &lt;/ins&gt;bad. Code &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;needs to &lt;/ins&gt;be clean to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;allow smooth &lt;/ins&gt;evolution. Cleanliness means good structure. Good &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and &lt;/ins&gt;bad structure &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;exist &lt;/ins&gt;at many levels&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;: &lt;/ins&gt;the amount and order of statements in a loop or conditional&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;; &lt;/ins&gt;the nesting of such control structures&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;; &lt;/ins&gt;the statements within a function&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;; &lt;/ins&gt;the functions within a module or class&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;; &lt;/ins&gt;the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;relationship between one &lt;/ins&gt;piece of code to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;another; &lt;/ins&gt;the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;partitioning &lt;/ins&gt;and dependencies between subsystems.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Bad structure can occur at all levels, but good structure starts from the ground up. Keep your program code clean and understandable from the statement level &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;on&lt;/del&gt;. Consider your code &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;is &lt;/del&gt;not &amp;quot;working&amp;quot; unless it is actually working in a way that you and other professionals can easily understand.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Bad structure can occur at all levels, but good structure starts from the ground up. Keep your program code clean and understandable from the statement level &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;up&lt;/ins&gt;. Consider your code &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;as &lt;/ins&gt;not &amp;quot;working&amp;quot; unless it is actually working in a way that you and other professionals can easily understand.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;There is a well-known &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;psychological barrier of understanding that is often told as &lt;/del&gt;seven plus&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;/&lt;/del&gt;minus two, meaning that it is easy to grasp between five to nine different things at once but not more. If you need to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;handle &lt;/del&gt;more things at once, you either need to concentrate very hard or usually your brain starts to group elements implicitly to keep &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;the &lt;/del&gt;picture of the whole&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;.  &lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;There is a well-known &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;cognitive capacity for short-term memory: &lt;/ins&gt;seven plus &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;or &lt;/ins&gt;minus two &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;items&lt;/ins&gt;, meaning that it is easy to grasp between five to nine different things at once but not more. If you need to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;comprehend &lt;/ins&gt;more things at once, you either need to concentrate very hard or&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;usually&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;your brain starts to group elements implicitly to keep &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;some coherent &lt;/ins&gt;picture of the whole.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Try to keep your code organized and use this five to nine elements at a given level of abstraction as a guideline to judge when better structure is needed. Other principles apply as well. Next to the size the number of relationships should be minimized. Notice that there are not only explicit but often also implicit relationships. Understand and manage the number of relationships. Loosen coupling as much as it makes sense. On all levels of abstraction. Refactor your code to keep its structure within understandable boundaries&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Try to keep your code organized and use this five-to-nine elements at a given level of abstraction as a guideline to judge when better structure is needed. Other principles apply as well. After the size, the number of relationships should be minimized. Notice that there are not only explicit but often also implicit relationships. Understand and manage the number of relationships. Loosen coupling as much as it makes sense. On all levels of abstraction. Refactor your code to keep its structure within understandable boundaries.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;by [[Peter Sommerlad]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;by [[Peter Sommerlad]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:21856:newid:21858 --&gt;
&lt;/table&gt;</summary>
		<author><name>Kevlin</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=21856&amp;oldid=prev</id>
		<title>PeterSommerlad at 12:36, 2 December 2008</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Structure_over_Function&amp;diff=21856&amp;oldid=prev"/>
				<updated>2008-12-02T12:36:27Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 12:36, 2 December 2008&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning how to program, the function of a piece of code is the most important thing to get right after the syntax of the programming language is mastered. Many non-professionals are easily satisfied with code that (somehow) works. Do not stop there.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When learning how to program, the function of a piece of code is the most important thing to get right after the syntax of the programming language is mastered. Many non-professionals are easily satisfied with code that (somehow) works. Do not stop there.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This early satisfaction with function is bad. Code must be clean to enable its evolution. Cleanliness &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;comes from &lt;/del&gt;structure. Good or bad structure comes at many levels, from the amount and order of statements in a loop or conditional, through the nesting of such control structures, through the statements within a function, the functions within a module or class, the relationships of a piece of code to other pieces up to the architecture: the structure of and dependencies between subsystems.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This early satisfaction with function is bad. Code must be clean to enable its evolution. Cleanliness &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;means good &lt;/ins&gt;structure. Good or bad structure comes at many levels, from the amount and order of statements in a loop or conditional, through the nesting of such control structures, through the statements within a function, the functions within a module or class, the relationships of a piece of code to other pieces up to the architecture: the structure of and dependencies between subsystems.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Bad structure can occur at all levels, but good structure starts from the ground up. Keep your program code clean and understandable. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;It &lt;/del&gt;is not &amp;quot;working&amp;quot; unless it is actually working in a way that you and other professionals can easily understand&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. The code must be so tidy and clean you can get it&lt;/del&gt;. &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Bad structure can occur at all levels, but good structure starts from the ground up. Keep your program code clean and understandable &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;from the statement level on&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Consider your code &lt;/ins&gt;is not &amp;quot;working&amp;quot; unless it is actually working in a way that you and other professionals can easily understand.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;There is a well-known psychological barrier of understanding that is often told as seven plus/minus two, meaning that it is easy to grasp between five to nine different things at once but not more. If you need to handle more things at once, you either need to concentrate very hard or usually your brain starts to group implicitly.  &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;There is a well-known psychological barrier of understanding that is often told as seven plus/minus two, meaning that it is easy to grasp between five to nine different things at once but not more. If you need to handle more things at once, you either need to concentrate very hard or usually your brain starts to group &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;elements &lt;/ins&gt;implicitly &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;to keep the picture of the whole&lt;/ins&gt;.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Try to keep your code organized and use this five to nine elements at a given level of abstraction as a guideline to judge when better structure is needed. Other principles apply as well. Next to the size the number of relationships should be minimized. Notice that there are not only explicit but often also implicit relationships. Understand and manage the number of relationships. Loosen coupling as much as it makes sense. On all levels of abstraction.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Try to keep your code organized and use this five to nine elements at a given level of abstraction as a guideline to judge when better structure is needed. Other principles apply as well. Next to the size the number of relationships should be minimized. Notice that there are not only explicit but often also implicit relationships. Understand and manage the number of relationships. Loosen coupling as much as it makes sense. On all levels of abstraction&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. Refactor your code to keep its structure within understandable boundaries&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:21855:newid:21856 --&gt;
&lt;/table&gt;</summary>
		<author><name>PeterSommerlad</name></author>	</entry>

	</feed>