The anti-pattern here is applying DRY to text rather than intents. The identical text may appear in a different source file with a different intent, say a tax calculation for a region. It may very well be that two regions have the same formula, but it's obvious that you shouldn't DRY it.
The example used in the post had no real-world intent. The intent was to blindly apply DRY which doesn't count as one.
I'd argue the example given in the article is bad not because it doesn't repeat itself, but because it only concats strings. Using more advanced language features, or perhaps a ORM, I think you could easily come up with a solution that doesn't involve repeating parts of SQL queries but is still readable.
Comments
The anti-pattern here is applying DRY to text rather than intents. The identical text may appear in a different source file with a different intent, say a tax calculation for a region. It may very well be that two regions have the same formula, but it's obvious that you shouldn't DRY it.
The example used in the post had no real-world intent. The intent was to blindly apply DRY which doesn't count as one.
I'd argue the example given in the article is bad not because it doesn't repeat itself, but because it only concats strings. Using more advanced language features, or perhaps a ORM, I think you could easily come up with a solution that doesn't involve repeating parts of SQL queries but is still readable.
It might not be the best, but until a better one comes up, it's the best. It's all relative.