Mad Musings of a coder

C++, C#, Java, PHP, ect...
Post Reply
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Mad Musings of a coder

Post by hallsofvallhalla »

Ever cringed your teeth at having to use too many loops or running a loop inside of another loop. I had to do a quick fix to a report in C# and had to "for each" through a list and remove items and then loop that loop to remove copies and through in a few other crazy loops and sillyness until it became inception. Every time that report is run some number gets thrown into a dream into a dream of another dream that is dreaming of a dream dreaming of this loop. A C# hero has to run in and find the poor variable and pull him out.


Sorry I have been coding for like 3 days straight in this site, 10 million data records growing by a few hundred thousand daily then running data mining to find inefficiencies to the point of madness :) god I love to code.
User avatar
Callan S.
Posts: 2042
Joined: Sun Jan 24, 2010 5:43 am

Re: Mad Musings of a coder

Post by Callan S. »

I'm afraid of single while loops, to be honest!
User avatar
Ark
Posts: 427
Joined: Wed Jun 01, 2011 10:25 pm

Re: Mad Musings of a coder

Post by Ark »

Haha +1 to Callan.

The 'for' loop is my favorite ;)
Orgullo Catracho
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Mad Musings of a coder

Post by Jackolantern »

Haha! Nice :cool:

I love loops lol! I use for loops for pretty much everything I need to iterate, and routinely have to make nested for loops, too. My only real problem with nested loops is that you have to be careful how many times the whole thing is going to run since the multiplication of iteration numbers can get out of hand really quickly.

For example, in my MUD, players can of course use SAY to speak to anyone in their current room. So I have to take that message, and broadcast it to the room in a special method that iterates through everyone in that room, and then has a nested loop to iterate through everyone on the ignore list of each person in the room to make sure one of the people in the room isn't ignoring the person speaking. If a room had a lot of players in it, that could get out of hand really fast. I have a limit of 30 people max on an ignore list, but if you had a room of 10 people all with the max amount in the ignore list (hopefully the community won't be that bad lol), that would be 300 iterations, and that is just for a simple SAY. :P
The indelible lord of tl;dr
Post Reply

Return to “Coding”