From bc28b775d8ad5bfdf53a17f2c396c768436285a1 Mon Sep 17 00:00:00 2001 From: CyC2018 <1029579233@qq.com> Date: Thu, 22 Feb 2018 01:06:40 +0800 Subject: [PATCH] auto commit --- README.md | 12 + notes/程序员的职业素养.md | 129 +++++ notes/编写可读代码的艺术.md | 342 +++++++++++++ notes/重构.md | 979 ++++++++++++++++++++++++++++++++++++ notes/黑客与画家.md | 135 +++++ 5 files changed, 1597 insertions(+) create mode 100644 notes/程序员的职业素养.md create mode 100644 notes/编写可读代码的艺术.md create mode 100644 notes/重构.md create mode 100644 notes/黑客与画家.md diff --git a/README.md b/README.md index f4fa5df9..0449f5d5 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,18 @@ File、InputStream 和 OutputStream、Reader 和 Writer、Serializable、Socket 以及 NIO +# 编码实践 + +> [重构](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/重构.md) + +> [编写可读代码的艺术](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/编写可读代码的艺术.md) + +# 个人提升 + +> [黑客与画家](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/黑客与画家.md) + +> [程序员的职业素养](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/程序员的职业素养.md) + # 资料下载 > [百度网盘](https://pan.baidu.com/s/1o9oD1s2#list/path=%2F) diff --git a/notes/程序员的职业素养.md b/notes/程序员的职业素养.md new file mode 100644 index 00000000..b0a7761d --- /dev/null +++ b/notes/程序员的职业素养.md @@ -0,0 +1,129 @@ + +* [](#) +* [ǰ](#ǰ) +* [רҵ](#רҵ) +* [˵](#˵) +* [˵](#˵) +* [](#) +* [](#) +* [ϰ](#ϰ) + + +# + + Bob 壬Сԭģʽʵ֮Աְҵ + +ڽ⣬ҪIJⱾǽķʽԼ˼ȣְҵ + +# ǰ + +ڹٺܴIJѹӼԱΣվ棬Žˡսߡɻյºɻڸ߿ձը˵ԱѾܶȥֹη䣬Dz˵ģǾûд绰ȥ̨¶˴ηΣԡ + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/bccb799f-56e2-4356-95f0-a9ea05b0de2a.jpg) + + +# רҵ + +רҵ岻ζͽҲζΡ + +Լһ绰·ϼϵͳʱΪڵս¹ܣûжϵͳвԣһ bug ij֡Ϊһֲεı֣ҲDzרҵı֡ + + bugDzζ㲻Ϊ bug + +˰ QA ɲ bug Ļ QA bugԼȴȥ bugDzԵġ + +Ϊ˱֤ȷԣҪдһЩʱеĵԪԣҲϵȥǡ + +Ŀĸԭ - ޸ġΪԼ޸ģҪȥ޸ + +ԪԿóԱȥ޸Ĵ룬Ϊȷ޸ĵǷȷ + +רҵݣ + +1. ѧϰ +2. ÿϰһЩ򵥵ıĿ +3. Ǻӱ˴ѧණ +4. ͨԼ˼룬ԼIJԼ˼ϵIJ졣 +5. ˽ҵҼ鿴 +6. / ͻһ +7. ǫѷΪ֪ԼҲܷ + +# ˵ + +һЩҪ󣬲ֻ˵ԿᱻǽҪԼֲ֪ҪᵼصĺͲչȥһҪ˵ + +˵ʱҪϸϸ˵Ƿط + +ҪԲʱЭһЩ˫ܽܵķ + +"пдô" ƪģһοһΪ"ɫ"ܹù˿ͿƷϢ̵ϢԼŻȹܵ ipone Ӧãʼ̵ľŵ˵ֻҪдӲӦþˣǿͻҪκһܣܱʼʱ˵ҪࡣʱĽͻIJϣԼıòдһѺõĴ룬ԼȷʵЩģʽȸ߼ǷdzԵġΪʵʵĿΪͻأдԼдĴ롣Bob Ϊƪĵ߲Ǵ˴οЩĸˣΪûжЩҪ˵ + +# ˵ + +ŵ裺ͷϴӦж + +ȱŵĴ + +1. ҪҪꣻ +2. ϣϣ +3. ǣǰꡣ + +ȱŵ˲صԼϣҲȷ˵һĽֹڡijŵġһ...֮ǰ... + +Լ޷ȫյ£Ҫ׳ŵ + +Լ޷ŵȥ˶Ԥڡ + +Կ˵ԼԳŵе˼ɣ˲ҪԿΪһֳŵȷԼܴﵽŵݶŵôصĺ + +# + +ҪͨһҪԸü߱ġ֪͡ + +״̬õʱñд롣״̬÷Ϊƣͣ簾ҹǣΪԼܰʱӦµٽб̡ + +״̬ĸоܺãÿܶ£״̬ʵһdzڤ룬˼ά½Ҫ״̬ + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/f0321ed1-fa93-460e-951b-4239fef819f3.jpg) + +״̬صǸͨԱָܹ˽Աֹܹ״̬ + +ԼûʱԱǸѡ񣬽ԱʱԺлѧ仯Ҳ˵˼άʽı䣬ͻƵǰ˼ά״̬ + +ʱֻռһԴ˻ᵼЧ½ⲻǾԡ + +һЩԵݣƻС˵ȣԼĴҲõ + +ʱҲܱ󣬲ܹ͵Եʱ䡣 + +һ޷ȫٶỵֻ̄ͨάֽȡʤҪֺԼĽ࣬ƣ͵ʱʵϢ + +ȺֹԤ׼ԤͱԤʱ㡣 + +ԼԤĽȸϲϽֹʱ䣬ҪӦڽֹʱȥɣΪ֪ԼԤDzܵġ + +ɵı׼ͨһԶղ塣 + +ҲԼôڰ˵ʱҪԼִܲ٣Ӧһ˲Ҫرʱ䡣ҲҪѧ˵İΪԼܵģͨ˵İܸõĽ⡣ + +# + +TDD ں̣ܶһӾͿһγ򣬶ڿԿٵõڿرҪһ߳Աļ飬һܹ緢 bug bug Խ緢޸ĵشҲԽ͡ + +TDD + +1. дԣ +2. һԪʧܵʱ򣬲ҪдԴ룻 +3. ƷǡͨǰʧܵĵԪԼɣҪд + +TDD ŵ + +1. ȷԣȷǰϵͳǷȷ +2. ģԱϢȥ޸ĻҵĴ룬ΪͨԪԿ֪Ƿ޸ĵȷ +3. ĵԪǵײϸڵĵͨĶԪܹ֪зʽ + +# ϰ + +һƺõʽʽģʵϰ߲ѵϤʽӶ졣̿һױ̹ûͼ̵Ķϰ߲Ϊ˽⣬ΪѾ֪˽ϰҪĶ;ߡ + +ʹ˶Ŀڱ򣬿һдԪԣһдͨԪԡ磬һʵ㷨дԵ˿Ժ׵ٶȺڴ棬ͬʩѹ diff --git a/notes/编写可读代码的艺术.md b/notes/编写可读代码的艺术.md new file mode 100644 index 00000000..5f14f947 --- /dev/null +++ b/notes/编写可读代码的艺术.md @@ -0,0 +1,342 @@ + +* [ 1 ɶԵҪ](#-1--ɶԵҪ) +* [ 2 ֱ뺬](#-2--ֱ뺬) +* [ 3 ֲܴ](#-3--ֲܴ) +* [ 4 õĴ](#-4--õĴ) +* [ 5 дע](#-5--дע) +* [ 6 αдע](#-6--αдע) +* [ 7 ߿Ŀɶ](#-7--߿Ŀɶ) +* [ 8 ֳʽ](#-8--ֳʽ) +* [ 9 ɶ](#-9--ɶ) +* [ 10 ȡ](#-10--ȡ) +* [ 11 һֻһ](#-11--һֻһ) +* [ 12 ȻԱ](#-12--ȻԱ) +* [ 13 ٴ](#-13--ٴ) + + +# 1 ɶԵҪ + +кܴһʱĶ룬ҪĶԼĴ룬ҪĶ˵Ĵ롣ˣɶõĴܹ߱Чʡ + +ɶõĴôܹãΪԱԸȥ޸ⲿִ룬Ҳ޸ġ + +ֻںΪЧʲſԷɶԣɶǵһλ + +# 2 ֱ뺬 + +һЩȽбĵʣ + +| | | +| --- | --- | +| send | deliverdispatchannouncedistributeroute | +| find | searchextractlocaterecover | +| start| launchcreatebeginopen| +|make|createset upbuildgeneratecomposeaddnew| + +ʹ ijk ΪѭǺõģΪӸбֻã user_imember_iΪѭԽ࣬Խ⣬бĵֿɶԻ + +ΪݴʵϢָбҲ䳤̵ֳ׼ǣԽԽֻڶʹһЩ֡ + +# 3 ֲܴ + +Ҫ˼һ±˻кν᲻ԭĺ塣 + + minmax ʾΧ + + firstlast ʾʿռİΧbeginend ʾʿռųΧ end β + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/26772ecc-a3e3-4ab7-a46f-8b4656990c27.jpg) + +ص iscanshouldhas ǰ׺ + +# 4 õĴ + +ʵĿк + +עͣ + +``` +int a = 1; // ע +int b = 11; // ע +int c = 111; // ע +``` + +˳⣬ html ıĸֵӦúͱ html е˳һ£ + +صĴ밴֯һ + +# 5 дע + +ĶȻע⵽עͣעû̫ãôͻ˷ѴĶʱ䡣ЩֱӿĴ벻ҪдעͣرDzҪΪÿעͣЩ򵥵 getter setter ΪЩдעͷôɶԸ + +Ϊע;֣ȡֶдע͡ + +ע¼õǰ취˼̣Ӷö߸롣 + +עһЩ + + TODO ǣ + +| | ÷ | +|---|---| +|TODO| | +|FIXME| ޸ | +|HACH| ֲڵĽ | +|XXX| ΣգҪ | + +# 6 αдע + +ˣ + +``` +// The first String is student's name +// The Second Integer is student's score +Map scoreMap = new HashMap<>(); +``` + +``` +// Student' name -> Student's score +Map scoreMap = new HashMap<>(); +``` + +Ӳ˵ + +``` +//... +// Example: add(1, 2), return 3 +int add(int x, int y) { + return x + y; +} +``` + +ںܸӵĺжÿ֣ + +``` +int a = 1; +int b = 2; +int num = add(\* x = *\ a, \* y = *\ b); +``` + +ʹרҵ̸ϵĽͣģʽ˵롣 + +# 7 ߿Ŀɶ + +ʽУDZҲdzһȷ + +``` +if(len < 10) +if(10 > len) +``` + +if / else 䣬ȴ߼ ߼ ؼ߼ۣ߼ +``` +if(a == b) { + // ߼ +} else{ + // ߼ +} +``` + +ֻ߼򵥵ʹ ? : ĿʹգӦòֳ if / else + +do / while ں棬ˣһһЩԻĵطʹ while 档 + +ֻһ goto Ŀ꣬ô goto һܽܣǹڸӵ goto ôɶرӦñʹ goto + +Ƕ׵ѭУһЩ return ܼǶ׵IJ + +# 8 ֳʽ + +ʽĿɶԺܲһЩͱӶֱʽ + +``` +if line.split(':')[0].strip() == "root": + ... +``` +``` +username = line.split(':')[0].strip() +if username == "root": + ... +``` + +ʹĦһЩ߼ʽ + +``` +if(!a && !b) { + ... +} +``` +``` +if(a || b) { + ... +} +``` + +# 9 ɶ + +ȥѭͨ break return Լٿʹá + +``` +boolean done = false; +while(/* condition */ && !done) { + ... + if(...) { + done = true; + continue; + } +} +``` +``` +while(/* condition */) { + ... + if(...) { + break; + } +} +``` + +СԽСԽ׶λʹõĵط + +JavaScript ñհС´ submit_form Ǻsubmitted ƺᱻύΡһʵ submitted ȫֱڶʵְ submitted ŵУӶΧ + +``` +submitted = false; +var submit_form = function(form_name) { + if(submitted) { + return; + } + submitted = true; +}; +``` + +``` +var submit_form = (function() { + var submitted = false; + return function(form_name) { + if(submitted) { + return; + } + submitted = true; + } +}()); // () ʹִ +``` + +JavaScript û var ıȫֱȫֱԻӦ var + +λӦʹõλ + +**ʵ** + +һҳıֶΣ + +``` + + + + +``` + +Ҫһַŵһյ input ֶУʼʵ£ + +``` +var setFirstEmptyInput = function(new_alue) { + var found = false; + var i = 1; + var elem = document.getElementById('input' + i); + while(elem != null) { + if(elem.value === '') { + found = true; + break; + } + i++; + elem = document.getElementById('input' + i); + } + if(found) elem.value = new_value; + return elem; +} +``` + +ʵ⣺ + +- found ȥ +- elem +- for ѭ while ѭ + +``` +var setFirstEmptyInput = function(new_value) { + for(var i = 1; true; i++) { + var elem = document.getElementById('input' + i); + if(elem === null) { + return null; + } + if(elem.value === '') { + elem.value = new_value; + return elem; + } + } +}; +``` + +# 10 ȡ + +ѧǰѴֳСٰЩĽŻһ + +Ӧȷһĸ߲Ŀ꣬ȻڲֱΪĿ깤Ĵ룬ȡŵĺС + +ԵĴ룺 + +``` +int findClostElement(int[] arr) { + int clostIdx; + int clostDist = Interger.MAX_VALUE; + for(int i = 0; i < arr.length; i++) { + int x = ...; + int y = ...; + int z = ...; + int value = x * y * z; + int dist = Math.sqrt(Math.pow(value, 2), Math.pow(arr[i], 2)); + if(dist < clostDist) { + clostIdx = i; + clostDist = value; + } + } + return clostIdx; +} +``` + +ϴѭҪ룬ⲿֲڴ߲Ŀ߲꣬ĿѰСֵ˿԰ⲿִȡĺСҲһĺôУԵвԡԿҵ޸ġ + +``` +public int findClostElement(int[] arr) { + int clostIdx; + int clostDist = Interger.MAX_VALUE; + for(int i = 0; i < arr.length; i++) { + int dist = computDist(arr, i); + if(dist < clostDist) { + clostIdx = i; + clostDist = value; + } + } + return clostIdx; +} +``` + +ǺȡԽԽãȡ࣬ĶʱҪȥֻڵǰҪȥ˽ijһϸڶܹʱȡӺǺõġ + +ȡҲڼСࡣ + +# 11 һֻһ + +ֻһµĴ֪Ҫ£ + +̣г񣻰ÿֵͬĺ߲ͬĶ䡣 + +# 12 ȻԱ + +Ȼд߼Ҳα룬Ȼд룬߼ + +# 13 ٴ + +Ҫƣ̻кܶ仯Ƶݵõġ + +ñ׼ʵ֡ diff --git a/notes/重构.md b/notes/重构.md new file mode 100644 index 00000000..7ac2b62d --- /dev/null +++ b/notes/重构.md @@ -0,0 +1,979 @@ + +* [һ عһ](#һ-عһ) +* [ڶ عԭ](#ڶ-عԭ) +* [ Ļζ](#-Ļζ) + * [1. Duplicated Codeظ룩](#1-duplicated-codeظ룩) + * [2. Long Method](#2-long-method) + * [3. Large Classࣩ](#3-large-classࣩ) + * [4. Long Parameter ListIJУ](#4-long-parameter-listIJУ) + * [5. Divergent Changeɢʽ仯](#5-divergent-changeɢʽ仯) + * [6. Shotgun Surgeryɢʽ޸ģ](#6-shotgun-surgeryɢʽ޸ģ) + * [7. Feature Envyᣩ](#7-feature-envyᣩ) + * [8. Data Clumpsţ](#8-data-clumpsţ) + * [9. Primitive Obsessionƫִ](#9-primitive-obsessionƫִ) + * [10. Switch Statementsswitch ](#10-switch-statementsswitch-) + * [11. Parallel Inheritance Hierarchiesƽм̳ϵ](#11-parallel-inheritance-hierarchiesƽм̳ϵ) + * [12. Lazy Classࣩ](#12-lazy-classࣩ) + * [13. Speculative Generality̸δԣ](#13-speculative-generality̸δԣ) + * [14. Temporary FieldԻʱֶΣ](#14-temporary-fieldԻʱֶΣ) + * [15. Message ChainsϵϢ](#15-message-chainsϵϢ) + * [16. Middle Manмˣ](#16-middle-manмˣ) + * [17. Inappropriate Intimacyǹϵ](#17-inappropriate-intimacyǹϵ) + * [18. Alernative Classes with Different Interfacesࣩͬ](#18-alernative-classes-with-different-interfacesࣩͬ) + * [19. Incomplete Library Class⣩](#19-incomplete-library-class⣩) + * [20. Data Classɵࣩ](#20-data-classɵࣩ) + * [21. Refused Bequestܾ](#21-refused-bequestܾ) + * [22. Commentsעͣ](#22-commentsעͣ) +* [ ϵ](#-ϵ) +* [ عб](#-عб) +* [ ֯](#-֯) + * [1. Extract Method](#1-extract-method) + * [2. Inline Method](#2-inline-method) + * [3. Inline Tempʱ](#3-inline-tempʱ) + * [4. Replace Temp with QueryԲѯȡʱ](#4-replace-temp-with-queryԲѯȡʱ) + * [5. Introduce Explaining Variableͱ](#5-introduce-explaining-variableͱ) + * [6. Split Temporary Variableֽʱ](#6-split-temporary-variableֽʱ) + * [7. Remove Assigments to ParametersƳԲĸֵ](#7-remove-assigments-to-parametersƳԲĸֵ) + * [8. Replace Method with Method ObjectԺȡ](#8-replace-method-with-method-objectԺȡ) + * [9. Subsititute Algorithn滻㷨](#9-subsititute-algorithn滻㷨) +* [ ڶ֮](#-ڶ֮) + * [1. Move Methodƺ](#1-move-methodƺ) + * [2. Move FieldֶΣ](#2-move-fieldֶΣ) + * [3. Extract Classࣩ](#3-extract-classࣩ) + * [4. Inline Class](#4-inline-class) + * [5. Hide Delegateءίйϵ](#5-hide-delegateءίйϵ) + * [6. Remove Middle ManƳмˣ](#6-remove-middle-manƳмˣ) + * [7. Introduce Foreign MethodӺ](#7-introduce-foreign-methodӺ) + * [8. Introduce Local Extension뱾չ](#8-introduce-local-extension뱾չ) +* [ڰ ֯](#ڰ-֯) + * [1. Self Encapsulate FieldԷװֶΣ](#1-self-encapsulate-fieldԷװֶΣ) + * [2. Replace Data Value with ObjectԶȡֵ](#2-replace-data-value-with-objectԶȡֵ) + * [3. Change Value to Referenceֵijö](#3-change-value-to-referenceֵijö) + * [4. Change Reference to valueöΪֵ](#4-change-reference-to-valueöΪֵ) + * [5. Replace Array with ObjectԶȡ飩](#5-replace-array-with-objectԶȡ飩) + * [6. Duplicate Observed Dataֵݡ](#6-duplicate-observed-dataֵݡ) + * [7. Change Unidirectional Association to BidirectionalΪ˫](#7-change-unidirectional-association-to-bidirectionalΪ˫) + * [8. Change Bidirectional Association to Unidirectional˫Ϊ](#8-change-bidirectional-association-to-unidirectional˫Ϊ) + * [9. Replace Magic Number with Symbolic Constant泣ȡħ](#9-replace-magic-number-with-symbolic-constant泣ȡħ) + * [10. Encapsulate FieldװֶΣ](#10-encapsulate-fieldװֶΣ) + * [11. Encapsulate Collectionװϣ](#11-encapsulate-collectionװϣ) + * [12. Replace Record with Data Classȡ¼](#12-replace-record-with-data-classȡ¼) + * [13. Replace Type Code with Classȡ룩](#13-replace-type-code-with-classȡ룩) + * [14. Replace Type Code with Subcalssesȡ룩](#14-replace-type-code-with-subcalssesȡ룩) + * [15. Replace Type Code with State/Strategy State/Strategy ȡ룩](#15-replace-type-code-with-statestrategy--statestrategy-ȡ룩) + * [16. Replace Subclass with Fieldsֶȡࣩ](#16-replace-subclass-with-fieldsֶȡࣩ) +* [ھ ʽ](#ھ-ʽ) + * [1. Decompose Conditionalֽʽ](#1-decompose-conditionalֽʽ) + * [2. Consolidate Conditional Expressionϲʽ](#2-consolidate-conditional-expressionϲʽ) + * [3. Consolidate Duplicate Conditional Fragments ϲظƬΣ](#3-consolidate-duplicate-conditional-fragments-ϲظƬΣ) + * [4. Remove Control FlagƳƱǣ](#4-remove-control-flagƳƱǣ) + * [5. Replace Nested Conditional with Guard Clauses ȡǶʽ](#5-replace-nested-conditional-with-guard-clauses-ȡǶʽ) + * [6. Replace Conditional with Polymorphism Զ̬ȡʽ](#6-replace-conditional-with-polymorphism-Զ̬ȡʽ) + * [7. Introduce Null ObjectNull](#7-introduce-null-objectnull) + * [8. Introduce Assertionԣ](#8-introduce-assertionԣ) +* [ʮ 򻯺](#ʮ-򻯺) + * [1. Rename Method](#1-rename-method) + * [2. Add ParameterӲ](#2-add-parameterӲ) + * [3. Remove ParameterƳ](#3-remove-parameterƳ) + * [4. Separate Query from Modifierѯ޸ĺ룩](#4-separate-query-from-modifierѯ޸ĺ룩) + * [5. Parameterize MethodЯ](#5-parameterize-methodЯ) + * [6. Replace Parameter with Explicit Methodsȷȡ](#6-replace-parameter-with-explicit-methodsȷȡ) + * [7. Preserve Whole Objectֶ](#7-preserve-whole-objectֶ) + * [8. Replace Parameter with MethodsԺȡ](#8-replace-parameter-with-methodsԺȡ) + * [9. Introduce Parameter Object](#9-introduce-parameter-object) + * [10. Remove Setting MethodƳֵ](#10-remove-setting-methodƳֵ) + * [11. Hide Methodغ](#11-hide-methodغ) + * [12. Replace Constructor with Factory Method Թȡ캯](#12-replace-constructor-with-factory-method-Թȡ캯) + * [13. Encapsulate Downcastװתͣ](#13-encapsulate-downcastװתͣ) + * [14. Replace Error Code with Exception 쳣ȡ룩](#14-replace-error-code-with-exception-쳣ȡ룩) + * [15. Replace Exception with TestԲȡ쳣](#15-replace-exception-with-testԲȡ쳣) +* [ʮһ ϵ](#ʮһ-ϵ) + * [1. Pull Up Fieldֶƣ](#1-pull-up-fieldֶƣ) + * [2. Pull Up Methodƣ](#2-pull-up-methodƣ) + * [3. Pull Up Constructor Body캯ƣ](#3-pull-up-constructor-body캯ƣ) + * [4. Push Down Methodƣ](#4-push-down-methodƣ) + * [5. Push Down Fieldֶƣ](#5-push-down-fieldֶƣ) + * [6. Extract Subclassࣩ](#6-extract-subclassࣩ) + * [7. Extract Superclassࣩ](#7-extract-superclassࣩ) + * [8. Extract Interfaceӿڣ](#8-extract-interfaceӿڣ) + * [9. Collapse Hierarchy۵̳ϵ](#9-collapse-hierarchy۵̳ϵ) + * [10. Form Template Methodģ庯](#10-form-template-methodģ庯) + * [11. Replace Inheritance with Delegation ίȡ̳У](#11-replace-inheritance-with-delegation-ίȡ̳У) + * [12. Replace Delegation with Inheritance Լ̳ȡίУ](#12-replace-delegation-with-inheritance-Լ̳ȡίУ) + + +# һ عһ + +㷢ԼҪΪһԣṹʹ޷ܷشĿģǾع + +عǰҪȹÿɿIJԻȷȫع + +ع΢СIJ޸ij´󣬺ױԷ + +**** + +ӰƬӦó򣬰ࣺMovieRental CustomerRental ޵ Movie Լ + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/a758c8b2-0ac7-438f-90c2-3923ffad6328.png) + +ʼʵǰеļƷѴ붼 Customer Уڱ仯ʱҪⲿִиġпܷı仯УһļƷѷʽı䣻µĵӰ𡣿ǵƷѴܴڶദһıʱҪмƷѴ޸ġ + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/9e5e3cc6-3107-4051-b584-8ff077638fe6.png) + +Ǽ̳ Movie Ķ̬һ Movie ᶯ̬ı䣬ַС + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/2a502516-5d34-4eef-8f39-916298a60035.png) + + Price ӦϢͨϵķʽ Movie м Price ÿļƷѷʽװڲͬ Price У Movie ҲԶ̬ıַʽԺܺõӦᵽı仯 + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/c02a83b8-a6b9-4d00-a509-6f0516beaf5e.png) + +عʱͼͼ + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/95f4559c-3d2a-4176-b365-4fbc46c76cf1.png) + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/293b9326-02fc-4ad8-8c79-b4a7b5ba60d3.png) + +# ڶ عԭ + +عǶڲṹһֵĿڲıɹ۲Ϊǰ£ԣ޸ijɱ + +عĺôĽƣʹ⣻ҵ bug߱ٶȡ + +η򣺵һijʱֻȥڶʱȥƵ£Ӧع + +ӲعѧеĺܶͨһӲӲ¼ֵ߼ֿͼʵ֣仯װ߼عΪʵλòӲԼڲҪʱƳӲ㡣 + +޸ĽӿڣԱɽӿڣþɽӿȥ½ӿڣʹ Java ṩ @deprecation ɽӿڱΪáбҪҪӿڣҲҪ緢ӿڡ + +дڻʱӦдعһеİ취ǣװһȻԸдعľ + +޷ԤƣΪкܶ仯ʼܶǽȥعԼƣعһ򵥵Ͻ޸ĸģ仯ʱһķʽȥӦԱ仯õơ + +Ϊ⣬عܻᵼܼ͡ڱдʱöܹעֻŻ׶ٿ⡣ӦֻעؼܣΪֻһСֵĴǹؼ롣 + +# Ļζ + +## 1. Duplicated Codeظ룩 + +ͬһͬʽ Extract Method ȡظ룻 + +Ϊֵܵຬͬıʽʹ Extract MethodȻȡĺ Pull Up Method 볬ࡣ + +ֻDzͬ Extract Method ƲֺͲ첿֣Ȼʹ Form Template Method ģ巽ģʽ + +صظ룬ʹ Extract Class ظȡһС + +## 2. Long Method + +Ӳļֵѡ + +ֽ⺯ԭ򣺵Ҫע˵һδʱҪⲿִдһĺС + +Extract Method Ѻܶʱ Replace Temp with Query ʱIntroduce Parameter Object Preserve Whole Object ԽIJбøࡣ + +ѭҲҪȡµĺС + +## 3. Large Classࣩ + +˹飬Ҫʹ Extract Class Extract Subclass + +ȷͻʹǣȻ Extract Interface Ϊÿһʹ÷ʽȡһӿڡ + +## 4. Long Parameter ListIJУ + +## 5. Divergent Changeɢʽ仯 + +һֱܵ仯Ӱ죻 + +ijԭı仯ʹ Extract Class һС + +## 6. Shotgun Surgeryɢʽ޸ģ + +һ仯޸ģ + +ʹ Move Method Move Field Ҫ޸ĵشŵͬһС + +## 7. Feature Envyᣩ + +һijȤڶԼȤͨǹݡ + +ʹ Move Method ƵȥĵطԶ඼ Feature Envy Extract Method ȡ + +## 8. Data Clumpsţ + +Щݾһֶ֣ͬΡຯͬIJʹ Extract Class Ƿһ + +## 9. Primitive Obsessionƫִ + +ʹʹû͸ãʹ Replace Data Value with Object ֵ滻Ϊ + +## 10. Switch Statementsswitch + +## 11. Parallel Inheritance Hierarchiesƽм̳ϵ + +ÿΪijһ࣬ҲΪһӦһࡣ + +ֽһЩظԣظԵһԣһ̳ϵʵһ̳ϵʵ + +## 12. Lazy Classࣩ + +һû㹻ĹӦʧ + +## 13. Speculative Generality̸δԣ + +Щδܷı仯ϵͳάԤδܷĸıܿܺʼ෴ˣDZҪͲҪô + +## 14. Temporary FieldԻʱֶΣ + +ijֶνΪijض裬Ĵ벻⣬ΪͨΪʱҪֶΡ + +ֶκضĴʹ Extract Class һС + +## 15. Message ChainsϵϢ + +һһȻһȻ...Ϣַʽζſͻ뽫Ĺϵϡ + +úúίһ + +## 16. Middle Manмˣ + +м˸ίиIJһйĺίи࣬ǾǹίУӦ Remove Middle Manֱ븺Ķ򽻵 + +## 17. Inappropriate Intimacyǹϵ + +ܣ̫ʱȥֱ̽˴˵ private ɷ֡ + +## 18. Alernative Classes with Different Interfacesࣩͬ + +## 19. Incomplete Library Class⣩ + +߲Ƴ⣬ҪһЩ޸ʱʹַֻ޸һʹ Introduce Foreign MethodҪһѶΪʹ Introduce Local Extension + +## 20. Data Classɵࣩ + +ֻӵһЩֶΡ + +ҳֶʹõĵطȻӦIJƵ Data Class С + +## 21. Refused Bequestܾ + +̳гкݣֻҪһ֡ + +Ϊ½һֵ࣬Ҫĺʹ Push Down Method Push Down Field ƸǸֵܡ + +## 22. Commentsעͣ + +ʹ Extract Method Ҫע͵IJ֣ȻúͺΪ + +# ϵ + +Java ʹ Junit еԪԡ + +ԪԵĶķܲԿͻĽǶȱ֤С + +ӦвԿܳı߽ + +# عб + +СǰƵԡ + +# ֯ + +## 1. Extract Method + +δŽһУúƽ͸ú; + +## 2. Inline Method + +һıͬ׶ + +ںõ뺯壬ȻƳú + +## 3. Inline Tempʱ + +һʱֻ򵥱ʽֵһΣعַ + +жԸñ滻ΪֵǸʽ + +```java +double basePrice = anOrder.basePrice(); +return basePrice > 1000; +``` + +```java +return anOrder.basePrice() > 1000; +``` + +## 4. Replace Temp with QueryԲѯȡʱ + +ʱijһʽʽһУжʱõ滻ΪºĵáReplace Temp with Query Extract Method ֮ǰزٵһ裬Ϊֲʹ + +```java +double basePrice = quantity * itemPrice; +if(basePrice > 1000) + return basePrice * 0.95; +else + return basePrice * 0.98; +``` + +```java +if(basePrice() > 1000) + return basePrice() * 0.95; +else + return basePrice() * 0.98; + +// ... +double basePrice(){ + return quantity * itemPrice; +} +``` + +## 5. Introduce Explaining Variableͱ + +ӱʽһ֣ĽŽһʱԴ˱ͱʽ; + +```java +if((platform.toUpperCase().indexOf("MAC") > -1) && + (browser.toUpperCase().indexOf("IE") > -1) && + wasInitialized() && resize > 0) { + // do something +} +``` + +```java +final boolean isMacOS = platform.toUpperCase().indexOf("MAC") > -1; +final boolean isIEBrower = browser.toUpperCase().indexOf("IE") > -1; +final boolean wasResized = resize > 0; + +if(isMacOS && isIEBrower && wasInitialized() && wasResized) { + // do something +} +``` + +## 6. Split Temporary Variableֽʱ + +ijʱֵһΣȲѭҲռ + +ÿθֵһӦʱÿʱֻеһΡ + +## 7. Remove Assigments to ParametersƳԲĸֵ + +һʱȡԸòĸֵ + +```java +int discount (int inputVal, int quentity, int yearToDate){ + if (inputVal > 50) inputVal -= 2; +``` + +```java +int discount (int inputVal, int quentity, int yearToDate){ + int result = inputVal; + if (inputVal > 50) result -= 2; +``` + +## 8. Replace Method with Method ObjectԺȡ + +һͺ Extract Method ʱڰ˾ֲʹúѽиò + +ŽһУһֲͳ˶ڵֶΡȻͬһнͺֽΪСͺ + +## 9. Subsititute Algorithn滻㷨 + +# ڶ֮ + +## 1. Move Methodƺ + +еijһиཻú߻߱ߵá + +ƵһС + +## 2. Move FieldֶΣ + +еijֶαһõõָȡֵֵӦѸֶƵһС + +## 3. Extract Classࣩ + +ijӦ¡ + +Ӧһ࣬صֶκͺӾƵࡣ + +## 4. Inline Class + + Extract Class ෴ + +## 5. Hide Delegateءίйϵ + +ĺίйϵ + +```java +class Person{ + Department department; + + public Department getDepartment(){ + return department; + } +} + +class Department{ + private Person manager; + + public Person getManager(){ + return manager; + } +} +``` + +ͻϣ֪ij˵ľ˭ Department ͶԿͻ¶ Department Ĺԭ + +```java +Person manager = john.getDepartment().getManager(); +``` + +ͨΪ Peron һίйϵ + +```java +public Person getManager(){ + return department.getManager(); +} +``` + +## 6. Remove Middle ManƳмˣ + + Hide Delegate ෴ҪƳίкÿͻֱӵίࡣ + +Hide Delegate кܴôĴǣÿͻҪʹʱͱڷһ򵥵ίкίеԽԽ࣬ȫһмˡ + +## 7. Introduce Foreign MethodӺ + +ҪΪṩһ޷޸ࡣ + +ڿͻнһԵһʽһʵÿͻϷʵ + +## 8. Introduce Local Extension뱾չ + + Introduce Foreign Method Ŀһ Introduce Local Extension ͨµʵַ֡ʽ߰װ̳࣬ͨʵ֣װͨʵ֡ + +# ڰ ֯ + +## 1. Self Encapsulate FieldԷװֶΣ + +Ϊֶνȡֵ/ֵЩֶΡֻеʳһֶΣнֶηʸΪһֵʹַʽֱӷֶεķʽˡ + +## 2. Replace Data Value with ObjectԶȡֵ + +ڿڣü򵥵ʾ򵥵ſĽУһЩһЩΪһʼѵ绰ֵַ绰Ҫʽȡš֮Ϊ + +## 3. Change Value to Referenceֵijö + +˴ȵʵ滻ΪͬһҪһΨһ󣬹ҪһѾбҪһʱȲбǷѾڸöڣ򷵻бе󣻷½һӵбУظö + +## 4. Change Reference to valueöΪֵ + + Change Value to Reference ෴ֵиdzҪԣDzɱģɱʾҪı󣬱һµĶ滻ɶ󣬶޸ľɶ + +ҪΪֵʵ equals() hashCode() + +## 5. Replace Array with ObjectԶȡ飩 + +һ飬еԪظԴͬĶ + +Զ滻飬еÿԪأһֶʾҲ⡣ + +## 6. Duplicate Observed Dataֵݡ + +һЩ GUI ؼУҪЩݡ + +ݸֵһУһ Oberver ģʽͬ GUI ڵظݡ + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/e024bd7e-fb4e-4239-9451-9a6227f50b00.jpg) + +## 7. Change Unidirectional Association to BidirectionalΪ˫ + +඼ҪԷʱʹ˫ + +ֱ࣬Ϊ Order Ϳͻ CustomerOrder CustomerCustomer ҲҪ Order 鿴ж顣 + +```java +class Order{ + private Customer customer; + public void setCustomer(Customer customer){ + if(this.customer != null) + this.customer.removeOrder(this); + this.customer = customer; + this.customer.add(this); + } +} +``` +```java +class Curstomer{ + private Set orders = new HashSet<>(); + public void removeOrder(Order order){ + orders.remove(order); + } + public void addOrder(Order order){ + orders.add(order); + } +} +``` + +ע⵽ Curstomer ƹϵԭĸƹϵijһIJôɺ߸ƹϵһԶϵɵһһƹϵ + +## 8. Change Bidirectional Association to Unidirectional˫Ϊ + + Change Unidirectional Association to Bidirectiona Ϊ + +˫άɱߣҲ⡣˫Ӻɡʬ󡱣ijѾˣȴϵͳУΪûûȫȫ + +## 9. Replace Magic Number with Symbolic Constant泣ȡħ + +һΪ泣λ + +## 10. Encapsulate FieldװֶΣ + +public ֶӦΪ privateṩӦķʺ + +## 11. Encapsulate Collectionװϣ + +ؼϵһֻṩ/ƳԪصĺؼû޸ļݶӵȴһ֪ + +## 12. Replace Record with Data Classȡ¼ + +## 13. Replace Type Code with Classȡ룩 + +һֵ룬ӰΪһ滻ֵ롣 switch УҪʹ Replace Conditional with Polymorphism ȥ switchȱ Replace Type Code with Subcalss Replace Type Code with State/Strategy ȥ롣 + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/27c2e0b3-8f95-453d-bedc-6398a8566ce9.jpg) + +## 14. Replace Type Code with Subcalssesȡ룩 + +һɱ룬ӰΪȡ롣 + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/c41d3977-e0e7-4ee4-93e1-d84f1ae3e20e.jpg) + +## 15. Replace Type Code with State/Strategy State/Strategy ȡ룩 + +һɱ룬ӰΪ״̬ȡ롣 + + Replace Type Code with Subcalsses Replace Type Code with State/Strategy Ƕ̬ɱģǰ̳ͨеķʽʵ֣ͨϵķʽʵ֡Ϊɱ䣬̳ͨеķʽһһı䣬ôҪıµĶȡɶ󣬶ͻԸıµĶ󡣵ͨϵķʽıõ״̬Ǻ׵ġ + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/81fd1d6f-a3b2-4160-9a0a-1f7cb50ba440.jpg) + +## 16. Replace Subclass with Fieldsֶȡࣩ + +Ψһֻڡسݡĺϡ + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/f2e0cee9-ecdc-4a96-853f-d9f6a1ad6ad1.jpg) + +# ھ ʽ + +## 1. Decompose Conditionalֽʽ + +һӵ䣬Դ ifthenelse зֱ + +```java +if(data.befor(SUMMER_START) || data.after(SUMMER_END)) + charge = quantity * winterRate + winterServiceCharge; +else charge = quantity * summerRate; +``` + +```java +if(notSummer(date)) + charge = winterCharge(quantity); +else charge = summerCharge(quantity); +``` + +## 2. Consolidate Conditional Expressionϲʽ + +һϵԣõͬ + +ЩԺϲΪһʽʽΪһ + +```java +double disabilityAmount(){ + if (seniority < 2) return 0; + if (monthsDisabled > 12 ) return 0; + if (isPartTime) return 0; + // ... +} +``` +```java +double disabilityAmount(){ + if (isNotEligibleForDisability()) return 0; + // ... +} +``` + +## 3. Consolidate Duplicate Conditional Fragments ϲظƬΣ + +ʽÿ֧ͬһδ롣 + +ظƵʽ֮⡣ + +```java +if (isSpecialDeal()){ + total = price * 0.95; + send(); +} else { + total = price * 0.98; + send(); +} +``` + +```java +if (isSpecialDeal()) { + total = price * 0.95; +} else { + total = price * 0.98; +} +send(); +``` + +## 4. Remove Control FlagƳƱǣ + +һϵвʽУijСƱǡá + + break return ȡƱǡ + +## 5. Replace Nested Conditional with Guard Clauses ȡǶʽ + +ij亱ӦõڸΪʱ̴Ӻзأĵ鳣Ϊ䡱guard clauses + +ʽֱͨʽһʽǣз֧ΪڶʽǣʽṩĴֻһΪDzʹ + +```java +double getPayAmount() { + double result; + if (isDead) result = deadAmount(); + else { + if (isSeparated) result = separatedAmount(); + else { + if (isRetired) result = retiredAmount(); + else result = normalPayAmount(); + }; + } + return result; +}; +``` + +```java +double getPayAmount() { + if (isDead) return deadAmount(); + if (isSeparated) return separatedAmount(); + if (isRetired) return retiredAmount(); + return normalPayAmount(); +}; +``` + +## 6. Replace Conditional with Polymorphism Զ̬ȡʽ + +ʽÿ֧ŽһڵĸдУȻԭʼΪҪʹ Replace Type Code with Subclass Replace Type Code with State/Strategy ̳н + +```java +double getSpeed() { + switch (type) { + case EUROPEAN: + return getBaseSpeed(); + case AFRICAN: + return getBaseSpeed()- getLoadFactor()* numberOfCoconuts; + case NORWEGIAN_BLUE: + return isNailed ? 0 : getBaseSpeed(voltage); + } + throw new RuntimeException("Should be unreachable"); +} +``` + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/1c8432c8-2552-457f-b117-1da36c697221.jpg) + +## 7. Introduce Null ObjectNull + + null ֵ滻Ϊ null ĺôڣҪѯʶǷΪգֱӵþС + +```java +if (customer == null) plan = BillingPlan.basic(); +else plan = customer.getPlan(); +``` + +## 8. Introduce Assertionԣ + +Զȷijּ衣ֻڿУƷвжԡ + +```java +double getExpenseLimit() { + // should have either expense limit or a primary project + return (expenseLimit != NULL_EXPENSE) ? expenseLimit : primaryProject.getMemberExpenseLimit(); +} +``` + +```java +double getExpenseLimit() { + Assert.isTrue (expenseLimit != NULL_EXPENSE || primaryProject != null); + return (expenseLimit != NULL_EXPENSE) ? expenseLimit : primaryProject.getMemberExpenseLimit(); +} +``` + +# ʮ 򻯺 + +## 1. Rename Method + +ʹܽͺ; + +## 2. Add ParameterӲ + +ʹҪͨûijϢ + +## 3. Remove ParameterƳ + + Add Parameter ෴õõķʽijϢ + +## 4. Separate Query from Modifierѯ޸ĺ룩 + +ijض״ֵ̬޸Ķ״̬ + +Ӧͬĺһѯһ޸ġκзֵĺӦпõĸá + +```java +getTotalOutstandingAndSetReadyForSummaries(); +``` + +```java +getTotalOutstanding(); +setReadyForSummaries(); +``` + +## 5. Parameterize MethodЯ + +ɺƵĹںȴ˲ֵͬ + +һԲЩֵͬ + +```java +fivePercentRaise(); +tenPercentRaise(); +``` +```java +raise(percentage); +``` + +## 6. Replace Parameter with Explicit Methodsȷȡ + +һȫȡڲֵȡͬΪ + +Ըòÿһֵһ + +```java +void setValue(String name, int value){ + if (name.equals("height")){ + height = value; + return; + } + if (name.equals("width")){ + width = value; + return; + } + Assert.shouldNeverReachHere(); +} +``` + +```java +void setHeight(int arg){ + height = arg; +} +void setWidth(int arg){ + width = arg; +} +``` + +## 7. Preserve Whole Objectֶ + +ijȡֵΪijһκʱIJ + +Ϊ + +```java +int low = daysTempRange().getLow(); +int high = daysTempRange().getHigh(); +withinPlan = plan.withinRange(low,high); +``` + +```java +withinPlan = plan.withinRange(daysTempRange()); +``` + +## 8. Replace Parameter with MethodsԺȡ + +ijýΪݸһܸòĺҲܹǰһ + +òȥֱӵǰһ + +```java +int basePrice = _quantity * _itemPrice; +discountLevel = getDiscountLevel(); +double finalPrice = discountedPrice (basePrice, discountLevel); +``` + +```java +int basePrice = _quantity * _itemPrice; +double finalPrice = discountedPrice (basePrice); +``` + +## 9. Introduce Parameter Object + +ijЩǺȻͬʱ֣Щ Data Clumps + +һȡЩ + +![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/08738dd0-ae8e-404a-ba78-a6b1b7d225b3.jpg) + +## 10. Remove Setting MethodƳֵ + +еijֶӦڶ󴴽ʱֵȻͲٸı䡣 + +ȥֶεֵֶΪ final + +## 11. Hide Methodغ + +һûбκõ + +޸Ϊ private + +## 12. Replace Constructor with Factory Method Թȡ캯 + +ϣڴʱ򵥵Ľ + +캯滻Ϊ + +## 13. Encapsulate Downcastװתͣ + +ijصĶҪɺִתͣdowncast + +תͶƵС + +```java +Object lastReading(){ + return readings.lastElement(); +} +``` +```java +Reading lastReading(){ + return (Reading)readings.lastElement(); +} +``` + +## 14. Replace Error Code with Exception 쳣ȡ룩 + +ijһضĴ룬Աʾijִ + +쳣쳣ͨʹֿʹ⡣ + +## 15. Replace Exception with TestԲȡ쳣 + +һ߿Ԥȼ׳һ쳣 + +޸ĵߣʹڵú֮ǰ顣 + +```java +double getValueForPeriod(int periodNumber) { + try { + return values[periodNumber]; + } catch (ArrayIndexOutOfBoundsException e) { + return 0; + } +} +``` +```java +double getValueForPeriod(int periodNumber) { + if (periodNumber >= values.length) return 0; + return values[periodNumber]; +``` + +# ʮһ ϵ + +## 1. Pull Up Fieldֶƣ + +ӵֶͬΡ + +ֶࡣ + +## 2. Pull Up Methodƣ + +ЩڸвȫͬĽ + +úࡣ + +## 3. Pull Up Constructor Body캯ƣ + +ڸӵһЩ캯ǵı弸ȫһ¡ + +ڳ½һ캯๹캯е + +```java +class Manager extends Employee... + +public Manager(String name, String id, int grade) { + this.name = name; + this.id = id; + this.grade = grade; +} +``` + +```java +public Manager(String name, String id, int grade) { + super(name, id); + this.grade = grade; +} +``` + +## 4. Push Down Methodƣ + +еijֻ벿йء + +ƵصЩȥ + +## 5. Push Down Fieldֶƣ + +еijֶֻõ + +ֶƵҪЩȥ + +## 6. Extract Subclassࣩ + +еijЩֻijЩʵõ + +½һ࣬˵һƵС + +## 7. Extract Superclassࣩ + +ԡ + +Ϊཨһ࣬ͬࡣ + +## 8. Extract Interfaceӿڣ + +ɿͻʹӿеͬһӼĽӿвͬ + +ͬӼһӿС + +## 9. Collapse Hierarchy۵̳ϵ + +̫֮ + +ǺΪһ塣 + +## 10. Form Template Methodģ庯 + +һЩ࣬ӦijЩͬ˳ִƵIJϸͬ + +ЩֱŽУǶͬǩԭҲͱͬˡȻԭࡣ(ģ巽ģʽ) + +## 11. Replace Inheritance with Delegation ίȡ̳У + +ijֻʹóӿеһ֣ǸҪ̳жݡ + +½һֶԱ泬࣬ຯĶίг࣬Ȼȥ֮ļ̳йϵ + +## 12. Replace Delegation with Inheritance Լ̳ȡίУ + +֮ʹίйϵΪӿڱд༫򵥵ίк + +ί̳ࡣ diff --git a/notes/黑客与画家.md b/notes/黑客与画家.md new file mode 100644 index 00000000..a50f6453 --- /dev/null +++ b/notes/黑客与画家.md @@ -0,0 +1,135 @@ + +* [](#) +* [ΪʲôӲܻӭ](#ΪʲôӲܻӭ) +* [ڿ뻭](#ڿ뻭) +* [˵Ļ](#˵Ļ) +* [һ·](#һ·) +* [о](#о) + + +# + +ߣҵ֮ + +ʼ hack ָĽ취Щܸɵ˱Ϊ hackerڿͰص㣺桢̡̽񡣺ڿ͵ĺļֵۣšʹá˺ڿָЩרҼԱ + +ںڿͳϵͳ˱ЩƻϵͳϵȻƻϵͳ˳ΪͣĺڿͲôøá + +# ΪʲôӲܻӭ + +Ϊӡ̡͡أӡܻ͡ӭء + +⣺Ȼ̸ߣôΪʲôܻӭķΪҪܻӭҪͶܴʱ侫ȥûôʱ;ܻӭǸںȤ£Ļȡ + +۸ӵԭ + +- ĺӸӲ̣ӲܻӭζűӺ۸ + > 11 ǰСɼҳӵӰޡ DzDzСѧͬѧ뷨Ǻ߲оӰ졣СѧҵԺοʼ仯 11 ң𽥰ѼͥѰˡ ͬпһµ磬ΪǸҪģȼҪʵϣڼ븸ĸͻ ǸµӣҲȷʵںǸ硣ǣڣԼһdzԭʼ硣ϻûаѶͯ״̬ ˶̵ضԴˡĥӵԭεһ֩һúܺ档һ˲֪֮ǰĥһ֡ + +- Ϊ͹Լ + > κȼƶУЩԼûŵ˾ͻͨŰеµͻԼݡѾʶΪԭеײǶԴпȺ塣ܻӭĺӲ۸ӣDzҪԼ󲿷ֵ۸ԴһȼѧЩǵм㡣 + +- Ϊ˺ܻӭ˽ͬˡ + > ûʲôһͬĵ˸ʹŽˡͺñһͣѡĹھƣΪҳһˣµ˲ĴڣҲԴһһȺһһӣӸµ۸ͻѱ˴ϵһ𹥻һˣ˾ͶԼˡΪʲôӵǿ¼йصԭһӣ㣬һȺ˵Űһ˵Űпöࡣ + +ѧУʦֻǰѽ鵱ɹ +> ѧУʦ䡣ܼҪĵǷ˶ԼӦôλáȻ÷жԣܲҪŹ˺¼Ϳˡ + +֮ӻᱻѺöԴΪܹӰ죬ҪЩӰ졣 + +˰ѺѧУܿѹΪഺڵļӰ죬ʵѧУƵ⣬ѧУֻǰѺȦǵܣȻѧУڲź̡ܶ + +ȥĺӸͶᣬҲܹѧ᱾졣 +> ȥУһĽɫҵʱǰ궼ijʽѧͽijijũׯijҾϡDzᱻӵһԣԼСᡣdzĵͼԱǰƺҲ𾴳ˣΪ˶ǿüרңᴫҪѧϰļܡĴ꣬ǵļҳңԶİ칫µĹһ֪ǿѧУҵδµĹкϵ + +ѧУʹǽˣûѹȥලôʦѧ˫Ƿ¡ + +ûڵĶ֣ǾͻѶԷ֡ + +˱˺ܶõĶ硰˸񡱡 +> ӿܶһֱбҵ󣬲ȥѧָǣҴľֻǼѡҶõ۶֮Աǣ硰˸񡱡ֱΪ˱ЩʡЩƺͬһ˼һЩΪ߱νġ˸񡱺ֱܵ͡佱DzǴһͷţḡһԽĴţߡ˸񡱺ֱ͡ӣԸҪǡ + +# ڿ뻭 + +ڿͺͻһңڽд + +ڿͱȽϲűֿԶ̬չҿǦʻһ޸ĸġ +> ҪӦ̬չmalleable˼ģѾõijӦһ֧Ǧʣһֱ֧ʡҶѧУ̵̣ô̬ͣstatic typingһĸǣʶĺڿͣûһϲþ̬Ա̡ҪһֿͿĨĸĵԣDzΣһʢֱ͵IJ豭СԼϥϣΪһ˿ı̸Ŭѡȷƥ䣬ԼԵòܵ + +벢ǿѧоѧҲһдһֺô롣 +> ߲ͬڿѧңһкܶô˲Ϊ̬ͷ⣬ȥһĥѧҵ⣬ǾǡѧĶʼɡѧÿһˣﶼѧұԼҾãѧԼҲһ㡣ĽǿѧԼĹŪÿȥѧѧ̫ܲӰ졣ǣԽȻѧķչԽΪһص⡣ + +ڿΪԼϲ²ҿԼ칤Լ¡ + +Ȱ̵˲ɱĻῪԼĿ +> ԳԱʱҪעҵʱдʲôΪ㲻һ£㲻ܰ㣬ҪỌ̇̄ͲɱػῪԼĿ + +ڿͲǻеļˣһλߡ +> ڿֻһʵ쵼־ļˣְǸݹ˵д룬ôʵһˮĹһģͷڵͷ˶ѡǣڿһߣµľͲǻеԵĹ߱С + +# ˵Ļ + +еĵ¹ȻںǻĵģֽȥΥЩ¹˵һЩʵۣԼ鷳֮С + +ԼͬԼĹ۵㣬ȷŻõ˵ͬܿǣЩ۵DZ˸Լģ˵ʲôԼʲô + +˵ĻȷĻΪԣijЩ˱ס + +ЩһȷԵ۱Ϊа˵dzǼϱǩĿΪ˷ɱǡ +> ðʥ顢˶ʷϳıǩıǩ˷绯塢ƻȡ + +ɵƳЩеȽײˣDzߵȽײ㹻űԼ棬ֲͬڵ͵Ƚײ㣬ʵȥС + +й۵ĵһ׷ΪԼڲͬڶԼڲͬ + +ѧҪй۵㣬Ӷȡͻơ + +Ϊ˵ijЩøԼûDZ˵ +> ʱҪף˼ȳԸҪеһҪЩ˱ףһҪѻ˵ܿǴӴҲ޷Ե˼ˡΪȡõķ˼֮仮һȷĽߡ룬DzһҪ˵Ҿ͹ԼĬĬ˼Щ޷뷨˼һ֯Ҫ﷢һ˵񶷾ֲĵһ򣬾DzҪᵽ񶷾ֲ + +ȷĹ۵ʱ˵Լûá + +ǻΪԼ˼뿪ţһޣΪʲôȷʲôǴġ + +ʶԼ +> ͯƣʱܻƢΪ֪Ϊʲô˽Ǹ˵״⣬޹أ˵һ䡰ûϵֻˡ + +# һ· + +ŵ + +1. Ҫûϵͳ˲Ҫרŵļ֪ʶʹʹã +2. ҪӲԴ٣ֻҪ豸У +3. 㣬ʱؾͿʹã +4. õݶʧΪݱƶˣ +5. ڶûȫ֪¼ʹã +6. ׵ bug ֣ bug ޸ģ +7. רŵļԱΪӰȫ + + +bug Խ췢ԽãΪڶ̣û죬 bug ķҲ졣 + +߼ûѰ bug +> ΪԺ󣬴 bug Ǻ²ŻᷢĸܵӰûǸ߼ʹߣϲЩõġѶȴIJ߼ʹ߶ bug ̶ȱȽϸߣЩ bug ڿ¹ܵĹģЩ¹ҪģǾ͸ˡʵϣΪ bug ֻ࣬оһЩӵĹԺŻǣԸ߼ʹΪ bug еܵ⡣Ǵ绰ͷʱһʤߵĿǣŭӣǻǵ÷һ + +õļ֧ǣͷԱͼԱúܽҵ޸ bug + +һõ뷨ʵֹ뷨˾ȥʵȽ֮߸ܹô + +Ṻûʹ˵ܹгӰ +> һĵ˾кôġ۶٣ЩûԶṺûʹõ棬㲢ûκʧʵϣ㷴׬ˣΪڶһûгӰ͸һЩûܱҵԺͻǮ + +# о + +׷Ǻãо׷¡ + +ûҪûûܲ˽ԼҪʲôûҪûĶ + +Ϊѧо׷ȷѧҲΪö߸׶һָ鷳֤ǻѡֱӼ֤ҲΪģ˱ҲͨƲġ + +ʯĶƯȴѣ޷ϵĽеҲҪֵ̣һֱʯһֻǽÿôͲһֺõıԡ + +Ӧóԭ񻭻һü߻һ׼ȷȻ𲽼ӹ +> һ˼룬ҲԱΪʥĸǡģʽҪ󾡿óԭͣȻŻĹ۵ӦõȵijƷԺһ¡صгʥĸǽһ˶Ա;ϮҲûйϵڻĭʱڣҵ˾ΪģʽԻǰ̡ + +ijºܷζôĶͻܷζٵԭܹóԱиߵʿӶǸȤȥʵ֡ҲΪٷҪ