Hacker News new | ask | show | jobs
by hinkley 557 days ago
I was on a team rewriting a UI from native to web, so we were moving fast on copying existing features instead of inventing new ones. About four times in 18 months we had triplets of features in the backlog and tried to generalize the implementation on the second occurrence, only to have to do expensive rework on the third. The code and the tests just wouldn’t bend the right way. We had mostly agreed to follow the Rule of 3 but someone kept thinking this time would be different and it never was. The last story was always the slowest and extra time spent on the middle one was wasted.
1 comments

I blame bootcamp culture driven between 2010 and 2020.

Students learning DRY on day 1 and then applying it to the max before intuitively understanding the problems DRY solves.

I encounter people trying to establish standards and abstract patterns on the first pass of code...

Sports are good at distinguishing drills from practice. Practice is meant to look almost like real play. Drills are something you do so practice goes better, and to narrow your window of harm in practice.

I put, for instance, TDD in the drills category. I don’t think you should live in TDD. nor do I think you should avoid TDD because someone said they thought it wasn’t a viable lifestyle choice. You should do it for a while every six months or a year to knock the cobwebs off and remind you what sort of tests you’re going to need and write code that complements good tests, rather than fighting them.

DRY is a bit more complex. I think DRY in unit and integration tests is a slow death. Tests should be DAMP because requirements change, and so do languages, frameworks and libraries. DAMP avoids the sunk cost fallacy which I’ve seen nerd snipe too many people. Test isn’t useful anymore? Just delete it. Or replace it. Boom, done.

> Sports are good at distinguishing drills from practice

The military also. Individuals learn 'part task' drills (e.g. firing a tank gun), then practice them in a team environment (e.g. the different crew roles working together in a single tank) and then finally (in something fairly unique to the military) exercising collectively: multiple teams working together to achieve a common task. E.g. several tanks coordinating an attack, then adding in infantry, etc.

> 'part task' drills (e.g. firing a tank gun), then practice them in a team environment

Brought to mind "wax on, wax off" from the original Karate Kid movie.

https://thekaratekid.fandom.com/wiki/Wax_On,_Wax_Off

Definitely true, but probably easier to get nerds to rewatch Ted Lasso than Full Metal Jacket.
I’m not sure that would be my go to movie for military discipline and effective teamwork, but I’d sure watch it again.
DRY... Don't Repeat Yourself

DAMP... Do Always More Pasting

Hah!

Descriptive And Meaningful Prose

Just have your test say what it does. Don’t play code gold and get clever. Tests for different features should be able to die separately. No coupling.