potiuk commented on PR #53149:
URL: https://github.com/apache/airflow/pull/53149#issuecomment-3092313492

   But just to be very clear - I am not fan at all of actually algorithmically 
"measuring" cyclomatic complexity - especially for functions and methods in big 
and complex system. There are multiple ways of measuring it (depending "what" 
you decide is your "run path" as in the above explanation and whatever you 
measure is just an abstract number that does not tell much especially when 
there is no context.
   
   But I am a big fan of CC as a "concept" and "abstract idea" and 
understanding that lower CC means less bugs, less confusion, easier to 
understand and reason code and better testability and that at different levels 
you can apply the practical  "rules of thumbs" on how you can say "with this 
approach we have lower CC and it's good".
   
   The above explanation on module imports and relations between them is such 
"module" level rule of thumb, for "single source code" - "refactoring your 
methods and breaking them in smaller, well named and narrow-scoped methods" 
brings CC down. Or reducing nesting and simplifiying conditionals.
   
   Of course (and I perfectly understand it) low CC often comes with tradeoffs 
(performance, increased number of lines of code, etc. and we should carefully 
look at what it brings with itself, and sometime live with higher CC because 
tradeoffs are too painful. As everything in IT, there is no absolute better or 
absolute worse - you usually trade things off. But, I think it's good to know 
what are the trade-offs you are making.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to