<?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=Interfaces_Should_Reveal_Intention&amp;action=history&amp;feed=atom</id>
		<title>Interfaces Should Reveal Intention - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;action=history&amp;feed=atom"/>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;action=history"/>
		<updated>2013-05-21T20:10:20Z</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=Interfaces_Should_Reveal_Intention&amp;diff=24702&amp;oldid=prev</id>
		<title>Elandre at 09:20, 8 July 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=24702&amp;oldid=prev"/>
				<updated>2009-07-08T09:20:54Z</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 09:20, 8 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;So, where are the ''setters'' and ''getters'' so often found dominating our object models? They are not here as they do not add value to the behavioral intention and expression of object responsibility.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So, where are the ''setters'' and ''getters'' so often found dominating our object models? They are not here as they do not add value to the behavioral intention and expression of object responsibility.&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;Some might then argue that we need setters to support ''dependency injection'' (a.k.a. ''inversion of control'' design principle). Dependency injection has benefits as it reduces coupling and simplifies unit testing so that an object can be tested using a mock-up of a dependency. At the code level this mean that an resturant object that contain table objects, code such as &amp;lt;code&amp;gt;Table table = new TableImpl(...);&amp;lt;/code&amp;gt; can be replaced with &amp;lt;code&amp;gt;Table table;&amp;lt;/code&amp;gt; and then initialized from the outside at runtime by calling &amp;lt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;/&lt;/del&gt;code&amp;gt;resturant.setTable(new Table());&amp;lt;/code&amp;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;Some might then argue that we need setters to support ''dependency injection'' (a.k.a. ''inversion of control'' design principle). Dependency injection has benefits as it reduces coupling and simplifies unit testing so that an object can be tested using a mock-up of a dependency. At the code level this mean that an resturant object that contain table objects, code such as &amp;lt;code&amp;gt;Table table = new TableImpl(...);&amp;lt;/code&amp;gt; can be replaced with &amp;lt;code&amp;gt;Table table;&amp;lt;/code&amp;gt; and then initialized from the outside at runtime by calling &amp;lt;code&amp;gt;resturant.setTable(new Table());&amp;lt;/code&amp;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;The answer to that is that you do not necessarily need ''setters'' for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made clear by being public and separate. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&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 answer to that is that you do not necessarily need ''setters'' for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made clear by being public and separate. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:24701:newid:24702 --&gt;
&lt;/table&gt;</summary>
		<author><name>Elandre</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=24701&amp;oldid=prev</id>
		<title>Elandre at 09:20, 8 July 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=24701&amp;oldid=prev"/>
				<updated>2009-07-08T09:20:01Z</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 09:20, 8 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;So, where are the ''setters'' and ''getters'' so often found dominating our object models? They are not here as they do not add value to the behavioral intention and expression of object responsibility.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So, where are the ''setters'' and ''getters'' so often found dominating our object models? They are not here as they do not add value to the behavioral intention and expression of object responsibility.&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;Some might then argue that we need setters to support ''dependency injection'' (a.k.a. ''inversion of control'' design principle). Dependency injection has benefits as it reduces coupling and simplifies unit testing so that an object can be tested using a mock-up of a dependency. At the code level this mean that code such as &amp;lt;code&amp;gt;Table table = new TableImpl(...);&amp;lt;/code&amp;gt; can be replaced with &amp;lt;code&amp;gt;Table table;&amp;lt;/code&amp;gt; and then initialized from the outside at runtime.&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;Some might then argue that we need setters to support ''dependency injection'' (a.k.a. ''inversion of control'' design principle). Dependency injection has benefits as it reduces coupling and simplifies unit testing so that an object can be tested using a mock-up of a dependency. At the code level this mean that &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;an resturant object that contain table objects, &lt;/ins&gt;code such as &amp;lt;code&amp;gt;Table table = new TableImpl(...);&amp;lt;/code&amp;gt; can be replaced with &amp;lt;code&amp;gt;Table table;&amp;lt;/code&amp;gt; and then initialized from the outside at runtime &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;by calling &amp;lt;/code&amp;gt;resturant&lt;/ins&gt;.&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;setTable(new Table());&amp;lt;/code&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The answer to that is that you do not necessarily need ''setters'' for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made clear by being public and separate. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&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 answer to that is that you do not necessarily need ''setters'' for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made clear by being public and separate. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:24700:newid:24701 --&gt;
&lt;/table&gt;</summary>
		<author><name>Elandre</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=24700&amp;oldid=prev</id>
		<title>Elandre at 09:11, 8 July 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=24700&amp;oldid=prev"/>
				<updated>2009-07-08T09:11: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 09:11, 8 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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Kristen Nygaard, father of object-oriented programming and the Simula programming language, focused in his lectures on how to use objects to model the behavior of the real world and on how objects interacted to get a piece of work done. His favorite example was Cafe Objecta, where waiter objects served the appetites of hungry customer objects by allocating seating at table objects, providing menu objects, and receiving order objects.&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;Kristen Nygaard, father of object-oriented programming and the Simula programming language, focused in his lectures on how to use objects to model the behavior of the real world and on how objects interacted to get a piece of work done. His favorite example was Cafe Objecta, where waiter objects served the appetites of hungry customer objects by allocating seating at table objects, providing menu objects, and receiving order objects.&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;In this type of model we will find a restaurant object with a public interface offering methods such as &amp;lt;code&amp;gt;reserveTable(numberOfSeats,customer,timePoint)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;availableTables(numberOfSeats,timePoint)&amp;lt;/code&amp;gt;, and waiter objects with methods such as &amp;lt;code&amp;gt;serveTable(&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;tableNumber&lt;/del&gt;)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;provideMenu(customer,&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;tableNumber&lt;/del&gt;)&amp;lt;/code&amp;gt; &amp;amp;mdash; object interfaces that reveal each object's intent and responsibility in terms of the domain at hand.&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;In this type of model we will find a restaurant object with a public interface offering methods such as &amp;lt;code&amp;gt;reserveTable(numberOfSeats,customer,timePoint)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;availableTables(numberOfSeats,timePoint)&amp;lt;/code&amp;gt;, and waiter objects with methods such as &amp;lt;code&amp;gt;serveTable(&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;table&lt;/ins&gt;)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;provideMenu(customer,&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;table&lt;/ins&gt;)&amp;lt;/code&amp;gt; &amp;amp;mdash; object interfaces that reveal each object's intent and responsibility in terms of the domain at hand.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So, where are the ''setters'' and ''getters'' so often found dominating our object models? They are not here as they do not add value to the behavioral intention and expression of object responsibility.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So, where are the ''setters'' and ''getters'' so often found dominating our object models? They are not here as they do not add value to the behavioral intention and expression of object responsibility.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:24597:newid:24700 --&gt;
&lt;/table&gt;</summary>
		<author><name>Elandre</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=24597&amp;oldid=prev</id>
		<title>Kevlin at 18:30, 4 July 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=24597&amp;oldid=prev"/>
				<updated>2009-07-04T18:30: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 18:30, 4 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;Some might then argue that we need setters to support ''dependency injection'' (a.k.a. ''inversion of control'' design principle). Dependency injection has benefits as it reduces coupling and simplifies unit testing so that an object can be tested using a mock-up of a dependency. At the code level this mean that code such as &amp;lt;code&amp;gt;Table table = new TableImpl(...);&amp;lt;/code&amp;gt; can be replaced with &amp;lt;code&amp;gt;Table table;&amp;lt;/code&amp;gt; and then initialized from the outside at runtime.&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 might then argue that we need setters to support ''dependency injection'' (a.k.a. ''inversion of control'' design principle). Dependency injection has benefits as it reduces coupling and simplifies unit testing so that an object can be tested using a mock-up of a dependency. At the code level this mean that code such as &amp;lt;code&amp;gt;Table table = new TableImpl(...);&amp;lt;/code&amp;gt; can be replaced with &amp;lt;code&amp;gt;Table table;&amp;lt;/code&amp;gt; and then initialized from the outside at runtime.&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 answer to that is that you do not need setters for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made public and &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;clear&lt;/del&gt;. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&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 answer to that is that you do not &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;necessarily &lt;/ins&gt;need &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;setters&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/ins&gt;for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;clear by being &lt;/ins&gt;public and &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;separate&lt;/ins&gt;. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So what about the ''getters''? I think you are better off just referring to queried attributes by their name, using methods named &amp;lt;code&amp;gt;price&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;timePoint&amp;lt;/code&amp;gt;. Methods that are pure queries returning values are, by definition, functions and read better if they are direct: &amp;lt;code&amp;gt;item.price()&amp;lt;/code&amp;gt; reads better than &amp;lt;code&amp;gt;item.getPrice()&amp;lt;/code&amp;gt; because it make the concepts of the domain stand out clearly following the principles found in natural language.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So what about the ''getters''? I think you are better off just referring to queried attributes by their name, using methods named &amp;lt;code&amp;gt;price&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;timePoint&amp;lt;/code&amp;gt;. Methods that are pure queries returning values are, by definition, functions and read better if they are direct: &amp;lt;code&amp;gt;item.price()&amp;lt;/code&amp;gt; reads better than &amp;lt;code&amp;gt;item.getPrice()&amp;lt;/code&amp;gt; because it make the concepts of the domain stand out clearly following the principles found in natural language.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:23306:newid:24597 --&gt;
&lt;/table&gt;</summary>
		<author><name>Kevlin</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=23306&amp;oldid=prev</id>
		<title>Kevlin at 10:06, 5 February 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=23306&amp;oldid=prev"/>
				<updated>2009-02-05T10:06:50Z</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 10:06, 5 February 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&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 answer to that is that you do not need setters for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made public and clear. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&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 answer to that is that you do not need setters for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made public and clear. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&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;So what about the ''getters''? I think you are better off just referring to queried attributes by their name, using methods named &amp;lt;code&amp;gt;price&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;timePoint&amp;lt;/code&amp;gt;. Methods that are pure queries returning values are, by definition, functions and read better if they are direct: &amp;lt;code&amp;gt;item.price()&amp;lt;/code&amp;gt; reads better than &amp;lt;code&amp;gt;item.getPrice()&amp;lt;/code&amp;gt; because it make the concepts of the domain stand out clearly following the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;princicples &lt;/del&gt;found in natural language.&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;So what about the ''getters''? I think you are better off just referring to queried attributes by their name, using methods named &amp;lt;code&amp;gt;price&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;timePoint&amp;lt;/code&amp;gt;. Methods that are pure queries returning values are, by definition, functions and read better if they are direct: &amp;lt;code&amp;gt;item.price()&amp;lt;/code&amp;gt; reads better than &amp;lt;code&amp;gt;item.getPrice()&amp;lt;/code&amp;gt; because it make the concepts of the domain stand out clearly following the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;principles &lt;/ins&gt;found in natural language.&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;The conclusion on this is that setters and getters are alien constructs that do not reveal the intention and responsibility of a behavior-centric interface. Therefore you should try to avoid using them; there are better alternatives.&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 conclusion on this is that setters and getters are alien constructs that do not reveal the intention and responsibility of a behavior-centric interface. Therefore you should try to avoid using them; there are better alternatives.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:23305:newid:23306 --&gt;
&lt;/table&gt;</summary>
		<author><name>Kevlin</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=23305&amp;oldid=prev</id>
		<title>Elandre at 10:02, 5 February 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=23305&amp;oldid=prev"/>
				<updated>2009-02-05T10:02: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 10:02, 5 February 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&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 answer to that is that you do not need setters for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made public and clear. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&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 answer to that is that you do not need setters for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made public and clear. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&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;So what about the ''getters''? I think you are better off just referring to queried attributes by their name, using methods named &amp;lt;code&amp;gt;price&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;timePoint&amp;lt;/code&amp;gt;. Methods that are pure queries returning values are, by definition, functions and read better if they are direct: &amp;lt;code&amp;gt;item.price()&amp;lt;/code&amp;gt; reads better than &amp;lt;code&amp;gt;item.getPrice()&amp;lt;/code&amp;gt; because &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;they &lt;/del&gt;make the concepts of the domain stand out clearly. &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;So what about the ''getters''? I think you are better off just referring to queried attributes by their name, using methods named &amp;lt;code&amp;gt;price&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;timePoint&amp;lt;/code&amp;gt;. Methods that are pure queries returning values are, by definition, functions and read better if they are direct: &amp;lt;code&amp;gt;item.price()&amp;lt;/code&amp;gt; reads better than &amp;lt;code&amp;gt;item.getPrice()&amp;lt;/code&amp;gt; because &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;it &lt;/ins&gt;make the concepts of the domain stand out clearly &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;following the princicples found in natural language&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The conclusion on this is that setters and getters are alien constructs that do not reveal the intention and responsibility of a behavior-centric interface. Therefore you should try to avoid using them; there are better alternatives.&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 conclusion on this is that setters and getters are alien constructs that do not reveal the intention and responsibility of a behavior-centric interface. Therefore you should try to avoid using them; there are better alternatives.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:23304:newid:23305 --&gt;
&lt;/table&gt;</summary>
		<author><name>Elandre</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=23304&amp;oldid=prev</id>
		<title>Elandre at 10:00, 5 February 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=23304&amp;oldid=prev"/>
				<updated>2009-02-05T10:00:15Z</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 10:00, 5 February 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&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 answer to that is that you do not need setters for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made public and clear. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&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 answer to that is that you do not need setters for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made public and clear. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&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;So what about the ''getters''? I think you are better off just referring to queried attributes by their name, using methods named &amp;lt;code&amp;gt;price&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;timePoint&amp;lt;/code&amp;gt;. Methods that are pure queries returning values are, by definition, functions and read better if they are direct: &amp;lt;code&amp;gt;item.price()&amp;lt;/code&amp;gt; reads better than &amp;lt;code&amp;gt;item.getPrice()&amp;lt;/code&amp;gt; because the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;focus is on &lt;/del&gt;the domain. &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;So what about the ''getters''? I think you are better off just referring to queried attributes by their name, using methods named &amp;lt;code&amp;gt;price&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;timePoint&amp;lt;/code&amp;gt;. Methods that are pure queries returning values are, by definition, functions and read better if they are direct: &amp;lt;code&amp;gt;item.price()&amp;lt;/code&amp;gt; reads better than &amp;lt;code&amp;gt;item.getPrice()&amp;lt;/code&amp;gt; because &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;they make &lt;/ins&gt;the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;concepts of &lt;/ins&gt;the domain &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;stand out clearly&lt;/ins&gt;. &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The conclusion on this is that setters and getters are alien constructs that do not reveal the intention and responsibility of a behavior-centric interface. Therefore you should try to avoid using them; there are better alternatives.&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 conclusion on this is that setters and getters are alien constructs that do not reveal the intention and responsibility of a behavior-centric interface. Therefore you should try to avoid using them; there are better alternatives.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:23303:newid:23304 --&gt;
&lt;/table&gt;</summary>
		<author><name>Elandre</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=23303&amp;oldid=prev</id>
		<title>Elandre at 09:58, 5 February 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=23303&amp;oldid=prev"/>
				<updated>2009-02-05T09:58:13Z</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 09:58, 5 February 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&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 answer to that is that you do not need setters for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made public and clear. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&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 answer to that is that you do not need setters for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made public and clear. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&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;So what about the ''getters''? I think you are better off just referring to queried attributes by their name, using methods named &amp;lt;code&amp;gt;price&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;timePoint&amp;lt;/code&amp;gt;. Methods that are pure queries returning values are, by definition, functions and read better if they are direct: &amp;lt;code&amp;gt;item.price()&amp;lt;/code&amp;gt; reads better than &amp;lt;code&amp;gt;item.getPrice()&amp;lt;/code&amp;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;So what about the ''getters''? I think you are better off just referring to queried attributes by their name, using methods named &amp;lt;code&amp;gt;price&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;timePoint&amp;lt;/code&amp;gt;. Methods that are pure queries returning values are, by definition, functions and read better if they are direct: &amp;lt;code&amp;gt;item.price()&amp;lt;/code&amp;gt; reads better than &amp;lt;code&amp;gt;item.getPrice()&amp;lt;/code&amp;gt; &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;because the focus is on the domain&lt;/ins&gt;. &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The conclusion on this is that setters and getters are alien constructs that do not reveal the intention and responsibility of a behavior-centric interface. Therefore you should try to avoid using them; there are better alternatives.&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 conclusion on this is that setters and getters are alien constructs that do not reveal the intention and responsibility of a behavior-centric interface. Therefore you should try to avoid using them; there are better alternatives.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:23276:newid:23303 --&gt;
&lt;/table&gt;</summary>
		<author><name>Elandre</name></author>	</entry>

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

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:01, 4 February 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Kristen Nygaard, father of object oriented programming and the Simula programming language focused in his lectures on how to use objects to model the behavior of the real world and on how objects interacted to get a piece of work done. His favorite example was Cafe Objecta, where waiter objects served the appetites of hungry customer objects by allocating seating at table objects, providing menu objects and receiving order objects.&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;Kristen Nygaard, father of object&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;-&lt;/ins&gt;oriented programming and the Simula programming language&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;focused in his lectures on how to use objects to model the behavior of the real world and on how objects interacted to get a piece of work done. His favorite example was Cafe Objecta, where waiter objects served the appetites of hungry customer objects by allocating seating at table objects, providing menu objects&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;and receiving order objects.&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;In this type of model we will find a restaurant object with a public interface methods such as &amp;lt;code&amp;gt;reserveTable(numberOfSeats,customer,timePoint)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;availableTables(numberOfSeats,timePoint)&amp;lt;/code&amp;gt;, waiter objects with methods such as &amp;lt;code&amp;gt;serveTable(tableNumber)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;provideMenu(customer,tableNumber)&amp;lt;/code&amp;gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/del&gt;object interfaces that reveal each object's intent and responsibility in terms of the domain at hand.&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;In this type of model we will find a restaurant object with a public interface &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;offering &lt;/ins&gt;methods such as &amp;lt;code&amp;gt;reserveTable(numberOfSeats,customer,timePoint)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;availableTables(numberOfSeats,timePoint)&amp;lt;/code&amp;gt;, &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and &lt;/ins&gt;waiter objects with methods such as &amp;lt;code&amp;gt;serveTable(tableNumber)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;provideMenu(customer,tableNumber)&amp;lt;/code&amp;gt; &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;object interfaces that reveal each object's intent and responsibility in terms of the domain at hand.&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;So, where are the ''setters'' and ''getters'' so often found dominating our object models? They are not here as they do not add value to the behavioral intention and expression of object responsibility. &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;So, where are the ''setters'' and ''getters'' so often found dominating our object models? They are not here as they do not add value to the behavioral intention and expression of object responsibility.&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;Some might then argue that we need setters to support ''dependency injection'' (a.k.a. ''inversion of control'' design principle). Dependency injection has benefits as it reduces coupling and simplifies unit testing so that an object can be tested using a mock-up of a dependency. At the code level this mean that code such as &amp;lt;code&amp;gt;Table table = new TableImpl(...);&amp;lt;/code&amp;gt; can be replaced with &amp;lt;code&amp;gt;Table table;&amp;lt;/code&amp;gt; and then initialized from the outside at runtime.&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 might then argue that we need setters to support ''dependency injection'' (a.k.a. ''inversion of control'' design principle). Dependency injection has benefits as it reduces coupling and simplifies unit testing so that an object can be tested using a mock-up of a dependency. At the code level this mean that code such as &amp;lt;code&amp;gt;Table table = new TableImpl(...);&amp;lt;/code&amp;gt; can be replaced with &amp;lt;code&amp;gt;Table table;&amp;lt;/code&amp;gt; and then initialized from the outside at runtime.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&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 answer to that is that you do not need setters for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made public and clear. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&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 answer to that is that you do not need setters for that. Either you use the constructor or, even better, create an interface in an appropriate package called something like &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made public and clear. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&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;So what about the ''getters''? I think &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;personally &lt;/del&gt;you are better &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;of &lt;/del&gt;just referring to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;the actual attribute&lt;/del&gt;, using methods &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;such as &lt;/del&gt;&amp;lt;code&amp;gt;price&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;()&lt;/del&gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;()&lt;/del&gt;&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;timePoint&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;()&lt;/del&gt;&amp;lt;/code&amp;gt;. Methods that &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;return attributes &lt;/del&gt;are by definition functions and read better if they are direct: &amp;lt;code&amp;gt;item.price()&amp;lt;/code&amp;gt; reads better than &amp;lt;code&amp;gt;item.getPrice()&amp;lt;/code&amp;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;So what about the ''getters''? I think you are better &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;off &lt;/ins&gt;just referring to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;queried attributes by their name&lt;/ins&gt;, using methods &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;named &lt;/ins&gt;&amp;lt;code&amp;gt;price&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;timePoint&amp;lt;/code&amp;gt;. Methods that are &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;pure queries returning values are, &lt;/ins&gt;by definition&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;functions and read better if they are direct: &amp;lt;code&amp;gt;item.price()&amp;lt;/code&amp;gt; reads better than &amp;lt;code&amp;gt;item.getPrice()&amp;lt;/code&amp;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;The conclusion on this is that setters and getters are alien constructs that do not reveal the intention and responsibility of a behavior-centric interface. Therefore you should try to avoid using them; there are better alternatives.&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 conclusion on this is that setters and getters are alien constructs that do not reveal the intention and responsibility of a behavior-centric interface. Therefore you should try to avoid using them; there are better alternatives.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:21669:newid:23276 --&gt;
&lt;/table&gt;</summary>
		<author><name>Kevlin</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=21669&amp;oldid=prev</id>
		<title>Kevlin at 15:43, 22 November 2008</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Interfaces_Should_Reveal_Intention&amp;diff=21669&amp;oldid=prev"/>
				<updated>2008-11-22T15:43:00Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 15:43, 22 November 2008&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Kristen Nygaard, father of object oriented programming and the Simula programming language focused in his lectures on how to use objects to model the behavior of the real world and on how objects interacted to get a piece of work done. His favorite example was Cafe Objecta, where waiter objects served the appetites of hungry customer objects by allocating seating at table objects, providing menu objects and receiving order objects.&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;Kristen Nygaard, father of object oriented programming and the Simula programming language focused in his lectures on how to use objects to model the behavior of the real world and on how objects interacted to get a piece of work done. His favorite example was Cafe Objecta, where waiter objects served the appetites of hungry customer objects by allocating seating at table objects, providing menu objects and receiving order objects.&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;In this type of model we will find a restaurant object with a public interface methods such as &amp;lt;code&amp;gt;reserveTable(numberOfSeats,customer,timePoint)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;availableTables(numberOfSeats,timePoint)&amp;lt;/code&amp;gt;, waiter objects with methods such as &amp;lt;code&amp;gt;serveTable(tableNumber)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;provideMenu&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;&lt;/del&gt;customer,tableNumber)&amp;lt;/code&amp;gt;, object interfaces that reveal each object's intent and responsibility in terms of the domain at hand.&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;In this type of model we will find a restaurant object with a public interface methods such as &amp;lt;code&amp;gt;reserveTable(numberOfSeats,customer,timePoint)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;availableTables(numberOfSeats,timePoint)&amp;lt;/code&amp;gt;, waiter objects with methods such as &amp;lt;code&amp;gt;serveTable(tableNumber)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;provideMenu&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;(&lt;/ins&gt;customer,tableNumber)&amp;lt;/code&amp;gt;, object interfaces that reveal each object's intent and responsibility in terms of the domain at hand.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So, where are the ''setters'' and ''getters'' so often found dominating our object models? They are not here as they do not add value to the behavioral intention and expression of object responsibility. &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So, where are the ''setters'' and ''getters'' so often found dominating our object models? They are not here as they do not add value to the behavioral intention and expression of object responsibility. &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;Some might then argue that we need setters to support ''dependency injection'' a.k.a. ''inversion of control'' design principle. Dependency injection &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;is a good thing &lt;/del&gt;as it &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;provide reduced &lt;/del&gt;coupling and &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;simplified &lt;/del&gt;unit testing &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;as &lt;/del&gt;an object can be tested using a mock-up of a dependency. At the code level this mean that code such as &amp;lt;code&amp;gt;Table table = new TableImpl(..);&amp;lt;/code&amp;gt; can be replaced with &amp;lt;code&amp;gt;Table table;&amp;lt;/code&amp;gt; and then initialized from the outside at runtime.&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;Some might then argue that we need setters to support ''dependency injection'' &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;(&lt;/ins&gt;a.k.a. ''inversion of control'' design principle&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;)&lt;/ins&gt;. Dependency injection &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;has benefits &lt;/ins&gt;as it &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;reduces &lt;/ins&gt;coupling and &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;simplifies &lt;/ins&gt;unit testing &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;so that &lt;/ins&gt;an object can be tested using a mock-up of a dependency. At the code level this mean that code such as &amp;lt;code&amp;gt;Table table = new TableImpl(&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;.&lt;/ins&gt;..);&amp;lt;/code&amp;gt; can be replaced with &amp;lt;code&amp;gt;Table table;&amp;lt;/code&amp;gt; and then initialized from the outside at runtime.&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 answer to that is that you do not need setters for that. Either you use the constructor or, even better, create an interface in an appropriate package called &amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made public and clear. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&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 answer to that is that you do not need setters for that. Either you use the constructor or, even better, create an interface in an appropriate package called &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;something like &lt;/ins&gt;&amp;lt;code&amp;gt;ExternalInjections&amp;lt;/code&amp;gt; with methods prefixed with &amp;lt;code&amp;gt;initializeAttributeName(AttributeType)&amp;lt;/code&amp;gt;. Again the intention of the interface has been made public and clear. An interface designed to support the use of a specific design principle or the intent of frameworks such as Spring.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So what about the ''getters''? I think personally you are better of just referring to the actual attribute, using methods such as &amp;lt;code&amp;gt;price()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name()&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;timePoint()&amp;lt;/code&amp;gt;. Methods that return attributes are by definition functions and read better if they are direct: &amp;lt;code&amp;gt;item.price()&amp;lt;/code&amp;gt; reads better than &amp;lt;code&amp;gt;item.getPrice()&amp;lt;/code&amp;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;So what about the ''getters''? I think personally you are better of just referring to the actual attribute, using methods such as &amp;lt;code&amp;gt;price()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name()&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;timePoint()&amp;lt;/code&amp;gt;. Methods that return attributes are by definition functions and read better if they are direct: &amp;lt;code&amp;gt;item.price()&amp;lt;/code&amp;gt; reads better than &amp;lt;code&amp;gt;item.getPrice()&amp;lt;/code&amp;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;The conclusion on this is that setters and getters are alien constructs that do not reveal the intention and responsibility of a behavior-centric interface. Therefore you should avoid using them&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/del&gt;there are better alternatives.&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 conclusion on this is that setters and getters are alien constructs that do not reveal the intention and responsibility of a behavior-centric interface. Therefore you should &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;try to &lt;/ins&gt;avoid using them&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;; &lt;/ins&gt;there are better alternatives.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;By [[Einar Landre]]&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 [[Einar Landre]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:12765:newid:21669 --&gt;
&lt;/table&gt;</summary>
		<author><name>Kevlin</name></author>	</entry>

	</feed>