Timeline for Why are nested loops considered bad practice?
Current License: CC BY-SA 3.0
19 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 26, 2020 at 3:37 | comment | added | Krzysztof Czelusniak | @Marco One nested loop has the same cyclomatic complexity as two non-nested loops, so cyclomatic complexity doesn't indicate that nested loops decrease maintainability. | |
| Jan 29, 2019 at 12:06 | answer | added | gnasher729 | timeline score: 0 | |
| Jan 29, 2019 at 7:00 | comment | added | Flater | A simple analogy that's not really a full answer: duct tape can be a good solution to certain problems. But if your handyman uses duct tape as the first solution for everything, then you are going to question the quality of their work. | |
| Jan 29, 2019 at 4:47 | answer | added | jgmjgm | timeline score: 0 | |
| Apr 9, 2015 at 19:20 | history | edited | Force444 | CC BY-SA 3.0 |
deleted 14 characters in body
|
| May 30, 2013 at 19:19 | audit | Close votes | |||
| May 31, 2013 at 1:51 | |||||
| May 29, 2013 at 10:26 | comment | added | Marco | Nested loops increase cyclomatic complexity (see here), which decreases the maintainability of a program, according to some people. | |
| May 24, 2013 at 11:43 | vote | accept | Force444 | ||
| May 24, 2013 at 9:00 | answer | added | user8709 | timeline score: 11 | |
| May 24, 2013 at 5:07 | history | tweeted | twitter.com/#!/StackProgrammer/status/337796946049773568 | ||
| May 23, 2013 at 20:43 | answer | added | 9000 | timeline score: 64 | |
| May 23, 2013 at 20:35 | answer | added | Mason Wheeler | timeline score: 28 | |
| May 23, 2013 at 20:20 | comment | added | Travis Pessetto | @m3th0dman Thanks for correcting me. My teacher wasn't the greatest on this subject. He treated O(n^2) and O(k^n) as the same. | |
| May 23, 2013 at 20:19 | comment | added | Random42 | @TravisPessetto Actually it is still polynomial complexity - O(n^k), k being the number of nested, not exponential O(k^n), where k is a constant. | |
| May 23, 2013 at 20:16 | answer | added | Travis Pessetto | timeline score: 9 | |
| May 23, 2013 at 20:11 | review | First posts | |||
| May 23, 2013 at 20:44 | |||||
| May 23, 2013 at 20:09 | comment | added | Blrfl | One thing you should learn about CS lecturers is that not everything they say applies 100% in the real world. I'd discourage loops nested more than a few deep, but if you have to process m x n elements to solve your problem, you're going to do that many iterations. | |
| May 23, 2013 at 20:01 | comment | added | Travis Pessetto | If I remember my CS3 course correctly it's because it often leads to exponential time which means if you get a large data-set your application will become unusable. | |
| May 23, 2013 at 19:56 | history | asked | Force444 | CC BY-SA 3.0 |