Did you know that you can navigate the posts by swiping left and right?
Background: I am working on an application which brings new user interface for legacy system used by customer. There is basic model in the legacy system: Department. My customer wants to see several statistics related to each of his departments.
As I started modelling business domain in my app I wanted to keep things as simple as possible. I wanted also try out DCI finally. The time had come ;-)
My first idea was to create Department model and let it to play roles in the app (bad idea, but keep reading):
However I realized that there was something missing. Obviously there was missing a relation that Department certainly has one Stock. Just like that. I was copying business model from legacy app instead of creating new model for this domain.
I am going to refactor that piece of code and I have two choices:
Keep going with DCI and let only actors to play roles
Second option was to go back to class-oriented paradighm:
My main concern is that DCI in those examples looks like to complex to me. Why we shouldn’t place more emphasis on better model granulation? If comes to the classic example with e-commerce: an user as a buyer: why we can’t use classic decorator pattern? Buyer might be a model being a decorator for User model. And that’s it, no roles, no additional layer.