Skip to content

Commit

Permalink
feat: new post on observer pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
mannuelf committed Oct 24, 2024
1 parent e9b6de6 commit 85f67c6
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions content/posts/design-patterns-observer-pattern.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
published: true
title: "Observer pattern - Design Patterns"
excerpt: "The observer pattern is a behavioural pattern."
category: "Programming"
tags: ["oop", "programming", "design-patterns"]
date: "2024-10-23T07:35:00.322Z"
author:
name: "M Ferreira"
picture: "https://res.cloudinary.com/mannuel/image/upload/f_auto/v1604067445/images/mee.jpg"
ogImage:
url: "https://res.cloudinary.com/mannuel/image/upload/v1729574243/mfcom/uvqa1m0nuuoahqii7mof.png"
coverImage: "https://res.cloudinary.com/mannuel/image/upload/v1729574243/mfcom/uvqa1m0nuuoahqii7mof.png"
---

## Pattern type

This is a behavioural pattern that allows a one-to-many relationship between objects so that when the state of one object changes all its children objects are notified and updated automatically.

## Intent

The pattern intent is to make it easier to maintain consistency between related objects without making them tightly coupled.

## Problem

...

## Pattern

```mermaid
classDiagram
class Observer {
+calculateTotal()
+calulateShipping()
}
```

## Code example

````python
class Subject:
def __init__(self):
pass

```python
class Observer:
def __init__(self):
pass
````

```python
...
```

prints out:

```text
...
```

0 comments on commit 85f67c6

Please sign in to comment.