124k views
7 votes
Which programming best practice does saving code snippets help you achieve?

O using consistent indentation and formatting

O documenting all changes and tracking revisions

O avoiding repetition of the same code in a program

O avoiding having to re-create code that you or another programmer has already written

1 Answer

7 votes

Final answer:

Saving code snippets helps in avoiding the recreation of code that already exists and facilitates the reuse of code, hence increasing programming efficiency and maintaining consistency.

Step-by-step explanation:

Saving code snippets is a programming best practice that helps you achieve the goal of avoiding having to re-create code that you or another programmer has already written. It is an effective way to maintain a personal or team-wide library of reusable code, which can increase efficiency and consistency across different projects. Utilizing code snippets is akin to developing a coding system for cross-referencing in that it allows you to easily refer back to previously written code, ensuring that you do not waste time rewriting it again. This can also help in maintaining a consistent style and approach to solving similar problems.

User Strickli
by
3.3k points