will not affect too much). If only the interface buttons, text rearrangement is simple, the most common is the business coupling change, what meaning? A list of display data, according to the original demand is 6 columns, suddenly one day to add 1 columns, and this column to cross n tables, processing m logic to show out, such a change is more scary, but still can be extended to complete the change, it depends on our original design is flexible.
PHP design Pattern--six major principles
It is generally considered that code that complies with the following six principles is easily extensible and reusable:
The six principles of any object-oriented language should be adhered to, in order to make your code easy to expand high-dose to meet the six
you need a calculator, the shell and the processor are likely to change, then you must detach it for the shell and the processor. There can be only one reason for the calculator to change.The principle of single responsibility aggregates the same responsibilities and avoids the dispersion of the same duties into different classes, which can control change, limit change to one place, and prevent a "ripple effect" that causes more local changes due to changes in one place. The principle of single
ArticleDirectory
Problem cause
Differences from the single Responsibility Principle
Notes
Design Pattern Series
Six principles of design model (1): single Responsibility Principle
Six principles of design patterns (2)
Six
to embedding, unless there are compelling reasons. B. you need to access an object individually, and that object is not intended to be embedded in other objects. C. arrays should not grow indefinitely. If there are hundreds of document objects on the many side, do not embed them with a reference to the ObjectID scheme, if there are thousands of document objects, then do not embed an array of ObjectID. Which scenarios to take depends on the size of
interface (an interface without any members ).
If you need to mark a class as a special feature (TAG), you generally use a custom attribute instead of an interface.
√ YesProvides at least one implementation type for the interface.
This will help verify the implementation of the interface. For example, list
√ YesEach interface you define provides at least one API that uses it (the method that uses the interface as a parameter or the attribute of the interface type ).
This will facilitate the
to minimize coupling
7, object-oriented common design principles: SOLID
Single principle of responsibility;
The principle of open closure;
Liskov substitution principle;
interface isolation principle;
dependency inversion principle;
Dimitri Law;
Synthesis/polymerization reuse principle;
Two1. Minimize access rights :Fro
from EMPLOYEE
So we need to continue the normalization process, take the table 1-3 apart and we get:
Table 1-5
And
Table 1-6
Now if 200003 Kevin leaves the company, we just need to remove him from table 1-5, and the salary C information that exists in table 1-6 is not lost. But we have to note that in addition to the presence of Kevin's information in table 1-5, there is also Kevin's information in table 1-4, which is easy to understand because Kev
ArticleDirectory
What is Lee's replacement principle?
Summary
Today is 3.15, a special day. I don't know how many bad companies will be exposed, and I don't know if the number of hidden companies that have not been exposed exceeds my imagination. Every year, new keywords such as "plasticizer, toxic capsules, problematic milk, and fast-growing chicken" are reported. They enter the restaurant, enter the canteen, and enter the supermarket. They really don't know what to touch. Ne
5S principle: Simple, Solid, strong, Safe, Smart.SimpleSimple is simply the principle, here the simple has two meanings, one is the logic is simple and easy to understand, the other is the simple coupling of the structure is weak.According to the method of modularization design, we usually define the boundary of the system first, then divide the module within the system, then divide the function points with
1, in the creation of the data table, for the string type of the field, if the length of the field is clearly known, the char type, otherwise varchar. Char types query faster, but waste storage spaceThe difference between a string char and a varchar is two points: 1, the storage length is different, the char type stores a fixed length, the varchar type is variable length, and a byte is added to the stored content. Like whatCHAR (5) varchar (5)', Memory accounts for 5 bytes ' 1 bytes' Kingwu_han
There is an important concept in the replica set in MongoDB: mostBecause the replica set has only one node that is readable and writable, the other nodes are readable only, and the selection of the master node is determined by the majority, and can continue as the primary node only if support is obtained.(1) Most of the confirmation formula for this number: M=int ((N/2) +1)* Most of the numbers are equal to greater than m, but less than or equal to n;n as the total number of servers in the repli
Adaptive XAML layout experience summary (I) Principles and page structure design, and xaml Experience SummaryXAML layout Review
Grid and StackPanel are the core layout, especially Grid.
Grid is a Grid layout. The XAML designer may have designed a Grid layout based on the Table in Html, but made improvements. Tables in Html are tr sets of td, which is very troublesome to change the columns. The Grid in XAML
. The Notice package contains all command objects that process cache update notifications. The factory package contains the c‑factory class, this class generates the corresponding subclass object of the ccommand Class Based on the message header.
The program code in the main package uses the ccommand class and the ccommandfactory class, so it inherits the creadcommand class according to the internal command package and internal factory; the class in
Design principles:
(1) programming for interfaces, rather than implementing Programming
(2) prioritize the use of object combinations, rather than inheritance.
(3) Encapsulation changes
Specific design principles:
(1) single Responsibility Principle
(2) Open and closed principles
The first three component design principles focus on the cohesion of components. Starting from this article, the three principles to be introduced will focus more on the coupling between components, which is more difficult than the first three principles, I will explain it with some examples. The main reference is stil
table by using the method of example, and show how to solve the problem of data redundancy and database operation anomaly in this process.In the concrete engineering application, using the database normalization method to design the database table, will have the practical significance.Resources
Database Normalization Basics: The basic principle of DB normalization
Normalization principles: Dat
PHP design patterns-six principles
Code that follows the following six principles is generally considered to be easily scalable and reusable:
These six principles should be followed by any object-oriented language. If you want to make your code easy to expand and take high, try to satisfy these six
Some basic features of OO
Package (encapsulation)
Inheritance (inheritance)
Polymorphic (polymorphism)
Poly (cohesion)
Coupling (COUPLING)
5 Principles for OO design (SOLID)
Single Duty principle (Srp-single Responsibility Principle)A CLASS should has only one REASON to change.
Open closure principle (ocp-open-closed Pri
ArticleDirectory
Problem cause
What is the Dependency inversion principle?
Three dependency implementation methods
Advantages
Summary
Design Pattern Series
Six principles of design model (1): single Responsibility Principle
Six principles of d
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.