Rubber Duck Debugging: History and Benefits 橡皮鴨調試:歷史和優勢

注:機翻,未校對。


Discover the origins of rubber duck debugging, why it works, and why it has become so popular among programmers.
了解橡皮鴨調試的起源,它為什么有效,以及為什么它在程序員中如此受歡迎。

Debugging code can be a frustrating and time-consuming process, with programmers often spending hours or even days trying to identify the root cause of a problem. However, a technique called rubber duck debugging has become a popular and effective method for programmers to quickly identify and fix issues in their code. The technique involves explaining code line-by-line to an inanimate object, usually a rubber duck, which can help programmers break the code down into smaller, more manageable pieces and identify where the problem is occurring. Discover the origins of rubber duck debugging, why it works, and why it has become so popular among programmers.
調試代碼可能是一個令人沮喪且耗時的過程,程序員經常花費數小時甚至數天來試圖確定問題的根本原因。然而,一種稱為橡皮鴨調試的技術已成為程序員快速識別和修復代碼中問題的一種流行且有效的方法。該技術涉及向無生命的對象(通常是橡皮鴨)逐行解釋代碼,這可以幫助程序員將代碼分解成更小、更易于管理的部分,并確定問題發生的位置。了解橡皮鴨調試的起源,它為什么有效,以及為什么它在程序員中如此受歡迎。?

What is Rubber Duck Debugging?
什么是橡皮鴨調試??

Rubber duck debugging is a common method used by programmers to debug code by explaining it to an inanimate object, usually a rubber duck. The concept behind rubber duck debugging dates back to the 1990s and has since become a popular debugging technique used by software developers around the world.
橡皮鴨調試是程序員通過向無生命對象(通常是橡皮鴨)解釋代碼來調試代碼的常用方法。橡皮鴨調試背后的概念可以追溯到 1990 年代,此后已成為全球軟件開發人員使用的流行調試技術。

The origins of rubber duck debugging can be traced back to a book called “The Pragmatic Programmer: From Journeyman to Master” written by Andrew Hunt and David Thomas. In the book, the authors described a technique called “rubber duck debugging,” which involved explaining code line-by-line to a rubber duck.
橡皮鴨調試的起源可以追溯到 Andrew Hunt 和 David Thomas 撰寫的一本名為“The Pragmatic Programmer: From Journeyman to Master”的書。在書中,作者描述了一種稱為“橡皮鴨調試”的技術,該技術涉及向橡皮鴨逐行解釋代碼。
?
Why do Programmers Use Rubber Duck Debugging?
為什么程序員使用橡皮鴨調試?
?
The idea behind rubber duck debugging is that when a programmer is stuck on a problem, explaining the code to someone else, or in this case, an inanimate object, can help them identify the root cause of the issue. By describing the problem to the rubber duck, the programmer is forced to break down the code into smaller, more manageable pieces, which can often help them identify the source of the problem.
橡皮鴨調試背后的想法是,當程序員遇到一個問題時,向其他人解釋代碼,或者在這種情況下,向一個無生命的對象解釋代碼,可以幫助他們確定問題的根本原因。通過向橡皮鴨描述問題,程序員被迫將代碼分解為更小、更易于管理的部分,這通常可以幫助他們確定問題的根源。
?
Rubber duck debugging is based on a technique called “active listening,” which involves actively listening to someone else to fully understand their point of view. By using this technique to explain code to a rubber duck, the programmer can gain a better understanding of the problem and potentially identify the root cause of the issue.
橡皮鴨調試基于一種稱為“主動傾聽”的技術,該技術涉及積極傾聽他人以充分理解他們的觀點。通過使用這種技術向橡皮鴨解釋代碼,程序員可以更好地了解問題,并可能確定問題的根本原因。
?
Why Does Rubber Duck Debugging Work?
為什么橡皮鴨調試有效?
?
One of the primary benefits of rubber duck debugging is that it helps to identify the root cause of the problem. By explaining the code line-by-line to a rubber duck, the programmer is forced to break the code down into smaller, more manageable pieces. This can help them to identify where the problem is occurring and what may be causing it. By gaining a better understanding of the code, programmers can more easily identify and fix issues.
橡皮鴨調試的主要好處之一是它有助于確定問題的根本原因。通過逐行向橡皮鴨解釋代碼,程序員被迫將代碼分解為更小、更易于管理的部分。這可以幫助他們確定問題發生的位置以及可能導致問題的原因。通過更好地理解代碼,程序員可以更輕松地識別和修復問題。
?
It can also save time and increase productivity! When a programmer is stuck on a problem, they may spend hours or even days trying to find the root cause of the issue. However, by explaining the code to a rubber duck, they can often identify the problem much more quickly. This can save time and increase productivity, allowing the programmer to move on to other tasks more quickly.
它還可以節省時間并提高生產力!當程序員遇到問題時,他們可能會花費數小時甚至數天的時間試圖找到問題的根本原因。但是,通過向橡皮鴨解釋代碼,他們通常可以更快地識別問題。這可以節省時間并提高生產力,使程序員能夠更快地繼續執行其他任務。
?
Rubber duck debugging can also encourage collaboration and communication among team members. When a programmer is stuck on a problem, they may turn to their colleagues for help. By explaining the code to a rubber duck, they may also be explaining it to their colleagues, who can offer suggestions and ideas for solving the problem. This can promote collaboration and communication, helping to build stronger teams and improve overall productivity.
橡皮鴨調試還可以鼓勵團隊成員之間的協作和溝通。當程序員遇到問題時,他們可能會向同事尋求幫助。通過向橡皮鴨解釋代碼,他們也可能向同事解釋代碼,他們可以提供解決問題的建議和想法。這可以促進協作和溝通,有助于建立更強大的團隊并提高整體生產力。

?Finally, rubber duck debugging can help to catch errors before they become larger problems. By identifying and fixing issues early on, programmers can prevent them from snowballing into larger, more complex problems down the line. This can save time and reduce the risk of more significant issues occurring later on.
最后,橡皮鴨調試可以幫助在錯誤變成更大的問題之前發現錯誤。通過及早識別和修復問題,程序員可以防止它們像滾雪球一樣越滾越大,變成更大、更復雜的問題。這可以節省時間并降低以后發生更重大問題的風險。
?
Why is Rubber Duck Debugging Popular?
為什么橡皮鴨調試很受歡迎?
?
The concept of rubber duck debugging has since become popularized in the programming community, with many programmers using it as a common debugging technique. It has even been incorporated into some integrated development environments (IDEs), such as Microsoft Visual Studio, which includes a rubber duck debugging feature.
橡皮鴨調試的概念從此在編程社區中流行起來,許多程序員將其作為一種常見的調試技術。它甚至被整合到一些集成開發環境(IDE)中,例如Microsoft Visual Studio,其中包括橡皮鴨調試功能。

In addition to its usefulness as a debugging technique, rubber duck debugging has also become a popular meme within the programming community. The concept of using a rubber duck to explain code has been used in various programming jokes and memes, with many programmers referring to their rubber duck as their “debugging buddy.”
除了作為調試技術的有用性外,橡皮鴨調試還成為編程社區中流行的模因。使用橡皮鴨來解釋代碼的概念已被用于各種編程笑話和模因中,許多程序員將他們的橡皮鴨稱為他們的“調試伙伴”。

Rubber duck debugging is a simple but effective technique used by programmers to debug code. By explaining the code line-by-line to an inanimate object, such as a rubber duck, programmers can break down the code into smaller, more manageable pieces, and potentially identify the root cause of the problem. Rubber duck debugging can save time, increase productivity, encourage collaboration and communication among team members, and help catch errors before they become larger problems. As a result, this technique has become widely popularized in the programming community and is a valuable tool for programmers of all levels of experience.
橡皮鴨調試是程序員用來調試代碼的一種簡單但有效的技術。通過向無生命的對象(如橡皮鴨)逐行解釋代碼,程序員可以將代碼分解為更小、更易于管理的部分,并可能確定問題的根本原因。橡皮鴨調試可以節省時間,提高生產力,鼓勵團隊成員之間的協作和溝通,并幫助在錯誤成為更大的問題之前發現錯誤。因此,這種技術在編程社區中得到了廣泛的普及,對于各種經驗水平的程序員來說都是一個有價值的工具。


via:

  • Rubber Duck Debugging: History and Benefits April 7, 2023 7 四月 2023

    https://www.masterycoding.com/blog/rubber-duck-debugging-history-and-benefits

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/44958.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/44958.shtml
英文地址,請注明出處:http://en.pswp.cn/web/44958.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

AMD CPU加 vega 顯卡運行ollama本地大模型

顯卡是VEGA56,這個卡代號是gfx900 雖然ollama頁面上寫著這個卡可以,但是實際是不可以的 報錯如下: levelWARN sourceamd_windows.go:97 msg"amdgpu is not supported" gpu0 gpu_typegfx900:xnack 它認為的GPU型號是 gfx900:xna…

【JavaScript】解決 JavaScript 語言報錯:Uncaught SyntaxError: Unexpected identifier

文章目錄 一、背景介紹常見場景 二、報錯信息解析三、常見原因分析1. 缺少必要的標點符號2. 使用了不正確的標識符3. 關鍵詞拼寫錯誤4. 變量名與保留字沖突 四、解決方案與預防措施1. 檢查和添加必要的標點符號2. 使用正確的標識符3. 檢查關鍵詞拼寫4. 避免使用保留字作為變量名…

全棧 Discord 克隆:Next.js 13、React、Socket.io、Prisma、Tailwind、MySQL筆記(一)

前言 閱讀本文你需要有 Next.js 基礎 React 基礎 Prisma 基礎 tailwind 基礎 MySql基礎 準備工作 打開網站 https://ui.shadcn.com/docs 這不是一個組件庫。它是可重用組件的集合,您可以將其復制并粘貼到應用中。 打開installation 選擇Next.js 也就是此頁面…

Python3 第十七課 -- 編程第一步

目錄 一. 前言 二. end 關鍵字 一. 前言 在前面的教程中我們已經學習了一些 Python3 的基本語法知識,接下來我們來嘗試一些實例。 打印字符串: print("Hello, world!") 輸出結果為: Hello, world! 輸出變量值: i 256*256…

智慧校園服務監控功能

智慧校園系統中的服務監控功能,扮演著維護整個校園數字化生態系統穩定與高效運作的重要角色。它如同一位全天候的守護者,通過實時跟蹤、分析并響應系統各層面的運行狀況,確保教學、管理等核心業務流程的順暢進行。 服務監控功能覆蓋了智慧校園…

開發個人Ollama-Chat--6 OpenUI

開發個人Ollama-Chat–6 OpenUI Open-webui Open WebUI 是一種可擴展、功能豐富且用戶友好的自托管 WebUI,旨在完全離線運行。它支持各種 LLM 運行器,包括 Ollama 和 OpenAI 兼容的 API。 功能 由于總所周知的原由,OpenAI 的接口需要密鑰才…

知識圖譜與 LLM:微調與檢索增強生成

Midjourney 的知識圖譜聊天機器人的想法。 大型語言模型 (LLM) 的第一波炒作來自 ChatGPT 和類似的基于網絡的聊天機器人,這些模型在理解和生成文本方面非常出色,這讓人們(包括我自己)感到震驚。 我們中的許多人登錄并測試了它寫…

微信視頻號的視頻怎么下載到本地?快速教你下載視頻號視頻

天來說說市面上常見的微信視頻號視頻下載工具,教大家快速下載視頻號視頻! 方法一:緩存方法 該方法來源早期視頻技術,因早期無法將大量視頻通過網絡存儲,故而會有緩存視頻文件到手機,其目的為了提高用戶體驗…

尚硅谷Vue3入門到實戰,最新版vue3+TypeScript前端開發教程

Vue3 編碼規范 創建vue3工程 基于vite創建 快速上手 | Vue.js (vuejs.org) npm create vuelatest 在nodejs環境下運行進行創建 按提示進行創建 用vscode打開項目 安裝依賴 源文件有src 內有main.ts App.vue 簡單分析 編寫src vue2語法在三中適用 vue2中的date metho…

UnityECS學習中問題及總結entityQuery.ToComponentDataArray和entityQuery.ToEntityArray區別

在Unity的ECS&#xff08;Entity Component System&#xff09;開發中&#xff0c;entityQuery.ToComponentDataArray<T>(Allocator.Temp) 和 entityQuery.ToEntityArray(Allocator.Temp) 是兩種不同的方法&#xff0c;用于從實體查詢中獲取數據。除了泛型參數之外&#…

【深度學習入門篇 ⑤ 】PyTorch網絡模型創建

【&#x1f34a;易編橙&#xff1a;一個幫助編程小伙伴少走彎路的終身成長社群&#x1f34a;】 大家好&#xff0c;我是小森( &#xfe61;?o?&#xfe61; ) &#xff01; 易編橙終身成長社群創始團隊嘉賓&#xff0c;橙似錦計劃領銜成員、阿里云專家博主、騰訊云內容共創官…

git、huggingface 學術加速

1、git 有時候服務器不能直接訪問 github&#xff0c;下載代碼會很麻煩&#xff1b;安裝庫的時候&#xff0c;pip xx git 就更難了 比如&#xff0c;這次我需要安裝 unsloth&#xff0c;官方給出的腳本是&#xff1a; pip install “unsloth[cu121-torch220] githttps://git…

【python】函數重構

函數重構 函數重構pycharm函數重構步驟函數重構練習 函數重構 函數重構是指對現有函數進行修改和優化的過程。重構的目的是改善代碼的可讀性、可維護性和靈活性&#xff0c;同時保持其功能不變。函數重構通常包括以下步驟&#xff1a; 理解函數的功能和目的。了解函數的作用和…

OSPF.綜合實驗

1、首先將各個網段基于172.16.0.0 16 進行劃分 1.1、劃分為4個大區域 172.16.0.0 18 172.16.64.0 18 172.16.128.0 18 172.16.192.0 18 四個網段 劃分R4 劃分area2 劃分area3 劃分area1 2、進行IP配置 如圖使用配置指令進行配置 ip address x.x.x.x /x 并且將缺省路由…

Sortable.js板塊拖拽示例

圖例 代碼在圖片后面 點贊??關注&#x1f64f;收藏?? 頁面加載后顯示 拖拽效果 源代碼 由于js庫使用外鏈&#xff0c;所以會加載一會兒 <!DOCTYPE html> <html lang"en"> <head> <meta charset"UTF-8"> <meta name&qu…

【Go系列】 Go的錯誤處理

承上啟下 上一篇文章中介紹了struct和interface&#xff0c;在Go語言中&#xff0c;是沒有Class這個概念的&#xff0c;我們可以通過Struct和方法的組合&#xff0c;來實現Class。我們通過Struct嵌套來實現繼承這樣的一種機制&#xff0c;并且不用設置虛函數這樣的特殊說明。同…

如何防止第三方DLL注入自己的進程?

PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY 結構 struct _PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY {union {DWORD Flags;struct {DWORD MicrosoftSignedOnly : 1;DWORD StoreSignedOnly : 1;DWORD MitigationOptIn : 1;DWORD AuditMicrosoftSignedOnly : 1;DWORD Audit…

C語言 ——— 實用調試技巧(Visual Studio)

目錄 Debug 和 Release 的區別 F10 --- 逐過程調試 & F11 --- 逐語句調試 F9 --- 新建/切換斷點 & F5 --- 開始調試 shift F5 & ctrl F5 Debug 和 Release 的區別 Debug&#xff1a;通常為調試版本&#xff0c;它包含調試信息&#xff0c;并且不作任何優化…

一 GD32 MCU 開發環境搭建

GD32 系列為通用型 MCU &#xff0c;所以開發環境也可以使用通用型的 IDE &#xff0c;目前使用較多的是 KEIL、 IAR 、 GCC 和 Embedded Builder &#xff0c;客戶可以根據個人喜好來選擇相應的開發環境。 目錄 1、使用 Keil 開發 GD32 目前市面通用的MDK for ARM版本有Kei…

華為OD機試真題2024版-路口最短時間問題

題目描述 假定街道是棋盤型的&#xff0c;每格距離相等&#xff0c;車輛通過每格街道需要時間均為 timePerRoad&#xff1b; 街道的街口&#xff08;交叉點&#xff09;有交通燈&#xff0c;燈的周期 T(lights[row][col]) 各不相同&#xff1b; 車輛可直行、左轉和右轉&…