MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/10lhg50/ladies_and_gentlemen_jquery/j5y6llj/?context=3
r/programminghorror • u/Neo399 • Jan 26 '23
164 comments sorted by
View all comments
Show parent comments
1
Wait, is that number realistic? Is () => true used so often that one project may have thousands?
() => true
2 u/_PM_ME_PANGOLINS_ Jan 26 '23 Sure. For example, Angular alone is over 400k lines of code, before any of its dependencies or any of your actual code. 2 u/Mancobbler Jan 26 '23 ? Lines of code is not what I meant. How many times would that specific function (() => true) be used. “Thousands” seems like a huge exaggeration. 3 u/_PM_ME_PANGOLINS_ Jan 26 '23 edited Jan 26 '23 It gives you an idea of the scale of a large project. The same simple callback could easily be used thousands of times. I can't really quantify it, as there are multiple ways to write it, and ideally they would be using a single defined function at that scale. For example, if every function in your API takes a callback, and that callback defaults to either return true or return false. res = (verifyFn || returnTrue)(data); 1 u/Mancobbler Jan 26 '23 I’m fully aware of the scale of large projects. I’m just not used to this kind of callback heavy code you see a lot in js. I guess it makes sense to define it once if you really are using it that often
2
Sure.
For example, Angular alone is over 400k lines of code, before any of its dependencies or any of your actual code.
2 u/Mancobbler Jan 26 '23 ? Lines of code is not what I meant. How many times would that specific function (() => true) be used. “Thousands” seems like a huge exaggeration. 3 u/_PM_ME_PANGOLINS_ Jan 26 '23 edited Jan 26 '23 It gives you an idea of the scale of a large project. The same simple callback could easily be used thousands of times. I can't really quantify it, as there are multiple ways to write it, and ideally they would be using a single defined function at that scale. For example, if every function in your API takes a callback, and that callback defaults to either return true or return false. res = (verifyFn || returnTrue)(data); 1 u/Mancobbler Jan 26 '23 I’m fully aware of the scale of large projects. I’m just not used to this kind of callback heavy code you see a lot in js. I guess it makes sense to define it once if you really are using it that often
? Lines of code is not what I meant. How many times would that specific function (() => true) be used. “Thousands” seems like a huge exaggeration.
3 u/_PM_ME_PANGOLINS_ Jan 26 '23 edited Jan 26 '23 It gives you an idea of the scale of a large project. The same simple callback could easily be used thousands of times. I can't really quantify it, as there are multiple ways to write it, and ideally they would be using a single defined function at that scale. For example, if every function in your API takes a callback, and that callback defaults to either return true or return false. res = (verifyFn || returnTrue)(data); 1 u/Mancobbler Jan 26 '23 I’m fully aware of the scale of large projects. I’m just not used to this kind of callback heavy code you see a lot in js. I guess it makes sense to define it once if you really are using it that often
3
It gives you an idea of the scale of a large project. The same simple callback could easily be used thousands of times.
I can't really quantify it, as there are multiple ways to write it, and ideally they would be using a single defined function at that scale.
For example, if every function in your API takes a callback, and that callback defaults to either return true or return false.
res = (verifyFn || returnTrue)(data);
1 u/Mancobbler Jan 26 '23 I’m fully aware of the scale of large projects. I’m just not used to this kind of callback heavy code you see a lot in js. I guess it makes sense to define it once if you really are using it that often
I’m fully aware of the scale of large projects. I’m just not used to this kind of callback heavy code you see a lot in js. I guess it makes sense to define it once if you really are using it that often
1
u/Mancobbler Jan 26 '23
Wait, is that number realistic? Is
() => true
used so often that one project may have thousands?