Valid point. In this case a separate function would be better. It's not always an option though.
Edit: Rather I should say; It's not always an option that makes things better.
If you're writing a comment for a block of code is definitely a good time to think "Should this not be a separate function?" (I clearly need to do this more myself too.)
Comments
Valid point. In this case a separate function would be better. It's not always an option though.
Edit: Rather I should say; It's not always an option that makes things better.
If you're writing a comment for a block of code is definitely a good time to think "Should this not be a separate function?" (I clearly need to do this more myself too.)
One good resource for learning and inspiration is Robert C. Martin's book Clean Code. Opinionated, yes, but a good read none the less.