blippy
blippy

Reputation: 1540

Using inheritence to simulate roles in C++ for DCI

I have been trying to learn about DCI (Data Context Interaction) (http://tidyjava.com/dci-architecture-visionary/)

It seems to me that 'roles' can be simulated by creating derived classes which inherit from a base class and have access to all the private members. Is that a reasonable statement?

Alternatively, could this be regarded as too much infrastructure? I mean, DCI seems to be about separating actions from classes. Isn't that just good ol' C, where you have functions that operate on structures?

Upvotes: 0

Views: 196

Answers (1)

kamikaze
kamikaze

Reputation: 1579

The difference between DCI objects and structs is explained early in the page you link:

The major difference between DCI‘s data object and a typical entity is that the data object is relatively stupid. It’s not anemic. It can still contain important domain methods that would preserve it’s invariants etc.

What that means is that classes still may contain the necessary boilerplate (getters, setters, constructors, destructor and more complex stuff), that maintain its consistency (i.e. make sure it is used correctly). So implementing your use cases is not burdened with these concerns.

Upvotes: 0

Related Questions