Saturday, September 21, 2019

The Mismeasurement of Code

Christ on a crutch.

My PM is suddenly gung-ho on getting measurements for "KPIs", and beaing able to "get ahead of things" when event volume changes.

Never mind that speaking up gets everyone and his brother pointing fingers at you for their problems, even when it's someone else in the middle who has screwed up.  The corporate mindset is such that whoever says they have a problem is suddenly the cause of the problem.

Never mind that we have a cient to who *not* in production, but acts like any small time out of service is like the Fires of Hell are burning their ass and it's all your fault.

Been sayin that for years

Just read an article in the PyCoders weekly list about refactoring functions to have multiple return points.

The article is well-written, but I was floored by the need for it.  I've been an advocate of multiple return points for 2 decades.

The only reason to hold to a single return point in a function is to guarantee release of resources, and every OO language has had a means to do that with a local variable and destructor for over 25 years.

Multiple return points make the logic clear, handle special cases better, and allow better refactoring later for all purposes.