--- url: "https://martinfowler.com/bliki/HumbleObject.html" titulek: "Humble Object" h1: "Humble Object" popis: "If a program element is hard to test, move as much logic as possible out into testable collaborators." jazyk: "" kanonicka: "" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-13 23:46:42" znaku: 1459 slov: 210 kodovani: "utf-8" sha256: "cc8bcc11e3b228a0511c57cc53eaebf1d82a7396dea9e0636cdd743ce90f3f0c" --- # [Humble Object](HumbleObject.html) 29 April 2020 [Martin Fowler](/) [testing](/tags/testing.html) Some program elements are inherently difficult, or even impossible to test. Any logic in these elements is thus prone to bugs and difficult to evolve. To mitigate this problem, move as much as logic as possible out of the hard-to-test element and into other more friendly parts of the code base. By making untestable objects humble 1, we reduce the chances that they harbor evil bugs. 1: The use of the word “humble” originated in [an article by Michael Feathers](/articles/humble-dialog-box.html) . A common example of this is in the user-interface. Some platforms provide no hooks to enable us to run automated tests against UI controls. Even those that do often make it difficult, with complex setup, special frameworks, and slow-running tests. But we can often test effectively by ensuring these controls have the absolute minimum of behavior, using patterns like [Presentation Model (MVVM)](/eaaDev/PresentationModel.html) and [Passive View](/eaaDev/PassiveScreen.html). For more details on this approach the key source is Gerard Meszaros's xUnit Test Patterns book - the entry on [Humble Object](http://xunitpatterns.com/Humble%20Object.html) is online and includes much more depth including variations and examples. ## Notes 1: The use of the word “humble” originated in [an article by Michael Feathers](/articles/humble-dialog-box.html) .