{"id":"6b09a4b5ff996234422a26ae","slug":"dry","title":"DRY: one piece of knowledge, one place – and when duplication is cheaper","summary":"The DRY principle through the order rules of Halina's pierogi place: knowledge duplication vs code duplication, the Rule of Three, Sandi Metz's wrong abstraction, a single source of truth for validation, schemas and configuration in C#, TypeScript, Java, Go and Python, plus WET and AHA.","servedLang":"en","availableLangs":["pl","en"],"topics":["dry","kiss","specification"],"techs":["dotnet","typescript","java","go","python"],"tags":["dry","principles","duplication","wrong-abstraction","rule-of-three","validation"],"level":"beginner","kind":"article","access":"members","status":"published","cover":null,"author":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","community":false},"readingMinutes":15,"stats":{"views":1,"likes":0,"bookmarks":0,"comments":0},"publishedAt":"2026-11-27T15:41:41.659Z","updatedAt":"2026-11-27T17:30:57.312Z","requestedLang":"en","theme":{"hero":"classic","heroMedia":null,"accent":"amber","background":"grid","weaveResources":true,"toc":"right"},"seoDescription":"DRY (Don't Repeat Yourself) in practice: knowledge vs code duplication, the Rule of Three, the wrong abstraction (Sandi Metz), DRY across layers – validation, schemas, configuration – with code in C#, TypeScript, Java, Go and Python, WET, AHA and DAMP.","wordCount":2892,"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"The minimum order value in Halina's pierogi place went up from 40 to 45 zł in March. Someone changed it in the API, but the shop's checkout form and the abandoned-cart e-mail still say \"40 zł\" – customers get an error they don't understand, and Halina gets phone calls from annoyed regulars. "},{"type":"text","text":"DRY","marks":[{"type":"bold"}]},{"type":"text","text":" ("},{"type":"text","text":"Don't Repeat Yourself","marks":[{"type":"italic"}]},{"type":"text","text":") is not about similar lines of code but about "},{"type":"text","text":"knowledge","marks":[{"type":"bold"}]},{"type":"text","text":": every rule should have one authoritative place in the system."}]},{"type":"callout","attrs":{"variant":"tip","title":"In short"},"content":[{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"DRY is about knowledge – rules, decisions, contracts – not about what the code looks like."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Two similar fragments that change for different reasons are not duplication, just a coincidence."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"A wrong abstraction costs more than a copy: before you extract shared code, wait for the third repetition."}]}]}]}]},{"type":"stats","attrs":{"items":[{"value":"1999","label":"\"The Pragmatic Programmer\"","hint":"Andy Hunt and Dave Thomas state the DRY principle"},{"value":"3","label":"the Rule of Three","hint":"refactor on the third repetition (Don Roberts)"},{"value":"45 ≠ 40","label":"the minimum in the API and in the form","hint":"one rule, two truths"}]}},{"type":"heading","attrs":{"level":2,"id":"where-dry-comes-from"},"content":[{"type":"text","text":"Where DRY comes from"}]},{"type":"paragraph","content":[{"type":"text","text":"Andy Hunt and Dave Thomas stated the principle in "},{"type":"text","text":"The Pragmatic Programmer","marks":[{"type":"italic"}]},{"type":"text","text":" (1999): every piece of knowledge must have a single, unambiguous, authoritative representation within a system. The key word is "},{"type":"text","text":"knowledge","marks":[{"type":"bold"}]},{"type":"text","text":". Duplication is not only a copied function, but also a comment that repeats the code, hand-written API docs living next to the controllers, or the same rule written once in SQL and once in the application. The authors have stressed many times that DRY is often misread as \"never write two similar lines\"."}]},{"type":"heading","attrs":{"level":2,"id":"knowledge-duplication-vs-code-duplication"},"content":[{"type":"text","text":"Knowledge duplication vs code duplication"}]},{"type":"paragraph","content":[{"type":"text","text":"The simplest test: "},{"type":"text","text":"when the rule changes, do all the copies have to change?","marks":[{"type":"bold"}]},{"type":"text","text":" If yes, it is the same knowledge. If the copies change for different reasons and at different times, it is just similar code."}]},{"type":"table","content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph"}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Knowledge duplication"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Coincidentally similar code"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Example"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"the 45 zł minimum in the API, the form and the e-mail"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"a 200-character limit for courier notes and for pierogi reviews"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Change test"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"changing the rule means changing every copy"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"each copy changes for a different reason"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"What to do"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"one source of truth"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"keep them apart and name each constant separately"}]}]}]}]},{"type":"paragraph","content":[{"type":"text","text":"The courier-note limit comes from the screen of the courier app; the review limit comes from moderation rules. When marketing asks for longer reviews, a shared "},{"type":"text","text":"MAX_TEXT = 200","marks":[{"type":"code"}]},{"type":"text","text":" constant silently changes the courier app too. It also works the other way round: the same knowledge can look completely different – "},{"type":"text","text":"if (total < 45)","marks":[{"type":"code"}]},{"type":"text","text":" in C# and "},{"type":"text","text":"CHECK (total >= 45)","marks":[{"type":"code"}]},{"type":"text","text":" in SQL share not a single character, and they are still duplicates."}]},{"type":"heading","attrs":{"level":2,"id":"the-problem-three-places-three-truths"},"content":[{"type":"text","text":"The problem: three places, three truths"}]},{"type":"paragraph","content":[{"type":"text","text":"This is the minimum-order rule after the March change – only one of the three places was updated:"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"three-places-three-truths.ts"},"content":[{"type":"text","text":"// web/checkout-form.ts\nif (cart.total < 40) showError('Minimum order is 40 zł');\n\n// api/orders.controller.ts – raised to 45 zł in March\nif (dto.total < 45) throw new BadRequestException('Minimum order is 45 zł');\n\n// emails/abandoned-cart.ts\nconst hint = 'Add one more portion – the minimum order is only 40 zł!';"}]},{"type":"paragraph","content":[{"type":"text","text":"Each of these lines is correct and readable on its own. The problem is that the business rule \"what is the minimum\" has three owners, and none of them knows about the others. The mobile app, which lives in a separate repository, holds a fourth copy."}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"flowchart LR\n  subgraph Before[\"Before: copies\"]\n    F1[\"Checkout form: 40 zł\"]\n    A1[\"API: 45 zł\"]\n    M1[\"Mobile app: 40 zł\"]\n    E1[\"E-mail: 40 zł\"]\n  end\n  subgraph After[\"After: single source\"]\n    R[\"OrderRules<br/>minTotal = 45 zł\"] --> A2[\"API validation\"]\n    R --> G[\"GET /api/order-rules\"]\n    G --> F2[\"Checkout form\"]\n    G --> M2[\"Mobile app\"]\n    G --> E2[\"E-mail templates\"]\n  end","caption":"The minimum-order rule: copies vs a single source"}},{"type":"heading","attrs":{"level":2,"id":"the-solution-a-single-source-of-truth"},"content":[{"type":"text","text":"The solution: a single source of truth"}]},{"type":"paragraph","content":[{"type":"text","text":"The order rules move into one module. The API validates against them, error messages are built from the same constants, and the checkout form, the mobile app and the e-mail templates download the rules from "},{"type":"text","text":"GET /api/order-rules","marks":[{"type":"code"}]},{"type":"text","text":" instead of hard-coding numbers."}]},{"type":"codeGroup","attrs":{"title":"A single source of order rules"},"content":[{"type":"codeBlock","attrs":{"language":"csharp","filename":"OrderRules.cs"},"content":[{"type":"text","text":"using System.Text.Json;\nusing System.Text.RegularExpressions;\n\nvar draft = new OrderDraft(Total: 38m, Portions: 22, Phone: \"600-100-200\");\nforeach (var error in OrderRules.Validate(draft)) Console.WriteLine(error);\nConsole.WriteLine(JsonSerializer.Serialize(OrderRules.Public)); // served at GET /api/order-rules\n\npublic sealed record OrderDraft(decimal Total, int Portions, string Phone);\n\n// The single, authoritative place for order rules.\npublic static partial class OrderRules\n{\n    public const decimal MinTotal = 45m;\n    public const int MaxPortions = 20;\n    public const string PhonePattern = @\"^\\d{9}$\";\n\n    // What the web form, the mobile app and e-mail templates read instead of hard-coding numbers.\n    public static readonly object Public = new { minTotal = MinTotal, maxPortions = MaxPortions, phonePattern = PhonePattern };\n\n    public static IEnumerable<string> Validate(OrderDraft order)\n    {\n        if (order.Total < MinTotal) yield return $\"Minimum order is {MinTotal} zł\";\n        if (order.Portions > MaxPortions) yield return $\"At most {MaxPortions} portions per order\";\n        if (!Phone().IsMatch(order.Phone)) yield return \"Phone number must have 9 digits\";\n    }\n\n    [GeneratedRegex(PhonePattern)]\n    private static partial Regex Phone();\n}"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"order-rules.ts"},"content":[{"type":"text","text":"// The single, authoritative place for order rules.\nexport const ORDER_RULES = {\n  minTotal: 4_500, // grosze\n  maxPortions: 20,\n  phonePattern: '^\\\\d{9}$',\n} as const;\n\nexport interface OrderDraft { total: number; portions: number; phone: string }\n\nexport function validateOrder(order: OrderDraft): string[] {\n  const errors: string[] = [];\n  if (order.total < ORDER_RULES.minTotal) errors.push(`Minimum order is ${ORDER_RULES.minTotal / 100} zł`);\n  if (order.portions > ORDER_RULES.maxPortions) errors.push(`At most ${ORDER_RULES.maxPortions} portions per order`);\n  if (!new RegExp(ORDER_RULES.phonePattern).test(order.phone)) errors.push('Phone number must have 9 digits');\n  return errors;\n}\n\n// Served at GET /api/order-rules – the web form, the mobile app and e-mail templates\n// read it instead of hard-coding numbers.\nexport const publicOrderRules = (): string => JSON.stringify(ORDER_RULES);\n\nconsole.log(validateOrder({ total: 3_800, portions: 22, phone: '600-100-200' }));\nconsole.log(publicOrderRules());"}]},{"type":"codeBlock","attrs":{"language":"java","filename":"OrderRules.java"},"content":[{"type":"text","text":"import java.math.BigDecimal;\nimport java.util.ArrayList;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.regex.Pattern;\n\n// The single, authoritative place for order rules.\npublic final class OrderRules {\n    public static final BigDecimal MIN_TOTAL = new BigDecimal(\"45\");\n    public static final int MAX_PORTIONS = 20;\n    public static final String PHONE_PATTERN = \"^\\\\d{9}$\";\n    private static final Pattern PHONE = Pattern.compile(PHONE_PATTERN);\n\n    private OrderRules() {}\n\n    public record OrderDraft(BigDecimal total, int portions, String phone) {}\n\n    public static List<String> validate(OrderDraft order) {\n        var errors = new ArrayList<String>();\n        if (order.total().compareTo(MIN_TOTAL) < 0) errors.add(\"Minimum order is \" + MIN_TOTAL + \" zł\");\n        if (order.portions() > MAX_PORTIONS) errors.add(\"At most \" + MAX_PORTIONS + \" portions per order\");\n        if (!PHONE.matcher(order.phone()).matches()) errors.add(\"Phone number must have 9 digits\");\n        return errors;\n    }\n\n    // Served at GET /api/order-rules (e.g. a Spring @GetMapping that returns this map as JSON).\n    public static Map<String, Object> publicRules() {\n        var rules = new LinkedHashMap<String, Object>();\n        rules.put(\"minTotal\", MIN_TOTAL);\n        rules.put(\"maxPortions\", MAX_PORTIONS);\n        rules.put(\"phonePattern\", PHONE_PATTERN);\n        return rules;\n    }\n\n    public static void main(String[] args) {\n        System.out.println(validate(new OrderDraft(new BigDecimal(\"38\"), 22, \"600-100-200\")));\n        System.out.println(publicRules());\n    }\n}"}]},{"type":"codeBlock","attrs":{"language":"go","filename":"order_rules.go"},"content":[{"type":"text","text":"package main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"regexp\"\n)\n\n// OrderRules is the single, authoritative place for order rules.\n// The JSON tags let us serve it as-is at GET /api/order-rules.\ntype OrderRules struct {\n\tMinTotal     int64  `json:\"minTotal\"` // grosze\n\tMaxPortions  int    `json:\"maxPortions\"`\n\tPhonePattern string `json:\"phonePattern\"`\n}\n\nvar Rules = OrderRules{MinTotal: 4500, MaxPortions: 20, PhonePattern: `^\\d{9}$`}\n\nvar phoneRe = regexp.MustCompile(Rules.PhonePattern)\n\ntype OrderDraft struct {\n\tTotal    int64\n\tPortions int\n\tPhone    string\n}\n\nfunc ValidateOrder(o OrderDraft) []string {\n\tvar errs []string\n\tif o.Total < Rules.MinTotal {\n\t\terrs = append(errs, fmt.Sprintf(\"Minimum order is %d zł\", Rules.MinTotal/100))\n\t}\n\tif o.Portions > Rules.MaxPortions {\n\t\terrs = append(errs, fmt.Sprintf(\"At most %d portions per order\", Rules.MaxPortions))\n\t}\n\tif !phoneRe.MatchString(o.Phone) {\n\t\terrs = append(errs, \"Phone number must have 9 digits\")\n\t}\n\treturn errs\n}\n\nfunc main() {\n\tfmt.Println(ValidateOrder(OrderDraft{Total: 3800, Portions: 22, Phone: \"600-100-200\"}))\n\tpublic, _ := json.Marshal(Rules) // what the web form and the mobile app download\n\tfmt.Println(string(public))\n}"}]},{"type":"codeBlock","attrs":{"language":"python","filename":"order_rules.py"},"content":[{"type":"text","text":"import json\nimport re\nfrom dataclasses import asdict, dataclass\nfrom decimal import Decimal\n\n\n@dataclass(frozen=True)\nclass OrderRules:\n    \"\"\"The single, authoritative place for order rules.\"\"\"\n\n    min_total: Decimal = Decimal(\"45\")\n    max_portions: int = 20\n    phone_pattern: str = r\"^\\d{9}$\"\n\n\nRULES = OrderRules()\n\n\n@dataclass(frozen=True)\nclass OrderDraft:\n    total: Decimal\n    portions: int\n    phone: str\n\n\ndef validate_order(order: OrderDraft, rules: OrderRules = RULES) -> list[str]:\n    errors = []\n    if order.total < rules.min_total:\n        errors.append(f\"Minimum order is {rules.min_total} zł\")\n    if order.portions > rules.max_portions:\n        errors.append(f\"At most {rules.max_portions} portions per order\")\n    if not re.fullmatch(rules.phone_pattern, order.phone):\n        errors.append(\"Phone number must have 9 digits\")\n    return errors\n\n\ndef public_rules(rules: OrderRules = RULES) -> str:\n    \"\"\"Served at GET /api/order-rules for the web form, the mobile app and e-mail templates.\"\"\"\n    return json.dumps(asdict(rules), default=str)\n\n\nprint(validate_order(OrderDraft(Decimal(\"38\"), 22, \"600-100-200\")))\nprint(public_rules())"}]}]}]},"toc":[{"id":"where-dry-comes-from","text":"Where DRY comes from","level":2,"locked":false},{"id":"knowledge-duplication-vs-code-duplication","text":"Knowledge duplication vs code duplication","level":2,"locked":false},{"id":"the-problem-three-places-three-truths","text":"The problem: three places, three truths","level":2,"locked":false},{"id":"the-solution-a-single-source-of-truth","text":"The solution: a single source of truth","level":2,"locked":false},{"id":"dry-across-layers","text":"DRY across layers","level":2,"locked":true},{"id":"the-rule-of-three","text":"The Rule of Three","level":2,"locked":true},{"id":"the-wrong-abstraction","text":"The wrong abstraction","level":2,"locked":true},{"id":"wet-aha-and-damp","text":"WET, AHA and DAMP","level":2,"locked":true},{"id":"when-to-use-it-and-when-not-to","text":"When to use it and when not to","level":2,"locked":true},{"id":"in-practice","text":"In practice","level":2,"locked":true},{"id":"related-topics","text":"Related topics","level":2,"locked":true},{"id":"test-yourself","text":"Test yourself","level":2,"locked":true}],"locked":true,"paywall":null,"previewRatio":0.3,"totalBlocks":49,"visibleBlocks":17,"resources":[{"id":"6b0857c03c96f2d34d0b4423","type":"article","provider":"web","url":"https://verraes.net/2014/08/dry-is-about-knowledge","embedUrl":null,"title":"DRY is about Knowledge","description":"Code duplication is not the issue.","author":"Mathias Verraes","thumbnailUrl":"https://verraes.net/img/posts/2014-08-02-dry-is-about-knowledge/find-the-differences.jpg","durationSec":null,"lang":"en","topics":["dry"],"techs":["general"],"tags":[],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":"2014-08-02T00:00:00.000Z","popularity":50,"verifiedAt":"2026-11-26T11:29:40.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:02.417Z","updatedAt":"2026-11-26T16:01:02.417Z"},{"id":"6b0857c33c96f2d34d0b4650","type":"book","provider":"openlibrary","url":"https://openlibrary.org/works/OL5748544W","embedUrl":null,"title":"The Pragmatic Programmer: From Journeyman to Master","description":"","author":"Andrew Hunt, Dave Thomas","thumbnailUrl":"https://covers.openlibrary.org/b/id/10143650-L.jpg","durationSec":null,"lang":"en","topics":[],"techs":["general"],"tags":["book"],"price":"paid","featured":false,"featuredOrder":0,"packageName":null,"source":"openlibrary","publishedAt":"1999-01-01T00:00:00.000Z","popularity":79,"verifiedAt":"2026-11-26T11:00:08.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:04.995Z","updatedAt":"2026-11-26T16:01:04.995Z"},{"id":"6b0857c23c96f2d34d0b458f","type":"article","provider":"web","url":"https://milanjovanovic.tech/blog/dry-is-the-most-misunderstood-rule-in-programming","embedUrl":null,"title":"What the DRY Principle Actually Means","description":"DRY was never about code that looks the same. It's about knowledge. Most of the tangled abstractions I've had to unwind started as a well-meaning attempt to…","author":"Milan Jovanović","thumbnailUrl":"https://milanjovanovic.tech/blog-covers/mnw_197.png","durationSec":null,"lang":"en","topics":["dry"],"techs":["dotnet"],"tags":[],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":"2026-06-06T00:00:00.000Z","popularity":50,"verifiedAt":"2026-11-26T11:28:56.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:04.995Z","updatedAt":"2026-11-26T16:01:04.995Z"},{"id":"6b0857c23c96f2d34d0b4591","type":"article","provider":"web","url":"https://threedots.tech/post/things-to-know-about-dry","embedUrl":null,"title":"When to avoid DRY in Go","description":"If you’re here for the first time, this post is part of our Business Applications in Go series. Previously, we introduced Wild Workouts, our example application built with modern tools but containing some subtle anti-patterns. We added them on purpose to show common pitfalls and how to avoid them…","author":"Three Dots Labs","thumbnailUrl":"https://threedots.tech/media/things-to-know-about-dry/cover.png","durationSec":null,"lang":"en","topics":["dry"],"techs":["go"],"tags":["refactoring"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":"2020-06-16T22:00:00.000Z","popularity":50,"verifiedAt":"2026-11-26T11:28:50.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:04.995Z","updatedAt":"2026-11-26T16:01:04.995Z"},{"id":"6b0857bd3c96f2d34d0b4144","type":"podcast","provider":"apple-podcasts","url":"https://podcasts.apple.com/us/podcast/160-dry-wet-damp-aha-and-removing-duplication-from/id1029487211?i=1000528283959","embedUrl":"https://embed.podcasts.apple.com/us/podcast/id1029487211?i=1000528283959","title":"160: DRY, WET, DAMP, AHA, and removing duplication from production code and test code","description":"Should your code be DRY or DAMP or something completely different? How about your test code? Do different rules apply? Wait, what do all of these acronyms mean? We'll get to all of these definitions, and then talk about how it applies to both production code and test code in this episode. Links…","author":"Test & Code","thumbnailUrl":"https://is1-ssl.mzstatic.com/image/thumb/Podcasts211/v4/bc/83/56/bc835690-12d4-9398-f8f8-234889fc4702/mza_11760862679876056298.jpg/600x600bb.jpg","durationSec":845,"lang":"en","topics":["dry"],"techs":["python"],"tags":["podcast","testing"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"itunes","publishedAt":"2021-07-08T20:00:00.000Z","popularity":34,"verifiedAt":"2026-11-26T11:07:00.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"},{"id":"6b0857c73c96f2d34d0b4951","type":"video","provider":"youtube","url":"https://www.youtube.com/watch?v=GmlZBdKhl9Y","embedUrl":"https://www.youtube-nocookie.com/embed/GmlZBdKhl9Y","title":"DRY Often Makes Your Code Worse","description":"🧱 Build software that lasts. Join the Software Design Mastery waiting list → https://arjan.codes/mastery. In this video, I show how a “clean” DRY refactor can actually make your code worse. Instead of improving the design, it introduces hidden complexity, confusing flags, and harder-to-understand…","author":"ArjanCodes","thumbnailUrl":"https://i.ytimg.com/vi/GmlZBdKhl9Y/hqdefault.jpg","durationSec":null,"lang":"en","topics":["dry"],"techs":["python"],"tags":["refactoring"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"youtube-rss","publishedAt":"2026-05-08T15:00:27.000Z","popularity":64,"verifiedAt":"2026-11-26T10:54:45.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:10.095Z","updatedAt":"2026-11-26T16:01:10.095Z"}],"challenges":[{"id":"6b093dc091bd8fbaf2a0c8bc","slug":"catalog-specification","title":"Catalog specifications","summary":"Promotion rules as small objects combined with and, or and not – the Specification pattern from DDD, custom rules and catalog search.","servedLang":"en","availableLangs":["pl","en"],"kind":"code","category":"pattern","status":"published","difficulty":"medium","topics":["specification"],"techs":["typescript","javascript","python","dotnet","java","go"],"tags":["specification","ddd","composite","business-rules","e-commerce"],"languages":["typescript","javascript","python","csharp","java","go"],"questionCount":null,"xp":20,"stats":{"attempts":0,"solves":0,"solutions":0,"comments":0},"solveRate":null,"publishedAt":"2026-11-27T08:22:24.795Z"}],"attachments":[],"hasCode":true,"repoUrl":null,"series":[{"slug":"design-principles","title":"Design principles","items":[{"slug":"kiss","title":"KISS: the simplest working solution usually wins","current":false},{"slug":"dry","title":"DRY: one piece of knowledge, one place – and when duplication is cheaper","current":true},{"slug":"yagni","title":"YAGNI: don't build ahead – what a feature nobody ordered really costs","current":false},{"slug":"law-of-demeter","title":"The Law of Demeter: talk only to your friends","current":false},{"slug":"solid","title":"SOLID: five object-oriented design principles without the myths","current":false}]}],"prev":{"slug":"kiss","title":"KISS: the simplest working solution usually wins"},"next":{"slug":"yagni","title":"YAGNI: don't build ahead – what a feature nobody ordered really costs"},"featured":false,"authorCard":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","headline":"Wzorce projektowe · Architektura · AI i LLM","community":false,"reputation":{"points":3900,"level":{"key":"mentor","label":"Mentor"}},"articles":104,"skills":[{"key":"typescript","title":"TypeScript","level":5,"levelLabel":"Authority","articles":90},{"key":"dotnet","title":".NET","level":5,"levelLabel":"Authority","articles":61},{"key":"python","title":"Python","level":5,"levelLabel":"Authority","articles":59},{"key":"java","title":"Java","level":5,"levelLabel":"Authority","articles":46}]}}