Various popular programming styles

Source: Internet
Author: User

Reprinted: http://coolshell.cn/articles/2058.html

 

In the past N years, I have met many developers who have used different styles. Below are some of my knowledge. Do you know anything else?

Shotgun Programming

This programming style is a very casual way for developers to treat code. "Well, an error occurred while calling this method ...... Then I will try to extract the output parameters fromFalseChangeTrue!", Of course there are still errors, so our programmers will do this: "Okay, let me comment out the entire method." or other more casual processing methods until the call is successful. Or is pointed out by a programmer.

If we put a regular programmer and a hitting programmer together, then the formal program can become crazy immediately, and, it can minimize the IQ of regular programmers. Programmers with two major hits should not join in Pair programming, because their destructive abilities will cause worse damage than only one.

Big game programming

This is a more moderate programming method than shotgun programming, and I believe this method may be used by most programmers. This programming method often occurs when programmers do not know exactly what they are doing, nor do they know the nature and reality of the program they write, but can make the program work. They write programs in a way that hits the big run. Sometimes, they don't even know the cause of a certain error, and they start to modify the code in a confused way. Once a problem occurs, they will take two steps: 1) Stop, understand the program, and find the cause of the error. 2) use shotgun programming to solve the problem.

Test driven development is a programmer that can be used to save millions of computers. So they have an excuse for NB: As long as my program passes the test, what else do you have to say? Don't scold me. Test-driven development is a good thing. It is mainly used to control the problems brought about by collision development.


Cargo-cult programming

The term cargo cults comes from indigenous people in some small Pacific Islands during World War II. During the war, the United States used these islands as a supply station on the pacific battlefield. They built their own runways on these islands to transport war supplies. The indigenous people on the island have never seen planes. When they saw the planes, they thought they could bring all kinds of items and food to white people. After the end of World War II, the indigenous people modeled the construction of the runway and used bamboo to build the tower. Then we expected a plane to deliver items and food for them.

Cargo cult programming is a very popular programming method. programmers who use this method will learn the programming methods of other programming experts, although they do not know why the experts want to do that, but they think that doing so can make the program work. For example, a large number of programmers used ejbs and entity beans excessively in the first year of J2EE's appearance.

Programming

It is a popular fable. This style of programming is very common in the programmer's circle. For example, one day, you find a null pointer exception, so when you get to the place where the NULL pointer exception is generated, simply put a judgment:if (p != NULL)。

Yes, such a fix can make your program work, but you have not really solved the problem. You just wrote down the position where the sword fell by the side of your ship. This only hides the problem, and eventually only makes the behavior of your program a ghost. You should find the reason why the pointer is null and then solve the problem.

Design Mode-driven programming

As the programming name says, this programming style uses a lot of design patterns. In your program, there are four design patterns, and your code is full of facade, observer, strategy, adapter, and so on. As a result, the business logic to be processed by your program cannot be read by these design patterns. At last, you do not know whether the business needs are re-engineering or the design model is important. In short, the program logic of actual business needs is messy by various design models.

Detective Programming

When solving a bug, the detective programmer will investigate the cause of the bug. Then, investigate the cause of the bug. Then, it will analyze the causal relationship between the corrected code and other code failures. Then, he will use text search to find all the code that uses this change, and continue to look for the call code at a higher level. Finally, the programmer will write 30 test cases in different situations. Even if these test cases have nothing to do with the bug, the programmer has enough confidence, and precisely corrected a spelling error.

At the same time, another normal program fixes the other five bugs.

Slaughter Programming

Programmers who use this style have an extreme impulse to refactor code that is hard to control. They will refactor almost all the handled code. Even on the eve of the product release, when he fixes several spelling mistakes, he will modify 10 classes, the other 20 classes associated with the 10 classes are reconstructed, and the build script of the code and five deployment descriptors are modified.

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.