DEV Community

Discussion on: Should I write a library?

Collapse
 
goober99 profile image
Matthew D. Miller

I just happened to read this post earlier today. It suggests WET (Write Everything Twice) as an alternative to DRY (Don't Repeat Yourself). One of the arguments for DRY is programmer laziness, but in fact, it is often much easier to copy and paste than factor out code into a library.

I think you give very good advice to know when a library is appropriate. I try to keep code the way it is until the duplication becomes a pain point. When I update a piece of code, and then find I have to make the same update in three other places (or create a bug by forgetting to update one of the places), then it's probably time to factor it out into a library.