<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Not necessarily necessary</title>
	<atom:link href="http://trinisoftinc.wordpress.com/2009/06/23/not-necessarily-necessary/feed/" rel="self" type="application/rss+xml" />
	<link>http://trinisoftinc.wordpress.com/2009/06/23/not-necessarily-necessary/</link>
	<description>JAND Blog spot</description>
	<lastBuildDate>Mon, 30 Nov 2009 11:30:05 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jose Ayerdis</title>
		<link>http://trinisoftinc.wordpress.com/2009/06/23/not-necessarily-necessary/#comment-199</link>
		<dc:creator>Jose Ayerdis</dc:creator>
		<pubDate>Thu, 25 Jun 2009 07:25:26 +0000</pubDate>
		<guid isPermaLink="false">http://trinisoftinc.wordpress.com/?p=65#comment-199</guid>
		<description>You can always edit it at the end, a correction from the statement. Remember not every one read the Comments. Rule 90-9-1. www.90-9-1.com</description>
		<content:encoded><![CDATA[<p>You can always edit it at the end, a correction from the statement. Remember not every one read the Comments. Rule 90-9-1. <a href="http://www.90-9-1.com" rel="nofollow">http://www.90-9-1.com</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Akintayo Olusegun</title>
		<link>http://trinisoftinc.wordpress.com/2009/06/23/not-necessarily-necessary/#comment-198</link>
		<dc:creator>Akintayo Olusegun</dc:creator>
		<pubDate>Thu, 25 Jun 2009 07:20:41 +0000</pubDate>
		<guid isPermaLink="false">http://trinisoftinc.wordpress.com/?p=65#comment-198</guid>
		<description>@ Jose Ayerdis That statement is not correct, Thanks for the correction. I would have edited the post, but then your comment would make no sense anymore, so I will leave it like that.</description>
		<content:encoded><![CDATA[<p>@ Jose Ayerdis That statement is not correct, Thanks for the correction. I would have edited the post, but then your comment would make no sense anymore, so I will leave it like that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jose Ayerdis</title>
		<link>http://trinisoftinc.wordpress.com/2009/06/23/not-necessarily-necessary/#comment-197</link>
		<dc:creator>Jose Ayerdis</dc:creator>
		<pubDate>Thu, 25 Jun 2009 00:30:08 +0000</pubDate>
		<guid isPermaLink="false">http://trinisoftinc.wordpress.com/?p=65#comment-197</guid>
		<description>&quot;This is where I prefer scala, the default is public, unlike java where the default is private&quot;

What do you mean the default access modifier is private?? the default access modifier in java is called packaged-modifier and it work under the package level access.

PD. nice post.</description>
		<content:encoded><![CDATA[<p>&#8220;This is where I prefer scala, the default is public, unlike java where the default is private&#8221;</p>
<p>What do you mean the default access modifier is private?? the default access modifier in java is called packaged-modifier and it work under the package level access.</p>
<p>PD. nice post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Bakketun</title>
		<link>http://trinisoftinc.wordpress.com/2009/06/23/not-necessarily-necessary/#comment-194</link>
		<dc:creator>Thomas Bakketun</dc:creator>
		<pubDate>Wed, 24 Jun 2009 01:20:55 +0000</pubDate>
		<guid isPermaLink="false">http://trinisoftinc.wordpress.com/?p=65#comment-194</guid>
		<description>Getter and setters are very useful for hiding implementation details that the user of an API does not have to be bothered with. However in your example the fact that the current password of a user can not be read is clearly part of the public API. Hiding the operation of generating a new password and returning it&#039;s hash violate the getter/setter idiom. Getters should always be idempotent, ie. calling the getter twice, with any other code in between, should always return the same value. Violating this idiom will sooner or later confuse some user of the API.

An example of proper use of a getter would be lazy loading in a database persistense system. A query might return &quot;hollow&quot; objects containg just the primary key. Whenever a property getter is accessed the data is automatically loaded from the database, and possibly cached in a hidden field of the object.

Please note that when an object is shared between different threads or processes, calling the same getter twice is not garanteed to return the same value. However it is still idempotent since it&#039;s not the act of calling the getter that is changing the property&#039;s value.


I would caution against the use of access modifiers as a means of keeping information secret. This will only work when the untrusted code is 100% garanteed to run in a sandbox. If it&#039;s not there are many ways of getting access to a private field, eg. by using the debugging functionality of the JVM.


As you correcly state, wrapper classes are need because the primitive types in Java are not objects. But why are they not? In programming languages such as Smalltalk and Lisp everything is an object. As far as I know effecieny problems related to this had been solved long before Java was created.</description>
		<content:encoded><![CDATA[<p>Getter and setters are very useful for hiding implementation details that the user of an API does not have to be bothered with. However in your example the fact that the current password of a user can not be read is clearly part of the public API. Hiding the operation of generating a new password and returning it&#8217;s hash violate the getter/setter idiom. Getters should always be idempotent, ie. calling the getter twice, with any other code in between, should always return the same value. Violating this idiom will sooner or later confuse some user of the API.</p>
<p>An example of proper use of a getter would be lazy loading in a database persistense system. A query might return &#8220;hollow&#8221; objects containg just the primary key. Whenever a property getter is accessed the data is automatically loaded from the database, and possibly cached in a hidden field of the object.</p>
<p>Please note that when an object is shared between different threads or processes, calling the same getter twice is not garanteed to return the same value. However it is still idempotent since it&#8217;s not the act of calling the getter that is changing the property&#8217;s value.</p>
<p>I would caution against the use of access modifiers as a means of keeping information secret. This will only work when the untrusted code is 100% garanteed to run in a sandbox. If it&#8217;s not there are many ways of getting access to a private field, eg. by using the debugging functionality of the JVM.</p>
<p>As you correcly state, wrapper classes are need because the primitive types in Java are not objects. But why are they not? In programming languages such as Smalltalk and Lisp everything is an object. As far as I know effecieny problems related to this had been solved long before Java was created.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
