Why can't a programmer write the function in one go? Is it because he doesn't want to?

Why does the function he makes have so many bugs?

introduction

Let’s talk about why there are so many bugs in the functions he made.

Hello everyone, I recently saw an interesting question :

Why can't programmers write it all in one go and need to fix bugs all the time?

In my opinion, programmers are human beings, not machines.

If you ask a programmer this question , there are only a few answers .

1. Understanding of requirements

Sometimes, at the beginning of a project , the requirements may not be fully understood .

As the project progresses , more details may emerge , requiring adjustments to the code to accommodate new or clearer requirements.

First of all, the transmission of requirements usually includes the following types :

  • Oral transmission : The programmer may overhear a sentence from the planner and assume that this is the requirement.

  • Demand meeting : This is what I think is a more formal meeting. Relevant people work together to analyze and discuss the needs.

  • Temporarily added : What was left out when the request was made earlier and made up later.

  • Added on non-working days : During breaks on non-working days, you receive a phone call from your manager or boss.

This all involves communication and understanding between people . It is extremely easily affected by people's state and emotions .

It may be because programmers carefully plan unintentional or intentional sentences when understanding the requirements .

It could also be because the programmer fell asleep during the meeting or was unimpressed .

The request was even received when the programmer was dissatisfied .

2. Functional complexity

Many features involve complex business logic, data processing, and user interaction .

In the process of understanding how the entire function works, programmers may not clarify the functions clearly enough , resulting in insufficient consideration of the initial implementation .

I believe everyone knows that whether it is a large function or a small function , there will be bugs .

But with relatively complex functions, bugs will appear more easily or even more.

The author believes that this is somewhat similar to the choices in life . The more critical the choice, the harder it is to choose .

3.New content

During the project iteration process, new features may need to be introduced , which may be completely different from the project framework or direction .

This will inevitably affect the stability of the program .

The lower the content, the easier it is to change the content when it is modified , and the wider the impact .

There may be new content that is completely incompatible with the old projects . Forcibly introducing such content is not right at the design level .

It may also be because the programmer did not think properly and did not take into account the changes in planning or managers more comprehensively .

4. Time pressure

Projects are often time-limited , resulting in programmers potentially having to complete tasks within a limited amount of time .

This can lead to potential problems being overlooked initially and needing to be fixed later .

Due to time pressure, programmers often skip problems encountered and execute in directions that are easier to complete .

Then these stuck points will be put into the final processing of the function, which is similar to our previous exams .

The teacher taught us that when we encounter difficult questions in the exam, we should skip them first and wait until we have finished the test paper before coming back to read the difficult questions.

But often problems also arise in these skipped contents , which are either difficult or difficult problems and cannot be solved. Or there is not much time left to solve these problems .

5. Functional coupling

In a team collaboration environment, different parts of the code may be modified by multiple programmers at the same time , which may lead to conflicts and bugs .

Furthermore, complex interactions between different modules may be difficult to fully predict before testing .

This kind of problem usually occurs when programmer A modifies function A of the project , but unexpectedly, programmer B has a problem with function B.

This involves the coupling between the framework and the project . The more severely coupled the code is (often called a " shit mountain "), the more your modifications will not be clean and will unexpectedly affect other functions.

6. Hardware and environment changes

Programs may run on different hardware and environments , which may cause problems that were not considered .

Some fixes and adjustments may be required to accommodate different environments .

As we all know, the user's usage environment may be very strange .

First of all, the device environment is divided into several types, including native Android, iOS , H5 for web pages , PC and small programs .

Secondly, different network environments, 2g, 3g, 4g, 5g and wifi .

When programmers use the best network and the best machine during development , the performance will be different when they go to the user's thousand-yuan machine, ten-thousand-yuan machine, or elderly machine .

How to deal with it

Once the demand is given to you, do you have so many problems that you can’t solve?

The author believes that this is not the case. People will make progress . Through continuous summary and optimization , the occurrence of bugs can be gradually reduced , but it cannot be eliminated .

  • Requirement understanding : The relationship between programmers and planners/managers must be harmonious, and personal emotions and opinions should not be included in communication and communication during work. Take every requirements meeting seriously.

  • Functional complexity : Programmers and planners/managers must consider the complexity of functions together. Planners and managers cannot blindly put forward requirements without considering complexity, and programmers cannot blindly implement functions without considering changes in functions.

  • New content : Programmers must carefully evaluate the impact of new content on old projects, and planners/managers must seriously consider whether this feature is really suitable for the project.

  • Time pressure : Evaluate the completion time of functions more reasonably and reject unreasonable cost reduction and efficiency increase.

  • Coupling of functions : Continuously improve coding capabilities, learn better writing methods, and respond to changes in different needs.

  • Hardware and environment changes : Strengthen testing in different environments. What should be considered here is the convenience of testing in different environments. Constantly optimize the testing environment and do not let testing difficulties lead to the generation of bugs.

Conclusion

Whether you are a programmer, planner, or manager, communication is the key to reducing problems, not questioning.

Where can I see such clear ideas? Come and follow me! Follow me and learn about the latest developments in the game industry and learn game development skills with me.

I am a "Billion Dollar Programmer", a programmer with 8 years of experience in the game industry. In game development, I hope to be able to help you, and I hope that through you I can help everyone.

AD: You can click and search for the author's online mini-games "Snake Handheld Classic", "Coloring Journey" and "Gravity Maze Ball" by yourself.

To be honest, I want to like and watch ! Please share this article with other friends who you think need it. Thanks!

Recommended columns:

100 Cocos instances

8 years of experience in building Cocos independent game development framework step by step

Learn design patterns with an 8-year game master programmer

Develop Snake mini game from scratch to online series

Knowledge paid column

Guess you like

Origin blog.csdn.net/lsw_Cs/article/details/135448407