<?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 for jalf.dk</title>
	<atom:link href="http://jalf.dk/blog/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://jalf.dk/blog</link>
	<description>Musings and thoughts on programming and other geeky stuff</description>
	<lastBuildDate>Sat, 07 Jan 2012 20:30:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>Comment on Dear games industry. Grow up by GMan</title>
		<link>http://jalf.dk/blog/2012/01/dear-games-industry-grow-up/comment-page-1/#comment-24832</link>
		<dc:creator>GMan</dc:creator>
		<pubDate>Sat, 07 Jan 2012 20:30:11 +0000</pubDate>
		<guid isPermaLink="false">http://jalf.dk/blog/?p=912#comment-24832</guid>
		<description>&lt;p&gt;That&#039;s funny, because it&#039;s the same thing I say about the coding practices.&lt;/p&gt;

&lt;p&gt;You can suggest the use of Boost or std::unique_ptr and quite literally get a totally negative response coupled with &quot;but what about speed?!&quot; The game industry is so for-profit and so overly-pragmatic (if you can even call their practices practical) that they constantly harm themselves repeatedly before taking a step back and saying, &quot;oh look, guys, everyone else solved this problem years ago!&quot;&lt;/p&gt;

&lt;p&gt;It&#039;s stupid.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>That’s funny, because it’s the same thing I say about the coding practices.</p>

<p>You can suggest the use of Boost or std::unique_ptr and quite literally get a totally negative response coupled with “but what about speed?!” The game industry is so for-profit and so overly-pragmatic (if you can even call their practices practical) that they constantly harm themselves repeatedly before taking a step back and saying, “oh look, guys, everyone else solved this problem years ago!”</p>

<p>It’s stupid.</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on “Good design”, and why OOP isn’t going to get us there by Frank</title>
		<link>http://jalf.dk/blog/2010/11/good-design-oop/comment-page-1/#comment-21954</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Mon, 12 Dec 2011 18:51:15 +0000</pubDate>
		<guid isPermaLink="false">http://jalf.dk/blog/?p=656#comment-21954</guid>
		<description>&lt;p&gt;@jalf The child object is not a good example, because you cannot classify someone/something as child because is playing with a ball, learning, aging, etc, these are processes executed by/happening to an entity/party/whatever, in this case a Entity &gt; Animal &gt; Human.&lt;/p&gt;

&lt;p&gt;But yet I agree with the fact of creating useless objects like in the car example, people forget that objects are good for &lt;em&gt;data encapsulation&lt;/em&gt; in a way that only the object has access to the raw data and provides functions to manipulate it.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@jalf The child object is not a good example, because you cannot classify someone/something as child because is playing with a ball, learning, aging, etc, these are processes executed by/happening to an entity/party/whatever, in this case a Entity &gt; Animal &gt; Human.</p>

<p>But yet I agree with the fact of creating useless objects like in the car example, people forget that objects are good for <em>data encapsulation</em> in a way that only the object has access to the raw data and provides functions to manipulate it.</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on Singletons: Solving problems you didn’t know you never had since 1995 by Hari Karam Singh</title>
		<link>http://jalf.dk/blog/2010/03/singletons-solving-problems-you-didnt-know-you-never-had-since-1995/comment-page-1/#comment-17597</link>
		<dc:creator>Hari Karam Singh</dc:creator>
		<pubDate>Sat, 19 Nov 2011 16:10:07 +0000</pubDate>
		<guid isPermaLink="false">http://jalf.dk/blog/?p=532#comment-17597</guid>
		<description>&lt;p&gt;Hidden in the sense that the lowest level object which is making the call now has 2 more dependencies in addition to its dependency on the settings class - perhaps not hidden from it&#039;s perspective but from the top level vantage point, doesn&#039;t the dependency on Settings seem quite buried?  Say you changed the structure of the settings object and needed to find all referencing code...&lt;/p&gt;

&lt;p&gt;At first I was inclined toward your stance on using a simple global variable which is init&#039;ed perhaps, with the app startup.  Upon reflection however, I&#039;m not sure I see the difference between this and the singleton pattern, other than that the later packages the global variable (as a static) and has a self contained initialisation.  Some might even argue that this is more in keeping with Single Responsibility Principle.  What do you think?&lt;/p&gt;

&lt;p&gt;Thanks for the thought provoking and detailed discussion by the way.  It&#039;s very pertinent to the code I&#039;m writing as we speak :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hidden in the sense that the lowest level object which is making the call now has 2 more dependencies in addition to its dependency on the settings class — perhaps not hidden from it’s perspective but from the top level vantage point, doesn’t the dependency on Settings seem quite buried?  Say you changed the structure of the settings object and needed to find all referencing code…</p>

<p>At first I was inclined toward your stance on using a simple global variable which is init’ed perhaps, with the app startup.  Upon reflection however, I’m not sure I see the difference between this and the singleton pattern, other than that the later packages the global variable (as a static) and has a self contained initialisation.  Some might even argue that this is more in keeping with Single Responsibility Principle.  What do you think?</p>

<p>Thanks for the thought provoking and detailed discussion by the way.  It’s very pertinent to the code I’m writing as we speak :)</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on Singletons: Solving problems you didn’t know you never had since 1995 by jalf</title>
		<link>http://jalf.dk/blog/2010/03/singletons-solving-problems-you-didnt-know-you-never-had-since-1995/comment-page-1/#comment-17474</link>
		<dc:creator>jalf</dc:creator>
		<pubDate>Thu, 17 Nov 2011 19:27:32 +0000</pubDate>
		<guid isPermaLink="false">http://jalf.dk/blog/?p=532#comment-17474</guid>
		<description>&lt;p&gt;How is the first one a hidden dependency? It&#039;s clear exactly &lt;em&gt;how&lt;/em&gt; the current object retrieves the settings object. We know that it does this through its reference to the parent controller, which has a reference to the parent application, and so on. We have explicitly said in the code that this code requires a reference to the parent controller, so it is not a hidden dependency. I can look at the object&#039;s constructor and see that it takes a reference to the object it needs to reference.
Or I can follow the code the other way around: Start at wherever the &lt;code&gt;settings&lt;/code&gt; object is created, and then read along to see where it is passed to. If I follow the code from that point, it naturally takes me to every use site.&lt;/p&gt;

&lt;p&gt;On the other hand, in your second snippet, it&#039;s not clear where this settings object &lt;em&gt;comes from&lt;/em&gt;. And I can&#039;t follow the uses of the object. If I start at the construction of the &lt;code&gt;settings&lt;/code&gt; object, I immediately run into &quot;it&#039;s stored into a singleton, which is... just there. At some point, someone might call &lt;code&gt;getInstance&lt;/code&gt; on it, but I don&#039;t know who does that, or when or why.&lt;/p&gt;

&lt;p&gt;So I disagree with your analysis of dependencies.&lt;/p&gt;

&lt;p&gt;On the other hand, it is certainly more &lt;em&gt;convenient&lt;/em&gt; to just make the settings object globally accessible.&lt;/p&gt;

&lt;p&gt;So go ahead and do that. But it doesn&#039;t need to be a &lt;em&gt;singleton&lt;/em&gt; to achieve that goal. Just a single global/static instance will allow everyone to access the settings object if they want to. There&#039;s no need for messing around with singletons and all the &lt;em&gt;other&lt;/em&gt; problems they cause.&lt;/p&gt;

&lt;p&gt;Singletons are global, but globals are not singletons. If you need a global, that doesn&#039;t mean you have to use a singleton.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>How is the first one a hidden dependency? It’s clear exactly <em>how</em> the current object retrieves the settings object. We know that it does this through its reference to the parent controller, which has a reference to the parent application, and so on. We have explicitly said in the code that this code requires a reference to the parent controller, so it is not a hidden dependency. I can look at the object’s constructor and see that it takes a reference to the object it needs to reference.
Or I can follow the code the other way around: Start at wherever the <code>settings</code> object is created, and then read along to see where it is passed to. If I follow the code from that point, it naturally takes me to every use site.</p>

<p>On the other hand, in your second snippet, it’s not clear where this settings object <em>comes from</em>. And I can’t follow the uses of the object. If I start at the construction of the <code>settings</code> object, I immediately run into “it’s stored into a singleton, which is… just there. At some point, someone might call <code>getInstance</code> on it, but I don’t know who does that, or when or why.</p>

<p>So I disagree with your analysis of dependencies.</p>

<p>On the other hand, it is certainly more <em>convenient</em> to just make the settings object globally accessible.</p>

<p>So go ahead and do that. But it doesn’t need to be a <em>singleton</em> to achieve that goal. Just a single global/static instance will allow everyone to access the settings object if they want to. There’s no need for messing around with singletons and all the <em>other</em> problems they cause.</p>

<p>Singletons are global, but globals are not singletons. If you need a global, that doesn’t mean you have to use a singleton.</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on Singletons: Solving problems you didn’t know you never had since 1995 by Hari Karam Singh</title>
		<link>http://jalf.dk/blog/2010/03/singletons-solving-problems-you-didnt-know-you-never-had-since-1995/comment-page-1/#comment-17460</link>
		<dc:creator>Hari Karam Singh</dc:creator>
		<pubDate>Thu, 17 Nov 2011 15:01:17 +0000</pubDate>
		<guid isPermaLink="false">http://jalf.dk/blog/?p=532#comment-17460</guid>
		<description>&lt;p&gt;So say you need access to a Settings class at various hierarchical levels in your code, for instance the Application, the Controller and the View.  You could have a globally accessible Singleton and have code like:&lt;/p&gt;

&lt;blockquote&gt;
SettingsClass.getSetting(&#039;showTooltips&#039;)
&lt;/blockquote&gt;

&lt;p&gt;Or you have it be an instance var on the Application class which is referenced by an instance var on the Controller class which is referenced by an instance var on the view and so on...  You end up with the following:&lt;/p&gt;

&lt;blockquote&gt;
self.parentController.parentApplication.settings.getSetting(&#039;showTooltips&#039;);
&lt;/blockquote&gt;

&lt;p&gt;Which is a (very!) hidden dependency.  Or you do...&lt;/p&gt;

&lt;blockquote&gt;
Application&#039;s init:
self.viewController.showTooltips = settings.getSettings(&#039;showTooltips&#039;)

viewController&#039;s init:
self.view = this.showTooltips

&lt;/blockquote&gt;

&lt;p&gt;...and create tons of code with a multiplicity of by way of property names, making changes such as refactoring a serious sweat.&lt;/p&gt;

&lt;p&gt;What I&#039;m asking really, is what about the case for the singleton (or at least a global variable) where it reduces complexity for application areas which aren&#039;t resource intensive?&lt;/p&gt;

&lt;p&gt;Like many things in programming isn&#039;t it a trade off between simplicity and covering all potential future  cases?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>So say you need access to a Settings class at various hierarchical levels in your code, for instance the Application, the Controller and the View.  You could have a globally accessible Singleton and have code like:</p>

<blockquote>
SettingsClass.getSetting(‘showTooltips’)
</blockquote>

<p>Or you have it be an instance var on the Application class which is referenced by an instance var on the Controller class which is referenced by an instance var on the view and so on…  You end up with the following:</p>

<blockquote>
self.parentController.parentApplication.settings.getSetting(‘showTooltips’);
</blockquote>

<p>Which is a (very!) hidden dependency.  Or you do…</p>

<blockquote>
Application’s init:
self.viewController.showTooltips = settings.getSettings(‘showTooltips’)

viewController’s init:
self.view = this.showTooltips

</blockquote>

<p>…and create tons of code with a multiplicity of by way of property names, making changes such as refactoring a serious sweat.</p>

<p>What I’m asking really, is what about the case for the singleton (or at least a global variable) where it reduces complexity for application areas which aren’t resource intensive?</p>

<p>Like many things in programming isn’t it a trade off between simplicity and covering all potential future  cases?</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on What’s wrong with Visual C++ and Microsoft Connect? by Joacim [MVP]</title>
		<link>http://jalf.dk/blog/2011/08/whats-wrong-with-visual-c-and-microsoft-connect/comment-page-1/#comment-15584</link>
		<dc:creator>Joacim [MVP]</dc:creator>
		<pubDate>Thu, 03 Nov 2011 00:37:16 +0000</pubDate>
		<guid isPermaLink="false">http://jalf.dk/blog/?p=947#comment-15584</guid>
		<description>&lt;p&gt;@Konrad. Well we all know Apple&#039;s slogan: It just works! (and if it doesn&#039;t we don&#039;t want to hear about it).&lt;/p&gt;

&lt;p&gt;I agree that Connect has been somewhat of a joke for many years but I must say that since Doug took over as the PM for Feedback at MS, things have started to move (slowly, but still moving) in the right direction. There&#039;s still a long way to go but I hope they will get there...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Konrad. Well we all know Apple’s slogan: It just works! (and if it doesn’t we don’t want to hear about it).</p>

<p>I agree that Connect has been somewhat of a joke for many years but I must say that since Doug took over as the PM for Feedback at MS, things have started to move (slowly, but still moving) in the right direction. There’s still a long way to go but I hope they will get there…</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on Singletons: Solving problems you didn’t know you never had since 1995 by jalf</title>
		<link>http://jalf.dk/blog/2010/03/singletons-solving-problems-you-didnt-know-you-never-had-since-1995/comment-page-1/#comment-14750</link>
		<dc:creator>jalf</dc:creator>
		<pubDate>Sat, 29 Oct 2011 12:18:41 +0000</pubDate>
		<guid isPermaLink="false">http://jalf.dk/blog/?p=532#comment-14750</guid>
		<description>&lt;p&gt;@Adriano: Why do you need to &quot;avoid&quot; having multiple instances of an object?
I don&#039;t need to do anything to &quot;avoid&quot; jumping into the sea. I don&#039;t need to do anything to &quot;avoid&quot; buying a plane ticket. Those things only happen if I &lt;em&gt;decide&lt;/em&gt; to do them. And likewise, instances of an object only exist if I decide to create them. If I only need one instance of an object, why would I create two? Why do you feel that you need to do anything special to &quot;avoid&quot; creating multiple instances?&lt;/p&gt;

&lt;p&gt;The second part, about global access, is somewhat more subjective. Perhaps you really want &lt;em&gt;global&lt;/em&gt; access to this object. In that case, go ahead and make it global. I think global access is nearly always the wrong thing, but it really doesn&#039;t matter. If you want global access, use a global. If you don&#039;t want global access, don&#039;t make it a global. Neither case requires a singleton.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;I also think you can solve the prob­lem get­ting those depen­den­cies vis­i­ble. Don’t you think you can assign a sin­gle­ton instance to a mem­ber vari­able of a class that needs it&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Sure, you can do that. But then (1) why does it need to be a singleton, why does it need to be globally accessible, and (2) you still have no way to ensure that it&#039;s never used in the &quot;other&quot; way. That&#039;s what&#039;s icky about singletons. You don&#039;t &lt;em&gt;know&lt;/em&gt; if these hidden dependencies exist. They &lt;em&gt;might&lt;/em&gt; all be made explicit as you expect, but there might also be a number of&quot;hidden&quot; uses scattered around your code. You don&#039;t know.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Adriano: Why do you need to “avoid” having multiple instances of an object?
I don’t need to do anything to “avoid” jumping into the sea. I don’t need to do anything to “avoid” buying a plane ticket. Those things only happen if I <em>decide</em> to do them. And likewise, instances of an object only exist if I decide to create them. If I only need one instance of an object, why would I create two? Why do you feel that you need to do anything special to “avoid” creating multiple instances?</p>

<p>The second part, about global access, is somewhat more subjective. Perhaps you really want <em>global</em> access to this object. In that case, go ahead and make it global. I think global access is nearly always the wrong thing, but it really doesn’t matter. If you want global access, use a global. If you don’t want global access, don’t make it a global. Neither case requires a singleton.</p>

<blockquote>
  <p>I also think you can solve the prob­lem get­ting those depen­den­cies vis­i­ble. Don’t you think you can assign a sin­gle­ton instance to a mem­ber vari­able of a class that needs it</p>
</blockquote>

<p>Sure, you can do that. But then (1) why does it need to be a singleton, why does it need to be globally accessible, and (2) you still have no way to ensure that it’s never used in the “other” way. That’s what’s icky about singletons. You don’t <em>know</em> if these hidden dependencies exist. They <em>might</em> all be made explicit as you expect, but there might also be a number of“hidden” uses scattered around your code. You don’t know.</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on Singletons: Solving problems you didn’t know you never had since 1995 by Adriano Di Giovanni</title>
		<link>http://jalf.dk/blog/2010/03/singletons-solving-problems-you-didnt-know-you-never-had-since-1995/comment-page-1/#comment-12390</link>
		<dc:creator>Adriano Di Giovanni</dc:creator>
		<pubDate>Wed, 05 Oct 2011 11:22:38 +0000</pubDate>
		<guid isPermaLink="false">http://jalf.dk/blog/?p=532#comment-12390</guid>
		<description>&lt;p&gt;I started studying OOP less than a year ago. So, it is not difficult that all of you are more aware of it than me.&lt;/p&gt;

&lt;p&gt;IMHO, I think it is not a bad idea to use Singletons in order to avoid having multiple instances of an object (i.e. the Model) and have a global access to the single instance.&lt;/p&gt;

&lt;p&gt;I agree with you about the fact that Singletons increase hidden dependencies. But I also think you can solve the problem getting those dependencies visible. Don&#039;t you think you can assign a singleton instance to a member variable of a class that needs it?&lt;/p&gt;

&lt;p&gt;Doing so, you make the dependency visible and give yourself the opportunity to remove the single instance constraint if you made a bad assumption about it.&lt;/p&gt;

&lt;p&gt;Does it make sense?
Do I have to apologize for my english? :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I started studying OOP less than a year ago. So, it is not difficult that all of you are more aware of it than me.</p>

<p>IMHO, I think it is not a bad idea to use Singletons in order to avoid having multiple instances of an object (i.e. the Model) and have a global access to the single instance.</p>

<p>I agree with you about the fact that Singletons increase hidden dependencies. But I also think you can solve the problem getting those dependencies visible. Don’t you think you can assign a singleton instance to a member variable of a class that needs it?</p>

<p>Doing so, you make the dependency visible and give yourself the opportunity to remove the single instance constraint if you made a bad assumption about it.</p>

<p>Does it make sense?
Do I have to apologize for my english? :)</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on A follow-up rant about Connect by Ben Voigt</title>
		<link>http://jalf.dk/blog/2011/08/a-follow-up-rant-about-connect/comment-page-1/#comment-8616</link>
		<dc:creator>Ben Voigt</dc:creator>
		<pubDate>Mon, 29 Aug 2011 17:06:25 +0000</pubDate>
		<guid isPermaLink="false">http://jalf.dk/blog/?p=966#comment-8616</guid>
		<description>&lt;p&gt;chalk up this VC++ MVP as 100% agreement&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>chalk up this VC++ MVP as 100% agreement</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on What’s wrong with Visual C++ and Microsoft Connect? by Konrad</title>
		<link>http://jalf.dk/blog/2011/08/whats-wrong-with-visual-c-and-microsoft-connect/comment-page-1/#comment-8359</link>
		<dc:creator>Konrad</dc:creator>
		<pubDate>Thu, 18 Aug 2011 09:53:50 +0000</pubDate>
		<guid isPermaLink="false">http://jalf.dk/blog/?p=947#comment-8359</guid>
		<description>&lt;p&gt;This has been my experience as well (duh). However, look at the bright side: try filing a bug with Apple’s bugreport.apple.com form. By comparison, Microsoft Connect will appear modern, user-friendly and all around professional. Apple’s bug reporting actively discourages you from submitting bugs. And if that’s not enough, they will just delete your bug reports without any feedback or accountability whatsoever.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>This has been my experience as well (duh). However, look at the bright side: try filing a bug with Apple’s bugreport.apple.com form. By comparison, Microsoft Connect will appear modern, user-friendly and all around professional. Apple’s bug reporting actively discourages you from submitting bugs. And if that’s not enough, they will just delete your bug reports without any feedback or accountability whatsoever.</p>]]></content:encoded>
	</item>
</channel>
</rss>

