DEV Community

Discussion on: Bad Programming Habits

Collapse
 
paullaffitte profile image
Paul Laffitte

Thanks for this concise list, very interesting. However, I disagree with some points:

  1. don’t write enough comments: Comment can often be considered as code smell, documenting your code with comments is ok, commenting all your code is not. When you update your code you need to update all your comments also, but developers are lazy so you get outdated and misleading comments. If you comment everything you will comment even self-explanatory code, which is useless. If your code isn't self-explanatory, it's maybe too complex and code is intended to be read by humans. There are plenty of reasons why you don't want to comment your code. But some people already wrote great blog posts about this subject, so I will let you google about it.

  2. copy code from online: Well, it depends, copying blindly without mentioning the origin of the code is very bad, especially if the code is under some licence (like on StackOverflow). But otherwise, it's often pretty useful, and if you can adapt the copied code well to your use-case, it's sometime a great time-saver, as long as you have the right to do it obviously. And in this case it's good to add a comment to reference the origin of the code.

  3. don’t plan before implementing: Again, it depends, on your workflow and organization mostly. Sometimes you want/need to plan, sometimes not. It's not a bad programming habit, it's just a way of doing things. In some case you will have to, in other cases you want to avoid it.

  4. count hours: If you're freelance, you do want to count your hours, to bill the right amount of time, and maybe to ensure that your estimations were right. Otherwise, yeah in a lot of cases, don't count, "When it comes to love, you don't count the cost.".

  5. don’t use social media: If the social media is facebook or instagram, I'm not sure you really need this to work, it could be more a distraction than a benefit. If it's reddit or dev.to, it can be a great source of inspiration or help. So again, it depends.

Again, thanks for this great list, there is always places where you cannot agree with everybody, but different point of view are always interesting.