News for hackers. Stuff that matters.
Re:PHP Frameworks Code Complexity Comparison by mywittyname on Tuesday January 10, 2017 @12:46PM (#13366939)
IMHO, most of the metrics picked for this comparison are useless.

Longest Method: Sometimes the functionality provided by a method is irreducible. And breaking off chunks of it into other one-time-use methods just to reduce method length can be detrimental to readability and understanding. This is a judgement call and it's not really "bad" unless it's >1000LoC.

"Complexity": Cyclomatic complexity is a near-worthless metric, especially in a language like PHP. It's easy to convert a series of 10 if statements into one while loop by leveraging call_user_func and deterministic method names. The resulting while statement is infinitely more complex than the if statements and reduces the benefits of using an IDE. So unless your CC algorithm treats this kind of programming as wildly complex, then it's not giving you a true complexity value (in fact, it's actually lying to you).

% of non-static methods: Unless this metric also includes singleton patterns, then it's useless. Foo::bar() is no different than Foo::getInstance()->bar() or (new Foo())->bar(). Also, in PHP-land, static methods are considered acceptable, as long as they have no side-effects or use static variables.

So I think the author is genuinely wasting his time capturing and optimizing for these metrics, because I don't think they provide any meaningful improvement to the product.

Re:PHP Frameworks Code Complexity Comparison by voidr on Tuesday January 17, 2017 @02:01AM (#13415670)
> "Complexity": Cyclomatic complexity is a near-worthless metric, especially in a language like PHP. It's easy to convert a series of 10 if statements into one while loop by leveraging call_user_func and deterministic method names. The resulting while statement is infinitely more complex than the if statements and reduces the benefits of using an IDE. So unless your CC algorithm treats this kind of programming as wildly complex, then it's not giving you a true complexity value (in fact, it's actually lying to you).

Just because you have a way of cheating it, doesn't make it worthless.

I agree that cyclomatic complexity is good, but it's not enough on it's own, that's why you have other metrics, rules and manual reviews.