[Design Mode] four principles

Single Responsibility Principle

Single Responsibility Principle , it is a class, it should be the cause of it is just a change.

If a class too many responsibilities to bear, it means these functions coupled together, a change in responsibilities may weaken or inhibit the ability of this class perform other duties. This coupling will lead to fragile designs, when a change occurs, the design will suffer unexpected damage.

Much of the software design really need to do is find those responsibilities and duties separate from each other [ASD].

How can I tell?

  • If you can think of more than a motivation to change a class, then the class will have more than one role [ASD], you should consider segregation of duties classes.

Guess you like

Origin www.cnblogs.com/LampsAsarum/p/12168228.html