81.0k views
1 vote
Which of these is a programming best practice?

Use general variable names such as V1 and V2.
Use lots of comments in the code.
Make lines of code as long as possible.
If you need to repeat a function, paste a copy of it each time you need it.

User John Ryann
by
5.1k points

2 Answers

2 votes

Answer:

B. use lots of comments in the code

Step-by-step explanation:

User Niki Yoshiuchi
by
5.9k points
2 votes

Answer:

B

Step-by-step explanation:

You should question C. That looks like a very poor practice, but sometimes it can't be helped. Try and make short lines

D also looks questionable. You'll wind up with pages and pages of code. A better practice is to create subroutines (functions and procedures in the language I use) and then learn how to pass parameters.

A is not a good idea either because if you look at the code a month later, chances are you won't know the difference between v1 and v2.

The best answer is B. But how many programmers do it?

User Martyn Lovell
by
5.4k points