看板 AndroidDev 關於我們 聯絡資訊
※ 引述《nothingptt (這該死的溫柔)》之銘言: : 問題 : 看 Android 技術文件常看到 stub 這個字眼,這是什麼字的縮寫有人知道嗎? : 程式碼(請多利用置底文網站) : 參考到的資料(網頁/書籍/...) http://goo.gl/37uOe Stubs are classes that provide replacement implementations for the actual classes that the code you are testing interacts with. 我一直把他理解為 "不真的,暫用的,測試的" 例如希望我的app裡面可以抓到火車時刻表 在我還沒完成這個功能前,為了配合測試程式中其他功能 我可能先定義一個interface interface TrainScheduleManager { TrainSchedule getSchedule(Time time); } 然後實作一份假的,用來測試的版本 class TrainScheduleManagerStub implements TrainScheduleManager { TrainSchedule getSchedule(Time time) { return createFakeSchedule(time); } ... } 以利程式中其他元件連過來測試使用 等到真正的TrainScheduleManager 完成之後,再行替換上去 大概是這樣,不全或者有誤請指證~ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 72.14.229.161
uranusjr:維基百科對不完整的條目也是稱作 stub, 其實還滿常用的 01/11 22:57
nowar100:原來如此,感謝解惑 01/12 00:05