Quantcast
Channel: User Filip Milovanović - Software Engineering Stack Exchange
Viewing all articles
Browse latest Browse all 167

Comment by Filip Milovanović on Is it better to pass a specific “context” object to handlers rather than the entire domain object?

$
0
0
Generally, it's a good idea to minimize what each chunk of code with a well defined purpose depends on, but you also don't want to pay for that with a high maintenance cost, if you can avoid it. Now, if this is one "context object" that you create from an order, used for all the different kinds of rules, the solution is not bad. But if you have a bunch of them that are rule-specific, this might make your life harder. One alternative is to use interfaces (where Order would implement a number of role-specific interfaces), and then require your rules to only operate on these interfaces. 1/2

Viewing all articles
Browse latest Browse all 167

Trending Articles