This is a great video. After 35+ years of programming and being told "never leave a function until the end" which changed when nodeJS came out to "always leave a function as quick as possible."
Yeah, the "unhappy" bails at the top of a function is how I write. I also support everything of the other thing. Unfortunately, I am a maintenance programmer, and the disasters I have seen our beyond @Master_Foo s comprehension. Just reading his shit makes me sad.
I'm almost 100% on this barring the inevitable edge case.
My rule is, "code should be modularization into 1 namespace/classe per file and should fit into one page of code.
If you need more than one page / file, then it's probably not in it's simplest form and you probably need to decomplexify the code using inheritance or other integration method.
Then you break the rule and use as much space as needed for unit testing under the fold.
But the functionality of the code ALWAYS fits in the top of the file. You can read it all as soon as you open it.
Break the rule when there is a good reason.
Also: Function names ARE the documentation Nested code is code that needs to be simplified.
[ + ] GrayDragon
[ - ] GrayDragon 0 points 2.0 yearsMay 19, 2023 10:05:09 ago (+0/-0)
Yeah, the "unhappy" bails at the top of a function is how I write. I also support everything of the other thing. Unfortunately, I am a maintenance programmer, and the disasters I have seen our beyond @Master_Foo s comprehension. Just reading his shit makes me sad.
[ + ] Master_Foo
[ - ] Master_Foo 0 points 2.0 yearsMay 19, 2023 15:08:46 ago (+0/-0)
[ + ] Master_Foo
[ - ] Master_Foo 0 points 2.0 yearsMay 18, 2023 14:49:56 ago (+0/-0)
My rule is, "code should be modularization into 1 namespace/classe per file and should fit into one page of code.
If you need more than one page / file, then it's probably not in it's simplest form and you probably need to decomplexify the code using inheritance or other integration method.
Then you break the rule and use as much space as needed for unit testing under the fold.
But the functionality of the code ALWAYS fits in the top of the file. You can read it all as soon as you open it.
Break the rule when there is a good reason.
Also:
Function names ARE the documentation
Nested code is code that needs to be simplified.