{"id":"6b09a4b7ff996234422a26c4","slug":"law-of-demeter","title":"The Law of Demeter: talk only to your friends","summary":"The Law of Demeter (principle of least knowledge) through loyalty-point redemption in Halina's pierogi place: call chains vs Tell, Don't Ask, exceptions for fluent interfaces and DTOs, code in C#, TypeScript, Java, Go and Python, and how it relates to encapsulation and coupling metrics.","servedLang":"en","availableLangs":["pl","en"],"topics":["law-of-demeter","facade","mediator"],"techs":["dotnet","typescript","java","go","python"],"tags":["law-of-demeter","principles","tell-dont-ask","encapsulation","coupling","code-smells"],"level":"intermediate","kind":"article","access":"members","status":"published","cover":null,"author":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","community":false},"readingMinutes":16,"stats":{"views":1,"likes":0,"bookmarks":0,"comments":0},"publishedAt":"2026-11-27T15:41:43.080Z","updatedAt":"2026-11-27T17:34:40.284Z","requestedLang":"en","theme":{"hero":"classic","heroMedia":null,"accent":"amber","background":"grid","weaveResources":true,"toc":"right"},"seoDescription":"The Law of Demeter (principle of least knowledge): train wrecks like a.getB().getC().doX() vs Tell, Don't Ask, exceptions – fluent interfaces, builders, DTOs – code in C#, TypeScript, Java, Go and Python, encapsulation and the CBO and RFC metrics.","wordCount":3070,"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"A customer of Halina's pierogi place pays for an order with loyalty points: 200 points give a 20 zł discount. Meanwhile the checkout code knows the order's entire family tree: "},{"type":"text","text":"order.getCustomer().getLoyaltyAccount().getBalance().getPoints()","marks":[{"type":"code"}]},{"type":"text","text":". The "},{"type":"text","text":"Law of Demeter","marks":[{"type":"bold"}]},{"type":"text","text":", also called the "},{"type":"text","text":"Principle of Least Knowledge","marks":[{"type":"italic"}]},{"type":"text","text":", says: an object talks only to its immediate collaborators, not to their insides."}]},{"type":"callout","attrs":{"variant":"tip","title":"In short"},"content":[{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"A method calls methods on its own object, its parameters, objects it created itself and its fields – but not on objects returned by those calls."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Instead of pulling data out and deciding on someone's behalf (\"ask\"), ask the object to do the work itself (\"tell\")."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"What counts is the number of "},{"type":"text","text":"types","marks":[{"type":"bold"}]},{"type":"text","text":" the caller gets to know, not the number of dots: fluent interfaces and data structures are not violations."}]}]}]}]},{"type":"stats","attrs":{"items":[{"value":"1987","label":"Northeastern University","hint":"Ian Holland states the principle in the Demeter project"},{"value":"5 → 1","label":"classes the checkout knows","hint":"before and after the refactoring"},{"value":"4","label":"kinds of a method's \"friends\"","hint":"its object, parameters, created objects and fields"}]}},{"type":"heading","attrs":{"level":2,"id":"where-the-law-of-demeter-comes-from"},"content":[{"type":"text","text":"Where the Law of Demeter comes from"}]},{"type":"paragraph","content":[{"type":"text","text":"Ian Holland formulated the principle in 1987 in the Demeter project at Northeastern University, led by Karl Lieberherr. The name comes from the project, and the project's name from the Greek goddess of agriculture: the idea was software that \"grows\" step by step. A year later Lieberherr, Holland and Riel described the principle at the OOPSLA conference. The colloquial version goes: talk only to your friends, don't talk to strangers."}]},{"type":"paragraph","content":[{"type":"text","text":"Formally, a method "},{"type":"text","text":"m","marks":[{"type":"code"}]},{"type":"text","text":" of an object "},{"type":"text","text":"O","marks":[{"type":"code"}]},{"type":"text","text":" may only call methods of these \"friends\":"}]},{"type":"table","content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Friend"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Example in "},{"type":"text","text":"Order.redeemPoints","marks":[{"type":"code"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"the object "},{"type":"text","text":"O","marks":[{"type":"code"}]},{"type":"text","text":" itself"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"this.applyDiscount(...)","marks":[{"type":"code"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"the parameters of "},{"type":"text","text":"m","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"points","marks":[{"type":"code"}]},{"type":"text","text":" passed in by the checkout"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"objects created within "},{"type":"text","text":"m","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"new Discount(...)","marks":[{"type":"code"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"the fields (components) of "},{"type":"text","text":"O","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"this.customer.redeemPoints(...)","marks":[{"type":"code"}]}]}]}]}]},{"type":"paragraph","content":[{"type":"text","text":"The original formulation also allows global variables in the method's scope – today we treat those as a problem rather than a friend. What is not allowed is calling methods on objects "},{"type":"text","text":"returned","marks":[{"type":"bold"}]},{"type":"text","text":" by those calls: "},{"type":"text","text":"this.customer.getLoyaltyAccount().redeem(...)","marks":[{"type":"code"}]},{"type":"text","text":" is already talking to a stranger."}]},{"type":"heading","attrs":{"level":2,"id":"the-problem-a-checkout-that-knows-too-much"},"content":[{"type":"text","text":"The problem: a checkout that knows too much"}]},{"type":"paragraph","content":[{"type":"text","text":"The first version of point redemption was written in the checkout, because \"that's where it's needed\":"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"checkout-before.ts"},"content":[{"type":"text","text":"// Before: Checkout reaches through Order → Customer → LoyaltyAccount → Balance.\nfunction redeemPoints(order: Order, points: number): void {\n  const balance = order.getCustomer().getLoyaltyAccount().getBalance();\n  if (balance.getPoints() < points) throw new Error('Not enough points');\n\n  const discount = points * 10; // 1 point = 10 grosze – a loyalty rule leaked into Checkout\n  if (discount > order.getTotal().getGrosze()) throw new Error('Discount larger than the order');\n\n  balance.setPoints(balance.getPoints() - points);\n  order.getTotal().setGrosze(order.getTotal().getGrosze() - discount);\n}"}]},{"type":"paragraph","content":[{"type":"text","text":"Such chains are called "},{"type":"text","text":"train wrecks","marks":[{"type":"italic"}]},{"type":"text","text":" – carriages of dots coupled one after another. Martin Fowler's "},{"type":"text","text":"Refactoring","marks":[{"type":"italic"}]},{"type":"text","text":" describes them as the "},{"type":"text","text":"Message Chains","marks":[{"type":"italic"}]},{"type":"text","text":" code smell. What is wrong with them?"}]},{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"The checkout knows five classes","marks":[{"type":"bold"}]},{"type":"text","text":" – the order, the customer, the loyalty account, the balance and the amount – and how they are connected. Any change to that structure breaks the code. The same chain also lived in the mobile app's API and in the admin panel, so when points moved to a separate customer wallet, three places needed fixing."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"A loyalty-programme rule leaked out.","marks":[{"type":"bold"}]},{"type":"text","text":" The \"1 point = 10 grosze\" conversion lives in the checkout, and probably in the mobile app too (see "},{"type":"text","text":"DRY","marks":[{"type":"link","attrs":{"href":"/en/topics/dry"}}]},{"type":"text","text":")."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Ask first, then act.","marks":[{"type":"bold"}]},{"type":"text","text":" The code reads the balance, decides on its own and writes the result back through setters. The invariant \"the balance never goes below zero\" is guarded by the caller, not by the object that owns the balance."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Mocks returning mocks.","marks":[{"type":"bold"}]},{"type":"text","text":" To test the checkout you have to build a mock order that returns a mock customer that returns a mock account…"}]}]}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"flowchart LR\n  subgraph Before[\"Before: a chain\"]\n    C1[\"Checkout\"] --> O1[\"Order\"]\n    C1 --> CU1[\"Customer\"]\n    C1 --> L1[\"LoyaltyAccount\"]\n    C1 --> B1[\"Balance\"]\n    C1 --> M1[\"Money\"]\n  end\n  subgraph After[\"After: friends only\"]\n    C2[\"Checkout\"] --> O2[\"Order\"]\n    O2 --> CU2[\"Customer\"]\n    CU2 --> L2[\"LoyaltyAccount\"]\n  end","caption":"Who the checkout knows: before and after the refactoring"}},{"type":"heading","attrs":{"level":2,"id":"the-solution-tell-don-t-ask"},"content":[{"type":"text","text":"The solution: tell, don't ask"}]},{"type":"paragraph","content":[{"type":"text","text":"Tell, Don't Ask","marks":[{"type":"italic"}]},{"type":"text","text":" was popularised by Andy Hunt and Dave Thomas in their article "},{"type":"text","text":"The Art of Enbugging","marks":[{"type":"italic"}]},{"type":"text","text":" (2003): instead of asking an object for its state and deciding on its behalf, tell it what to do. Each object does its part of the work and talks only to its neighbour: the order knows its total and caps the discount, the customer passes the request on to its account, and the account checks the balance and converts the points."}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"sequenceDiagram\n  participant K as Checkout\n  participant O as Order\n  participant C as Customer\n  participant L as LoyaltyAccount\n  K->>O: redeemPoints(200)\n  O->>C: redeemPoints(200, max 45.90 zł)\n  C->>L: redeem(200, max 45.90 zł)\n  L-->>C: discount 20.00 zł\n  C-->>O: discount 20.00 zł\n  Note over O: to pay 25.90 zł","caption":"Point redemption: everyone talks only to their neighbour"}},{"type":"codeGroup","attrs":{"title":"Tell, don't ask – redeeming loyalty points"},"content":[{"type":"codeBlock","attrs":{"language":"csharp","filename":"Loyalty.cs"},"content":[{"type":"text","text":"var order = new Order(\"A-1042\", new Customer(\"Ania\", new LoyaltyAccount(initialPoints: 250)), totalGrosze: 4_590);\norder.RedeemPoints(200);  // Checkout talks only to its friend: the order\nConsole.WriteLine(order); // A-1042: 25.90 zł, Ania has 50 points left\n\npublic sealed class LoyaltyAccount(int initialPoints)\n{\n    private const int GroszePerPoint = 10;\n    public int Points { get; private set; } = initialPoints;\n\n    // Tell the account to redeem – don't read its balance and do the maths outside.\n    public long Redeem(int points, long maxDiscountGrosze)\n    {\n        var discount = (long)points * GroszePerPoint;\n        if (points > Points) throw new InvalidOperationException(\"Not enough points\");\n        if (discount > maxDiscountGrosze) throw new InvalidOperationException(\"Discount larger than the order\");\n        Points -= points;\n        return discount;\n    }\n}\n\npublic sealed class Customer(string name, LoyaltyAccount loyalty)\n{\n    public long RedeemPoints(int points, long maxDiscountGrosze) => loyalty.Redeem(points, maxDiscountGrosze);\n    public override string ToString() => $\"{name} has {loyalty.Points} points left\";\n}\n\npublic sealed class Order(string id, Customer customer, long totalGrosze)\n{\n    private long _total = totalGrosze;\n\n    public void RedeemPoints(int points) => _total -= customer.RedeemPoints(points, maxDiscountGrosze: _total);\n\n    public override string ToString() => $\"{id}: {_total / 100}.{_total % 100:00} zł, {customer}\";\n}"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"loyalty.ts"},"content":[{"type":"text","text":"class LoyaltyAccount {\n  private static readonly GROSZE_PER_POINT = 10;\n  constructor(private points: number) {}\n\n  get balance(): number {\n    return this.points;\n  }\n\n  // Tell the account to redeem – don't read its balance and do the maths outside.\n  redeem(points: number, maxDiscount: number): number {\n    const discount = points * LoyaltyAccount.GROSZE_PER_POINT;\n    if (points > this.points) throw new Error('Not enough points');\n    if (discount > maxDiscount) throw new Error('Discount larger than the order');\n    this.points -= points;\n    return discount;\n  }\n}\n\nclass Customer {\n  constructor(private readonly name: string, private readonly loyalty: LoyaltyAccount) {}\n  redeemPoints(points: number, maxDiscount: number): number {\n    return this.loyalty.redeem(points, maxDiscount);\n  }\n  toString(): string {\n    return `${this.name} has ${this.loyalty.balance} points left`;\n  }\n}\n\nclass Order {\n  constructor(private readonly id: string, private readonly customer: Customer, private total: number) {}\n  redeemPoints(points: number): void {\n    this.total -= this.customer.redeemPoints(points, this.total);\n  }\n  toString(): string {\n    return `${this.id}: ${(this.total / 100).toFixed(2)} zł, ${this.customer}`;\n  }\n}\n\nconst order = new Order('A-1042', new Customer('Ania', new LoyaltyAccount(250)), 4_590);\norder.redeemPoints(200);    // Checkout talks only to its friend: the order\nconsole.log(String(order)); // A-1042: 25.90 zł, Ania has 50 points left"}]},{"type":"codeBlock","attrs":{"language":"java","filename":"Loyalty.java"},"content":[{"type":"text","text":"public class Loyalty {\n    public static void main(String[] args) {\n        var order = new Order(\"A-1042\", new Customer(\"Ania\", new LoyaltyAccount(250)), 4_590);\n        order.redeemPoints(200);   // Checkout talks only to its friend: the order\n        System.out.println(order); // A-1042: 25.90 zł, Ania has 50 points left\n    }\n}\n\nclass LoyaltyAccount {\n    private static final int GROSZE_PER_POINT = 10;\n    private int points;\n\n    LoyaltyAccount(int points) { this.points = points; }\n\n    int balance() { return points; }\n\n    // Tell the account to redeem – don't read its balance and do the maths outside.\n    long redeem(int points, long maxDiscountGrosze) {\n        long discount = (long) points * GROSZE_PER_POINT;\n        if (points > this.points) throw new IllegalStateException(\"Not enough points\");\n        if (discount > maxDiscountGrosze) throw new IllegalStateException(\"Discount larger than the order\");\n        this.points -= points;\n        return discount;\n    }\n}\n\nrecord Customer(String name, LoyaltyAccount loyalty) {\n    long redeemPoints(int points, long maxDiscountGrosze) { return loyalty.redeem(points, maxDiscountGrosze); }\n\n    @Override public String toString() { return name + \" has \" + loyalty.balance() + \" points left\"; }\n}\n\nclass Order {\n    private final String id;\n    private final Customer customer;\n    private long total; // grosze\n\n    Order(String id, Customer customer, long total) { this.id = id; this.customer = customer; this.total = total; }\n\n    void redeemPoints(int points) { total -= customer.redeemPoints(points, total); }\n\n    @Override public String toString() { return \"%s: %d.%02d zł, %s\".formatted(id, total / 100, total % 100, customer); }\n}"}]},{"type":"codeBlock","attrs":{"language":"go","filename":"loyalty.go"},"content":[{"type":"text","text":"package main\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n)\n\nconst groszePerPoint = 10\n\nvar (\n\tErrNotEnoughPoints = errors.New(\"not enough points\")\n\tErrDiscountTooBig  = errors.New(\"discount larger than the order\")\n)\n\ntype LoyaltyAccount struct{ points int }\n\nfunc (a *LoyaltyAccount) Balance() int { return a.points }\n\n// Redeem: tell the account what to do instead of reading its balance.\nfunc (a *LoyaltyAccount) Redeem(points int, maxDiscount int64) (int64, error) {\n\tdiscount := int64(points) * groszePerPoint\n\tif points > a.points {\n\t\treturn 0, ErrNotEnoughPoints\n\t}\n\tif discount > maxDiscount {\n\t\treturn 0, ErrDiscountTooBig\n\t}\n\ta.points -= points\n\treturn discount, nil\n}\n\ntype Customer struct {\n\tname    string\n\tloyalty *LoyaltyAccount\n}\n\nfunc (c *Customer) RedeemPoints(points int, maxDiscount int64) (int64, error) {\n\treturn c.loyalty.Redeem(points, maxDiscount)\n}\n\nfunc (c *Customer) String() string { return fmt.Sprintf(\"%s has %d points left\", c.name, c.loyalty.Balance()) }\n\ntype Order struct {\n\tid       string\n\tcustomer *Customer\n\ttotal    int64 // grosze\n}\n\nfunc (o *Order) RedeemPoints(points int) error {\n\tdiscount, err := o.customer.RedeemPoints(points, o.total)\n\tif err != nil {\n\t\treturn err\n\t}\n\to.total -= discount\n\treturn nil\n}\n\nfunc (o *Order) String() string {\n\treturn fmt.Sprintf(\"%s: %d.%02d zł, %s\", o.id, o.total/100, o.total%100, o.customer)\n}\n\nfunc main() {\n\torder := &Order{id: \"A-1042\", customer: &Customer{name: \"Ania\", loyalty: &LoyaltyAccount{points: 250}}, total: 4590}\n\tif err := order.RedeemPoints(200); err != nil { // Checkout talks only to its friend: the order\n\t\tfmt.Println(err)\n\t}\n\tfmt.Println(order) // A-1042: 25.90 zł, Ania has 50 points left\n}"}]},{"type":"codeBlock","attrs":{"language":"python","filename":"loyalty.py"},"content":[{"type":"text","text":"class LoyaltyAccount:\n    GROSZE_PER_POINT = 10\n\n    def __init__(self, points: int) -> None:\n        self._points = points\n\n    @property\n    def balance(self) -> int:\n        return self._points\n\n    def redeem(self, points: int, max_discount: int) -> int:\n        \"\"\"Tell the account to redeem – don't read its balance and do the maths outside.\"\"\"\n        discount = points * self.GROSZE_PER_POINT\n        if points > self._points:\n            raise ValueError(\"Not enough points\")\n        if discount > max_discount:\n            raise ValueError(\"Discount larger than the order\")\n        self._points -= points\n        return discount\n\n\nclass Customer:\n    def __init__(self, name: str, loyalty: LoyaltyAccount) -> None:\n        self._name = name\n        self._loyalty = loyalty\n\n    def redeem_points(self, points: int, max_discount: int) -> int:\n        return self._loyalty.redeem(points, max_discount)\n\n    def __str__(self) -> str:\n        return f\"{self._name} has {self._loyalty.balance} points left\"\n\n\nclass Order:\n    def __init__(self, order_id: str, customer: Customer, total: int) -> None:\n        self._id = order_id\n        self._customer = customer\n        self._total = total  # grosze\n\n    def redeem_points(self, points: int) -> None:\n        self._total -= self._customer.redeem_points(points, self._total)\n\n    def __str__(self) -> str:\n        return f\"{self._id}: {self._total // 100}.{self._total % 100:02d} zł, {self._customer}\"\n\n\norder = Order(\"A-1042\", Customer(\"Ania\", LoyaltyAccount(250)), 4590)\norder.redeem_points(200)  # Checkout talks only to its friend: the order\nprint(order)  # A-1042: 25.90 zł, Ania has 50 points left"}]}]}]},"toc":[{"id":"where-the-law-of-demeter-comes-from","text":"Where the Law of Demeter comes from","level":2,"locked":false},{"id":"the-problem-a-checkout-that-knows-too-much","text":"The problem: a checkout that knows too much","level":2,"locked":false},{"id":"the-solution-tell-don-t-ask","text":"The solution: tell, don't ask","level":2,"locked":false},{"id":"exceptions-fluent-interfaces-dtos-and-queries","text":"Exceptions: fluent interfaces, DTOs and queries","level":2,"locked":true},{"id":"encapsulation-and-coupling-metrics","text":"Encapsulation and coupling metrics","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":47,"visibleBlocks":18,"resources":[{"id":"6b0857be3c96f2d34d0b41fe","type":"article","provider":"web","url":"https://martinfowler.com/bliki/TellDontAsk.html","embedUrl":null,"title":"bliki: Tell Dont Ask","description":"a bliki entry for Tell Dont Ask","author":"Martin Fowler","thumbnailUrl":"https://martinfowler.com/bliki/images/tellDontAsk/sketch.png","durationSec":null,"lang":"en","topics":[],"techs":["general"],"tags":["martin-fowler"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":75,"verifiedAt":"2026-11-26T11:07:17.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"},{"id":"6b0857be3c96f2d34d0b41f3","type":"article","provider":"web","url":"https://martinfowler.com/bliki/FluentInterface.html","embedUrl":null,"title":"bliki: Fluent Interface","description":"A fluent interface is a way of building an API so that its use has the feel of an internal domain-specific language.","author":"Martin Fowler","thumbnailUrl":"https://martinfowler.com/logo-sq.png","durationSec":null,"lang":"en","topics":[],"techs":["general"],"tags":["martin-fowler"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":75,"verifiedAt":"2026-11-26T11:07:28.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"},{"id":"6b0857b83c96f2d34d0b3c81","type":"podcast","provider":"apple-podcasts","url":"https://podcasts.apple.com/pl/podcast/17-o-prawie-demeter-clean-code-i-zasadach-solid-z-piotrem/id1508298430?i=1000493704813","embedUrl":"https://embed.podcasts.apple.com/us/podcast/id1508298430?i=1000493704813","title":"17. O prawie Demeter, Clean Code i zasadach SOLID z Piotrem Stawirejem","description":"Materiały dodatkowe: Definicja Law of Demeter, WikipediaClean Code: A Handbook of Agile Software Craftsmanship, Robert C. Martin, klasyczna książka Uncle Boba na temat czystego koduAgile Principles, Patterns, and Practices in C#, Robert C. Martin, Mikah MartinTest Driven Development: By Example…","author":"Better Software Design","thumbnailUrl":"https://is1-ssl.mzstatic.com/image/thumb/Podcasts115/v4/a9/6d/bb/a96dbb46-a01a-9cf6-40ef-27a27cef3c73/mza_18038037312547630971.jpg/600x600bb.jpg","durationSec":3883,"lang":"pl","topics":["ddd-strategic-design","solid","law-of-demeter"],"techs":["dotnet"],"tags":["podcast","testing","clean-code","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"itunes","publishedAt":"2020-10-05T23:00:00.000Z","popularity":62,"verifiedAt":"2026-11-26T11:02:40.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:55.661Z","updatedAt":"2026-11-26T16:00:55.661Z"},{"id":"6b0857c33c96f2d34d0b469b","type":"book","provider":"openlibrary","url":"https://openlibrary.org/works/OL16955281W","embedUrl":null,"title":"Growing object-oriented software, guided by tests","description":"","author":"Steve Freeman","thumbnailUrl":"https://covers.openlibrary.org/b/id/9937887-L.jpg","durationSec":null,"lang":"en","topics":[],"techs":["general"],"tags":["book","testing"],"price":"paid","featured":false,"featuredOrder":0,"packageName":null,"source":"openlibrary","publishedAt":"2010-01-01T00:00:00.000Z","popularity":46,"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":"6b0857c43c96f2d34d0b46f1","type":"book","provider":"openlibrary","url":"https://openlibrary.org/works/OL17424491W","embedUrl":null,"title":"Practical Object Oriented Design In Ruby","description":"","author":"Sandi Metz","thumbnailUrl":"https://covers.openlibrary.org/b/id/7551361-L.jpg","durationSec":null,"lang":"en","topics":[],"techs":["general"],"tags":["book"],"price":"paid","featured":false,"featuredOrder":0,"packageName":null,"source":"openlibrary","publishedAt":"2012-01-01T00:00:00.000Z","popularity":39,"verifiedAt":"2026-11-26T11:00:08.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:07.480Z","updatedAt":"2026-11-26T16:01:07.480Z"},{"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"}],"challenges":[{"id":"6b0857af5a2625e44ecaad13","slug":"design-patterns-basics-quiz","title":"Design patterns – basics","summary":"Six questions about classic GoF patterns: groups, intent and differences.","servedLang":"en","availableLangs":["pl","en"],"kind":"quiz","category":null,"status":"published","difficulty":"easy","topics":["builder","adapter","strategy","decorator","composite","facade","observer"],"techs":["general"],"tags":["quiz","gof","basics"],"languages":[],"questionCount":6,"xp":10,"stats":{"attempts":1,"solves":1,"solutions":0,"comments":0},"solveRate":100,"publishedAt":"2026-11-26T16:00:47.960Z"}],"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":false},{"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":true},{"slug":"solid","title":"SOLID: five object-oriented design principles without the myths","current":false}]}],"prev":{"slug":"yagni","title":"YAGNI: don't build ahead – what a feature nobody ordered really costs"},"next":{"slug":"solid","title":"SOLID: five object-oriented design principles without the myths"},"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}]}}