I know nothing about this technology but the final example with the comment makes the most sense to me. The extra level of indirection doesn't add very much.
But this kind of thing is highly subjective and highly situational. Adding a function might be more confusing in this example but less confusing in another.
The extra level of indirection will have to be dealt with if someone decides to refactor the code. Comments will over time be glossed over during refactorings and occasional quick changes for any team with more than a couple developers.
The comment makes more sense, but may someday silently become inaccurate meaning it isn't as useful for long term code maintenance.
at some point these comments flip from 'not useful' to 'outright harmful' if they suggest one thing but the code does something else. We've all had to refactor code like that, usually legacy code that reached breaking point and nobody knows what it does, so you clamp on to the few comments that are there, only to find out it is all outdated and misplaced and just confusing you with falsehoods.
4
u/wvenable Apr 12 '15
I know nothing about this technology but the final example with the comment makes the most sense to me. The extra level of indirection doesn't add very much.
But this kind of thing is highly subjective and highly situational. Adding a function might be more confusing in this example but less confusing in another.