<?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=Methods_Matter&amp;action=history&amp;feed=atom</id>
		<title>Methods Matter - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;action=history&amp;feed=atom"/>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;action=history"/>
		<updated>2013-05-23T08:41:34Z</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=Methods_Matter&amp;diff=25339&amp;oldid=prev</id>
		<title>Kevlin at 08:33, 18 August 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=25339&amp;oldid=prev"/>
				<updated>2009-08-18T08:33:10Z</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 08:33, 18 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;A large part of today's software is written using object-oriented languages. Object-oriented software is composed of objects communicating via methods. So in a way it can be argued that not objects but methods are the basic building blocks of our code. While there is a lot of literature on design in the large &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;— &lt;/del&gt;architecture and components &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;— &lt;/del&gt;and on medium granularity &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;— &lt;/del&gt;e.g., design patterns &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;— &lt;/del&gt;surprisingly little can be found on designing individual methods. Design in the small, however, matters. A lot. &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;A large part of today's software is written using object-oriented languages. Object-oriented software is composed of objects communicating via methods. So in a way it can be argued that not objects but methods are the basic building blocks of our code. While there is a lot of literature on design in the large &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;architecture and components &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;and on medium granularity &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;e.g., design patterns &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;surprisingly little can be found on designing individual methods. Design in the small, however, matters. A lot.&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;Ideally, any piece of source code should be readable like a good book: it should be interesting; it should convey its intention clearly; and last, but not least, it should be fun to read. &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;Ideally, any piece of source code should be readable like a good book: it should be interesting; it should convey its intention clearly; and last, but not least, it should be fun to read.&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;The simplest way to achieve readability is to use expressive names that properly describe the concepts they identify. In most cases this will mean relatively long names for methods and variables. Some argue that short names are easier and thus faster to type. Modern IDEs and editors are capable of simplifying the typing, renaming, and searching of names to make this objection less relevant. Instead of thinking about the typing overhead today, think about the time saved tomorrow when you and others have to reread the code. Be particularly careful when designing your method names because they are the verbs in the story you are trying to tell. &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;The simplest way to achieve readability is to use expressive names that properly describe the concepts they identify. In most cases this will mean relatively long names for methods and variables. Some argue that short names are easier and thus faster to type. Modern IDEs and editors are capable of simplifying the typing, renaming, and searching of names to make this objection less relevant. Instead of thinking about the typing overhead today, think about the time saved tomorrow when you and others have to reread the code. Be particularly careful when designing your method names because they are the verbs in the story you are trying to tell.&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;Keeping it simple (KISS) is a general rule of thumb in software design. One source of simplicity is brevity: Most of the time, shorter methods are simpler than long ones. While a low &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;LoC &lt;/del&gt;count is a good starting point &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;reducing &lt;/del&gt;the overall cognitive load &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;is even more aided &lt;/del&gt;by keeping the cyclomatic complexity low &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;— &lt;/del&gt;ideally under 3 or 4, definitely under 10. Cyclomatic complexity is a numeric value that can easily be computed by many tools and is roughly equivalent to the number of execution paths through a method. A high &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;value of CC &lt;/del&gt;complicates unit testing and has been empirically shown to correlate with bugs. &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;Keeping it simple (KISS) is a general rule of thumb in software design. One source of simplicity is brevity: Most of the time, shorter methods are simpler than long ones. While a low &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;line &lt;/ins&gt;count is a good starting point&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;the overall cognitive load &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;can be further reduced &lt;/ins&gt;by keeping the cyclomatic complexity low &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;ideally under 3 or 4, definitely under 10. Cyclomatic complexity is a numeric value that can easily be computed by many tools and is roughly equivalent to the number of execution paths through a method. A high &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;cyclomatic complexity &lt;/ins&gt;complicates unit testing and has been empirically shown to correlate with bugs.&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;Mixing concerns is often considered harmful. This is normally applied to classes as a whole, but &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;also &lt;/del&gt;applied at the method level it can &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;go a long way to increasing &lt;/del&gt;the readability of your code. Applied to methods this means that you should strive to map different aspects of your required behavior cleanly to different methods. Such a separation of technical and business concerns facilitates, and benefits from, the use of a well-defined domain vocabulary. Using such a vocabulary helps to reveal intention in your methods. This can ensure that a consistent and ubiquitous vocabulary is used when speaking to domain experts, but it also ensures that methods are focused and consistent, so that developers benefit. &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;Mixing concerns is often considered harmful. This is normally applied to classes as a whole, but applied at the method level it can &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;further increase &lt;/ins&gt;the readability of your code. Applied to methods this means that you should strive to map different aspects of your required behavior cleanly to different methods. Such a separation of technical and business concerns facilitates, and benefits from, the use of a well-defined domain vocabulary. Using such a vocabulary helps to reveal intention in your methods. This can ensure that a consistent and ubiquitous vocabulary is used when speaking to domain experts, but it also ensures that methods are focused and consistent, so that developers &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;also &lt;/ins&gt;benefit.&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;When you have properly separated concerns try to do the same with levels of abstraction. This is achieved by staying at a single level of abstraction within each method. This way you don't jump back and forth between little technical details and the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;grand &lt;/del&gt;motives of your code narrative. The resulting methods will be easier and more pleasant to read.&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 you have properly separated concerns try to do the same with levels of abstraction. This is achieved by staying at a single level of abstraction within each method. This way you don't jump back and forth between little technical details and the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;grander &lt;/ins&gt;motives of your code narrative. The resulting methods will be easier &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;to grasp &lt;/ins&gt;and more pleasant to read.&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;All in all, careful design of short methods with low complexity that focus on a single fine-grained concern and stay at a single level of abstraction combined with proper expressive naming will definitely help to better convey the intention of your code to other developers &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;— &lt;/del&gt;and to yourself. This will improve maintainability in the long run and, after all, most software development is maintenance. &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;All in all, careful design of short methods with low complexity that focus on a single fine-grained concern and stay at a single level of abstraction combined with proper expressive naming will definitely help to better convey the intention of your code to other developers &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;and to yourself. This will improve maintainability in the long run and, after all, most software development is maintenance.&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;Happy method design!&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;Happy method design!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:25334:newid:25339 --&gt;
&lt;/table&gt;</summary>
		<author><name>Kevlin</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=25334&amp;oldid=prev</id>
		<title>Matthias at 21:59, 17 August 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=25334&amp;oldid=prev"/>
				<updated>2009-08-17T21:59:20Z</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 21:59, 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;A large part of today's software is written using object-oriented languages. Object-oriented software is composed of objects communicating via methods. So in a way it can be argued that not objects but methods are the basic building blocks of our code. While there is a lot of literature on design in the large &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/del&gt;architecture and components &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/del&gt;and on medium granularity &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/del&gt;e.g., design patterns &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/del&gt;surprisingly little can be found on designing individual methods. Design in the small, however, matters. A lot.&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;A large part of today's software is written using object-oriented languages. Object-oriented software is composed of objects communicating via methods. So in a way it can be argued that not objects but methods are the basic building blocks of our code. While there is a lot of literature on design in the large &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;— &lt;/ins&gt;architecture and components &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;— &lt;/ins&gt;and on medium granularity &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;— &lt;/ins&gt;e.g., design patterns &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;— &lt;/ins&gt;surprisingly little can be found on designing individual methods. Design in the small, however, matters. A lot. &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;Ideally, any piece of source code should be readable like a good book: it should be interesting; it should convey its intention clearly; and last, but not least, it should be fun to read.&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;Ideally, any piece of source code should be readable like a good book: it should be interesting; it should convey its intention clearly; and last, but not least, it should be fun to read. &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;The simplest way to achieve readability is to use expressive names that properly describe the concepts they identify. In most cases this will mean relatively long names for methods and variables. Some argue that short names are easier and thus faster to type. Modern IDEs and editors are capable of simplifying the typing, renaming, and searching of names to make this objection less relevant. Instead of thinking about the typing overhead today, think about the time saved tomorrow when you and others have to reread the code. Be particularly careful when designing your method names because they are the verbs in the story you are trying to tell.&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;The simplest way to achieve readability is to use expressive names that properly describe the concepts they identify. In most cases this will mean relatively long names for methods and variables. Some argue that short names are easier and thus faster to type. Modern IDEs and editors are capable of simplifying the typing, renaming, and searching of names to make this objection less relevant. Instead of thinking about the typing overhead today, think about the time saved tomorrow when you and others have to reread the code. Be particularly careful when designing your method names because they are the verbs in the story you are trying to tell. &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;Another &lt;/del&gt;source of &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;readability and comprehensibility &lt;/del&gt;is brevity&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. As a rough guideline for an appropriate &lt;/del&gt;methods &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;size I would argue for usually no more &lt;/del&gt;than &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;7&amp;amp;plusmn;2 lines of code&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This &lt;/del&gt;is &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;motivated &lt;/del&gt;by &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;applying &lt;/del&gt;the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;famous ''Rule of Seven'' which roughly states &lt;/del&gt;that &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;the average human being &lt;/del&gt;can &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;keep around 7 items in short term memory. In any case, make sure each &lt;/del&gt;method &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;can fit on your (&lt;/del&gt;and &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;your co-worker's) screen&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;Keeping it simple (KISS) is a general rule of thumb in software design. One &lt;/ins&gt;source of &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;simplicity &lt;/ins&gt;is brevity&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;: Most of the time, shorter &lt;/ins&gt;methods &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;are simpler &lt;/ins&gt;than &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;long ones&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;While a low LoC count &lt;/ins&gt;is &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;a good starting point reducing the overall cognitive load is even more aided &lt;/ins&gt;by &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;keeping &lt;/ins&gt;the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;cyclomatic complexity low — ideally under 3 or 4, definitely under 10. Cyclomatic complexity is a numeric value &lt;/ins&gt;that can &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;easily be computed by many tools and is roughly equivalent to the number of execution paths through a &lt;/ins&gt;method&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. A high value of CC complicates unit testing &lt;/ins&gt;and &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;has been empirically shown to correlate with bugs&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;''Keeping it simple'' (KISS) &lt;/del&gt;is &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;a general rule of thumb in software design&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;One &lt;/del&gt;way of &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;applying this &lt;/del&gt;to methods &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;is &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;keep the cyclomatic complexity low &amp;amp;mdash; ideally under 3 or 4&lt;/del&gt;, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;definitely under 10&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Cyclomatic complexity is &lt;/del&gt;a &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;numeric value that &lt;/del&gt;can &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;easily be computed by many tools &lt;/del&gt;and is &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;roughly equivalent &lt;/del&gt;to the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;number &lt;/del&gt;of &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;execution paths through &lt;/del&gt;a method. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;A high value &lt;/del&gt;of &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;CC complicates unit testing &lt;/del&gt;and &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;has been empirically shown &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;correlate &lt;/del&gt;with &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;bugs&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;Mixing concerns &lt;/ins&gt;is &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;often considered harmful&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This is normally applied to classes as a whole, but also applied at the method level it can go a long &lt;/ins&gt;way &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;to increasing the readability &lt;/ins&gt;of &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;your code. Applied &lt;/ins&gt;to methods &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;this means that you should strive &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;map different aspects of your required behavior cleanly to different methods. Such a separation of technical and business concerns facilitates&lt;/ins&gt;, &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and benefits from, the use of a well-defined domain vocabulary&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Using such &lt;/ins&gt;a &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;vocabulary helps to reveal intention in your methods. This &lt;/ins&gt;can &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;ensure that a consistent &lt;/ins&gt;and &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;ubiquitous vocabulary &lt;/ins&gt;is &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;used when speaking &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;domain experts, but it also ensures that methods are focused and consistent, so that developers benefit. &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;When you have properly separated concerns try to do &lt;/ins&gt;the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;same with levels &lt;/ins&gt;of &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;abstraction. This is achieved by staying at &lt;/ins&gt;a &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;single level of abstraction within each &lt;/ins&gt;method. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This way you don't jump back and forth between little technical details and the grand motives &lt;/ins&gt;of &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;your code narrative. The resulting methods will be easier &lt;/ins&gt;and &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;more pleasant &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;read.&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;All in all, careful design of short methods &lt;/ins&gt;with &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;low complexity that focus on a single fine-grained concern and stay at a single level of abstraction combined with proper expressive naming will definitely help to better convey the intention of your code to other developers — and to yourself. This will improve maintainability in the long run and, after all, most software development is maintenance&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;Mixing concerns is often considered harmful. This is normally applied to classes as a whole, but also applied at the method level it can go a long way to increasing the readability of your code. Applied to methods this means that you should strive to map different aspects of your required behavior cleanly to different methods. Such a separation of technical and business concerns facilitates, and benefits from, the use of a well-defined domain vocabulary. Using such a vocabulary helps to reveal intention in your methods. This can ensure that a consistent and ubiquitous vocabulary is used when speaking to domain experts, but it also ensures that methods are focused and consistent, so that developers benefit.&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&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;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&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;All in all, careful design of short methods with low complexity that focus on a single fine-grained concern and proper expressive naming of methods and variables will definitely help to better convey the intention of your code to other developers &amp;amp;mdash; and to yourself. This will improve maintainability in the long run and, after all, most software development is maintenance.&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&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;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&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;Happy method design!&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;Happy method design!&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;/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;/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 [[Matthias Merdes]]&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 [[Matthias Merdes]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Matthias</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=25243&amp;oldid=prev</id>
		<title>Matthias at 12:27, 10 August 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=25243&amp;oldid=prev"/>
				<updated>2009-08-10T12:27:57Z</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:27, 10 August 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 18:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 18:&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;This work is licensed under a [http://creativecommons.org/licenses/by/3.0/us/ Creative Commons Attribution 3] &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;This work is licensed under a [http://creativecommons.org/licenses/by/3.0/us/ Creative Commons Attribution 3] &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;/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;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;Back to [[97 Things Every Programmer Should Know]] home page&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;Back to [[97 Things Every Programmer Should Know]] home page&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:25029:newid:25243 --&gt;
&lt;/table&gt;</summary>
		<author><name>Matthias</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=25029&amp;oldid=prev</id>
		<title>Kevlin at 21:20, 28 July 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=25029&amp;oldid=prev"/>
				<updated>2009-07-28T21:20:55Z</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 21:20, 28 July 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;The simplest way to achieve readability is to use expressive names that properly describe the concepts they identify. In most cases this will mean relatively long names for methods and variables. Some argue that short names are easier and thus faster to type. Modern IDEs and editors are capable of simplifying the typing, renaming, and searching of names to make this objection less relevant. Instead of thinking about the typing overhead today, think about the time saved tomorrow when you and others have to reread the code. Be particularly careful when designing your method names because they are the verbs in the story you are trying to tell.&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;The simplest way to achieve readability is to use expressive names that properly describe the concepts they identify. In most cases this will mean relatively long names for methods and variables. Some argue that short names are easier and thus faster to type. Modern IDEs and editors are capable of simplifying the typing, renaming, and searching of names to make this objection less relevant. Instead of thinking about the typing overhead today, think about the time saved tomorrow when you and others have to reread the code. Be particularly careful when designing your method names because they are the verbs in the story you are trying to tell.&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;Another source of readability and comprehensibility is brevity. As a rough guideline for an appropriate methods size I would argue for usually no more than 7&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;+/-&lt;/del&gt;2 lines of code. This is motivated by applying the famous ''Rule of Seven'' which roughly states that the average human being can keep around 7 items in short term memory. In any case, make sure each method can fit on your (and your co-worker's) screen.&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;Another source of readability and comprehensibility is brevity. As a rough guideline for an appropriate methods size I would argue for usually no more than 7&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;plusmn;&lt;/ins&gt;2 lines of code. This is motivated by applying the famous ''Rule of Seven'' which roughly states that the average human being can keep around 7 items in short term memory. In any case, make sure each method can fit on your (and your co-worker's) screen.&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;Keeping &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;things &lt;/del&gt;simple (KISS) is a general rule of thumb in software design. One way of applying this to methods is to keep the cyclomatic complexity low &amp;amp;mdash; ideally under 3 or 4, definitely under 10. Cyclomatic complexity is a numeric value that can easily be computed by many tools and is roughly equivalent to the number of execution paths through a method. A high value of CC complicates unit testing and has been empirically shown to correlate with bugs&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;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;Keeping &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;it &lt;/ins&gt;simple&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/ins&gt;(KISS) is a general rule of thumb in software design. One way of applying this to methods is to keep the cyclomatic complexity low &amp;amp;mdash; ideally under 3 or 4, definitely under 10. Cyclomatic complexity is a numeric value that can easily be computed by many tools and is roughly equivalent to the number of execution paths through a method. A high value of CC complicates unit testing and has been empirically shown to correlate with bugs.&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;It has been pointed out by many that mixing concerns is considered harmful. This is normally applied to classes as a whole, but also applied at the method level it can go a long way to increase the readability of your code. Applied to methods this means that you should strive to map different aspects of your required behavior cleanly to different methods.&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: #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;This idea of separation of technical and business, or generally, domain logic concerns is emphasized by the current popularity of domain-specific languages (DSLs). Within this approach the domain logic is expressed in a dedicated language specialized for the given domain which can ideally be edited by domain experts who are not programmers. DSL authors strive to make statements in the DSL sound just like &amp;quot;plain English.&amp;quot; While this probably can help to improve communication with domain experts, careful design of short methods with low complexity which focus on a single fine-granular concern and proper expressive naming of methods and variables will certainly help to better convey the intention of your code to other developers &amp;amp;mdash; and to yourself. This will improve maintainability in the long run and, after all, most software development is maintenance&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;Mixing concerns is often considered harmful. This is normally applied to classes as a whole, but also applied at the method level it can go a long way to increasing the readability of your code. Applied to methods this means that you should strive to map different aspects of your required behavior cleanly to different methods. Such a separation of technical and business concerns facilitates, and benefits from, the use of a well-defined domain vocabulary. Using such a vocabulary helps to reveal intention in your methods. This can ensure that a consistent and ubiquitous vocabulary is used when speaking to domain experts, but it also ensures that methods are focused and consistent, so that developers benefit.&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;/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;All in all, careful design of short methods with low complexity that focus on a single fine-grained concern and proper expressive naming of methods and variables will definitely help to better convey the intention of your code to other developers &amp;amp;mdash; and to yourself. This will improve maintainability in the long run and, after all, most software development is maintenance.&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;/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;div&gt;Happy method design!&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;Happy method design!&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;!-- diff cache key wikicontent:diff:version:1.11a:oldid:25002:newid:25029 --&gt;
&lt;/table&gt;</summary>
		<author><name>Kevlin</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=25002&amp;oldid=prev</id>
		<title>Matthias at 06:29, 23 July 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=25002&amp;oldid=prev"/>
				<updated>2009-07-23T06:29:28Z</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 06:29, 23 July 2009&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;Another source of readability and comprehensibility is brevity. As a rough guideline for an appropriate methods size I would argue for usually no more than 7+/-2 lines of code. This is motivated by applying the famous ''Rule of Seven'' which roughly states that the average human being can keep around 7 items in short term memory. In any case, make sure each method can fit on your (and your co-worker's) screen.&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;Another source of readability and comprehensibility is brevity. As a rough guideline for an appropriate methods size I would argue for usually no more than 7+/-2 lines of code. This is motivated by applying the famous ''Rule of Seven'' which roughly states that the average human being can keep around 7 items in short term memory. In any case, make sure each method can fit on your (and your co-worker's) screen.&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;Keeping things simple (KISS) is a general rule of thumb in software design. One way of applying this to methods is to keep the cyclomatic complexity low &amp;amp;mdash; ideally under &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;4 &lt;/del&gt;or &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;5&lt;/del&gt;, definitely under 10. Cyclomatic complexity is a numeric value that can easily be computed by many tools and is roughly equivalent to the number of execution paths through a method. A high value of CC complicates unit testing and has been empirically shown to correlate with bugs.&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;Keeping things simple (KISS) is a general rule of thumb in software design. One way of applying this to methods is to keep the cyclomatic complexity low &amp;amp;mdash; ideally under &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;3 &lt;/ins&gt;or &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;4&lt;/ins&gt;, definitely under 10. Cyclomatic complexity is a numeric value that can easily be computed by many tools and is roughly equivalent to the number of execution paths through a method. A high value of CC complicates unit testing and has been empirically shown to correlate with bugs.&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;It has been pointed out by many that mixing concerns is considered harmful. This is normally applied to classes as a whole, but also applied at the method level it can go a long way to increase the readability of your code. Applied to methods this means that you should strive to map different aspects of your required behavior cleanly to different methods.&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;It has been pointed out by many that mixing concerns is considered harmful. This is normally applied to classes as a whole, but also applied at the method level it can go a long way to increase the readability of your code. Applied to methods this means that you should strive to map different aspects of your required behavior cleanly to different methods.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:24940:newid:25002 --&gt;
&lt;/table&gt;</summary>
		<author><name>Matthias</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=24940&amp;oldid=prev</id>
		<title>Kevlin at 06:26, 19 July 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=24940&amp;oldid=prev"/>
				<updated>2009-07-19T06:26: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 06:26, 19 July 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 11:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 11:&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;It has been pointed out by many that mixing concerns is considered harmful. This is normally applied to classes as a whole, but also applied at the method level it can go a long way to increase the readability of your code. Applied to methods this means that you should strive to map different aspects of your required behavior cleanly to different methods.&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;It has been pointed out by many that mixing concerns is considered harmful. This is normally applied to classes as a whole, but also applied at the method level it can go a long way to increase the readability of your code. Applied to methods this means that you should strive to map different aspects of your required behavior cleanly to different methods.&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 idea of separation of technical and business, or generally, domain logic concerns is emphasized by the current popularity of domain-specific languages (DSLs). Within this approach the domain logic is expressed in a dedicated language specialized for the given domain which can ideally be edited by domain experts who are not programmers. DSL authors strive to make statements in the DSL sound just like &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'&lt;/del&gt;plain English&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'&lt;/del&gt;. While this probably can help to improve communication with domain experts, &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 idea of separation of technical and business, or generally, domain logic concerns is emphasized by the current popularity of domain-specific languages (DSLs). Within this approach the domain logic is expressed in a dedicated language specialized for the given domain which can ideally be edited by domain experts who are not programmers. DSL authors strive to make statements in the DSL sound just like &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;quot;&lt;/ins&gt;plain English.&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;quot; &lt;/ins&gt;While this probably can help to improve communication with domain experts, careful design of short methods with low complexity which focus on a single fine-granular concern and proper expressive naming of methods and variables will certainly help to better convey the intention of your code to other developers &amp;amp;mdash; and to yourself. This will improve maintainability in the long run and, after all, most software development is maintenance.&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;careful design of short methods with low complexity which focus on a single fine-granular concern and proper expressive naming of methods and variables will certainly help to better convey the intention of your code to other developers &amp;amp;mdash; and to yourself. This will improve maintainability in the long run and, after all, most software development is maintenance.&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Happy method design!&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;Happy method design!&lt;/div&gt;&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=Methods_Matter&amp;diff=24939&amp;oldid=prev</id>
		<title>Kevlin at 06:22, 19 July 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=24939&amp;oldid=prev"/>
				<updated>2009-07-19T06:22:55Z</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 06:22, 19 July 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;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Despite the recent interest in functional programming languages a &lt;/del&gt;large part of today's software is object-oriented. Object-oriented software is composed of objects communicating via methods. So in a way it can be argued that not objects but methods are the basic building blocks of our &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;software&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;A &lt;/ins&gt;large part of today's software is &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;written using &lt;/ins&gt;object-oriented &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;languages&lt;/ins&gt;. Object-oriented software is composed of objects communicating via methods. So in a way it can be argued that not objects but methods are the basic building blocks of our &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;. While there is a lot of literature on design in the large &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;architecture &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and &lt;/ins&gt;components &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;and on medium granularity &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;e.g., design patterns &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;surprisingly little can be found on designing &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;individual &lt;/ins&gt;methods. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Design &lt;/ins&gt;in the small&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, however, &lt;/ins&gt;matters&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. A &lt;/ins&gt;lot.&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;While there is a lot of literature on design in the large&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, aka &lt;/del&gt;architecture&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;/&lt;/del&gt;components and on &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;a &lt;/del&gt;medium granularity &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;(&lt;/del&gt;e.g., design patterns&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;), &lt;/del&gt;surprisingly little can be found on designing &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;single &lt;/del&gt;methods. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This piece of advice claims that this design &lt;/del&gt;in the small matters &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;a &lt;/del&gt;lot.&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;Key aspects in method design include clarity and readability. &lt;/del&gt;Ideally, any piece of source code should be readable like a good book: it should be interesting&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, clearly &lt;/del&gt;convey its intention and last but not least, fun to read&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. There are a number of very simple yet effective measures you can take towards this goal&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;Ideally, any piece of source code should be readable like a good book: it should be interesting&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;; it should &lt;/ins&gt;convey its intention &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;clearly; &lt;/ins&gt;and last&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;but not least, &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;it should be &lt;/ins&gt;fun to read.&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;The &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;most simple &lt;/del&gt;way to achieve readability is to use expressive names that properly describe the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;named &lt;/del&gt;concepts. In most cases this will mean relatively long names for methods and variables.&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;The &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;simplest &lt;/ins&gt;way to achieve readability is to use expressive names that properly describe the concepts &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;they identify&lt;/ins&gt;. In most cases this will mean relatively long names for methods and variables. Some argue that short names are easier and thus faster to type. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Modern &lt;/ins&gt;IDEs &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and editors are capable &lt;/ins&gt;of &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;simplifying &lt;/ins&gt;the typing&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, renaming, and searching of &lt;/ins&gt;names &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;to make &lt;/ins&gt;this &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;objection less relevant. Instead of thinking about the typing overhead today, think about the &lt;/ins&gt;time &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;saved tomorrow when you and others have to reread the code&lt;/ins&gt;. Be &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;particularly &lt;/ins&gt;careful &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;when &lt;/ins&gt;designing your method names because they are the verbs in the story you are trying to tell.&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;Some argue that short names are easier and thus faster to type. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;First of all, modern &lt;/del&gt;IDEs &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;can generate a variable name from the type &lt;/del&gt;of the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;variable in question - at least if you use a statically typed language. Even if you do spend time on &lt;/del&gt;typing &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;longer &lt;/del&gt;names this &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;usually has a pretty high ROI by saving you &lt;/del&gt;time &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;later&lt;/del&gt;. Be &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;even more &lt;/del&gt;careful &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;in &lt;/del&gt;designing your method names because they are the verbs in the story you are trying to tell.&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;Another source of readability and comprehensibility is brevity&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. While it will not necessarily make your overall LoC count smaller carefully designing the size of your methods is beneficial as pointed  out by Uncle Bobs contribution&lt;/del&gt;. As a rough guideline for an appropriate methods size I would argue for usually no more than 7+/-2 lines of code. This is motivated by applying the famous Rule of Seven which roughly states that the average human being can keep around 7 items in short term memory. In any case, make sure &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;every &lt;/del&gt;method &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;fits &lt;/del&gt;on your (and your &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;coworker&lt;/del&gt;'s) screen.&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;Another source of readability and comprehensibility is brevity. As a rough guideline for an appropriate methods size I would argue for usually no more than 7+/-2 lines of code. This is motivated by applying the famous &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;Rule of Seven&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/ins&gt;which roughly states that the average human being can keep around 7 items in short term memory. In any case, make sure &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;each &lt;/ins&gt;method &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;can fit &lt;/ins&gt;on your (and your &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;co-worker&lt;/ins&gt;'s) screen.&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; &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: #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;Keeping things simple (KISS) is a general rule of thumb in software design. One way of applying this to methods is to keep the cyclomatic complexity low – ideally under 4 or 5, definitely under 10.&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: #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;Cyclomatic complexity is a numeric value that can easily be computed by many tools and is roughly equivalent to the number of execution paths through a method. A high value of CC is empirically known to correlate with bugs and hinders unit testing.  &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 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;It has been pointed out by many that mixing concerns &lt;/del&gt;is &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;considered harmful&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;It stands &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;debate whether aspect-orientation &lt;/del&gt;is &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;needed &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;avoid this but separation of concerns at &lt;/del&gt;the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;method level goes a long way to increase the readability and maintainability of your code&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;In a way this &lt;/del&gt;is a &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;specialization of the Single Responsibility Principle (see Uncle Bob's contribution)  which states &lt;/del&gt;that &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;a class should have only one reason &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;change. Applied to methods this means that you should strive to map different aspects &lt;/del&gt;of &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;your required behavior cleanly to different methods&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This implies a finer level &lt;/del&gt;of &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;granularity compared &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;designing at class granularity and is useful even if your class as a whole does not violate the SRP&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;Keeping things simple (KISS) &lt;/ins&gt;is &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;a general rule of thumb in software design&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;One way of applying this &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;methods &lt;/ins&gt;is to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;keep &lt;/ins&gt;the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;cyclomatic complexity low &amp;amp;mdash; ideally under 4 or 5, definitely under 10&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Cyclomatic complexity &lt;/ins&gt;is a &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;numeric value &lt;/ins&gt;that &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;can easily be computed by many tools and is roughly equivalent &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;the number &lt;/ins&gt;of &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;execution paths through a method&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;A high value &lt;/ins&gt;of &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;CC complicates unit testing and has been empirically shown &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;correlate with bugs&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 idea of separation of technical and business, or generally, domain logic &lt;/del&gt;concerns is &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;emphasized by the current popularity of domain-specific languages (DSLs)&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Within this approach the domain logic &lt;/del&gt;is &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;expressed in &lt;/del&gt;a &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;dedicated language specialized for &lt;/del&gt;the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;given domain which &lt;/del&gt;can &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;ideally be edited by domain experts who are not programmers. DSL authors strive &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;make statements in &lt;/del&gt;the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;DSL sound just like 'plain English'&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;It has been pointed out by many that mixing &lt;/ins&gt;concerns is &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;considered harmful&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This &lt;/ins&gt;is &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;normally applied to classes as &lt;/ins&gt;a &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;whole, but also applied at &lt;/ins&gt;the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;method level it &lt;/ins&gt;can &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;go a long way &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;increase &lt;/ins&gt;the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;readability of your code&lt;/ins&gt;. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Applied &lt;/ins&gt;to methods &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;this means that you should strive &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;map different aspects &lt;/ins&gt;of your &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;required behavior cleanly &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;different methods&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: #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 this probably can help &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;improve communication with domain experts, &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: #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;careful design of short &lt;/del&gt;methods &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;with low complexity which focus on a single fine-granular concern and proper expressive naming of methods and variables will certainly help &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;better convey the intention &lt;/del&gt;of your &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;code &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;other developers - and to yourself&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This will improve maintainability in the long run and, after all, most software development is maintenance. Happy method design!&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 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;(yes&lt;/del&gt;, this &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;got &lt;/del&gt;a &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;bit too long&lt;/del&gt;, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;I &lt;/del&gt;will &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;try &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;make it shorter soon)&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;This idea of separation of technical and business&lt;/ins&gt;, &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;or generally, domain logic concerns is emphasized by the current popularity of domain-specific languages (DSLs). Within &lt;/ins&gt;this &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;approach the domain logic is expressed in &lt;/ins&gt;a &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;dedicated language specialized for the given domain which can ideally be edited by domain experts who are not programmers. DSL authors strive to make statements in the DSL sound just like 'plain English'. While this probably can help to improve communication with domain experts&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;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;careful design of short methods with low complexity which focus on a single fine-granular concern and proper expressive naming of methods and variables &lt;/ins&gt;will &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;certainly help &lt;/ins&gt;to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;better convey the intention of your code to other developers &amp;amp;mdash; and to yourself. This will improve maintainability in the long run and, after all, most software development is maintenance.&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;Happy method design!&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;By [[Matthias Merdes]]&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;This work is licensed under a [http://creativecommons.org/licenses/by/3.0/us/ Creative Commons Attribution 3] &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;&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;&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;Back to [[97 Things Every Programmer Should Know]] home page&lt;/ins&gt;&lt;/div&gt;&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=Methods_Matter&amp;diff=24937&amp;oldid=prev</id>
		<title>Kevlin: Methods matter moved to Methods Matter</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=24937&amp;oldid=prev"/>
				<updated>2009-07-19T05:47:18Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;a href=&quot;/wiki/index.php/Methods_matter&quot; title=&quot;Methods matter&quot;&gt;Methods matter&lt;/a&gt; moved to &lt;a href=&quot;/wiki/index.php/Methods_Matter&quot; title=&quot;Methods Matter&quot;&gt;Methods Matter&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 05:47, 19 July 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=Methods_Matter&amp;diff=24476&amp;oldid=prev</id>
		<title>Matthias at 00:32, 20 June 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=24476&amp;oldid=prev"/>
				<updated>2009-06-20T00:32:47Z</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 00:32, 20 June 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 12:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 12:&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;Cyclomatic complexity is a numeric value that can easily be computed by many tools and is roughly equivalent to the number of execution paths through a method. A high value of CC is empirically known to correlate with bugs and hinders unit testing.  &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;Cyclomatic complexity is a numeric value that can easily be computed by many tools and is roughly equivalent to the number of execution paths through a method. A high value of CC is empirically known to correlate with bugs and hinders unit testing.  &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;It has been pointed out by many that mixing concerns is considered harmful. It stands to debate whether &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;aspects are &lt;/del&gt;needed to avoid this but separation of concerns at the method level goes a long way to increase the readability and maintainability of your code. In a way this is a specialization of the Single Responsibility Principle (see Uncle Bob's contribution)  which states that a class should have only one reason to change. Applied to methods this means that you should strive to map different aspects of your required behavior cleanly to different methods. This implies a finer level of granularity compared to designing at class granularity and is useful even if your class as a whole does not violate the SRP. &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;It has been pointed out by many that mixing concerns is considered harmful. It stands to debate whether &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;aspect-orientation is &lt;/ins&gt;needed to avoid this but separation of concerns at the method level goes a long way to increase the readability and maintainability of your code. In a way this is a specialization of the Single Responsibility Principle (see Uncle Bob's contribution)  which states that a class should have only one reason to change. Applied to methods this means that you should strive to map different aspects of your required behavior cleanly to different methods. This implies a finer level of granularity compared to designing at class granularity and is useful even if your class as a whole does not violate the SRP. &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;This idea of separation of technical and business, or generally, domain logic concerns is emphasized by the current popularity of domain-specific languages (DSLs). Within this approach the domain logic is expressed in a dedicated language specialized for the given domain which can ideally be edited by domain experts who are not programmers. DSL authors strive to make statements in the DSL sound just like 'plain English'. &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;This idea of separation of technical and business, or generally, domain logic concerns is emphasized by the current popularity of domain-specific languages (DSLs). Within this approach the domain logic is expressed in a dedicated language specialized for the given domain which can ideally be edited by domain experts who are not programmers. DSL authors strive to make statements in the DSL sound just like 'plain English'. &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Matthias</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=24475&amp;oldid=prev</id>
		<title>Matthias at 00:31, 20 June 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Methods_Matter&amp;diff=24475&amp;oldid=prev"/>
				<updated>2009-06-20T00:31:37Z</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 00:31, 20 June 2009&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;Some argue that short names are easier and thus faster to type. First of all, modern IDEs can generate a variable name from the type of the variable in question - at least if you use a statically typed language. Even if you do spend time on typing longer names this usually has a pretty high ROI by saving you time later. Be even more careful in designing your method names because they are the verbs in the story you are trying to tell.&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;Some argue that short names are easier and thus faster to type. First of all, modern IDEs can generate a variable name from the type of the variable in question - at least if you use a statically typed language. Even if you do spend time on typing longer names this usually has a pretty high ROI by saving you time later. Be even more careful in designing your method names because they are the verbs in the story you are trying to tell.&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;Another source of readability and comprehensibility is brevity. While it will not necessarily make your overall LoC count smaller carefully designing the size of your methods is beneficial as pointed  out by Uncle Bobs contribution. As a rough guideline for an appropriate methods size I would argue for usually no more than 7+/-2 lines of code. This is motivated by applying the famous Rule of Seven which roughly states that the average human being can keep around 7 items in short term memory. In any case, make sure every &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;methods &lt;/del&gt;fits on your (and your coworker's) screen.&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;Another source of readability and comprehensibility is brevity. While it will not necessarily make your overall LoC count smaller carefully designing the size of your methods is beneficial as pointed  out by Uncle Bobs contribution. As a rough guideline for an appropriate methods size I would argue for usually no more than 7+/-2 lines of code. This is motivated by applying the famous Rule of Seven which roughly states that the average human being can keep around 7 items in short term memory. In any case, make sure every &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;method &lt;/ins&gt;fits on your (and your coworker's) screen.&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;div&gt; &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; &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;div&gt;Keeping things simple (KISS) is a general rule of thumb in software design. One way of applying this to methods is to keep the cyclomatic complexity low – ideally under 4 or 5, definitely under 10.&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;Keeping things simple (KISS) is a general rule of thumb in software design. One way of applying this to methods is to keep the cyclomatic complexity low – ideally under 4 or 5, definitely under 10.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:24474:newid:24475 --&gt;
&lt;/table&gt;</summary>
		<author><name>Matthias</name></author>	</entry>

	</feed>