Design principle of package (1)

zhaozj2021-02-12  220

Package design principle:

Polymy principle

(1) Reuse publishing equivalence principles

The granularity of reuse is the particle size released (not very understanding)

(2) Co-reuse

All classes in a package should be commonly reused, if you reuse one class in the package,

Then you have to reusable all classes in the package, such as container classes, and iterator classes associated with him.

But in the actual project, can you really do this?

(3) Common closure principles

The change in the package should be commonly closed, and a change is generated if a package is generated.

Influence, it will affect all classes in the package, but no impact on other packets

This is the re-regulation of SRP on the package

When choosing the class to be organized into the package, you must consider the opposite of reusability and developmentability.

Structure, balance between these roles and applications is not a simple job, this

Balance is always dynamic, the composition of the package is likely to change and evolve over time

转载请注明原文地址:https://www.9cbs.com/read-6548.html

New Post(0)