Simplify the constructor.

Sometimes its dependencies can be moved to other components

For example, if dependencies are only used by a validator, consider moving those dependencies from the constructor to the validator. After all, they are really the concern of the validator.

This will simplify the constructor. Anytime you have a good opportunity to simplify code and separate concerns, you should take it and make the improvements. This will make your software easier to maintain and enhance.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: