Full stack dev. Building with Python, JS, Jekyll and more. Looking to answer technical questions and coach on career direction, learning path and projects.
Yes I agree that too much nesting is hard to test and reason about, rather refactor like split into functions.
Uncle Bob said to use 2 or at most 3 params for functions. It limits the number of combinations to test in unit tests, which grows exponentially for every param added. Also I like adding a structure as a param to keep things like. Pass an object of type Person which has 10 attributes, instead of 10 attributes. Where Person might be a class, or it could be a type of interface - typed languages like Go and adding types in Python and JS means you can pass a data structure to a function and be confident it has all the attributes set (while a plain dictionary without typechecking would be unreliable)
For further actions, you may consider blocking this person and/or reporting abuse
Yes I agree that too much nesting is hard to test and reason about, rather refactor like split into functions.
Uncle Bob said to use 2 or at most 3 params for functions. It limits the number of combinations to test in unit tests, which grows exponentially for every param added. Also I like adding a structure as a param to keep things like. Pass an object of type Person which has 10 attributes, instead of 10 attributes. Where Person might be a class, or it could be a type of interface - typed languages like Go and adding types in Python and JS means you can pass a data structure to a function and be confident it has all the attributes set (while a plain dictionary without typechecking would be unreliable)