idea提高调试超时_如何提高您的调试技能

idea提高调试超时

by Nick Karnik

尼克·卡尼克(Nick Karnik)

如何提高您的调试技能 (How to Improve Your Debugging Skills)

All of us write code that breaks at some point. That is part of the development process. When you run into an error, you may feel that you don’t know what to do. However, even the most seasoned developers introduce errors and bugs that break their code. We are humans after all.

我们所有人编写的代码都会在某个时候中断。 这是开发过程的一部分。 当您遇到错误时,您可能会觉得自己不知道该怎么办。 但是,即使是经验最丰富的开发人员,也会引入会破坏代码的错误和错误。 毕竟我们是人类。

The important thing is to learn from these mistakes and avoid repeating them by developing techniques to improve your programming and debugging skills. Errors are primarily logical or syntactical. Some of them manifest via exceptions or crashes while others may only be observed when using the software.

重要的是要从这些错误中学习,并避免通过开发提高编程和调试技能的技术来重复这些错误。 错误主要是逻辑上或语法上的。 其中一些通过异常或崩溃来体现,而另一些则可能仅在使用该软件时被观察到。

这是开发人员犯的一些错误 (Here are some of the mistakes that developers make)

无法记录消息 (Failure to Log Messages)

One of the most unhelpful scenarios you can run into is when your program crashes and there are no error messages to indicate what went wrong. The first step is to identify if the program is crashing on start or during runtime. You can accomplish this by printing a simple log message to the terminal at the beginning of your code.

您可能会遇到的最无益的情况之一是程序崩溃时,没有错误消息指出发生了什么问题。 第一步是确定程序是在启动时还是在运行时崩溃。 您可以通过在代码开头将简单的日志消息打印到终端来完成此操作。

If you don’t see your log message, your program is most likely crashing while loading and it is possibly a dependency or build related issue.

如果您没有看到日志消息,则说明程序很可能在加载时崩溃,并且可能是依赖项或与构建有关的问题。

If you see your message, you need to narrow down to the general vicinity of the crash. The best way is to strategically place some log messages throughout your program depending upon how much information you have about the execution path by the time it crashes. Then, all you have to do is see which messages are printed.

如果看到您的消息,则需要缩小到崩溃的大致范围。 最好的方法是根据程序崩溃时对执行路径的了解程度,从策略上在程序中放置一些日志消息。 然后,您要做的就是查看打印了哪些消息。

无法读取错误消息 (Failing to Read Error Messages)

Exception messages on the front-end are usually displayed on the UI or developer console. Sometimes these messages are visible in the backend through the terminal or via log files. Regardless of where these errors occur, new developers are intimidated by them and fail to take the time to read them.

前端上的异常消息通常显示在UI或开发人员控制台上。 有时,这些消息可以通过终端或日志文件在后端看到。 不管这些错误发生在什么地方,新开发人员都会被它们吓倒,无法花时间阅读它们。

This is the number one reason why debugging takes longer for many developers. The first thing you should do is take the time to read the error message in front of you, let it sink in, and process it thoroughly.

这是许多开发人员调试时间更长的第一原因。 您应该做的第一件事是花一些时间阅读面前的错误消息,让它沉入其中并进行彻底处理。

无法读取系统日志文件 (Failing to Read System Log Files)

Some programs generate log files or write to the system event log. There is often useful information in these logs. Even if it doesn’t tell you exactly what is wrong, there might be a warning or error message or even a success message providing a hint about what happened before the error occurred.

一些程序会生成日志文件或写入系统事件日志。 这些日志中通常包含有用的信息。 即使它不能告诉您确切的问题是什么,也可能会出现警告或错误消息,甚至可能还会显示一条成功消息,提示您在错误发生之前发生了什么。

无法写入跟踪日志 (Failing to Write Trace Logs)

Tracing is following your program flow and data. Writing trace messages throughout your program helps simplify the debugging process. Trace Logs are an easy way to keep track of program execution throughout the runtime of your application.

跟踪正在跟踪您的程序流和数据。 在整个程序中编写跟踪消息有助于简化调试过程。 跟踪日志是在整个应用程序运行时跟踪程序执行的简便方法。

无法进行增量更改,构建和测试它们 (Failing to Make Incremental Changes, Build Them, and Test Them)

Many developers write big chunks of code before building and testing it. The time to find bugs increases proportional to the amount of code that was changed. You should strive to make incremental changes, build them, and test them as frequently as possible. This will ensure that you don’t end up in a situation where a lot of code was written before you discover your program doesn’t work.

许多开发人员在构建和测试代码之前都会编写大量代码。 发现错误的时间与更改的代码量成正比。 您应该努力进行增量更改,构建它们,并尽可能频繁地对其进行测试。 这将确保您不会在发现程序无法正常工作之前不会陷入编写大量代码的情况。

Often, I will even refactor my code to simplify what I’ve written.

通常,我什至会重构代码以简化编写的内容。

无法编写测试自动化 (Failing to Write Test Automation)

Unit-tests and end-to-end test automation allow you to catch potential errors as they happen. One of the reasons why existing code breaks is that developers refactor their code when they have low test coverage, which means all changes are not tested automatically.

单元测试和端到端自动化测试使您能够在潜在错误发生时及时发现它们。 现有代码中断的原因之一是,开发人员在测试覆盖率较低时会重构代码,这意味着不会自动测试所有更改。

未能使用消除方法 (Failing to Use the Method of Elimination)

If you’re unable to identify the root cause of your issue, you need to use the method of elimination. You can comment out new blocks of code to see if the errors stop. Eliminating blocks of code will help you get closer to diagnosing the issue.

如果您无法确定问题的根本原因,则需要使用消除方法。 您可以注释掉新的代码块以查看错误是否停止。 消除代码块将帮助您进一步诊断问题。

You can form a certain hypothesis and try to prove or disprove it. Many times a simple assumption can prevent you from finding bugs.

您可以形成某种假设,然后尝试证明或反驳它。 很多时候,简单的假设可能会阻止您发现错误。

从StackOverflow复制和粘贴 (Copying and Pasting from StackOverflow)

Often developers copy and paste code from stack overflow without understanding what it does. This has so many adverse effects. First, it is important that you pay attention to what goes into your application.

开发人员经常从堆栈溢出中复制和粘贴代码,而不了解其功能。 这有很多不良影响。 首先,重要的是要注意应用程序中包含的内容。

More often than I’d like, when I write a question on StackOverflow and think about how to effectively articulate it, I end up answering my own question!

当我在StackOverflow上写一个问题并考虑如何有效地表达它时,我比我想的要多得多,最终我回答了我自己的问题!

Similarly, sometimes when I talk to other members of the team, I end up answering my own question. This happens because it forces you to think about your solution.

同样,有时当我与团队中的其他成员交谈时,我最终会回答自己的问题。 发生这种情况是因为它迫使您考虑解决方案。

未能再次解决他们的问题 (Failing to Solve their Problem Again)

One of the most successful debugging techniques I have found is to try to walk through your solution over and over again and in some cases try to re-implement certain functionality from scratch. This forces you to find potential issues by recreating your implementation.

我发现的最成功的调试技术之一就是尝试一遍又一遍地介绍您的解决方案,在某些情况下,尝试从头开始重新实现某些功能。 这迫使您通过重新创建实现来发现潜在问题。

无法回溯 (Failing to Backtrack)

Normally, if you can isolate the symptoms to a specific area, you can start to walk up the call-stack to verify all variables and expected values. This can quickly lead you to uncover parts of your program where things are behaving unexpectedly.

通常,如果您可以将症状隔离到特定区域,则可以开始遍历调用堆栈以验证所有变量和期望值。 这可以Swift导致您发现程序中异常运行的部分。

无法学习调试器 (Failing to Learn the Debugger)

Finally, the single best investment you can make in yourself is to learn to use a debugger. All IDE’s come with powerful debuggers. They follow the same basic concepts. They allow you to programmatically stop the execution of your application, either on start or in a specific part of the program flow.

最后,您可以自己进行的一项最佳投资就是学习使用调试器。 所有的IDE都带有强大的调试器。 它们遵循相同的基本概念。 它们使您可以在启动时或在程序流的特定部分以编程方式停止执行应用程序。

There are also a ton of debugging tools that can aid in this process.

还有大量的调试工具可以帮助完成此过程。

If this article was helpful, ??? and Follow me on Twitter.

如果这篇文章有帮助,??? 然后在Twitter上关注我。

GitHub Extensions to Boost Your ProductivityHere are GitHub Extensions that I use. They will enable you to improve your productivity on GitHub. Please share your…medium.freecodecamp.org

可以提高生产力 的GitHub扩展这是我使用的GitHub扩展。 它们将使您能够提高GitHub上的生产率。 请分享您的… medium.freecodecamp.org

翻译自: https://www.freecodecamp.org/news/how-to-improve-your-debugging-skills-abb5b363bdb8/

idea提高调试超时

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/392886.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

leetcode 834. 树中距离之和(dp)

给定一个无向、连通的树。树中有 N 个标记为 0...N-1 的节点以及 N-1 条边 。第 i 条边连接节点 edges[i][0] 和 edges[i][1] 。返回一个表示节点 i 与其他所有节点距离之和的列表 ans。示例 1:输入: N 6, edges [[0,1],[0,2],[2,3],[2,4],[2,5]] 输出: [8,12,6,10,10,10] 解…

CSS设计指南(读书笔记 - 背景)

本文转自william_xu 51CTO博客,原文链接:http://blog.51cto.com/williamx/1140006,如需转载请自行联系原作者

在计算机网络中 带宽是什么,在计算机网络中,“带宽”用____表示。

答案查看答案解析:【解析题】计算机的发展经历了4个时代,各个时代划分的原则是根据()。【解析题】计算机网络的最主要的功能是______。【解析题】冯.诺依曼提出的计算机工作原理为____。【解析题】计算机的通用性使其可以求解不同的算术和逻辑问题,这主要…

如何在iOS上运行React Native应用

by Soujanya PS通过Soujanya PS 如何在iOS上运行React Native应用 (How to run a React Native app on iOS) I recently started to develop a React-Native app on iOS. This was my first foray into native app development. I was surprised by the ease and level of abs…

导出excel 后 页面按钮失效(页面假死)

在 page_load 里加上如下代码:string beforeSubmitJS "\nvar exportRequested false; \n"; beforeSubmitJS "var beforeFormSubmitFunction theForm.onsubmit;\n"; beforeSubmitJS "theForm.onsubmit function(){ \n"; …

Mysql分组查询group by语句详解

(1) group by的含义:将查询结果按照1个或多个字段进行分组,字段值相同的为一组(2) group by可用于单个字段分组,也可用于多个字段分组 select * from employee; --------------------------------------------- | num | d_id | name | age | sex | homea…

leetcode 75. 颜色分类(双指针)

给定一个包含红色、白色和蓝色,一共 n 个元素的数组,原地对它们进行排序,使得相同颜色的元素相邻,并按照红色、白色、蓝色顺序排列。 此题中,我们使用整数 0、 1 和 2 分别表示红色、白色和蓝色。 注意: 不能使用代码…

火车头如何才能设置发布的时候,如果是有html代码就直接的转换掉,互联网上笑话抽取及排重---火车头采集器的使用和MD5算法的应用...

10011311341 吕涛、10011311356李红目的:通过熟悉使用火车头采集器,在网络上采取3万条笑话并进行排重,以此来熟悉web文本挖掘的一些知识。过程:本次学习,主要分成两个部分。第一部分是笑话文本的采集,第二部…

Tcp_wrapper

在Linux进程分为:独立进程和非独立进程非独立进程:是依赖于超级守护进程的进程, 且受Xinetd 管理,并在启动服务时 必须启动例子:#chkconfig –level 2345 telnetd on关与chkconfig 的命令:#chkconfig –lis…

angular 动画_如何在Angular 6中使用动画

angular 动画介绍 (Introduction) Animation is defined as the transition from an initial state to a final state. It is an integral part of any modern web application. Animation not only helps us create a great UI but it also makes the application interesting…

win10上面安装win7的虚拟机怎么相互ping通

最近干了一些很蛋疼的事,这些都是自己踩过的坑,记录下来方便自己以后查阅 首先我的目的就是为了在自己的PC机上面部署一个SVN服务器,然后安装一个客户端,自己写的软件就可以定期入库,做好自己的版本控制,但…

新东方面试知识点记录

3.spring mvc 怎么接受http post 方式提交过来的xml数据?servlet中怎么接受? RequestMapping(value"/jsonPrase", headers {"content-typeapplication/json","content-typeapplication/xml"}) ResponseBody …

win10用计算机名访问文件夹,win10系统提示你当前无权访问该文件夹的解决方法【图文教程】...

Win10系统下,我们在访问或更改某些系统文件夹时,有时会遇到系统提示“你当前无权访问该文件夹”的情况。那么,遇到这种情况的话,我们该怎么办呢?接下来,小编就向大家分享win10系统提示“你当前无权访问该文…

.Net Micro Framework研究—实现SideShow窗体界面

基于MF系统的Windows SideShow界面是非常炫的(如下图)。既然微软能用.Net Micro Framework实现这么棒的界面效果,我想我们也能做到。 (SideShow模拟器界面和游戏程序中的右键菜单—注意菜单弹出后,其它的界面变暗了&am…

leetcode 344. 反转字符串

编写一个函数,其作用是将输入的字符串反转过来。输入字符串以字符数组 char[] 的形式给出。 不要给另外的数组分配额外的空间,你必须原地修改输入数组、使用 O(1) 的额外空间解决这一问题。 你可以假设数组中的所有字符都是 ASCII 码表中的可打印字符。…

事件捕获(capture)和冒泡事件(Bubble)

PS:这里是我从别人的博客中学习事件捕获和冒泡是的总结,如果你也感兴趣的话,建议你点击链接查看原博客的内容,他们写的都是很经典! 对“捕获”和“冒泡”这两个概念,我想我们对冒泡更熟悉一些&…

gulp编译css_如何用gulp缩小CSS

gulp编译cssby Vinicius Gularte由Vinicius Gularte 如何用gulp缩小CSS (How to minify your CSS with gulp) In this article, Im going to show a simple way to automatically minify your CSS files using gulp. ?在本文中,我将展示一种使用gulp自动缩小CSS文…

线段树(区间更改,区间查最值)模板

线段树(区间更改,区间查最值)模板 主要重在理解线段树,理解了怎么改都可以,还有以后不要直接抄模板,要写出自己想的一份代码 &代码&#xff1a; #include <cstdio> #include <bitset> #include <iostream> #include <set> #include <cmath>…

Unity3D项目开发一点经验

我们主要使用3dsmax2010进行制作&#xff0c;输出FBX的类型导入Unity3D中。默认情况下&#xff0c;3dsmax8可以和U3D软件直接融合&#xff0c;自动转换为FBX物体。 注意事项如下&#xff1a; 1.面数控制 在MAX软件中制作单一GameObject物体的面数不能超过65000个三角形&#xf…

leetcode 142. 环形链表 II(set/快慢指针)

给定一个链表&#xff0c;返回链表开始入环的第一个节点。 如果链表无环&#xff0c;则返回 null。 为了表示给定链表中的环&#xff0c;我们使用整数 pos 来表示链表尾连接到链表中的位置&#xff08;索引从 0 开始&#xff09;。 如果 pos 是 -1&#xff0c;则在该链表中没有…