Maintain legacy code: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
(Created page with " require_once, include_once --> autoload * [http://justericgg.logdown.com/posts/196891-php-series-autoload PHP系列 - Autoload 自動載入 « 不像樣工程師 Eric G. Huan...")
 
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
== cases of legacy code ==


require_once, include_once --> autoload
legacy: require_once, include_once
* [http://justericgg.logdown.com/posts/196891-php-series-autoload PHP系列 - Autoload 自動載入 « 不像樣工程師 Eric G. Huang's 學習日記]
* alternative: [http://justericgg.logdown.com/posts/196891-php-series-autoload PHP系列 - Autoload 自動載入 « 不像樣工程師 Eric G. Huang's 學習日記]


legacy: mysql_query, mysql_fetch_array
* alternative: [http://php.net/manual/en/pdo.prepare.php PHP: PDO::prepare - Manual]
legacy: [http://php.net/manual/en/control-structures.foreach.php foreach]
* alternative: [http://php.net/manual/en/language.generators.overview.php generators]
legacy: nested if-else
* alternative: interface
<pre>
(left blank intentionally)
legacy:
* alternative:
</pre>
== 避免的 coding 習慣 ==
[[Coding habits to avoid |避免的 coding 習慣]]
== further reading ==
* 王建興 (2009). [http://www.ithome.com.tw/node/57107 如何面對與避免Legacy Code | iThome] 「Michael Feathers曾經對Legacy Code下了另一個定義,他認為Legacy和Non-Legacy Code區分的關鍵,在於測試。」
* Fukuball Lin (2015). [https://speakerdeck.com/fukuball/indievox-ta-ru-yan-chang-hui-shou-piao-zhi-hou-de-kuai-su-shui-bian-how-we-build-a-scalable-php-website-for-ticketing iNDIEVOX 踏入演唱會售票之後的快速蛻變:How we build a scalable PHP website for ticketing // Speaker Deck]
* zonble (2016). [http://www.slideshare.net/zonble/code-60464624 怎樣寫出比較沒有問題的 Code] 「不要寫 if。如果非要寫 if,不要亂寫 if。」


[[Category:Programming]] [[Category:PHP]]
[[Category:Programming]] [[Category:PHP]]

Latest revision as of 19:18, 5 November 2025

cases of legacy code[edit]

legacy: require_once, include_once

legacy: mysql_query, mysql_fetch_array

legacy: foreach

legacy: nested if-else

  • alternative: interface
(left blank intentionally)
legacy: 
* alternative:

避免的 coding 習慣[edit]

避免的 coding 習慣

further reading[edit]