vendredi 24 février 2023

When are times when it is preferable to copy-and-paste code, slightly changing it, instead of using something like composition?

I have heard design patterns and reducing duplicated code can be very helpful for maintainability, I would like to know when it is preferable to simply copy-and-paste code from one part of a codebase to another and change it slightly instead of using something like composition or some design pattern that avoids this situation?

I also would love to learn about how common this strategy of copying-and-pasting code and changing it slightly is across the industry? Is this common to see at many developer jobs? Also, when does it become preferable to use a different approach?

Aucun commentaire:

Enregistrer un commentaire