DEV Community

Discussion on: Single-Responsibility Principle done right

Collapse
 
hamsterasesino profile image
Gabriel

In this case I agree with Yegor's approach. Most of the times when dealing with I/O you have a Reader class and a Writer class (like Java does: FileReader,
FileWriter). I think it is the best approach in terms of separation of concerns.

What I would expect from the class AwsOcket is to be some kind of simplified interface that actually dellegates the implementation of the read() and write() methods in proper classes.

Good post! Thank you

Collapse
 
riccardo_cardin profile image
Riccardo Cardin

Maybe you're right. However, if the reading and write operations are separated into two classes, the overall dependency degree of a client will be increased without any reason.

This fact makes me prefer the solution that uses a single type that exposes both the reading and write operations.