Jump to content

Talk:Loop-switch sequence

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 88.217.134.114 (talk) at 09:42, 3 September 2010. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconComputer science Start‑class Low‑importance
WikiProject iconThis article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-importance on the project's importance scale.
Things you can help WikiProject Computer science with:

Personal experience

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)[reply]

RFD?

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)[reply]
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)[reply]
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

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

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

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)[reply]

Possibility to model goto

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
   }
 }