Universal Design Principles
Separation of concerns
Building Applications should core business practices and infrastructure and the user interface logic separately, ideally business rules and logic should be located in a single item, and is not dependent on other items in the application.Package
Different portions of the application should be isolated from the rest of the package by the application. It does not violate external agreements, application components and the layer can
not be interrupted by other collaborators situation
under conditions
to adjust its internal implementation
. The correct application package helps achieve
loose coupling
and
modularity
.
The application itself should be publicly
open-defined interfaces
for collaborators,
rather than let collaborators directly modify its state
. So as to continuously improve the internal programming without worrying about interrupting collaborators.
Dependency inversion
Dependencies direction applications should be abstract direction , rather than to achieve detailed directions. After application dependent reverse relationship, A can call the implementation of the abstract method B, so that A can call B at runtime, and B at compile time depends on the Interface A controlled.
Dependency inversion loosely coupled applications is to generate a key ring. Because it can
achieve more information write to rely on and achieve a higher level of abstraction
, rather than the reverse.
Explicit dependency
Methods and classes should display any object requires coordination normally required to work. By
class constructor
, class can
identify its effective state
and
to work the desired content
.
Single Responsibility
Single Responsibility applies to object-oriented design, the system can also be regarded as the principle of institutional separation of concerns. He pointed out that the object should have only one duty , and only one reason to change the subject .
This principle
applied to the application architecture
and the
logical end point
, you will
get micro-services
. Micro service should have a single responsibility, in general, if you need
to expand the system behavior
, preferably
through the addition of other micro-service
to achieve.
Do not repeat yourself
The application should
be avoided to specify the behavior of a particular concept in many places
, because it can easily lead to errors. Please
logic programming package configuration
, without duplicating the logic. Let constructed as a single authority for this behavior.
Persistent Inaudible
No lasting perception (PI) type means needs to be constant, but the impact of its code from the selected persistence techniques (e.g. SqlServer change MySql) of.
Examples of violations of this principle:
- Must base class.
- The necessary interface.
- Responsible for its own guarantee class (such as active recording mode).
- Required no argument constructor.
- Required attributes virtual keyword.
- Specific characteristics must be persistent.
Bounded context
Bounded context is
the field in the center of the drive mode
. Can
large programs be broken down into separate module concept
, to solve complex problems in this way. Ideally
each bounded context should be able to freely choose a name for the concepts of
, and
have exclusive access to their persistent storage
.