# Principle of Least Surprise (POLS)

> Ruby tries to behave the way you would expect. But least surprise to whom, exactly?

The **Principle of Least Surprise** (often shortened to **POLS**) is the idea that Ruby tries to behave the way you would naturally expect, so that code does the sensible thing and does not trip you up. It is one of the reasons people describe Ruby as pleasant to write. But [Yukihiro "Matz" Matsumoto](https://chunkybacon.dev/people/matz.md), Ruby's creator, adds a nuance that people often miss: the surprise being minimized is *his*, not everyone's. As he put it in a 2003 interview, "The principle of least surprise is not for you only. The principle of least surprise means principle of least *my* surprise. And it means the principle of least surprise after you learn Ruby very well." In other words, it was never a promise that no one is ever surprised by Ruby, since people arriving from different languages carry different expectations. It is a design compass pointing at what feels natural to someone who has learned Ruby well. That gentle, human-centered aim is close kin to Ruby's larger goal of ["Optimize for programmer happiness"](https://chunkybacon.dev/glossary/optimize-for-programmer-happiness.md).

*Related:* [Yukihiro "Matz" Matsumoto](https://chunkybacon.dev/people/matz.md) · ["Optimize for programmer happiness"](https://chunkybacon.dev/glossary/optimize-for-programmer-happiness.md)

## Sources
- The Philosophy of Ruby (Matz interview, Artima, 2003): https://www.artima.com/articles/the-philosophy-of-ruby

---

Source: https://chunkybacon.dev/glossary/principle-of-least-surprise/
License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
