From the course: Learning SOLID Programming Principles

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Reading and building samples

Reading and building samples

- [Instructor] I also need a class to create sample objects from the files that are the sources of my data. This class will be a collaborator with both the sample list and the underlying sample classes. I've segregated the problem of reading from the underlying sample instances. And this is kept separate from the collection of samples and also separate from any analysis performed on a collection of samples. I might call this class a sample Reader, a more specific name than simply Reader can help maintainers navigate a complex analytical application with many kinds of samples and many kinds of data being read. The samples attribute exposes a tiny implementation detail of the Reader class. It's true. This attribute reflects the internal state of a Reader object. Prior to reading its empty, after the read method is evaluated, this attribute has all the data from the source file. In some languages, this is considered a…

Contents