Tag Archives: design patterns

Your constructor smells

A code like the following looks as a “code smell” definitely:

public ProductProvider(
    IProductDataProvider dataProvider = null,
    IProductDecorator decorator = null,
    IProductSearchCriteriaParser parser = null,
    IProductInventoryDataProvider inventoryProvider = null,
    IProductSessionDataProvider sessionProvider = null,
    IContentProvider contentProvider = null,
    IProductQueueProvider queueProvider = null)
{
}

But unfortunately nothing I can do. What can I say? Alas!

“Black Hole” software anti-pattern

During digging into eCommerce5 codebase and discussing ongoing impressions with my colleague,¬† I just discovered a software design anti-pattern I called “Black Hole”.

As a workaround I declare a rule:

Any variables passed into constructor then should be available through a read-only property.

Honestly I haven’t invented the explanation yet.