Slide 23
Slide 23 text
23
// Adding New Functionality?
class Stream {
function __construct(
KinesisClient $kinesisClient,
SqsClient $sqsClient,
string $streamName,
string $streamType
);
function write(Message $message): void {
if ($this->streamType === 'kinesis') $this->kinesisClient->…
elseif ($this->streamType === 'sqs') $this->sqsClient->…
else throw new Exception("…");
}
}
SRP
OCP