Method design, separation of concerns, DRY and so on RRS feed

  • Question

  • Just wanted to get a feel for the various pros and cons of "multi-aspect" functions/methods over separation of concerns...

    best way to illustrate my grey area is with this example:

    GetCustomers(params - eg: CustomerType) returns "Customers"


    GetCustomerTypeHighFlier() returns "Customers"
    GetCustomerTypeStandard() returns "Customers"

    Obviously two key issues in this design are:
    Option A means more complexity in the function - more DRY, less SoC...
    Option B means more functions - more SoC, but less DRY...

    Is there MORE considerations to this than these two aspects?

    How/where do you draw the line and decide which aspect is better to choose in what situations?

    Friday, September 26, 2014 3:34 AM

All replies

  • SoC in this case doesn't seem to be a compelling argument, unless you have different ways (algorithmically) of populating different types of customers. If you do, they can be factored in to separate private methods with no DRY issues.

    But the public interface is better with the first option, in my opinion.

    Friday, September 26, 2014 7:14 PM