Skip to content

This is not a strategy design pattern #1

@ahavriluk

Description

@ahavriluk

It looks more like a Chain of Responsibility Design Pattern.

Good you have a few login methods. The linear search for the right strategy wouldn't work very well if there are many strategies: O(n). In other words we have a scalability issue.

Instead of leaner search, map process.env['LOGIN_METHOD'] to a strategy, then you can pull your strategy at the constant speed regardless of how many you have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions