WET vs DRY
Saw a LinkedIn post about preferring WET (Write Everything Twice) over DRY (Don’t Repeat Yourself). For the most part, I agree — I think trying to build libraries and re-usable code on the first-pass is problematic; I would rather copy-paste a couple of times before settling on the final implementation. Especially in the age of microservices — if you “write and forget” a service which may have one of your original implementations in it, if it’s still working, there’s no need to revisit that microservice. If you have a shared library you’re constantly working on, you’ll be having to update (and deploy) multiple applications that could be left alone.
I did a stint working in Oil & Gas, specifically in the field of non-intrusive condition monitoring. As with most industries I’ve worked in, I didn’t have much of a reason to know much about that industry before I started writing software for it. But I was fascinated by the “non-intrusive” aspect of the condition monitoring.
Basically, our oil & gas engineers were going out onto oil rigs, attaching probes to pieces of rotating equipment (motors, compressors, etc) and analysing the vibration data. If a particular piece of equipment was vibrating much the same as it was last time you monitored — it was probably doing ok. This meant you could somewhat safely ignore the manufacturers’ guidelines of “pull this apart every six months and maintain it” if you could be pretty sure it was functioning just fine. If you consider all the pieces of rotating equipment on an oil rig and all the different maintenance schedules clashing, you’d always have to be pulling one piece of machinery or another out of service, and for oil & gas — you’d be stopping pulling all that money out of the ground.
Long way to basically say I prefer to leaving working stuff alone. I’d much rather copy-paste some working code into a small microservice and never have to deploy it again than have a single library in multiple microservices which immediately become out of date when you update the library.
Of course, there’s always going to be some exceptions, this isn’t an absolute decree. I just believe as engineers we’ve always tended towards DRY because it sounds right and fits with our beliefs about software, but WET to me feels like a more pragmatic approach.
Would love to hear your thoughts.