Skip to content

Consider making UiThreadPoster and BackgroundThreadPoster Singletons #3

Description

@techyourchance

While Singleton is an anti-pattern in general, it can be useful in case of third-party libs like ThreadPoster.
There are two main benefits in adoption of Singleton:

  1. It will provide the developers who don't use dependency injection and/or don't unit test their code an easier way of using ThreadPoster
  2. It will ensure that there will be only one instance of BackgroundThreadPoster. This might prevent developer mistakes which could lead to non-optimal performance.

I believe that experienced developers who use DI or unit test will understand that they shouldn't use ThreadPosters as Singletons all over their app, but call the static methods just once in the composition root.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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