Four more bad programming practices

See the first part here.

Some more bad programming practices which tend to hamper the progress of coding include:

  1. Not having one exit point: When a function has multiple exit points (or return statements), it becomes easy to miss one or the other exit point when reading the code or making any changes
  2. Writing long code blocks: A function should be roughly of length 5-10 lines in order to be easily readable. Similarly, by following the single responsibility principle, class bodies can be restricted to be small since they should only do one thing
  3. Functions having too many parameters: A function should ideally have a few (roughly 1-3) parameters. When the number of parameters increase,  the function could be modified or the parameters could be packed into a structure
  4. Optimizing too early or too late: It is usually recommended to not optimize code in the early stages of writing a program. This is valid for some cases. But waiting too long to optimize also leads to problems. So, one needs to use their judgement in optimizing all along when required