From the course: Learning SOLID Programming Principles

Unlock the full course today

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

Problem domain objects: Individual data samples

Problem domain objects: Individual data samples - Python Tutorial

From the course: Learning SOLID Programming Principles

Problem domain objects: Individual data samples

- [Instructor] One easy thing to segregate is the low level foundational class definitions. Let's take a look at these and see how I've isolated their implementation details. While these sample objects originate in a CSV file as a small dictionary, that's a poor overall assumption. It turns out it'll be better to look at these as part of the problem domain overall. In this case, they're experimental sample results from matching engine RPMs with tachometer readings. Why create a class this simple? What's the advantage of this very simple class? The input from the CSV reader's a small dictionary, is it really so bad to use float(r["Tach"]), or is it much simpler to have s.tach? Instead of the full dictionary mapping strings to strings, we have a much narrower interface when we use a data class. The separate data class divorces the problem domain objects from all of the file in coding considerations, including the…

Contents