What are top 7 most common issues I find doing Code Reviews?
Commented out code
It makes me think that you didn’t learn how to use version control and tagging, why the hell do I need to read that old code, if it’s no longer valid!?
If it’s important and you might need to get back to it in the future tag it properly, then remove from current code.
Comments that don’t bring any value, they are obvious or they mark part of code that should be put in a method.
Remember: comments get outdated very quickly and people don’t maintain them.
A method only calling super is considered empty. Remove it.
Files are too long
How can you keep reading file that has over 400 lines of code? It makes my eyes bleed, please use composition, categories or other ways of organising your code.
When I see a file that has so many lines I assume it’s breaking SRP unless proven otherwise.
Immutable object properties with wrong qualifiers
If you have immutable object property that has mutable counterpart, always use copy. Otherwise you can end up having nasty bugs, if someone assigns you mutable counterpart and modified it.
Remember: if you call copy on immutable object like NSString, it will really only call retain, 0 performance hit.
Not caring about results
If you call my API without passing errorHandler, I’m gonna make you pay dearly(crash). Same goes for completion results.
Remember: When you create API don’t allow people to call expensive methods without them caring about results, your users will appreciate longer battery life.
No assertions or validation
Assert your assumptions, use asserts to enforce proper API usage or to make sure your assumptions are actually valid. If they are not, you’ll get to know about that quickly.
That’s the most common mistakes I usually see, let me know if you know other recurring ones.