DEV Community

Discussion on: CopyPasta vs adding smaller dependencies

Collapse
 
steveruizok profile image
Steve Ruiz

For me, this comes down to who is working on the project. If it’s just me, or if I’m prototyping, then I tend to copy in utility code so that I can modify it, if needed. Sometimes the utility code is only used in one place, and so can be made more specific to how I’m using it.

If I expect others to work on the same project, or if I expect to hand off the project at some point, then I use libraries instead. Using libraries makes it easier to separate project-specific code—that will need to be understood and maintained—from extraneous/utility/black-box code. If the library is well known (like lodash) then most devs will be able to recognise and understand it right away.