1. Single-respoonsibility Principle (SRP)--Package
2. Opening and closing principle open Close Principle (OCP)--open for expansion, closed for modification
3. Liskov Substitution Principle (LSP)-all references to base classes must be able to transparently use objects of their subclasses
4. Dependency inversion (dependency inversion) dependence inversion Principle (DIP)-dependent on abstraction, not on detail (i.e., the parameter of the transfer is an interface or abstract class, not a specific instance class)
5. Interface isolation principle Interface segregation principles (ISP)--The client should not rely on the interface it does not need to make the interface as small as possible
6. Dimitri principle (minimum knowledge principle) Law of Demeter (LOD)--a class that knows the least of the classes that it needs to be coupled or called, and how the interior is implemented without any control
NO1:
Abstract refers to an interface or abstract class, both of which cannot be instantiated directly.
No2:
More than 100 classes, such as OutputStream and cursor objects, inherit the Closeable interface, meaning that the close () method is called each time it is used, and a common tool class can be written
Public Final classcloseutils{Privatecloseutils{}/** Close Closeable object*/ Public Static voidclosequitely (closeable closeable) {if(NULL!=closeable) { Try{closeable.close (); }Catch() {e.printstacktrace (); } } }}
"Android Source design mode"----object-oriented six principles