logoalt Hacker News

suzzer99yesterday at 8:28 PM8 repliesview on HN

> Generally, though, most of us need to think about using more abstraction rather than less.

Maybe this was true when Programming Perl was written, but I see the opposite much more often now. I'm a big fan of WET - Write Everything Twice (stolen from comments here), then the third time think about maybe creating a new abstraction.


Replies

badlucklotteryyesterday at 8:35 PM

>WET - Write Everything Twice

I've always heard this as the "Rule of three": https://en.wikipedia.org/wiki/Rule_of_three_(computer_progra...

show 1 reply
dasil003yesterday at 9:37 PM

Totally agree with this, the beauty of software is the right abstractions have untold impact, spanning many orders of magnitude. I'm talking about the major innovations, things like operating systems, RDBMS, cloud orchestration. But the majority of code in the world is not like that, it's just simple business logic that represents ideas and processes run by humans for human purposes which resist abstraction.

That doesn't people from trying though, platform creation is rife within big tech companies as a technical form of empire building and career-driven development. My rule of thumb in tech reviews is you can't have a platform til you have three proven use cases and shown that coupling them together is not a net negative due to the autonomy constraint a shared system imposes.

show 1 reply
marcus_holmestoday at 1:52 AM

"Duplication is far cheaper than the wrong abstraction"

Sandi Metz https://sandimetz.com/blog/2016/1/20/the-wrong-abstraction

show 1 reply
layer8yesterday at 9:30 PM

More than twice is a rather low bar, I don’t think that it conflicts with the quote from Programming Perl.

show 1 reply
HarHarVeryFunnyyesterday at 10:26 PM

Writing twice makes sense if time permits, or the opportunity presents itself. First time may be somewhat exploratory (maybe a thow-away prototype), then second time you better understand the problem and can do a better job.

A third time, with a new abstraction, is where you need to be careful. Fred Brooks ("Mythical Man Month") refers to it as the "second-system effect" where the confidence of having done something once (for real, not just prototype) may lead to an over-engineered and unnecessarily complex "version 2" as you are tempted to "make it better" by adding layers of abstractions and bells and whistles.

show 1 reply
nixpulvisyesterday at 9:01 PM

I've been advocating for writing everything twice since college.

raincoleyesterday at 10:42 PM

I agree. It's crazy how many layers of abstraction have been created since 1991 (when Programming Perl was published.)

jimbokunyesterday at 10:29 PM

That will still result in more abstraction than the average programmer.