<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Peter Ritchie&amp;#39;s MVP Blog - All Comments</title><link>http://msmvps.com/blogs/peterritchie/default.aspx</link><description>This is not a life-saving device.</description><dc:language>en</dc:language><generator>CommunityServer 2008 SP1 (Build: 30619.63)</generator><item><title>re: 'System.Threading.Thread.Suspend()' is obsolete: 'Thread.Suspend has been deprecated...</title><link>http://msmvps.com/blogs/peterritchie/archive/2006/10/13/_2700_System.Threading.Thread.Suspend_280029002700_-is-obsolete_3A00_-_2700_Thread.Suspend-has-been-deprecated_2E00__2E00__2E00_.aspx#1639251</link><pubDate>Thu, 03 Jul 2008 15:32:09 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1639251</guid><dc:creator>PeterRitchie</dc:creator><description>&lt;p&gt;@Vikram. &amp;nbsp;Unless the thread terminates itself between the first Join and the Set call, you&amp;#39;re guaranteed to halt for 2 seconds.&lt;/p&gt;
&lt;p&gt;If the thread goes into a waitsleepjoin after you call Set, there&amp;#39;s not much you can do without calling Interrupt. &amp;nbsp;The thread will still see the Set when it next waits for that event; setting it again won&amp;#39;t make a difference. &amp;nbsp;It will only make a difference if the event is an auto reset and something else is waiting on the event as well--which is not a good thing; the event should be only used for termination of the thread.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1639251" width="1" height="1"&gt;</description></item><item><title>re: 'System.Threading.Thread.Suspend()' is obsolete: 'Thread.Suspend has been deprecated...</title><link>http://msmvps.com/blogs/peterritchie/archive/2006/10/13/_2700_System.Threading.Thread.Suspend_280029002700_-is-obsolete_3A00_-_2700_Thread.Suspend-has-been-deprecated_2E00__2E00__2E00_.aspx#1639217</link><pubDate>Thu, 03 Jul 2008 08:33:52 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1639217</guid><dc:creator>Vikram</dc:creator><description>&lt;p&gt;Thanks Peter,&lt;/p&gt;
&lt;p&gt;Yes, I want the workerthread to come to a known end.&lt;/p&gt;
&lt;p&gt;I wrote the waitHandler.Set within the loop to cater a scenario where the workerthread goes to &amp;quot;waitsleepjoin&amp;quot;, between the waithandler.Set and workerthread.Join() call or rather after the &amp;#39;set&amp;#39; and before &amp;#39;join&amp;#39;.&lt;/p&gt;
&lt;p&gt;And I used ANTS profiler to see if my threads actually terminates and ends. And am happy to see it does once the GC runs.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1639217" width="1" height="1"&gt;</description></item><item><title>re: 'System.Threading.Thread.Suspend()' is obsolete: 'Thread.Suspend has been deprecated...</title><link>http://msmvps.com/blogs/peterritchie/archive/2006/10/13/_2700_System.Threading.Thread.Suspend_280029002700_-is-obsolete_3A00_-_2700_Thread.Suspend-has-been-deprecated_2E00__2E00__2E00_.aspx#1639124</link><pubDate>Wed, 02 Jul 2008 15:56:25 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1639124</guid><dc:creator>PeterRitchie</dc:creator><description>&lt;p&gt;Vikram, I&amp;#39;d likely have to see more code to judge what would be the most appropriate answer. &amp;nbsp;But, from your code you appear to be attempting to wait for the thread to exit (by calling Join) then signalling the thread to exit (via the call to Set) if the Join times out after 2 seconds. &amp;nbsp;Join is the only reliable way to be informed of a thread exiting (polling IsAlive is problematic and introduces latency). &amp;nbsp;I&amp;#39;m assuming the worker thread is either performing work or waiting on waitHandler. &amp;nbsp;I would call waitHandler.Set before calling Join; but I would only call it once--I see no reason to repeatedly call Set.&lt;/p&gt;
&lt;p&gt;You&amp;#39;ll only get the ThreadStateException if the worker thread hasn&amp;#39;t been started. &amp;nbsp;You&amp;#39;ll also get a ThreadInterruptedException if the thread is interrupted while Join is waiting for the thread to exit--which sometimes occurs upon application shutdown if at thread hasn&amp;#39;t exited.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1639124" width="1" height="1"&gt;</description></item><item><title>re: 'System.Threading.Thread.Suspend()' is obsolete: 'Thread.Suspend has been deprecated...</title><link>http://msmvps.com/blogs/peterritchie/archive/2006/10/13/_2700_System.Threading.Thread.Suspend_280029002700_-is-obsolete_3A00_-_2700_Thread.Suspend-has-been-deprecated_2E00__2E00__2E00_.aspx#1639069</link><pubDate>Wed, 02 Jul 2008 05:48:21 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1639069</guid><dc:creator>Vikram</dc:creator><description>&lt;p&gt;Peter,&lt;/p&gt;
&lt;p&gt;I have build up a windows server, which does some file processing using multiple threads. Now there is a situation, where in I need to call the Stop() &amp;amp; Start(), which doesnt effect the windows service as such, but internally its like restarting the service. During this process I need to terminate all the active threads. My code to terminate the thread in the Stop() is similar to this:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (Thread.CurrentThread.ManagedThreadId != workerThread.ManagedThreadId)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;try&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Signal the thread.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Try to join the main thread with a timeout of 2sec&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (!workerThread.Join(2000))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Awake any sleeping thread&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;waitHandler.Set();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catch (ThreadStateException tex)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tex.Message;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;Now, how do i ensure the thread have terminated properly, so that I can recreate new set of threads in the Start() method. I think currently my threads have gone to the WaitSleepJoin state and will get awakned any time.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1639069" width="1" height="1"&gt;</description></item><item><title>re: Is C++/CLI a Second Class Language with Microsoft?</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/01/29/is-c-cli-a-second-class-language-with-microsoft.aspx#1639019</link><pubDate>Tue, 01 Jul 2008 17:33:04 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1639019</guid><dc:creator>Lil Joey</dc:creator><description>&lt;p&gt;It&amp;#39;s an interesting question, but I think some of you guys are being a bit unfair.&lt;/p&gt;
&lt;p&gt;Of course they are going to concentrate on other languages because that&amp;#39;s where the money is. No one is developing C++ desktop business apps any more, and why would you want to? C++ is great and it&amp;#39;s all I use these days, but database support? I would never waste my time making a C++ business app or wireless app when I could use Java for that, and you will come across cobol a lot more these days than C++ business apps - and 95% of the people actually programming are making either a website or business app of some kind so maybe they are treating it a bit as a second class language but it&amp;#39;s probably more because not many people use it any more.&lt;/p&gt;
&lt;p&gt;As for legacy libraries, they are just that. Legacy. There is no need to add new features to support legacy code.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t see what the issue with bugs is - it&amp;#39;s always harder to debug C++ than other languages, but it is not terribly hard with experience and the debugger is good. If you have serious problems you can&amp;#39;t seem to unravel and cutting the project into pieces doesn&amp;#39;t work there&amp;#39;s always lint.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1639019" width="1" height="1"&gt;</description></item><item><title>re: Changing TextBox Text as an Undo-able Action</title><link>http://msmvps.com/blogs/peterritchie/archive/2006/09/10/Changing-TextBox-Text-as-an-Undo_2D00_able-Action.aspx#1638775</link><pubDate>Sun, 29 Jun 2008 07:54:13 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1638775</guid><dc:creator>Nir Fishman</dc:creator><description>&lt;p&gt;Great, just what I was looking for, thank you very much.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1638775" width="1" height="1"&gt;</description></item><item><title>re: Fundamentals of OOD Part 3: Method Cohesion</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/06/10/fundamentals-of-ood-part-3-method-cohesion.aspx#1638271</link><pubDate>Fri, 27 Jun 2008 07:25:55 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1638271</guid><dc:creator>JJ</dc:creator><description>&lt;p&gt;Great blog, very informative!&lt;/p&gt;
&lt;p&gt;I have a question, what are your thoughts on creating an extension method of PerformOperation? This way PerformOperation is not &amp;#39;physically&amp;#39; part of the Operation-derived class, however, one can still invoke it as if.&lt;/p&gt;
&lt;p&gt;One may wonder, however, what the added value would be over just calling Execute on the object.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1638271" width="1" height="1"&gt;</description></item><item><title>re: Comparing CodeRush Refactor! Pro and Resharper 4, part 1 or N -- first glance.</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/06/25/comparing-coderush-refactor-pro-and-resharper-4-part-1-or-n-first-glance.aspx#1637962</link><pubDate>Thu, 26 Jun 2008 15:04:46 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1637962</guid><dc:creator>Derik Whittaker</dc:creator><description>&lt;p&gt;I love the UI stuff that CodeRush/Refactor! does. &amp;nbsp;It appears to be eye candy at first, but then you realized that it is really about making the process easier and have less friction.&lt;/p&gt;
&lt;p&gt;If they would just add a test runner i might switch.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1637962" width="1" height="1"&gt;</description></item><item><title>re: Comparing CodeRush Refactor! Pro and Resharper 4, part 1 or N -- first glance.</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/06/25/comparing-coderush-refactor-pro-and-resharper-4-part-1-or-n-first-glance.aspx#1637803</link><pubDate>Thu, 26 Jun 2008 03:28:53 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1637803</guid><dc:creator>Paul U.</dc:creator><description>&lt;p&gt;unfortunately both cause the IDE to crash (out_of_memory) when dealing with our large application, so I can no longer use either :(&lt;/p&gt;
&lt;p&gt;I did favor CodeRush/Refactor.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1637803" width="1" height="1"&gt;</description></item><item><title>re: Entity Framework Petition of Vote of Non Confidence</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/06/25/entity-framework-petition-of-vote-of-non-confidence.aspx#1637747</link><pubDate>Wed, 25 Jun 2008 23:36:40 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1637747</guid><dc:creator>Greg Beech</dc:creator><description>&lt;p&gt;People seem upset that EF isn&amp;#39;t suitable for building large and complex projects, and to be fair it probably isn&amp;#39;t. But then again, no ORM is suitable for building large and complex projects. The technology is fundamentally inappropriate for database driven solutions in the same way that object-orientation is.&lt;/p&gt;
&lt;p&gt;So the fact that it doesn&amp;#39;t give a clean separation of data from code, or that it doesn&amp;#39;t handle lazy loading that well, or any of these complex project issues don&amp;#39;t matter. For smaller and simpler projects it will be just fine.&lt;/p&gt;
&lt;p&gt;I&amp;#39;d give it a vote of no confidence, but no more than any other ORM solution.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1637747" width="1" height="1"&gt;</description></item><item><title>Why it's important to be aware of the issues with Entity Framework</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/06/25/entity-framework-petition-of-vote-of-non-confidence.aspx#1637618</link><pubDate>Wed, 25 Jun 2008 17:42:37 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1637618</guid><dc:creator>DotNetKicks.com</dc:creator><description>&lt;p&gt;You&amp;#39;ve been kicked (a good thing) - Trackback from DotNetKicks.com&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1637618" width="1" height="1"&gt;</description></item><item><title>re: RFC: Conditionals on false</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/05/11/rfc-conditionals-on-false.aspx#1637569</link><pubDate>Wed, 25 Jun 2008 14:22:46 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1637569</guid><dc:creator>Ray</dc:creator><description>&lt;p&gt;Be different and use:&lt;/p&gt;
&lt;p&gt;if (GetTrueOrFalse().Equals(false))&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1637569" width="1" height="1"&gt;</description></item><item><title>re: Windows Live Messenger Virus Scanner Settings</title><link>http://msmvps.com/blogs/peterritchie/archive/2007/03/22/windows-live-messenger-virus-scanner-settings.aspx#1637093</link><pubDate>Mon, 23 Jun 2008 20:20:35 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1637093</guid><dc:creator>vicky </dc:creator><description>&lt;p&gt;my windows live messanger keeps sending stuff to people with out me doing it and i have tryed every thing could u help &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1637093" width="1" height="1"&gt;</description></item><item><title>re: Sudden "...you must have Terminal Server User Access permissions on this computer." Error.</title><link>http://msmvps.com/blogs/peterritchie/archive/2007/02/03/sudden-you-must-have-terminal-server-user-access-permissions-on-this-computer-error.aspx#1636193</link><pubDate>Fri, 20 Jun 2008 21:45:09 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1636193</guid><dc:creator>Lee</dc:creator><description>&lt;p&gt;I have Citrix PS 4.5 installed on a W2003 Server and I solved mine by changing the Environment settings for both ICA and RDP to open the Desktop. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I think the problem happens in the RCA environment, when you select the middle option to open the application specified by the user. &amp;nbsp;This seems to also changes the ICA setting and I believe this cause the weird all of a sudden &amp;quot;&amp;quot;...you must have Terminal Server User Access permissions&amp;quot; message.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1636193" width="1" height="1"&gt;</description></item><item><title>re: Sudden "...you must have Terminal Server User Access permissions on this computer." Error.</title><link>http://msmvps.com/blogs/peterritchie/archive/2007/02/03/sudden-you-must-have-terminal-server-user-access-permissions-on-this-computer-error.aspx#1635580</link><pubDate>Mon, 16 Jun 2008 10:24:51 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1635580</guid><dc:creator>Lenco</dc:creator><description>&lt;p&gt;Something similar, maybe somebody knows the solution?&lt;/p&gt;
&lt;p&gt;I can connect remote desktop as a administrator, but not as user with admin rights, or with any right (tried all rights and polices). I was able some time ago, but i don`t know what happend that it stop working. May be I changed something but can not recall.&lt;/p&gt;
&lt;p&gt;Any clue?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1635580" width="1" height="1"&gt;</description></item><item><title>re: RFC: Conditionals on false</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/05/11/rfc-conditionals-on-false.aspx#1635536</link><pubDate>Mon, 16 Jun 2008 05:33:30 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1635536</guid><dc:creator>Ben Govett</dc:creator><description>&lt;p&gt;I use !, but I know what Rubio is saying about sometimes missing the !. To stop that problem, I set my context highlighting to make operators Red. Also breaks up long object.subobject.subobject... references and generally makes a lot of the short form operators in C# a lot easier to read.&lt;/p&gt;
&lt;p&gt;Having a standard is the more important thing so you know what to expect in the code, especially in large teams of programmers. Even more important is having tools setup to enforce the rules.&lt;/p&gt;
&lt;p&gt;Our checkin policy automatically stops people using == true and == false here so it&amp;#39;s never an issue. Experience has taught us that unless coding standards are able to be enforced automatically, you cannot rely on them and are therefore of no value.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1635536" width="1" height="1"&gt;</description></item><item><title>re: Single-Entry, Single-Exit, Should It Still Be Applicable In Object-oriented Languages?</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/03/07/single-entry-single-exit-should-it-still-be-applicable-in-object-oriented-languages.aspx#1635359</link><pubDate>Sun, 15 Jun 2008 16:37:01 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1635359</guid><dc:creator>PeterRitchie</dc:creator><description>&lt;p&gt;In most OO languages you can allocate data as needed, not like most procedural languages where you have to allocate data at the top of a function.&lt;/p&gt;
&lt;p&gt;If you get away from that procedural method of allocation, SESE becomes very difficult--time better spent writing value-added code.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1635359" width="1" height="1"&gt;</description></item><item><title>re: Single-Entry, Single-Exit, Should It Still Be Applicable In Object-oriented Languages?</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/03/07/single-entry-single-exit-should-it-still-be-applicable-in-object-oriented-languages.aspx#1635344</link><pubDate>Sun, 15 Jun 2008 15:39:26 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1635344</guid><dc:creator>Eric Eilebrecht</dc:creator><description>&lt;p&gt;I always thought the big benefit of SESE was that it allowed you to do some things at the top of the method (set up data structures, validate args, etc.) or at the end of the method (cleanup, etc.) and be sure that those things would actually be executed.&lt;/p&gt;
&lt;p&gt;OO doesn&amp;#39;t have anything to do with this. &amp;nbsp;Exceptions do foil it, as many have pointed out.&lt;/p&gt;
&lt;p&gt;But every modern language I&amp;#39;m familiar with has some way of automating back-out/cleanup code. &amp;nbsp;C++ stack-allocated object destructors, most other languages&amp;#39; &amp;quot;finally&amp;quot; constructs, etc. &amp;nbsp;And the single-entry thing is just assumed these days (coroutines are not an exception to this; a C# iterator method is conceptually a single method with a single entrypoint - the fact that the compiler breaks it up is an implementation detail. &amp;nbsp;You still get to do some initialization at the top, and any cleanup can be put in finally blocks that will run with the enumerator is disposed.)&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve found that most people who try to religiously follow the SESE ideal don&amp;#39;t end up writing the kind of code people have been posting here (with lots of nice nested ifs and such.) &amp;nbsp;What they do is write a bunch of &amp;quot;goto CLEANUP;&amp;quot; statements, and then do their cleanup at the end. &amp;nbsp;This is an abomination in a world that has &amp;quot;finally&amp;quot; or its equivalents.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1635344" width="1" height="1"&gt;</description></item><item><title>re: Fundamentals of OOD Part 3: Method Cohesion</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/06/10/fundamentals-of-ood-part-3-method-cohesion.aspx#1634967</link><pubDate>Sat, 14 Jun 2008 11:44:22 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1634967</guid><dc:creator>PeterRitchie</dc:creator><description>&lt;p&gt;Felipe, my example is very simple. &amp;nbsp;I a real-world case after you perform this change you may actually want to refactor to what you've suggested. &amp;nbsp;It depends on the project and depends on what you want to accomplish. &amp;nbsp;&amp;quot;PerformOperation&amp;quot; isn't very descriptive and isn't very intention-revealing; so, yes, simply calling the Operation-derived class directly may be a valid refactoring. &amp;nbsp;If &amp;quot;PerformOperation&amp;quot; has a more descriptive name--being more intention revealing--then refactoring to just calling the Operation-derived class directly would likely make the code less clear.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1634967" width="1" height="1"&gt;</description></item><item><title>re: Fundamentals of OOD Part 3: Method Cohesion</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/06/10/fundamentals-of-ood-part-3-method-cohesion.aspx#1634802</link><pubDate>Fri, 13 Jun 2008 19:44:51 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1634802</guid><dc:creator>Felipe Fujiy Pessoto</dc:creator><description>&lt;p&gt;Peter, answer my question please&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1634802" width="1" height="1"&gt;</description></item></channel></rss>