2018-02-20 10:40:05 +08:00
<!-- GFM - TOC -->
* [S.O.L.I.D ](#solid )
2018-02-22 14:47:54 +08:00
* [1. <20> <> һ <EFBFBD> <D2BB> <EFBFBD> <EFBFBD> ԭ<EFBFBD> <D4AD> ](#1-<2D> <> һ <EFBFBD> <D2BB> <EFBFBD> <EFBFBD> ԭ<EFBFBD> <D4AD> )
* [2. <20> <> <EFBFBD> ŷ<EFBFBD> <C5B7> <EFBFBD> ԭ<EFBFBD> <D4AD> ](#2-<2D> <> <EFBFBD> ŷ<EFBFBD> <C5B7> <EFBFBD> ԭ<EFBFBD> <D4AD> )
* [3. <20> <> <EFBFBD> <EFBFBD> <EFBFBD> 滻ԭ<E6BBBB> <D4AD> ](#3-<2D> <> <EFBFBD> <EFBFBD> <EFBFBD> 滻ԭ<E6BBBB> <D4AD> )
* [4. <20> ӿڷ<D3BF> <DAB7> <EFBFBD> ԭ<EFBFBD> <D4AD> ](#4-<2D> ӿڷ<D3BF> <DAB7> <EFBFBD> ԭ<EFBFBD> <D4AD> )
* [5. <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ԭ<EFBFBD> <D4AD> ](#5-<2D> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ԭ<EFBFBD> <D4AD> )
* [<EFBFBD> <EFBFBD> װ<EFBFBD> <EFBFBD> <EFBFBD> ̳С <EFBFBD> <EFBFBD> <EFBFBD> ̬ ](#<23> <> װ<EFBFBD> ̳ж<CCB3> ̬ )
* [1. <20> <> װ ](#1-<2D> <> װ )
* [2. <20> ̳<EFBFBD> ](#2-<2D> ̳<EFBFBD> )
* [3. <20> <> ̬ ](#3-<2D> <> ̬ )
2018-02-20 10:40:05 +08:00
* [UML ](#uml )
2018-02-22 14:47:54 +08:00
* [1. <20> <> ͼ ](#1-<2D> <> ͼ )
* [2. ʱ<> <CAB1> ͼ ](#2-ʱ<> <CAB1> ͼ )
* [<EFBFBD> ο <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ](#<23> ο <EFBFBD> <CEBF> <EFBFBD> <EFBFBD> <EFBFBD> )
2018-02-20 10:40:05 +08:00
<!-- GFM - TOC -->
# S.O.L.I.D
2018-02-22 14:47:54 +08:00
S.O.L.I.D<> <44> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ƺͱ<C6BA> <CDB1> <EFBFBD> (OOD& OOP)<29> м<EFBFBD> <D0BC> <EFBFBD> <EFBFBD> <EFBFBD> Ҫ<EFBFBD> <D2AA> <EFBFBD> <EFBFBD> ԭ<EFBFBD> <D4AD> (Programming Priciple)<29> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ĸ<EFBFBD> <C4B8> д<EFBFBD> <D0B4>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
|<7C> <> д |ȫƴ |<7C> <> <EFBFBD> ķ<EFBFBD> <C4B7> <EFBFBD> |
2018-02-20 10:40:05 +08:00
| -- | -- | -- |
2018-02-22 14:47:54 +08:00
|SRP| The Single Responsibility Principle |<7C> <> һ <EFBFBD> <D2BB> <EFBFBD> <EFBFBD> ԭ<EFBFBD> <D4AD> |
|OCP| The Open Closed Principle | <20> <> <EFBFBD> ŷ<EFBFBD> <C5B7> <EFBFBD> ԭ<EFBFBD> <D4AD> |
|LSP| The Liskov Substitution Principle |<7C> <> <EFBFBD> <EFBFBD> <EFBFBD> 滻ԭ<E6BBBB> <D4AD> |
|ISP| The Interface Segregation Principle |<7C> ӿڷ<D3BF> <DAB7> <EFBFBD> ԭ<EFBFBD> <D4AD> |
|DIP| The Dependency Inversion Principle |<7C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ԭ<EFBFBD> <D4AD> |
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
## 1. <20> <> һ <EFBFBD> <D2BB> <EFBFBD> <EFBFBD> ԭ<EFBFBD> <D4AD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ҫ<EFBFBD> <EFBFBD> ij<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <EFBFBD> ԭ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ֻ<EFBFBD> <EFBFBD> һ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 仰˵<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> һ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ֻ<EFBFBD> <EFBFBD> һ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Σ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ҫ<EFBFBD> е <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͵<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ε<EFBFBD> ʱ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ҫ<EFBFBD> ֽ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ࡣ
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
## 2. <20> <> <EFBFBD> ŷ<EFBFBD> <C5B7> <EFBFBD> ԭ<EFBFBD> <D4AD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʵ<EFBFBD> <EFBFBD> Ӧ<EFBFBD> <EFBFBD> <EFBFBD> ǿ<EFBFBD> <EFBFBD> <EFBFBD> չ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ĵġ<EFBFBD> Ҳ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ˵<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> չ<EFBFBD> ǿ<EFBFBD> <EFBFBD> ŵģ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƿ<EFBFBD> <EFBFBD> յġ<EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
## 3. <20> <> <EFBFBD> <EFBFBD> <EFBFBD> 滻ԭ<E6BBBB> <D4AD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> һ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʵ<EFBFBD> <EFBFBD> Ӧ<EFBFBD> <EFBFBD> <EFBFBD> ܹ<EFBFBD> <EFBFBD> 滻<EFBFBD> κ<EFBFBD> <EFBFBD> 䳬<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʵ<EFBFBD> <EFBFBD> ʱ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ֮<EFBFBD> <EFBFBD> <EFBFBD> ž<EFBFBD> <EFBFBD> <EFBFBD> is-a <20> <> ϵ<EFBFBD> <CFB5>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
## 4. <20> ӿڷ<D3BF> <DAB7> <EFBFBD> ԭ<EFBFBD> <D4AD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ǿ<EFBFBD> <EFBFBD> <EFBFBD> û<EFBFBD> ȥ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Щ<EFBFBD> <EFBFBD> <EFBFBD> Dz<EFBFBD> ʹ <EFBFBD> õĽӿڡ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 仰˵<EFBFBD> <EFBFBD> ʹ <EFBFBD> ö<EFBFBD> <EFBFBD> <EFBFBD> ר<EFBFBD> ŵĽӿڱ<EFBFBD> ʹ <EFBFBD> õ<EFBFBD> һ <EFBFBD> <EFBFBD> <EFBFBD> ܽӿ<EFBFBD> <EFBFBD> <EFBFBD> Ҫ<EFBFBD> á<EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
## 5. <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ԭ<EFBFBD> <D4AD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
1. <20> ߲<EFBFBD> ģ<EFBFBD> 鲻Ӧ<E9B2BB> <D3A6> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ڵͲ<DAB5> ģ<EFBFBD> 飬<EFBFBD> <E9A3AC> <EFBFBD> ߶<EFBFBD> Ӧ<EFBFBD> <D3A6> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ڳ<EFBFBD> <DAB3> <EFBFBD>
2. <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ӧ<EFBFBD> <D3A6> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϸ<EFBFBD> ڣ<EFBFBD> ϸ<EFBFBD> <CFB8> Ӧ<EFBFBD> <D3A6> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ڳ<EFBFBD> <DAB3> <EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
# <20> <> װ<EFBFBD> <D7B0> <EFBFBD> ̳С <CCB3> <D0A1> <EFBFBD> ̬
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> װ<EFBFBD> <EFBFBD> <EFBFBD> ̳С <EFBFBD> <EFBFBD> <EFBFBD> ̬<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ԡ<EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
## 1. <20> <> װ
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <EFBFBD> ó<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͽ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ݺͻ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ݵIJ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> װ<EFBFBD> <EFBFBD> һ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʹ <EFBFBD> 乹<EFBFBD> <EFBFBD> һ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɷָ<EFBFBD> <EFBFBD> Ķ<EFBFBD> <EFBFBD> <EFBFBD> ʵ<EFBFBD> 壬<EFBFBD> <EFBFBD> <EFBFBD> ݱ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ڳ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͵<EFBFBD> <EFBFBD> ڲ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܵ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ڲ<EFBFBD> <EFBFBD> <EFBFBD> ϸ<EFBFBD> ڣ<EFBFBD> ֻ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> һ Щ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ӿ<EFBFBD> ʹ ֮<EFBFBD> <EFBFBD> <EFBFBD> ⲿ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϵ<EFBFBD> <EFBFBD> <EFBFBD> û<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ֪<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ڲ<EFBFBD> <EFBFBD> <EFBFBD> ϸ<EFBFBD> ڣ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͨ<EFBFBD> <EFBFBD> <EFBFBD> ö<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ṩ<EFBFBD> Ľӿ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʸö<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> װ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ô<EFBFBD> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
1. <20> <> <EFBFBD> õķ<C3B5> װ<EFBFBD> ܹ<EFBFBD> <DCB9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϡ<EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
2. <20> <> <EFBFBD> ڲ<EFBFBD> <DAB2> Ľṹ<C4BD> <E1B9B9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ġ<DEB8>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
3. <20> <> <EFBFBD> ԶԳ<D4B6> Ա<EFBFBD> <D4B1> <EFBFBD> и<EFBFBD> <D0B8> <EFBFBD> ȷ<EFBFBD> Ŀ<EFBFBD> <C4BF> ơ<EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
4. <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϣ<EFBFBD> <CFA2> ʵ<EFBFBD> <CAB5> ϸ<EFBFBD> ڡ<EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Person <20> <> <EFBFBD> <EFBFBD> װ name<6D> <65> gender<65> <72> age <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ԣ<EFBFBD> <D4A3> <EFBFBD> <EFBFBD> <EFBFBD> ֻ<EFBFBD> <D6BB> ͨ<EFBFBD> <CDA8> get() <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ȡһ <C8A1> <D2BB> Person <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> name <20> <> <EFBFBD> Ժ<EFBFBD> gender <20> <> <EFBFBD> ԣ<EFBFBD> <D4A3> <EFBFBD> <EFBFBD> <EFBFBD> <DEB7> <EFBFBD> ȡ age <20> <> <EFBFBD> ԣ<EFBFBD> <D4A3> <EFBFBD> <EFBFBD> <EFBFBD> age <20> <> <EFBFBD> Կ<EFBFBD> <D4BF> Թ<EFBFBD> work() <20> <> <EFBFBD> <EFBFBD> ʹ <EFBFBD> á<EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
ע<EFBFBD> gender <20> <> <EFBFBD> <EFBFBD> ʹ <EFBFBD> <CAB9> int <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͽ<EFBFBD> <CDBD> д洢<D0B4> <E6B4A2> <EFBFBD> <EFBFBD> װʹ <D7B0> <CAB9> <EFBFBD> û<EFBFBD> ע<EFBFBD> ⲻ<EFBFBD> <E2B2BB> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʵ<EFBFBD> <CAB5> ϸ<EFBFBD> ڡ<EFBFBD> <DAA1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ҫ<EFBFBD> <EFBFBD> ʹ <EFBFBD> õ<EFBFBD> <C3B5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <CAB1> Ҳ<EFBFBD> <D2B2> <EFBFBD> <EFBFBD> <EFBFBD> ڲ<EFBFBD> Ӱ<EFBFBD> <D3B0> <EFBFBD> ͻ<EFBFBD> <CDBB> ˴ <EFBFBD> <CBB4> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ½<EFBFBD> <C2BD> С <EFBFBD>
2018-02-20 10:40:05 +08:00
```java
public class Person {
private String name;
private int gender;
private int age;
public String getName() {
return name;
}
public String getGender() {
return gender == 0 ? "man" : "woman";
}
public void work() {
if(18 < = age & & age < = 50) {
System.out.println(name + " is working very hard!");
} else {
System.out.println(name + " can't work!");
}
}
}
```
2018-02-22 14:47:54 +08:00
## 2. <20> ̳<EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> ̳<EFBFBD> ʵ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> **is-a** <20> <> ϵ<EFBFBD> <CFB5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Cat <20> <> Animal <20> <> <EFBFBD> <EFBFBD> һ <EFBFBD> <D2BB> is-a <20> <> ϵ<EFBFBD> <CFB5> <EFBFBD> <EFBFBD> <EFBFBD> ˿<EFBFBD> <CBBF> Խ<EFBFBD> Cat <20> ̳<EFBFBD> <CCB3> <EFBFBD> Animal<61> <6C> <EFBFBD> Ӷ<EFBFBD> <D3B6> <EFBFBD> <EFBFBD> <EFBFBD> Animal <20> <> private <20> <> <EFBFBD> <EFBFBD> <EFBFBD> Ժͷ<D4BA> <CDB7> <EFBFBD> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
Cat <20> <> <EFBFBD> Ե<EFBFBD> <D4B5> <EFBFBD> Animal <20> <> ʹ <EFBFBD> ã<EFBFBD> Ҳ<EFBFBD> <D2B2> <EFBFBD> ǿ<EFBFBD> <C7BF> <EFBFBD> ʹ <EFBFBD> <CAB9> Animal <20> <> <EFBFBD> <EFBFBD> Cat <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ת<EFBFBD> <D7AA> Ϊ<EFBFBD> <CEAA> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϊ ** <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ת<EFBFBD> <EFBFBD> **<2A> <>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> ̳<EFBFBD> Ӧ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ѭ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 滻ԭ<EFBFBD> <EFBFBD> һ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʵ<EFBFBD> <EFBFBD> Ӧ<EFBFBD> <EFBFBD> <EFBFBD> ܹ<EFBFBD> <EFBFBD> 滻<EFBFBD> κ<EFBFBD> <EFBFBD> 䳬<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʵ<EFBFBD> <EFBFBD> ʱ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ֮<EFBFBD> <EFBFBD> <EFBFBD> ž<EFBFBD> <EFBFBD> <EFBFBD> is-a <20> <> ϵ<EFBFBD> <CFB5>
2018-02-20 10:40:05 +08:00
```java
Animal animal = new Cat();
```
2018-02-22 14:47:54 +08:00
## 3. <20> <> ̬
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> ̬<EFBFBD> <EFBFBD> Ϊ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <EFBFBD> ̬<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <EFBFBD> ̬<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <EFBFBD> ̬<EFBFBD> <EFBFBD> Ҫָ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> װ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <EFBFBD> ָ̬<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ж<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ķ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ָ<EFBFBD> <EFBFBD> <EFBFBD> ľ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ڼ<EFBFBD> <EFBFBD> <EFBFBD> ȷ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> ̬<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 1. <20> ̳У <CCB3> 2. <20> <> <EFBFBD> Ǹ<EFBFBD> <C7B8> <EFBFBD> <E0B7BD> <EFBFBD> <EFBFBD> 3. <20> <> <EFBFBD> <EFBFBD> ת<EFBFBD> ͡<EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ĵ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> У <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ࣨInstrument<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ࣺWind <20> <> Percussion<6F> <6E> <EFBFBD> <EFBFBD> <EFBFBD> Ƕ<EFBFBD> <C7B6> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> play() <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> main() <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʹ <EFBFBD> ø<EFBFBD> <C3B8> <EFBFBD> Instrument <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Wind <20> <> Percussion <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Instrument <20> <> <EFBFBD> õ<EFBFBD> <C3B5> <EFBFBD> play() <20> <> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <CAB1> <EFBFBD> <EFBFBD> ִ<EFBFBD> <D6B4> ʵ<EFBFBD> <CAB5> <EFBFBD> <EFBFBD> <EFBFBD> ö<EFBFBD> <C3B6> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> play() <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Instrument <20> <> <EFBFBD> ķ<EFBFBD> <C4B7> <EFBFBD> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
```java
public class Instrument {
public void play() {
System.out.println("Instument is playing...");
}
}
public class Wind extends Instrument {
public void play() {
System.out.println("Wind is playing...");
}
}
public class Percussion extends Instrument {
public void play() {
System.out.println("Percussion is playing...");
}
}
public class Music {
public static void main(String[] args){
List< Instrument > instruments = new ArrayList< >();
instruments.add(new Wind());
instruments.add(new Percussion());
for(Instrument instrument : instruments){
instrument.play();
}
}
}
```
# UML
2018-02-22 14:47:54 +08:00
## 1. <20> <> ͼ
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
**1.1 <20> ̳<EFBFBD> <CCB3> <EFBFBD> <EFBFBD> <EFBFBD> **
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> ̳<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʽ : <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> generalize<7A> <65> <EFBFBD> <EFBFBD> ʵ<EFBFBD> ֣<EFBFBD> realize<7A> <65> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϊ is-a <20> <> ϵ<EFBFBD> <CFB5>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϵ(generalization)
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> Ӿ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> м̳<EFBFBD>
2018-02-20 10:40:05 +08:00
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/29badd92-109f-4f29-abb9-9857f5973928.png)
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> ʵ<> ֹ<EFBFBD> ϵ(realize)
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> ӳ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ߽ӿ<EFBFBD> <EFBFBD> м̳<EFBFBD>
2018-02-20 10:40:05 +08:00
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/4b16e1d3-3a60-472c-9756-2f31b1c48abe.png)
2018-02-22 14:47:54 +08:00
**1.2 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> Ͳ<EFBFBD> <CDB2> <EFBFBD> **
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <20> ۺϹ <DBBA> ϵ(aggregation)
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> ʾ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɲ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɣ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ͳ<EFBFBD> <EFBFBD> ֲ<EFBFBD> <EFBFBD> <EFBFBD> ǿ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ģ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 岻<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ˲<EFBFBD> <EFBFBD> ֻ<EFBFBD> <EFBFBD> ǻ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ڡ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ±<EFBFBD> ʾ B <20> <> A <20> <> <EFBFBD> ɣ <EFBFBD>
2018-02-20 10:40:05 +08:00
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/34259bb8-ca3a-4872-8771-9e946782d9c3.png)
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <20> <> <EFBFBD> Ϲ <EFBFBD> ϵ(composition)
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> ; ۺϲ <EFBFBD> ͬ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ͳ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ǿ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ģ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 岻<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ˲<EFBFBD> <EFBFBD> <EFBFBD> Ҳ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ˡ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 繫˾<EFBFBD> Ͳ<EFBFBD> <EFBFBD> ţ<EFBFBD> <EFBFBD> <EFBFBD> ˾û<EFBFBD> ˲<EFBFBD> <EFBFBD> žͲ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ˡ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ǹ<EFBFBD> ˾<EFBFBD> <EFBFBD> Ա<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ھ ۺϹ <EFBFBD> ϵ<EFBFBD> ˣ<EFBFBD> <EFBFBD> <EFBFBD> Ϊ<EFBFBD> <EFBFBD> ˾û<EFBFBD> <EFBFBD> Ա<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ڡ<EFBFBD>
2018-02-20 10:40:05 +08:00
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/7dda050d-ac35-4f47-9f51-18f18ed6fa9a.png)
2018-02-22 14:47:54 +08:00
**1.3 <20> <EFBFBD> <E0BBA5> ϵ**
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϵ(association)
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> ʾ <EFBFBD> <EFBFBD> ͬ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ֮<EFBFBD> <EFBFBD> <EFBFBD> й<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> һ <EFBFBD> ־<EFBFBD> ̬<EFBFBD> <EFBFBD> ϵ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> й<EFBFBD> <EFBFBD> ̵<EFBFBD> ״̬<EFBFBD> أ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʼ <EFBFBD> Ϳ <EFBFBD> <EFBFBD> <EFBFBD> ȷ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ҳ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 1 <20> <> 1<> <31> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 1<> <31> <EFBFBD> <EFBFBD> <EFBFBD> Զ<EFBFBD> <D4B6> <EFBFBD> <EFBFBD> ֹ<EFBFBD> <D6B9> <EFBFBD> <EFBFBD> <EFBFBD> ϵ<EFBFBD> <CFB5> <EFBFBD> <EFBFBD> ʾ <EFBFBD> <CABE> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ѧ<EFBFBD> <D1A7> <EFBFBD> <EFBFBD> ѧУ <D1A7> <D0A3> <EFBFBD> <EFBFBD> һ <EFBFBD> ֹ<EFBFBD> <D6B9> <EFBFBD> <EFBFBD> <EFBFBD> ϵ<EFBFBD> <CFB5> һ <EFBFBD> <D2BB> ѧУ <D1A7> <D0A3> <EFBFBD> <EFBFBD> <EFBFBD> кܶ<D0BA> ѧ<EFBFBD> <D1A7> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> һ <EFBFBD> <D2BB> ѧ<EFBFBD> <D1A7> ֻ<EFBFBD> <D6BB> <EFBFBD> <EFBFBD> һ <EFBFBD> <D2BB> ѧУ <D1A7> <D0A3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> һ <EFBFBD> ֶ<EFBFBD> <D6B6> <EFBFBD> һ <EFBFBD> Ĺ<EFBFBD> ϵ<EFBFBD> <CFB5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> п<EFBFBD> ʼ ֮ǰ<D6AE> Ϳ <EFBFBD> <CDBF> <EFBFBD> ȷ<EFBFBD> <C8B7> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/4ccd294c-d6b2-421b-839e-d88336ff5fb7.png)
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϵ(dependency)
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϵ<EFBFBD> <EFBFBD> ͬ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> , <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϵ<EFBFBD> <CFB5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> й<EFBFBD> <D0B9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> õġ<C3B5> һ <EFBFBD> <D2BB> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϊ<EFBFBD> <CEAA> <EFBFBD> Ĺ<EFBFBD> <C4B9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ߷<EFBFBD> <DFB7> <EFBFBD> <EFBFBD> IJ<EFBFBD> <C4B2> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 롣˫<EBA1A3> <CBAB> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʱһ <CAB1> ֲ<EFBFBD> <D6B2> õ<EFBFBD> <C3B5> <EFBFBD> <EFBFBD> ơ<EFBFBD>
2018-02-20 10:40:05 +08:00
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/47ca2614-509f-476e-98fc-50ec9f9d43c0.png)
2018-02-22 14:47:54 +08:00
## 2. ʱ<> <CAB1> ͼ
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
**2.1 <20> <> <EFBFBD> <EFBFBD> **
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
ʱ<EFBFBD> <EFBFBD> ͼ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ˶<EFBFBD> <EFBFBD> <EFBFBD> ֮<EFBFBD> 䴫<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϣ<EFBFBD> <EFBFBD> ʱ<EFBFBD> <EFBFBD> ˳<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʾ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϊ˳<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ҫ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͨ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ľ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ע<EFBFBD> <EFBFBD> <EFBFBD> Ƕ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ӷ<EFBFBD> Ѱ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> IJ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
**2.2 <20> <> <EFBFBD> <EFBFBD> ֮ս ʱ<D5BD> <CAB1> ͼ**
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ߴ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ±<EFBFBD> ʾ ʱ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ƽ <EFBFBD> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/80c5aff8-fc46-4810-aeaa-215b5c60a003.png)
2018-02-22 14:47:54 +08:00
<EFBFBD> ɼ<EFBFBD> <EFBFBD> <EFBFBD> ͨ<EFBFBD> <EFBFBD> ʱ<EFBFBD> <EFBFBD> ͼ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ֪<EFBFBD> <EFBFBD> ÿ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ²<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
```java
2018-02-22 14:47:54 +08:00
publc class <20> <> <EFBFBD> <EFBFBD> {
public void Ӧս();
2018-02-20 10:40:05 +08:00
}
2018-02-22 14:47:54 +08:00
publc class <20> <> <EFBFBD> <EFBFBD> {
public void <20> ⶨ<EFBFBD> <E2B6A8> <EFBFBD> <EFBFBD> ();
public void <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ȩ();
private void <20> 趫<EFBFBD> <E8B6AB> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ();
2018-02-20 10:40:05 +08:00
}
2018-02-22 14:47:54 +08:00
public class <20> <> <EFBFBD> <EFBFBD> {
public void <20> <> <EFBFBD> <EFBFBD> <EFBFBD> G<EFBFBD> <47> ();
2018-02-20 10:40:05 +08:00
}
2018-02-22 14:47:54 +08:00
public class <20> ŷ<EFBFBD> {
public void <20> <> <EFBFBD> ؾ<EFBFBD> <D8BE> <EFBFBD> ǰ<EFBFBD> <C7B0> ();
2018-02-20 10:40:05 +08:00
}
2018-02-22 14:47:54 +08:00
public class <20> <> Ȩ {
public void <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ();
2018-02-20 10:40:05 +08:00
}
```
2018-02-22 14:47:54 +08:00
**2.3 <20> ͼ<EEB6AF> <CDBC> ʱ<EFBFBD> <CAB1> ͼ֮<CDBC> <D6AE> <EFBFBD> Ĺ<EFBFBD> ϵ**
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> ͼʾ <EFBFBD> <EFBFBD> <EFBFBD> û<EFBFBD> <EFBFBD> ĽǶ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
ʱ<EFBFBD> <EFBFBD> ͼ<EFBFBD> ǴӼ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ĽǶȣ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ľ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
**2.4 <20> <> ͼ<EFBFBD> <CDBC> ʱ<EFBFBD> <CAB1> ͼ<EFBFBD> Ĺ<EFBFBD> ϵ**
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> ͼ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϵͳ<EFBFBD> ľ<EFBFBD> ̬<EFBFBD> ṹ<EFBFBD> <EFBFBD> ʱ<EFBFBD> <EFBFBD> ͼ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϵͳ<EFBFBD> Ķ<EFBFBD> ̬<EFBFBD> <EFBFBD> Ϊ<EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
**2.5 ʱ<> <CAB1> ͼ<EFBFBD> <CDBC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> **
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ֱ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʽ
2018-02-20 10:40:05 +08:00
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/25b8adad-2ef6-4f30-9012-c306b4e49897.png)
2018-02-22 14:47:54 +08:00
<EFBFBD> ڻ<EFBFBD> ͼʱ<EFBFBD> <EFBFBD> Ӧ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ѭ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ԭ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
1. <20> ѽ<EFBFBD> <D1BD> <EFBFBD> Ƶ<EFBFBD> <C6B5> <EFBFBD> Ķ<EFBFBD> <C4B6> <EFBFBD> <F3BEA1BF> ܵؿ<DCB5> £<EFBFBD> <C2A3>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
2. <20> ѳ<EFBFBD> ʼ <EFBFBD> <CABC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ķ<EFBFBD> <C4B6> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <CAB1> һ <EFBFBD> <D2BB> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ߣ<EFBFBD> <DFA3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ߡ<EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ߴ Ӷ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ĵ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʼ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <EFBFBD> ֹ
2018-02-20 10:40:05 +08:00
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/b7b0eac6-e7ea-4fb6-8bfb-95fec6f235e2.png)
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <20> <> Ϣ
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ֮<EFBFBD> <EFBFBD> <EFBFBD> Ľ<EFBFBD> <EFBFBD> <EFBFBD> ʽ ͨ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϣ<EFBFBD> <EFBFBD> ʵ<EFBFBD> ֵġ<EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> Ϣ<EFBFBD> <EFBFBD> 4<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͣ<EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
1\. <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϣ<EFBFBD> <CFA2> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͬ<EFBFBD> <CDAC> <EFBFBD> 첽<EFBFBD> <ECB2BD>
2018-02-20 10:40:05 +08:00
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/a13b62da-0fa8-4224-a615-4cadacc08871.png)
2018-02-22 14:47:54 +08:00
2\. ͬ<> <CDAC> <EFBFBD> <EFBFBD> Ϣ<EFBFBD> <CFA2> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϣ֮<CFA2> <D6AE> <EFBFBD> <EFBFBD> Ҫ<EFBFBD> <D2AA> ͣ<EFBFBD> <EFBFBD> <EEB6AF> <EFBFBD> ȴ<EFBFBD> <C8B4> <EFBFBD> Ӧ<EFBFBD> <D3A6>
2018-02-20 10:40:05 +08:00
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/33821037-dc40-4266-901c-e5b38e618426.png)
2018-02-22 14:47:54 +08:00
3\. <20> 첽<EFBFBD> <ECB2BD> Ϣ<EFBFBD> <CFA2> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϣ֮<CFA2> <D6AE> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ҫ<EFBFBD> ȴ<EFBFBD> <C8B4> <EFBFBD>
2018-02-20 10:40:05 +08:00
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/dec6c6cc-1b5f-44ed-b8fd-464fcf849dac.png)
2018-02-22 14:47:54 +08:00
4\. <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϣ<EFBFBD> <CFA2> <EFBFBD> <EFBFBD> ѡ <EFBFBD> <D1A1>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϵķ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʾ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ״̬<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʱ<EFBFBD> 䴦<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ״̬<EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/6ab5de9b-1c1e-4118-b2c3-fb6c7ed7de6f.png)
2018-02-22 14:47:54 +08:00
# <20> ο <EFBFBD> <CEBF> <EFBFBD> <EFBFBD> <EFBFBD>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
- Java <20> <> <EFBFBD> <EFBFBD> ˼<EFBFBD> <CBBC>
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
- [<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƶ<EFBFBD> SOLIDԭ<EFBFBD> <EFBFBD> ](http://www.cnblogs.com/shanyou/archive/2009/09/21/1570716.html )
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
- [<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> UML<EFBFBD> <EFBFBD> ͼ<EFBFBD> <EFBFBD> ʱ<EFBFBD> <EFBFBD> ͼ ](http://design-patterns.readthedocs.io/zh_CN/latest/read_uml.html#generalization )
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
- [UMLϵ<EFBFBD> С <EFBFBD> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <EFBFBD> ͼ<EFBFBD> <EFBFBD> ˳<EFBFBD> <EFBFBD> ͼ<EFBFBD> <EFBFBD> sequence diagram ](http://www.cnblogs.com/wolf-sun/p/UML-Sequence-diagram.html )
2018-02-20 10:40:05 +08:00
2018-02-22 14:47:54 +08:00
- [<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ------<2D> <> װ<EFBFBD> <D7B0> <EFBFBD> ̳С <CCB3> <D0A1> <EFBFBD> ̬ ](http://blog.csdn.net/jianyuerensheng/article/details/51602015 )