Talk:Loop-switch sequence
This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||||
|
Personal experience
[edit]I've have also, personally figured this method of looping in respect of scheduling algorithms. With these Switched Loops, we are allowed the freedom to choose between choices of loop execution; as oppose to nested loops with fixed orders. i also liken to loop within an array at the point of switching, so that the index allows for dynamicity. Now, we are able to flex the muscles of computing! - John Lian (talk) 09:48, 19 April 2008 (UTC)
RFD?
[edit]Wow that's bad. At some point, I'll bet that somebody asks for this one to be removed. Please don't. - Joshua
- I wouldn't be surprised if someone does it, at least partly because you told them not to. — User:ACupOfCoffee@ 22:24, 1 November 2006 (UTC)
- Improving an article is better than deleting it. I've edited the article to hint at cases where the subject may not be an anti-pattern. --Damian Yerrick (☎) 07:57, 5 November 2006 (UTC)
- That first sentence needs to be changed! The word choice made me laugh. - Anon
- Well change it, stupid.
This is even beyond my own worst moments
[edit]Well, I have produced some bad code, using god-objects, spaghetti code, methods in a class which is only ever called by a method in the class in which a method is located which it not relies on, and which method (the last mentioned) called another method in the second class to read data from a file (in Java), but that was more caused by taking a simple program and adding methods and an extra class to handle file IO, and then more methods t handle other bright ideas: I have never managed to program something as weird as that.
Rewrite
[edit]Ok, I'm the original author and I've gone back to make my point a bit clearer -- and less passionate, as I've finally achieved some emotional distance on the issue... I wrote the initial article after I found my fourth loop-switch-sequence at work. I was in a bit of a stop-the-madness mindset. :)
I don't think the coroutine was a good example, as it's a bit boutique and also general event-driven programming is a better and more familiar domain for explaining the correct loop-switch idiom.
thanks for the feedback! --Ping Bannon (☎)
The last two lines in each example
[edit]Why are those there? The last two lines of each example:
int number = 2; int num = int.Parse (number.ToString ());
and
int number = 2; int num = number;
solve no purpose but are distracting to the reader in my opinion. 83.236.169.222 (talk) 17:20, 28 January 2008 (UTC)
Possibility to model goto
[edit]A nice way to use this antipattern is a goto loop.
int line = 100; while (line > 0) { switch (line) { case 1: i += 1; line = 20; break; case 5: i *= i; line = 20; break; case 20: if (i > 1000) { line = 0; } else { line = 5; i *= 1.5; }; break case 100: if (i % 2 == 0) { line = 5; } else { line = 5; }; break } }
Does anybody actually do this?
[edit]This seems like something that no one would ever accidentally do. There is no motivation to make such a "mistake". There is no way that anyone would ever think to do it the convoluted way for no reason at all. It seems like something that someone just made up, which is technically an "antipattern", but not even seen in real life. This is like telling someone, "never separate parts of a sentence using three commas in a row,,, like this,,, because it is wrong" (but no one ever does it). I would consider removing the article because it doesn't add anything useful to society's knowledge. — Preceding unsigned comment added by 208.78.143.245 (talk) 00:07, 18 October 2014 (UTC)