Hacker News new | ask | show | jobs
by BadOakOx 782 days ago
1 and 2 kind of contradict themselves (or compliment, based on how much DRY we allow)... You want to make that abstraction when you need to have a single source of truth.

Also, the argument for 2 isn't very clear, it could be interpreted like the author doesn't understand inheritance.

2 comments

You should have one source of truth for data. But frequently multiple implementations of the same, or similar, interface don't actually have the same semantics. By merging them, you now have the same source of truth for two distinct concepts.
They don't really contradict. That FOO and BAR look similar, does not mean they share some "truthfulness". Prematurely reaching to deduplicate and abstract them may lead to issues when you realise they aren't actually as similar as you thought, then you end up handling edge cases that wouldn't exist if you just kept the things separate to begin with.
The line I like to pull out is: things that look alike may not be alike.