How do programmers practice code reuse

前端 未结 14 1291
天涯浪人
天涯浪人 2021-02-13 14:14

I\'ve been a bad programmer because I am doing a copy and paste. An example is that everytime i connect to a database and retrieve a recordset, I will copy the previous code and

14条回答
  •  清酒与你
    2021-02-13 14:24

    Easy: whenever you catch yourself copy-pasting code, take it out immediately (i.e., don't do it after you've already CP'd code several times) into a new function.

提交回复
热议问题