# Humble Object

## Aim

* separating behaviors that are easy to handle from behaviors that are hard to handle
  * ie separating external events or dependencies from domain logic

## Why

* Makes unit testing easier
* Hard to test 3rd party services, randomness, time, io
  * unit testing these are hard, as cannot control, slow, money etc
  * Can isolate these areas away from the core logic we wish to test
* encapsulated hard-to-test stuff and easy-to-test stuff.

## How

* Take out the hard - testing parts and put it into a wrapper that you can stub/mock in your test. That wrapper is called Humble object.

## Issues

* These behaviours still need to be tested, but via integration, E2E or manual tests


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hanfak.gitbook.io/workspace/general-paradigms/patterns/humble-object.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
