What I suggest
I'd like to open a community wiki post that address and explain the most common beginners bad-practices/mistakes in an XXX language, to be used as a reference when answering.
It often happens that someone is asking for a review on an intermediate/advanced level about his code, while presenting very common beginners bad practices or mistakes.
To give an example (with Python), something like:
if len(my_list) == 0: # ...
I'd have, everytime, to explain to a different person why that shouldn't be done (along with other four or five things like that). This might take a while, maybe even half of my answer without a glance of answer to the main OP concern of review on his code.
This is why I'd like to be able to reference a complete explanaitaion without losing much time. More or less something like:
This line: if len(my_list) == 0: Should be replaced with: if not my_list: All reasons well explained at Point n.7 here <link>. [My additional comment if necessary] [... Going on with the actual review ...]
This are the pros that I see:
- Who answer wouldn't have to write the same things again and again to different people
- Who answer could focus his energy on the main problem.
- Who answer wouldn't have to go into details of the feautures of the XXX language.
- It will all be referenced inside CodeReview.
- The asker will find have good and wiki approved explanation.
- The asker who follow the link will find there other common mistakes and learn.
Some of them might not even be in his posted code, but he might fixed them anyway, and the next time he ask for a review he might present a better code.
What do you think?
Is it doable?
Will be useful?
Could it be improved?