It seems that every profession brings its practitioners all kinds of habits.

Programming has brought programmers many bad habits, and it continues to add more bad habits every day. Of course, some habits have nothing to do with programming. Although programmers would also like to get rid of the habits below, they are deeply ingrained.

Explaining the size of something with pixels and colors in hexadecimal code; discovering polymorphism, inheritance, and patterns in all things under heaven and earth;

Using code-related abstract terms in everyday conversation.

f27c0635e7ebd0d5debcdfe456382724

0. Programmers start counting from 0.

Example: When programmers quarrel, they might say, "I'll count to three. If you don't shut up, I won't be polite! Zero! One! Two!" Or when making a list, they number it starting from 0.

Reason: array

Comment: Forming this habit was a difficult process. Countless out-of-bounds errors and loop count mistakes have deeply engraved in us the practice of starting from 0.

1. Programmers answer either-or questions with affirmation or negation.

Example: Asked, "Would you like coffee or tea?" a programmer answers, "Mm-hmm."

Reason: When one clause of a condition or || is true, the entire statement is true.

Comment: This habit is a bit exaggerated, but it is indeed a common flaw in programmers' way of thinking: using computer processing logic to handle human problems. Of course, this answer is obviously a programming error, because for this question he incorrectly returned a boolean value. Although I highly doubt whether anyone cares what the result of this answer would be, I'll still give an answer. If this were truly in the programming world, the server would consider giving you coffee first, and only if there was no coffee would she bring you tea.

2. Programmers commonly suffer from, or have suffered from, semicolon-at-the-end syndrome.

Example: For instance, these lines;

Reason: Most programs, especially C, the introductory programming language for most programmers, end statements with semicolons.

Comment: Getting used to ending a line with a semicolon is a bad habit unique to programmers. Remember all those weird compilation errors whose ultimate cause was always that tiny missing ";"? That is the origin of this bad habit. It is said that the semicolon ending has a story behind it: the semicolon key happens to be right at the position of the right little finger, giving it a uniquely favorable geographic advantage over the period and other keys. Of course, there are also programming languages that do not require a semicolon at the end (such as Ruby and Python), and when you first use them, you feel especially uneasy because there is no trailing semicolon.

3. Programmers' concept of "language" differs from ordinary people's.

Example: Asked, "What languages do you know?" Ordinary person: "I know Chinese and English, and a little French." Programmer: "I know C, C++, and Java, and a little Ruby."

Reason: In a programmer's world, there is no native language or foreign language, only programming languages.

Comment: Seriously, the syntax of programming languages is easier to learn than foreign languages. If you get a program written in a language you haven't learned, you can more or less understand parts of it. Programming languages have no borders and are the best bridge for programmers from all countries to communicate.

4. Programmers especially loathe situations where parentheses/quotation marks are not paired.

Example: When you see content like this (just a simple example (I know you get it), can you say "I'm calm, I'm not freaking out"?

Reason: Various mismatched problems cause compilation errors.

Comment: When scanning code, they are abnormally sensitive to mismatched pairs; a single glance reveals where a closing parenthesis is missing. This symptom becomes even more agonizing when using development environments with auto-complete functionality.

5. Programmers think that kilo (k) == 1024.

Example: Programmer conversion table: 1km == 1024m, 1kg == 1024g.

Reason: The origin is convoluted. Computers are a binary world -> 1024 is 2 to the 10th power -> In English, the word kilo is used to represent it -> kilo is translated into Chinese as "thousand", such as kilometer and kilogram.

Comment: Maybe ordinary people think 500 and 1000 are nice round numbers, but programmers think 512 and 1024 are round numbers. Don't be surprised. If 128, 256, 512 don't look round enough, let me convert them to binary for you: 10000000, 100000000, 1000000000...

6. Programmers habitually use == to mean equality.

Example: See 5.

Reason: In programming languages, "=" is assignment, and "==" is used to judge whether two things are equal.

Comment: The difference between single equals and double equals is a required course for beginners in programming and a test point that teachers love. If you write a single equals in the condition of an if statement in C, it will compile, but the result is often wrong, enough for a beginner to spend a while debugging it. Of course, most current languages have taken this into account and prevent this kind of typo, but the difference between single equals and double equals is deeply ingrained in every programmer's heart.

7. Programmers use "//" to mean "please ignore this line of text."

Example: At a restaurant. Programmer A: "I'll have the fish-flavored shredded pork rice bowl. What will you have?"

Programmer B: "Kung Pao chicken rice bowl."

Programmer A writes on the order slip:

Fish-flavored shredded pork rice bowl 1

Kung Pao chicken rice bowl 1

Programmer B: "I'll have beef noodles after all!"

Programmer A corrects the order slip:

Fish-flavored shredded pork rice bowl 1

// Kung Pao chicken rice bowl 1

Beef noodles 1

Reason: In programs, "//" is used to add comments to code. When the program runs, it ignores lines of code beginning with "//".

Comment: If you are left out when with a group of programmers, you can complain, "Hey, hey, hey, have I been commented out?" I believe programmers, who have always been known for their rich sense of humor and caring nature, will pay attention to you.

8. Programmers have a phobia of Chinese punctuation marks.

Example: If you've noticed, this article has used English punctuation from beginning to end—this is the best example.

Reason: All symbols in programs strictly require English half-width punctuation.

Comment: This bad habit has Chinese characteristics and is unique to Chinese programmers. Any excellent programmer in our country should be able to distinguish Chinese punctuation from English punctuation. For example, , vs. ,, and ' vs. '. Really, back when we first learned programming, had we not seen enough errors like "error C2018: unknown character '0xa3′"?

9. I now think the number 256 is absolutely perfect. But non-programmers don't understand this, and sometimes it catches me off guard.

Editor's comment: What about 1024?

10. When I read a paper book, I get very frustrated. Why can't I use Ctrl+F to find what I want to read?

Editor's comment: When I watch TV and a commercial comes on, I also get very frustrated. Why can't I drag it forward?

11. I Google everything.

Editor's comment: What if you forget Google's address?

12. A few years ago, I went to a coffee shop for lunch. The girl behind the counter asked me what kind of bread I wanted. Without thinking, I said, "The default one."

Awkward—she might still be laughing at me now...

Editor's comment: If that girl didn't understand programming, she probably wouldn't laugh; she would just be baffled.

13. Sleep deprivation—I'm used to it now.

Editor's comment: Giant pandas should no longer be an endangered species! Sleep deprivation is harmful to health. Also, friends reading this article, whether or not you are a programmer, should check whether your sleep meets the standard.

I like to optimize my daily tasks and use parallel processing as much as possible. For example, after starting my computer, I run to the kitchen to turn on the kettle and prepare coffee, then run back to enter my password and log in; while Firefox is opening, I go pour hot water to brew coffee, then come back with the coffee to browse the news; in addition, brushing my teeth while sitting on the toilet saves a few minutes every day.

Editor's comment: Bro, what you're holding is not coffee—it's your jaw!

This is exactly the kind of people they are: if you use a computer slowly, they will impatiently grab the keyboard and deftly use all kinds of shortcuts; they tell children that the three primary colors of computers are red, green, and blue, not red, yellow, and blue; when describing size and distance, they tend to use pixels as the unit; when watching a movie with their girlfriend and seeing the sparse, scattered audience in the theater, they want to do disk defragmentation... Complaints aside, isn't this exactly what makes them endearing?

Editor's comment: Thank goodness no programming language ends with a question mark? Otherwise who could understand your article?

Do you have similar bad habits? Come share your rants with everyone! :)

Source: oschina