logoalt Hacker News

ttoinouyesterday at 8:00 PM2 repliesview on HN

We still need a way to track that there’s some common pattern in the code. So that when we update one pattern we wonder about the others places in code with the same pattern. Avoiding duplication doesn’t solve that


Replies

Akronymusyesterday at 8:19 PM

My metric for that is "does that code MEAN the same thing" or "does it just look the same". Has worked quite well for me so far. I frequently find myself making a copy of some code rather than adding a parameter (most commonly done with code that would get some flag added)

show 2 replies
t-3yesterday at 8:51 PM

> when we update one pattern we wonder about the others places in code with the same pattern. Avoiding duplication doesn’t solve that

It can, that's all about how aggressively you factor and structure your code, eg. combinators make it easy to reuse code in different application patterns without rewriting.

show 1 reply