In a code review i suggested extracting a well named function. They replied that it does not add any value to introduce a new function. They're right in the worst way, the computer doesn't care and they don't value the readers.

Do you have suggestions on how to respond to that?

@bcgoss might a well named local variable be a good compromise?

I think you've identified the important aspect though -- they need to value the comprehensibility of code.

Perhaps you can find some other examples in your codebase where a single-call function helps make another nearby expression much easier to understand.

@james @bcgoss It comes down to cost. What’s more expensive, an additional function call or the time a dev spends trying to understand what the code does?

@bcgoss Oof, that's rough. One thing I've been thinking a lot about is how code is read more than it's written, so we should write readable code. Maybe one approach is to help them value their readers.

I wrote a blog post on this which may serve as good 3rd party, non-personal advocacy for this. There's even a section on extracting functions.


> and they don't values the readers

That's really the crux of the problem though, right? Source code isn't for the computer to read, but for other humans to understand what the computer is doing.

If we worried just about the computer understanding, we'd all be writing in assembly.
Sign in to participate in the conversation

A Mastodon instance for Rubyists & friends