Programmer Encounters Bug Explanation

Source: Internet
Author: User

Developing applications is a stressful job, no one is perfect, it is normal to encounter bugs at work, some programmers will be angry, frustrated, depressed, even discouraged, and some programmers will be more calm. How to fix the bug is worth our scrutiny.
I want to share some of the ideas that programmers often say and pop up when trying to fix bugs. When the atmosphere becomes tense, these words will appear relaxed and humorous. Eventually, the bug will be repaired and you will continue to the next task.
I'm sure many web developers and software engineers are having trouble programming, and it's funny to think about it afterwards.

1, I do not know whether to delete or rewrite

Regression once wrote the source code, there is always a desire to re-rework the impulse, logical, redundant code, more difficult to understand. However, if there is no problem with the function, do not modify it. This is a problem that I often have to face, and I believe that it also bothers a lot of other software developers.

2, the beginning of the structure should be checked GitHub

It is believed that the vast majority of developers know about GitHub, a number of magical open-source projects that are released on a daily basis. Programmers who are involved in all computer languages use the Web to fork out existing projects, talk about or buy back their own source code in a wiki forum, which provides a wealth of resources for plugins and templates for a wide variety of projects.

3. Why this script relies on so many libraries
When it comes to more and more widely used computer languages like Java and Objective-c, the number of library files is increasing. Obviously, building a framework requires a lot of base libraries, and even some JavaScript plugins require a lot of additional files. Sometimes these messy things can be frustrating, but at least it works.

4, there must be a solution to the Internet

In the face of difficulties, my first response is to surf the Internet to check information, many programmers will post their questions on the forum, and eventually these issues will be resolved and archived. Google will magically pick up some of the keywords that are relevant to your problem, and you'll be able to easily get some useful discussion information. Unfortunately, sometimes there is not a lot of information about a particular problem.

5. Is there a plugin for this function?

What is necessary superfluous plugin is a good resource to extend any program or website user interface. In addition, they provide developers with some customization and unique options. If there are no plugins available, why don't you create one yourself?

6, for the website project, I am very worried about the pit father's InternetExplorer

Using IE to render web pages encountered various difficulties, I will not mention, from 5. Version 5 to Ie9-ie10, there has been a constant controversy over browser support issues. Web developers are afraid of Web debugging, and using IE6 for rendering is a nightmare. , fortunately those days have slowly become history.

7, some logical statements, does not conform to the logic

There are some logical statements, like if/else loops, for loops, while loops, do loops ... Wait, there's a lot more. In reviewing some of the source code, I always try to figure out what my logic is. I often go back and update the code to make the logic clearer.

8, I spend 30 minutes to write a function, it takes 2 hours to run it

Isn't that a story about programming ten years ago? When everything is going well as you expect, suddenly a function prints a fatal error, so you have to go back and delete the code block, trying to locate the line of code that went wrong. Although it can be exhausting, once you find the cause of the error, the problem is solved and you immediately feel relaxed.

9. After reading several blogs, I realized that what I had done was all wrong.

I always like to go straight to the subject based on my own programming ideas, but it can cause a lot of trouble if things don't follow my original plan. There were times when I was in the middle of a project when I was in trouble and had to find blogs and related articles to ask for help. Then I found out that my whole method was completely wrong, but it was easier to start from scratch. So in the long run, doing more research at the start of the project will save time.

10. There are good people on stackoverflow who may be able to help me .

I have not counted how many times, encountered problems are solved through StackOverflow. As long as you ask a question, there will be a lot of smart, friendly enthusiasts in the community who are willing to help you. In all online forums, it is definitely the most comprehensive web site that supports software programming and front-end Web development.

11. This problem is due to the lack of a closing parenthesis

Debugging is the method we often use, two steps forward, one step back, two steps forward, so repeated. In order to find the function name or variable scope and other errors, staring at the code for a few hours, the results found that only missing a parenthesis, you will have a sense of distress. All the time wasted on a small grammatical error, at that moment, you will feel that you are both a genius and a fool.

12. Have a cup of coffee and rest

Sometimes you need to get up and leave the monitor and hit the keyboard for a couple of hours, and if you rest in the middle, it will be good for your body. Most health guides recommend a break every 30-60 minutes. But it depends on your needs, if you feel the middle of the pause to rest will interrupt your thinking, make you very uncomfortable, it is better not.

13, I should put this project first put, later in processing it

Another way to rest is to pause your project instead of leaving your computer desk. Maybe you have other work to do, so go on to the next task. It would be a more rational way of allocating time and resources than trying to continue struggling with a problem that took 5 hours to solve.

14. I was thinking maybe classical music could inspire my programming potential.

There is a saying that classical music can promote the early growth of plants, I personally prefer classical music complex annotation and music theory. Jazz, piano, large bands, elegant music have a place in human culture all over the world. So when you're programming, listen to some wonderful concerts that make it easier to debug. Of course, it can also make you more upset.

15, perhaps now is a good time to verify the Ballmer peak theory

I believe a lot of readers know Steve Ballmer's peak, which is based on a special xkcd comic. To put it simply, the theory is that the programmer's coding ability reaches a peak after drinking a certain amount of alcohol. The quirky antics that originated in Steveballmer are thought to be like a drunken man's nonsense. Although this is a bit ironic, because Mr. Ballmer was never a real programmer at Microsoft, guess we had to wait for someone else to practice the theory.

16. Who moved my code?

This may sound paranoid, but sometimes you really want to know who wrote these things while you were awake. Looking back at the projects of the past weeks or months will give you a sense of dizzy. Sometimes you don't remember that you wrote these things-even though you were involved in the project last week. It's like I'm writing a crazy code, but you never know ...

17, completely do not know this is God horse Dongdong

The worst thing you can do is to study the source code without knowing exactly what it is doing, probably from your own project, or from someone else's project, but the same is true. At this point, you have to decide if it is worthwhile to spend more time looking for other solutions or to dissect the code carefully to see what it does.

18, direct Google under the error prompt

Given the years of PHP experience, I have to say that Google is really the best little partner for debugging problems. This must be the same for Objective-c,c++,java and other mainstream languages. The error message is useful for us, but you have to remember what the different error codes mean. It reads more like a computer language that has been translated. Fortunately with so much online support, let's make sure that these error messages represent the true meaning.

19, today should end, but I really want to solve the problem

We all know the feeling of extreme frustration when we want to quit, but at the same time feel that giving up is not the right choice. You really want to go ahead and find a new solution. But what if you're wasting one hours in the end? I am not unfamiliar with this situation, it will make people particularly depressed.

20, OH buy cakes, why I did not write notes?

When it comes to the most basic front-end code HTML/CSS/JS, there is no need to always write comments. But when it comes to complex scripts and programs, you need to write some standard comments so you can revisit the code for months, even years. Sometimes you forget to write comments on functions, parameters, output formats, and other important data, which will undoubtedly lead to a bug when you have to debug the entire script to find a solution, and you'll feel very confused when you think it would be nice to have some useful comments.

21, this 20 minutes ago is good?

Perhaps the most frustrating thing about building a program is that something that was just fine, didn't make any code, and now it doesn't work. I swear, it definitely happens, and it doesn't make any sense--maybe other programs are running a cached version, and then there are times when we just update a little bit of code, and the whole program crashes and stops running completely. That will go back to the latest backup version and go from there.

22, forget a damn semicolon, the whole program has been blown

Almost all of the programming languages I've used require Terminator at the end of each line, but not all languages, but this is definitely the case with the C/S series language. When you forget to add a semicolon terminator, this is a much more obvious error! But the parser does not understand and throws a fatal error. The next step is to take another 20 minutes to study the code and look for technical errors. The final discovery is just missing a semicolon. Ha, this is the fun of software debugging.

23, I want to recruit to help me fix the bug, how much money to spend

The idea of hiring programmers sounds tempting, but clearly not economically feasible. Also, how can you learn from these mistakes if you don't even solve your own mistakes? Experience a lot of failure, and finally, when you really understand the concept of programming, you will have a sense of accomplishment. But sometimes the mind will inevitably flash the idea.

24, quickly browse under Hackernews, certainly can improve my efficiency

Many programmers prefer to browse the social news such as software and startups are hackernews home. It has a lot of great information about freelancing, time management, software development, startup launch and fundraising. Although HN can simulate the feeling of being more productive through self-education, it is actually wasting your time. It's not that bad to get a quick tour of the news every few hours.

25. Why is this API not documented?

The most frustrating thing is that when you use a plugin or frame, your own documentation sucks and you have to read the source code yourself. I prefer to have the developer spend time designing a document page specifically for the project, explaining all the parameters and options, and, if possible, giving some sample code. But unfortunately, this situation is almost impossible. So the easiest way to do this is to stay away from the bad work that comes with documentation so you don't get yourself into trouble.

26. I wish I had backed up the database.

When writing and debugging code, I sometimes think of backup. However, data backup can help us fall back to the version before a specific change is made, which is particularly useful for an immediate server environment, and some changes occur instantaneously. Remember to keep a copy of your Web site files and databases locally for urgent needs. You might think it's too much of a hassle, but it's much better than rebuilding a SQL database.

27. How can we solve this problem quickly?

If you haven't found a solution after a few hours, it's clear that you need a new solution. Programmers always want to implement features before they can design and beautify the interface. It's easy to identify the fastest, most accurate solution, and try to implement and complete it, and then consider the problem of beautifying the interface.

28, I bet you update my code, this problem solved

Teams that provide dependency packages and plug-ins for programming languages do not need to publish products frequently. Sometimes when transferring files from the local to the server, updating the Php/ruby/python/sql version may solve some debugging problems. Unless your version is too old, local updates will rarely help you fix bugs in your source code, but it's worth a try!

29, I really should study git well, ... It's next week.

Open source versioning control software git is popular among programmers. Compared to other competitors, it offers a simpler learning curve that is used in many online warehouses like GitHub and BitBucket. It may be a bit difficult for beginners, but once you have mastered the basic commands, you will find that using Git is a piece of cake. It also makes version control clearer.

30, forget it, I'll start from the beginning.

Sometimes after trying a few hours of solution, you may need to archive (or delete) your work files and start over. The biggest difficulty with this decision is that you will consider that the work of the hours ahead will be fruitless. But if you keep the previous idea, the project is nowhere to be made. A restart will make it possible for the project to be completed successfully.

The programmer is having an explanation of the bug

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.