Posts: 4,647
Threads: 1,494
Joined: Sep 2016
i've had larger cases that if done this way would involve at least 10 variables being passed. i would probable have to pass
locals().
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,647
Threads: 1,494
Joined: Sep 2016
there definitely is "too much". but having all that code duplicated in 15 places makes it "way too much". but when i reduce it, i want each of the 15 places to be real simple like
perform_all_the_profile_checks_and_return_if_needed()
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,647
Threads: 1,494
Joined: Sep 2016
Mar-16-2021, 07:54 PM
(This post was last modified: Mar-16-2021, 07:54 PM by Skaperen.)
(Mar-15-2021, 06:33 AM)ndc85430 Wrote: Yeah, functions should be doing one thing.
yes, i do agree ... for most cases. but here, the "one thing" is to reduce a sequence of things. suppose you have 15 complicated things to do. reducing this to 15 functions, each doing one thing, makes sense. but the you still have 15 function calls to do. now you have 12 places to do the 15 calls. i now consider the sequence of 15 calls to be the 16th "one thing" and make a 16th function to all that. now the returns have to go back another calling level. maybe this what exceptions are for.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.