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.mzph.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; 车辆可直行、左转和右转&…