Skip to content

Why use PublisherBoxBase as a base class instead of directly using PublisherBox? #253

Open
@sinno93

Description

@sinno93

Hello,I have been studying the implementation of AnyPublisher in the Combine framework and noticed that the implementation uses an abstract base class PublisherBoxBase and a concrete subclass PublisherBox. I am curious about the design decision behind this approach.

My question is:

1.	What is the advantage of having PublisherBoxBase as an abstract base class instead of directly implementing everything in PublisherBox?
2.	Is there a specific design pattern or principle that this approach is adhering to?

I appreciate any insights or explanations you can provide. Thank you!
related code:

internal class PublisherBoxBase<Output, Failure: Error>: Publisher {

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions