Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”
This article has participated in the “Digitalstar Project” and won a creative gift package to challenge the creative incentive money.
When did your programming skills take off?
Seeing this question, I was lost in thought. I started thinking about my past programming experiences… It seems that my programming skills have not improved at all! But if the frequency of being scolded and disliked is less progress, then THE turning point of my “rapid progress” should be: since I can understand the code error and exception, do not take the idiot problem to my master, I seldom get scolded. Since then I’ve been working on bugs and problems in the code myself, and then I’ve been “entrusted” with modules and projects on my own. Since then I can also be a programmer to eat this meal, thank the master did not give up me ~
If code is a wild horse, it is important to start by recognizing that it is not a “horse”, that is, understanding the syntax and understanding the code. And then most of the time running the code will be wrong, so you need to tame it first. You can start by:
- Try to locate the problem and print out variables for key steps
- Learn to debug code with the IDE and figure out the value of each step
- Take the keywords of the exception: the error code, the exception category, and ask the search engines
But if you have code running online, you need to find problems on the server, and you need to debug on the real machine, the above approach is hard to follow. No sooner had I found the key to success than I found the locks had been changed.
Not afraid! Today, HelloGitHub brings open source projects to help you deal with unruly code in all aspects, so that there is no place to hide bugs.
Better debugging tools
All programming languages have their own Debugger tools, such as C/C++(GDB), Python(PDB), Java(JDB), and LLDB. These tools are often used to debug code on the server. The following open source projects are easier to operate, more informative, and more user-friendly than their own debugging tools. Debugging tools make it easier to debug code and locate problems.
Note: Do not debug online code on the server, it is risky!
1. Dbg-macro (C++)
Star: 1.7k | language: C++
Compatible with C++11 header-only single header file logging debugging library. It provides better macro functions than printf and STD ::cout. Features:
- Beautiful color output
- Supports output of base and STL container types
- In addition to basic information, variable names and types are printed
Github.com/sharkdp/dbg…
Python also has a library for similar functionality: PySnooper
Github.com/cool-RR/PyS…
2. Pudb (Python)
Star: 2.2K | Language: Python
Python command line visual debugger that supports code highlighting. Stack, breakpoint, variable dynamic real-time update, support VIM mode of operation, but also compatible with some PDB commands, easier to use.
Github.com/inducer/pud…
3. Pylane (Python)
Star: 292 | Language: Python
Python process injection and debugging tools. You can go directly into a running Python process and dynamically inject or execute snippets of code.
Github.com/NtesEyes/py…
4. Arthas (Java)
Star: 27.3K | Language: Java
Easy to use command line Java diagnostic tool. Support JVM process and resource monitoring, can also display GC, JDK version and other information, without adding code can be added to the log, to help quickly locate problems. When a strange exception occurs on the line, runtime data can be captured, including parameters, return values, exceptions, time spent, and so on, without having to issue a release.
Github.com/alibaba/art…
5. Delve (Go)
Star: 17.1K | Language: Go
Simple and powerful Go source debugger. Support thread and Goroutine, complete functionality.
Github.com/go-delve/de…
Many ides now support remote debugging (based on the above project implementation), I will not go into details here, mainly because I have not used IDE remote debugging 😅.
Mobile debugging tool
The most commonly used Web debugging tool on the PC is the Chrome development tool.
The following open source projects help you open the “developer tools” on mobile.
I don’t have to guess. It feels good to see it all.
6. Eruda (Mobile Web)
Star: 11.2K | Language: JavaScript
Front-end debugging tool designed for mobile web. Similar to mobile mini developer mode, it can be used to debug the page on mobile. The main functions include displaying console logs, checking element status, capturing XHR requests, and displaying local storage and Cookie information
Github.com/liriliri/er…
7. FLEX (iOS)
Star: 12.6K | Language: Objective-C
Debugging tools for iOS apps. It allows you to view almost any state of your application and change the value of any component. For example: adjust layout, browse files, view network request history, local database, etc
Github.com/FLEXTool/FL…
8 DoraemonKit.
Star: 18K | Language: Java
Supports debugging tools for a variety of clients. It is powerful, easy to access, easy to expand, can let you in Android, iOS, small programs and other mobile applications, quick access to commonly used debugging, auxiliary development, performance testing, visual AIDS and other tools.
Github.com/didi/Doraem…
9, insomnia,
Star: 18.1K | Language: JavaScript
Support API, GraphQL, REST, gRPC debugging tools, request interface desktop applications. Not only has a simple and beautiful interface, but also supports Windows, Linux, macOS mainstream operating systems.
Github.com/Kong/insomn…
Now there’s another strange tool
Debug your code, open or disable your application. It’s all about finding the cause of the problem and then fixing it.
So can we get some help remotely?
10, termpair
Star: 1.2K | Language: Python
Tools that enable remote assistance from the command line. The idea is that a command line starts a Web service and then generates a link for sharing. Finally, you just need to get the link to remotely operate the server through the browser. It makes it easier to turn to the big boys for help.
# Install termpair # Create termpair Share for remote control terminalCopy the code
Github.com/cs01/termpa…
The last
Taming unruly code is not easy. My experience:
Identify the problem, then validate the idea of replicating the problem, and finally consider the solution.
Understand every line of code and understand the flow and state of data in complex systems.
The open source projects in this installment are tools to help you find bugs and locate problems, and over time, your ability to tame your code will improve dramatically. Programming takes off!
That’s it for this installment, sharing interesting, entry-level open source projects on GitHub. Thank you for your reading and support. Ask for praise and share, so that excellent open source projects will be discovered and liked by more people.