Search Results
7/7/2025, 10:34:24 AM
>>530270797
Just make the comment the variable name of a constant with the value of the magic number. Problem solved.
>>530271903
>Every additional function call and unnecessary abstraction makes it harder to change things.
No, it makes it easier to change things. Instead of moving or deleting n lines of code, you move or delete a single function call. I agree that the example code in the screenshot is a bit trash, but that’s kind of a general problem with "simple examples for retards." E.g. if you were serious about writing some kind of abstracted / reusable logic, the function would be setAsFirstPrime(number) and be invoked setAsFirstPrime(2). Problem being of course that calculating the primes is so highly specific that making anything "reusable" seems weird. That’s why it’s a bad example problem.
Just make the comment the variable name of a constant with the value of the magic number. Problem solved.
>>530271903
>Every additional function call and unnecessary abstraction makes it harder to change things.
No, it makes it easier to change things. Instead of moving or deleting n lines of code, you move or delete a single function call. I agree that the example code in the screenshot is a bit trash, but that’s kind of a general problem with "simple examples for retards." E.g. if you were serious about writing some kind of abstracted / reusable logic, the function would be setAsFirstPrime(number) and be invoked setAsFirstPrime(2). Problem being of course that calculating the primes is so highly specific that making anything "reusable" seems weird. That’s why it’s a bad example problem.
Page 1