Home Collections and objects

Interfaces

When declaring or initializing an object, you should always make the declared type an interface, not a concrete object.

Avoid creating unnecessary objects

You should create just as many new objects as you need to solve a problem – no more, and no less.

Note that creating new objects is not the same thing as declaring new variables. You are allowed to declare as many variables as you'd like.