<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Help Us Name This Method</title>
	<atom:link href="http://davybrion.com/blog/2009/04/help-us-name-this-method/feed/" rel="self" type="application/rss+xml" />
	<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/</link>
	<description>Trying to walk that thin line between intelligence and ignorance</description>
	<lastBuildDate>Thu, 29 Jul 2010 21:01:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Graham</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-22125</link>
		<dc:creator>Graham</dc:creator>
		<pubDate>Mon, 06 Jul 2009 11:13:26 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-22125</guid>
		<description>Cheers for this. I had the same problem :)

I went for the LoadingBehaviour option as well. It&#039;s an unnecessary overload in some respects but it is obvious what its for.</description>
		<content:encoded><![CDATA[<p>Cheers for this. I had the same problem <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I went for the LoadingBehaviour option as well. It&#8217;s an unnecessary overload in some respects but it is obvious what its for.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olivier</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13762</link>
		<dc:creator>Olivier</dc:creator>
		<pubDate>Wed, 29 Apr 2009 20:29:23 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13762</guid>
		<description>I too vote for either LazyGet or FutureGet</description>
		<content:encoded><![CDATA[<p>I too vote for either LazyGet or FutureGet</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13525</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Tue, 28 Apr 2009 05:51:03 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13525</guid>
		<description>@Rob

There are cases where you specifically want to use proxies for performance reasons, so yes, the calling code should care :)

The difference in behavior is not something i&#039;d want to configure through an IOC container, since the choice of using a proxy instead of fetching the real reference should in most cases be an explicit one IMO

As for where we stand on the name of the method... we&#039;re currently leaning towards the overloaded Get method with the enum as mentioned by Dylan.  It seems to be the only option that nobody objects to :)</description>
		<content:encoded><![CDATA[<p>@Rob</p>
<p>There are cases where you specifically want to use proxies for performance reasons, so yes, the calling code should care <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The difference in behavior is not something i&#8217;d want to configure through an IOC container, since the choice of using a proxy instead of fetching the real reference should in most cases be an explicit one IMO</p>
<p>As for where we stand on the name of the method&#8230; we&#8217;re currently leaning towards the overloaded Get method with the enum as mentioned by Dylan.  It seems to be the only option that nobody objects to <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13496</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Mon, 27 Apr 2009 21:40:30 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13496</guid>
		<description>Should the calling code actually care? Or is it more a strategy configured through you ioc?</description>
		<content:encoded><![CDATA[<p>Should the calling code actually care? Or is it more a strategy configured through you ioc?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TomasE</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13472</link>
		<dc:creator>TomasE</dc:creator>
		<pubDate>Mon, 27 Apr 2009 14:32:15 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13472</guid>
		<description>GetProxiableInstance</description>
		<content:encoded><![CDATA[<p>GetProxiableInstance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dylan Beattie</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13387</link>
		<dc:creator>Dylan Beattie</dc:creator>
		<pubDate>Sun, 26 Apr 2009 14:17:25 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13387</guid>
		<description>Why not create an enumeration
&lt;code&gt;
public enum LoadingBehaviour {
    ///&lt;summary&gt;Load from the data store immediately, 
    ///raising an exception if the item is not found&lt;/summary&gt;
    Force,

   ///&lt;summary&gt;Return the cached object if it exists, otherwise
   ///create and return a proxy that may later raise an exception
   ///when it&#039;s used&lt;/summary&gt;
   Defer
}
&lt;/code&gt;

and then add an overload like .Get(int id, LoadingBehaviour behaviour), with the default .Get(int id) calling the new overload with the appropriate default loading behaviour?

It means when you&#039;re reading the code, you&#039;ll see

customerRepository.Get(customerId, LoadingBehaviour.Defer)

- which indicates pretty clearly what&#039;s going on, without polluting your repository interface with potentially confusing method names.

Just an idea :)

-D-</description>
		<content:encoded><![CDATA[<p>Why not create an enumeration<br />
<code><br />
public enum LoadingBehaviour {<br />
    ///&lt;summary&gt;Load from the data store immediately,<br />
    ///raising an exception if the item is not found&lt;/summary&gt;<br />
    Force,</p>
<p>   ///&lt;summary&gt;Return the cached object if it exists, otherwise<br />
   ///create and return a proxy that may later raise an exception<br />
   ///when it's used&lt;/summary&gt;<br />
   Defer<br />
}<br />
</code></p>
<p>and then add an overload like .Get(int id, LoadingBehaviour behaviour), with the default .Get(int id) calling the new overload with the appropriate default loading behaviour?</p>
<p>It means when you&#8217;re reading the code, you&#8217;ll see</p>
<p>customerRepository.Get(customerId, LoadingBehaviour.Defer)</p>
<p>- which indicates pretty clearly what&#8217;s going on, without polluting your repository interface with potentially confusing method names.</p>
<p>Just an idea <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>-D-</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken Egozi</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13313</link>
		<dc:creator>Ken Egozi</dc:creator>
		<pubDate>Sat, 25 Apr 2009 16:37:03 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13313</guid>
		<description>@Davy - resharper can help with the rename, and smtp/pop3 with communicating that to the team ;)

I&#039;m gonna go with that for our team, so hopefully soon enough I&#039;ll have input from people who have never used NH about this naming convention.</description>
		<content:encoded><![CDATA[<p>@Davy &#8211; resharper can help with the rename, and smtp/pop3 with communicating that to the team <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I&#8217;m gonna go with that for our team, so hopefully soon enough I&#8217;ll have input from people who have never used NH about this naming convention.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fabio Maulo</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13304</link>
		<dc:creator>Fabio Maulo</dc:creator>
		<pubDate>Sat, 25 Apr 2009 14:17:29 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13304</guid>
		<description>in uNhAddIns application blocks the name is GetProxi, in another app I&#039;m using GetDelayed</description>
		<content:encoded><![CDATA[<p>in uNhAddIns application blocks the name is GetProxi, in another app I&#8217;m using GetDelayed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13296</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Sat, 25 Apr 2009 11:16:53 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13296</guid>
		<description>FutureGet: at first i liked this one, but i think it would be too easy to think that the actual query (if it&#039;s ever sent) would be batched along with other queries if possible (which is the behavior of every other FutureSomething method name). But the ISession.Load method won&#039;t do any batching.

GetInstanceOrProxy: might be a good one, though i&#039;d probably go for GetProxyOrInstance then, since it&#039;s often more likely that you&#039;ll end up with a proxy than with the actual instance

@Rob: public methods with a boolean parameter that modify the behavior of the method are a bit of a no-no. It&#039;s far better to come up with a meaningful name which clearly explains the different behavior... not always easy if you can&#039;t come up with a good name though ;)

@Ken: i kinda like the reasoning behind that, but unfortunately we&#039;ve already had the Get method in the base class for months now and it&#039;s already being used all over the place, so i can&#039;t just change it like that.

another possibility i came up with is DeferredGet... the name is not entirely accurate though since the actual retrieval may never happen... thoughts?</description>
		<content:encoded><![CDATA[<p>FutureGet: at first i liked this one, but i think it would be too easy to think that the actual query (if it&#8217;s ever sent) would be batched along with other queries if possible (which is the behavior of every other FutureSomething method name). But the ISession.Load method won&#8217;t do any batching.</p>
<p>GetInstanceOrProxy: might be a good one, though i&#8217;d probably go for GetProxyOrInstance then, since it&#8217;s often more likely that you&#8217;ll end up with a proxy than with the actual instance</p>
<p>@Rob: public methods with a boolean parameter that modify the behavior of the method are a bit of a no-no. It&#8217;s far better to come up with a meaningful name which clearly explains the different behavior&#8230; not always easy if you can&#8217;t come up with a good name though <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>@Ken: i kinda like the reasoning behind that, but unfortunately we&#8217;ve already had the Get method in the base class for months now and it&#8217;s already being used all over the place, so i can&#8217;t just change it like that.</p>
<p>another possibility i came up with is DeferredGet&#8230; the name is not entirely accurate though since the actual retrieval may never happen&#8230; thoughts?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken Egozi</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13287</link>
		<dc:creator>Ken Egozi</dc:creator>
		<pubDate>Sat, 25 Apr 2009 08:55:10 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13287</guid>
		<description>Hi Davy.
I have the exact same problem at hand now. We&#039;re setting up the Persistence layer, using NH, and looking for the correct naming.

My (not final) take is to map NH.Load to repo.Get, and NH.Get to repo.FindById

reasoning:
The NH.Load method is supposed to be used when you know that the ID is present in the data store. Otherwise, an exception will be thrown.  the .Get behaviour adhere to search mechanism - that is: if it&#039;s there then bring it back, otherwise return null.  It behaves exactly like &quot;from Whadever o where o.Id == Id&quot;.List().FirstOrDefault()  + first look in Session cache.</description>
		<content:encoded><![CDATA[<p>Hi Davy.<br />
I have the exact same problem at hand now. We&#8217;re setting up the Persistence layer, using NH, and looking for the correct naming.</p>
<p>My (not final) take is to map NH.Load to repo.Get, and NH.Get to repo.FindById</p>
<p>reasoning:<br />
The NH.Load method is supposed to be used when you know that the ID is present in the data store. Otherwise, an exception will be thrown.  the .Get behaviour adhere to search mechanism &#8211; that is: if it&#8217;s there then bring it back, otherwise return null.  It behaves exactly like &#8220;from Whadever o where o.Id == Id&#8221;.List().FirstOrDefault()  + first look in Session cache.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: efdee</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13249</link>
		<dc:creator>efdee</dc:creator>
		<pubDate>Fri, 24 Apr 2009 22:37:59 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13249</guid>
		<description>I&#039;d go for GetCachedOrLazy(id). &#039;Instance&#039; doesn&#039;t really imply not touching the database, and &#039;Proxy&#039; is just an implementation detail I think.</description>
		<content:encoded><![CDATA[<p>I&#8217;d go for GetCachedOrLazy(id). &#8216;Instance&#8217; doesn&#8217;t really imply not touching the database, and &#8216;Proxy&#8217; is just an implementation detail I think.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13244</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Fri, 24 Apr 2009 21:24:11 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13244</guid>
		<description>Isn&#039;t it a viable option to provide an overload of the Getmethod with an extra boolean to specify if you want to immdiate DBaccess or not?</description>
		<content:encoded><![CDATA[<p>Isn&#8217;t it a viable option to provide an overload of the Getmethod with an extra boolean to specify if you want to immdiate DBaccess or not?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arjan`s World &#187; LINKBLOG for April 24, 2009</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13238</link>
		<dc:creator>Arjan`s World &#187; LINKBLOG for April 24, 2009</dc:creator>
		<pubDate>Fri, 24 Apr 2009 19:45:30 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13238</guid>
		<description>[...] Help Us Name This Method - Davy Brion Davy has trouble making up his own names method, so could you please help him out? [...]</description>
		<content:encoded><![CDATA[<p>[...] Help Us Name This Method &#8211; Davy Brion Davy has trouble making up his own names method, so could you please help him out? [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Nguyen</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13236</link>
		<dc:creator>Nick Nguyen</dc:creator>
		<pubDate>Fri, 24 Apr 2009 19:22:26 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13236</guid>
		<description>GetInstanceOrProxy(id) makes sense and does what it says it does.</description>
		<content:encoded><![CDATA[<p>GetInstanceOrProxy(id) makes sense and does what it says it does.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Rivers</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13229</link>
		<dc:creator>Josh Rivers</dc:creator>
		<pubDate>Fri, 24 Apr 2009 17:07:47 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13229</guid>
		<description>I like .Imagine()

If you already have what you imagine, then you have it. If you don&#039;t already have what you imagine, you get to play with a make-believe one.</description>
		<content:encoded><![CDATA[<p>I like .Imagine()</p>
<p>If you already have what you imagine, then you have it. If you don&#8217;t already have what you imagine, you get to play with a make-believe one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BengtBe</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13226</link>
		<dc:creator>BengtBe</dc:creator>
		<pubDate>Fri, 24 Apr 2009 16:21:11 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13226</guid>
		<description>LazyGet or
FutureGet (as Bill proposed)</description>
		<content:encoded><![CDATA[<p>LazyGet or<br />
FutureGet (as Bill proposed)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Morris</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13225</link>
		<dc:creator>Peter Morris</dc:creator>
		<pubDate>Fri, 24 Apr 2009 16:13:42 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13225</guid>
		<description>Or 
  GetObjectReferenceByID
  GetObjectLocatorByID</description>
		<content:encoded><![CDATA[<p>Or<br />
  GetObjectReferenceByID<br />
  GetObjectLocatorByID</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Morris</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13224</link>
		<dc:creator>Peter Morris</dc:creator>
		<pubDate>Fri, 24 Apr 2009 16:13:09 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13224</guid>
		<description>I&#039;d go for GetProxyByID(....)</description>
		<content:encoded><![CDATA[<p>I&#8217;d go for GetProxyByID(&#8230;.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hernan Garcia</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13223</link>
		<dc:creator>Hernan Garcia</dc:creator>
		<pubDate>Fri, 24 Apr 2009 16:11:26 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13223</guid>
		<description>Interesting dilema. 
Not sure all the usages scenarios in your case but a few quick ideas (without much thought behind theme).

_repo.GetFromCache(id); 
Using &quot;from cache&quot; indicates that you may not get the actual object and doesn&#039;t necessarily breaks persistance ignorance) an alternatived name could be: _repo.GetCached(id).
Now, if you use another cache for other purposes like memcached this method name may be misleading.

_repo.TryToGet(id); 
Again this is not perfect, but indicates that you may not actually get the instance.

A more verbose (but precise) naming approach.

_repo.GetInstanceOrProxy(id); //I may personaly get this one.</description>
		<content:encoded><![CDATA[<p>Interesting dilema.<br />
Not sure all the usages scenarios in your case but a few quick ideas (without much thought behind theme).</p>
<p>_repo.GetFromCache(id);<br />
Using &#8220;from cache&#8221; indicates that you may not get the actual object and doesn&#8217;t necessarily breaks persistance ignorance) an alternatived name could be: _repo.GetCached(id).<br />
Now, if you use another cache for other purposes like memcached this method name may be misleading.</p>
<p>_repo.TryToGet(id);<br />
Again this is not perfect, but indicates that you may not actually get the instance.</p>
<p>A more verbose (but precise) naming approach.</p>
<p>_repo.GetInstanceOrProxy(id); //I may personaly get this one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pierce</title>
		<link>http://davybrion.com/blog/2009/04/help-us-name-this-method/comment-page-1/#comment-13222</link>
		<dc:creator>Bill Pierce</dc:creator>
		<pubDate>Fri, 24 Apr 2009 16:01:58 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1334#comment-13222</guid>
		<description>I&#039;d think this would be an easy one for you Davy, considering your recent efforts in this area:

FutureGet

:)</description>
		<content:encoded><![CDATA[<p>I&#8217;d think this would be an easy one for you Davy, considering your recent efforts in this area:</p>
<p>FutureGet</p>
<p> <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
