Re: [請益] 請問要怎麼改老舊的程式碼?

看板Soft_Job (軟體人)作者 (3d)時間8年前 (2018/03/04 21:05), 編輯推噓6(600)
留言6則, 6人參與, 8年前最新討論串2/2 (看更多)
啊!時代的眼淚。MS COM(component object model). 你先找一下資料,看COM是什麼東西。 第一張圖只是把ptr function call變成比較清楚的function名稱。無特殊功能。 第二張圖ifdef只是看要用macro text substitution還是真function. debug purpose? --------------------------------------------------------------------------- 要understand legacy code其實是有方法的。 不是top-down從main追流程。要bottom-up。記得演算法就是divide and conquer. Fred Brooks說"Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won’t usually need your flowcharts; they’ll be obvious." 首先把所有struct, global variable列出來。盡可能寫出它們的用途. 然後class data同樣寫出。 第二,找出最簡單的function, 除了c library/win library, 沒有call其他function.註 解功能。 第三,找出function只call已經註解的function. 第四,repeat 3, 直到所有function都註解了。 第五,從main開始trace.很簡單的完成任務。 ---------------------------------------------- 因為com的原因,你會有很多program. 一樣divide and conquer. 沒有depend on其他com(program)的program先解析。 然後解析只depend已經解析過的program. ---------------------------------------------- 你可以一邊解析一邊port到java. mindmap可能可以幫助你了解dependencies. -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.167.153.229 ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1520168750.A.184.html

03/04 21:29, 8年前 , 1F
好哦,謝謝你
03/04 21:29, 1F

03/04 22:47, 8年前 , 2F
感謝樓主 下次看舊的code時來練習
03/04 22:47, 2F

03/04 23:15, 8年前 , 3F
好人推推
03/04 23:15, 3F

03/05 01:02, 8年前 , 4F
03/05 01:02, 4F

03/05 01:15, 8年前 , 5F
03/05 01:15, 5F

03/05 17:45, 8年前 , 6F
03/05 17:45, 6F
文章代碼(AID): #1Qc-yk64 (Soft_Job)
文章代碼(AID): #1Qc-yk64 (Soft_Job)