I just have to mention my objection at This is a stylistic question. No, it absolutely is not purely about style.
new Class().method() is also about resource use and the mystical "good code". One instance of such inefficiency here or there probably doesn't matter much, but letting it slip is going to lead to a widespread use of
new BigHeavyClass().method1();
new BigHeavyClass().method2();
useData1(heavyFunction());
useData2(heavyFunction());
Instead of
instance = BigHeavyClass();
instance.method1();
instance.method2();
// Or
BigHeavyClass.method1();
BigHeavyClass.method2();
// And
data = heavyFunction();
useData1(data);
useData2(data);
A systematic misuse of programming languages and referring to differences like that "stylistic questions" is going to lead you into having big issues later that are difficult to figure out because this kind of poor quality code is normal in your codebase.
Thanks for taking the time to reply. “Stylistic” perhaps doesn't clearly express my intent. I expect my mentees to have read enough that they’ll understand the language sufficiently to understand performance and efficiency considerations. But knowing when it’s better to choose readability over efficiency -- that’s the job of experience, not the mentor.
(Then there's the question of what does readability even mean, which again is something that I’d rather let them explore on their own without my influence.)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I just have to mention my objection at
This is a stylistic question
. No, it absolutely is not purely about style.new Class().method()
is also about resource use and the mystical "good code". One instance of such inefficiency here or there probably doesn't matter much, but letting it slip is going to lead to a widespread use ofInstead of
A systematic misuse of programming languages and referring to differences like that "stylistic questions" is going to lead you into having big issues later that are difficult to figure out because this kind of poor quality code is normal in your codebase.
Thanks for taking the time to reply. “Stylistic” perhaps doesn't clearly express my intent. I expect my mentees to have read enough that they’ll understand the language sufficiently to understand performance and efficiency considerations. But knowing when it’s better to choose readability over efficiency -- that’s the job of experience, not the mentor.
(Then there's the question of what does readability even mean, which again is something that I’d rather let them explore on their own without my influence.)