New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/arthurshafikov/patterns/decorator/problem

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/arthurshafikov/patterns/decorator/problem

  • v0.0.0-20221111082450-091a6adcc560
  • Source
  • Go
  • Socket score

Version published
Created
Source

Decorator Problem

Imagine we have an application and we have to set up a notification system in case something goes wrong. We have facebook, phone and slack notifiers. But what if we want to receive notification about major crashes through multiple notifiers? For example slack + phone or facebook + slack or even facebook + phone + slack. In order to do that we have to create a bunch of subclasses (SlackNotifier, PhoneSlackNotifier, FacebookPhoneSlackNotifier etc.).

Our code has bloated with redunant classes, but what if we add one more notifier - EmailNotifier, we'll need to create 7 subclasses - EmailSlackNotifier, EmailPhoneNotifier, EmailFacebookNotifier, EmailPhoneSlackNotifier, EmailFacebookSlackNotifier, EmailFacebookPhoneNotifier, EmailFacebookPhoneSlackNotifier. In my opinion, this solution is unacceptable and terrible.

FAQs

Package last updated on 11 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc