{"id":"6b09a4b5ff996234422a26ae","slug":"dry","title":"DRY: jedna wiedza, jedno miejsce – i kiedy duplikacja jest tańsza","summary":"Zasada DRY na przykładzie reguł zamówień w pierogarni Haliny: duplikacja wiedzy a duplikacja kodu, reguła trzech, zła abstrakcja według Sandi Metz, jedno źródło prawdy dla walidacji, schematów i konfiguracji w C#, TypeScript, Javie, Go i Pythonie oraz WET i AHA.","servedLang":"pl","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":14,"stats":{"views":0,"likes":0,"bookmarks":0,"comments":0},"publishedAt":"2026-11-27T15:41:41.659Z","updatedAt":"2026-11-27T15:41:53.847Z","requestedLang":"pl","theme":{"hero":"classic","heroMedia":null,"accent":"amber","background":"grid","weaveResources":true,"toc":"right"},"seoDescription":"DRY (Don't Repeat Yourself) w praktyce: duplikacja wiedzy kontra duplikacja kodu, reguła trzech, zła abstrakcja (Sandi Metz), DRY między warstwami – walidacja, schematy, konfiguracja – z kodem w C#, TypeScript, Java, Go i Python, WET, AHA i DAMP.","wordCount":2669,"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"Minimalna wartość zamówienia w pierogarni Haliny wzrosła w marcu z 40 do 45 zł. Ktoś zmienił ją w API, ale formularz w sklepie i e-mail o porzuconym koszyku dalej mówią „40 zł” – klienci dostają błąd, którego nie rozumieją, a Halina telefony od zdenerwowanych stałych gości. "},{"type":"text","text":"DRY","marks":[{"type":"bold"}]},{"type":"text","text":" (ang. "},{"type":"text","text":"Don't Repeat Yourself","marks":[{"type":"italic"}]},{"type":"text","text":" – „nie powtarzaj się”) nie dotyczy podobnych linijek kodu, tylko "},{"type":"text","text":"wiedzy","marks":[{"type":"bold"}]},{"type":"text","text":": każda reguła powinna mieć w systemie jedno, autorytatywne miejsce."}]},{"type":"callout","attrs":{"variant":"tip","title":"W skrócie"},"content":[{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"DRY dotyczy wiedzy – reguł, decyzji, kontraktów – a nie wyglądu kodu."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Dwa podobne fragmenty, które zmieniają się z różnych powodów, to nie duplikacja, tylko zbieg okoliczności."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Zła abstrakcja kosztuje więcej niż kopia: zanim wydzielisz wspólny kod, poczekaj na trzecie powtórzenie."}]}]}]}]},{"type":"stats","attrs":{"items":[{"value":"1999","label":"„The Pragmatic Programmer”","hint":"Andy Hunt i Dave Thomas formułują zasadę DRY"},{"value":"3","label":"reguła trzech","hint":"refaktoryzuj przy trzecim powtórzeniu (Don Roberts)"},{"value":"45 ≠ 40","label":"minimum w API i w formularzu","hint":"jedna reguła, dwie prawdy"}]}},{"type":"heading","attrs":{"level":2,"id":"skad-sie-wzielo-dry"},"content":[{"type":"text","text":"Skąd się wzięło DRY"}]},{"type":"paragraph","content":[{"type":"text","text":"Zasadę sformułowali Andy Hunt i Dave Thomas w książce "},{"type":"text","text":"The Pragmatic Programmer","marks":[{"type":"italic"}]},{"type":"text","text":" (1999): każdy fragment wiedzy musi mieć w systemie jedną, jednoznaczną i autorytatywną reprezentację. Słowo kluczowe to "},{"type":"text","text":"wiedza","marks":[{"type":"bold"}]},{"type":"text","text":". Duplikacją jest nie tylko skopiowana funkcja, ale też komentarz, który powtarza kod, ręcznie pisana dokumentacja API obok kontrolerów, czy ta sama reguła zapisana raz w SQL, a raz w aplikacji. Autorzy wielokrotnie podkreślali, że DRY bywa źle rozumiane jako „nigdy nie pisz dwa razy podobnych linijek”."}]},{"type":"heading","attrs":{"level":2,"id":"duplikacja-wiedzy-a-duplikacja-kodu"},"content":[{"type":"text","text":"Duplikacja wiedzy a duplikacja kodu"}]},{"type":"paragraph","content":[{"type":"text","text":"Najprostszy test: "},{"type":"text","text":"gdy reguła się zmieni, czy trzeba zmienić wszystkie kopie?","marks":[{"type":"bold"}]},{"type":"text","text":" Jeśli tak – to ta sama wiedza. Jeśli kopie zmieniają się z różnych powodów i w różnym czasie, to tylko podobny kod."}]},{"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":"Duplikacja wiedzy"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Przypadkowa zbieżność kodu"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Przykład"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"minimum 45 zł w API, formularzu i e-mailu"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"limit 200 znaków dla uwag dla kuriera i dla opinii o pierogach"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Test zmiany"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"zmiana reguły wymaga zmiany każdej kopii"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"każda kopia zmienia się z innego powodu"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Co robić"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"jedno źródło prawdy"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"zostawić osobno i nazwać każdą stałą osobno"}]}]}]}]},{"type":"paragraph","content":[{"type":"text","text":"Limit uwag dla kuriera wynika z ekranu w jego aplikacji, a limit opinii – z zasad moderacji. Gdy marketing poprosi o dłuższe opinie, wspólna stała "},{"type":"text","text":"MAX_TEXT = 200","marks":[{"type":"code"}]},{"type":"text","text":" po cichu zmieni też aplikację kuriera. Działa to w obie strony: ta sama wiedza może wyglądać zupełnie inaczej – "},{"type":"text","text":"if (total < 45)","marks":[{"type":"code"}]},{"type":"text","text":" w C# i "},{"type":"text","text":"CHECK (total >= 45)","marks":[{"type":"code"}]},{"type":"text","text":" w SQL nie mają ani jednego wspólnego znaku, a to wciąż duplikat."}]},{"type":"heading","attrs":{"level":2,"id":"problem-trzy-miejsca-trzy-prawdy"},"content":[{"type":"text","text":"Problem: trzy miejsca, trzy prawdy"}]},{"type":"paragraph","content":[{"type":"text","text":"Tak wygląda reguła minimalnego zamówienia po marcowej zmianie – poprawiono tylko jedno z trzech miejsc:"}]},{"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":"Każda z tych linijek z osobna jest poprawna i czytelna. Problem w tym, że reguła biznesowa „ile minimum” ma trzech właścicieli, a żaden z nich nie wie o pozostałych. Aplikacja mobilna, której kod jest w osobnym repozytorium, ma czwartą kopię."}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"flowchart LR\n  subgraph Przed[\"Przed: kopie\"]\n    F1[\"Formularz: 40 zł\"]\n    A1[\"API: 45 zł\"]\n    M1[\"Aplikacja mobilna: 40 zł\"]\n    E1[\"E-mail: 40 zł\"]\n  end\n  subgraph Po[\"Po: jedno źródło\"]\n    R[\"OrderRules<br/>minTotal = 45 zł\"] --> A2[\"Walidacja w API\"]\n    R --> G[\"GET /api/order-rules\"]\n    G --> F2[\"Formularz\"]\n    G --> M2[\"Aplikacja mobilna\"]\n    G --> E2[\"Szablony e-maili\"]\n  end","caption":"Reguła minimalnego zamówienia: kopie kontra jedno źródło"}},{"type":"heading","attrs":{"level":2,"id":"rozwiazanie-jedno-zrodlo-prawdy"},"content":[{"type":"text","text":"Rozwiązanie: jedno źródło prawdy"}]},{"type":"paragraph","content":[{"type":"text","text":"Reguły zamówień trafiają do jednego modułu. API waliduje na ich podstawie, komunikaty błędów są budowane z tych samych stałych, a formularz, aplikacja mobilna i szablony e-maili pobierają reguły z endpointu "},{"type":"text","text":"GET /api/order-rules","marks":[{"type":"code"}]},{"type":"text","text":" zamiast wpisywać liczby na sztywno."}]},{"type":"codeGroup","attrs":{"title":"Jedno źródło reguł zamówienia"},"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":"skad-sie-wzielo-dry","text":"Skąd się wzięło DRY","level":2,"locked":false},{"id":"duplikacja-wiedzy-a-duplikacja-kodu","text":"Duplikacja wiedzy a duplikacja kodu","level":2,"locked":false},{"id":"problem-trzy-miejsca-trzy-prawdy","text":"Problem: trzy miejsca, trzy prawdy","level":2,"locked":false},{"id":"rozwiazanie-jedno-zrodlo-prawdy","text":"Rozwiązanie: jedno źródło prawdy","level":2,"locked":false},{"id":"dry-miedzy-warstwami","text":"DRY między warstwami","level":2,"locked":true},{"id":"regula-trzech","text":"Reguła trzech","level":2,"locked":true},{"id":"zla-abstrakcja","text":"Zła abstrakcja","level":2,"locked":true},{"id":"wet-aha-i-damp","text":"WET, AHA i DAMP","level":2,"locked":true},{"id":"kiedy-stosowac-a-kiedy-nie","text":"Kiedy stosować, a kiedy nie","level":2,"locked":true},{"id":"w-praktyce","text":"W praktyce","level":2,"locked":true},{"id":"powiazania","text":"Powiązania","level":2,"locked":true},{"id":"sprawdz-sie","text":"Sprawdź się","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":"Specyfikacje w katalogu sklepu","summary":"Reguły promocji jako małe obiekty, które się składa operatorami and, or i not – wzorzec Specyfikacja z DDD, własne reguły i wyszukiwanie w katalogu.","servedLang":"pl","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":"Zasady projektowania","items":[{"slug":"kiss","title":"KISS: najprostsze działające rozwiązanie zwykle wygrywa","current":false},{"slug":"dry","title":"DRY: jedna wiedza, jedno miejsce – i kiedy duplikacja jest tańsza","current":true},{"slug":"yagni","title":"YAGNI: nie buduj na zapas – ile kosztuje funkcja, której nikt nie zamówił","current":false},{"slug":"law-of-demeter","title":"Prawo Demeter: rozmawiaj tylko z przyjaciółmi","current":false},{"slug":"solid","title":"SOLID: pięć zasad projektowania obiektowego bez mitów","current":false}]}],"prev":{"slug":"kiss","title":"KISS: najprostsze działające rozwiązanie zwykle wygrywa"},"next":{"slug":"yagni","title":"YAGNI: nie buduj na zapas – ile kosztuje funkcja, której nikt nie zamówił"},"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":"Autorytet","articles":90},{"key":"dotnet","title":".NET","level":5,"levelLabel":"Autorytet","articles":61},{"key":"python","title":"Python","level":5,"levelLabel":"Autorytet","articles":59},{"key":"java","title":"Java","level":5,"levelLabel":"Autorytet","articles":46}]}}