Timeline for Is it bad practice to create blocks of code?
Current License: CC BY-SA 4.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 15, 2021 at 14:21 | comment | added | Martin Maat | One can think of reasons to solve the multiple-identifier-name-for-the-same-thing problem alternatively. But if you have multiple steps of a semantically single operation that mean nothing outside this particular method, I say this is better than using a shared variable that is declared all the way up or different methods, because this keeps your scope tighter. And that is a good thing. | |
Jun 15, 2021 at 13:56 | history | edited | Inertial Ignorance | CC BY-SA 4.0 |
edited body
|
Jan 28, 2018 at 12:04 | vote | accept | Inertial Ignorance | ||
Nov 8, 2017 at 22:47 | comment | added | mrr | @Maybe_Factor Ah you're right... not sure how I missed that the first time | |
Nov 8, 2017 at 5:15 | comment | added | Maybe_Factor | @MilesRout This isn't one logical function, this is multiple unit tests for a function all crammed into a single test function. Code blocks vs functions in normal code is another discussion entirely. | |
Nov 7, 2017 at 22:19 | comment | added | mrr | @Maybe_Factor I disagree. Moving things into separate functions has the negative effect of making them seem like little reusable bits of functionality. Keeping all the logic for a function in one place is good. | |
Nov 7, 2017 at 4:06 | history | tweeted | twitter.com/StackSoftEng/status/927749163542081536 | ||
Nov 2, 2017 at 23:01 | comment | added | Maybe_Factor | @mouviciel Not just more readable code, but more readable test reports! | |
Nov 2, 2017 at 8:54 | comment | added | mouviciel | @Maybe_Factor - I agree. Benefit of separate methods is that you can name each block, providing a more readable code. | |
Nov 2, 2017 at 8:11 | review | Close votes | |||
Nov 7, 2017 at 3:01 | |||||
Nov 2, 2017 at 4:34 | comment | added | Maybe_Factor | If I were reveiwing this code, I would tell you to separate each of these tests into individual methods... As a consequence you wouldn't need to use code blocks to scope them seperately. | |
Nov 2, 2017 at 3:48 | answer | added | Nicol Bolas | timeline score: 23 | |
Nov 2, 2017 at 2:35 | answer | added | Robert Andrzejuk | timeline score: 11 | |
Nov 2, 2017 at 2:12 | review | First posts | |||
Nov 2, 2017 at 5:57 | |||||
Nov 2, 2017 at 2:09 | history | asked | Inertial Ignorance | CC BY-SA 3.0 |