# Mixin

A small reusable bundle of methods that can be added to unrelated classes.

## What is **Mixin**?

A **mixin** is a small bundle of methods that can be added to many unrelated classes, like a "can be printed" or "can be saved" ability. Python and TypeScript use mixins directly; C# gets a similar effect with default interface methods.

```python
class JsonMixin:
    def to_json(self):
        import json
        return json.dumps(self.__dict__)

class Recipe(JsonMixin):
    def __init__(self, title):
        self.title = title
```

Level: Journeyman · [More OOP terms at this level](https://www.ask-codey.com/glossary/subjects/oop/journeyman)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/mixin
