3 ms·
Yes, I think it would be better to start with composition with a few classes that you inject into your implementation. Next step is to replace those few classe
by tored 5y ago
Yes, I think it would be better to start with composition with a few classes that you inject into your implementation.
Next step is to replace those few classes with interfaces and test with multiple implementations of these interfaces.
Class done.
Edit: another important part is to separate your classes into two different types so you don’t end up as described in the article.
One type of class is data only, like old style struct.
The other type of class is a repository type, class for working with data classes. Thus you never ask a data class for more data, you ask a repository class for that.
That eliminates the problem that the article describes as complex relations between data classes.
Benefit of this is that you can create data classes from different sources, thus it becomes
easier to gradually rewrite your storage as long as the data classes stays the same.
Edit 2: the author of the article seem to describe something what I wrote, a datastore that exposes plain data objects.