How do I think like a programmer? -Php Tutorial

Source: Internet
Author: User
Can you explain the thinking logic of programmers? Can you explain the thinking logic of programmers? Reply: one day, when the teacher tried to test the students' IQ in class, he asked a boy, "there are ten birds in the tree, how many birds are left when I shot and killed ?"
The boy asked, "Is it a pistol without sound, or is it a gun without sound ?"
"No ."
"How big is Gunshots ?"
"80 ~ 100 db ."
"That means it will shake your ears ?"
"Yes ."
"Isn't it illegal to beat birds in this city ?"
'No offense ."
"Are you sure the bird is really killed ?"
"OK." The teacher is impatient. "Please, just tell me how many are left. OK ?"
"OK. Are there any deaf birds in the bird ?"
"No ."
"Is there a problem with the intelligence of a bird? I am so stupid that I don't know how to fly when I hear a gun ?"
"No, I have an IQ of more than 200 !"
"Are they in cages ?"
"No ."
"Are there any other trees on the edge, and are there any other birds on the tree ?"
"No." "Ten miles away ?" "That's a tree !"
"Are there any birds with disabilities or Ele. me flying ?"
"No, it's amazing ."
"Isn't it a bird in a pregnant stomach ?"
"All are public ."
"Is it impossible to get pregnant ?"
"......, Never possible ."
"Are there any flowers in the eyes of a bird? Ten are guaranteed ?"
"There are no flowers, just ten." The sweat on the teacher's head has flowed down,
The bell rings, but the boy continues to ask, "Are you stupid and not afraid of death ?"
"They are all afraid of death ."
"Was it because a couple was hit and they left behind ?"
"Stupid, I didn't mean they were all public !"
"Can comrades !"
"……, Sexual orientation is normal !"
"Will it take one shot to kill two of them ?"
"No ."
"How about killing three at a gun ?"
"No ."
"What about four ?"
"No !"
"What about five ?"
"Absolutely not !!!"
"Are there always six possibilities ?"
"Unless you are a pig, it's possible! Only one shot can be killed !"
"... Okay, so can all birds be moved freely ?"
"Yes ."
"Will they be panic and hit each other when they get scared ?"
"No, every bird has a satellite navigation system and can fly automatically ."
"Well, if your answer is not a lie," the students replied with confidence, "if the dead bird hangs on a tree and does not fall down, there will be one left. if it falls down, only one is left."
The teacher pushed his glasses and said with a trembling feeling: "You can become a programmer ......" Process-oriented:
What is the first step, what is the second step, and what is the third step?
Well, I found a shortcut to jump from step 1 to step 3.

Object-oriented:
First find who, then find who
Well, I found an agent. I only need to look for him. the people behind me asked him to find the agent. The program won't go wrong. I always faithfully execute my commands. if the program doesn't work properly, it must be something I did wrong. The source is no longer available. I am just a Porter --

[1].-What should I do if there is a pile of fire grass with a bucket filled with water next to it?
-Pour water from the bucket to the grass to extinguish the fire.

[2].-What should I do if there is a pile of grass on fire and there is an empty bucket next to it?
-Fill the bucket with water and then get the result of [1.

[3]-what should I do if there is a pile of grass with an empty bucket next to it?
-Ignition the heap of grass and then get the result of [2. Programmers do not have the same thinking. Therefore, the premise of "thinking the same" with programmers is not true ~ Then ~
If ~ Else ~
Do ~ Abstract generalization? Well, he is thinking... imagining his various ideas for solving mathematical problems, and then summarizing these ideas with a general idea. At this time, you get the principle of the Turing machine. Then, let's take a look at what a Turing machine is, and then imagine a device in mind. This device uses the parameters of various existing devices to replace the parameters of the device in the Turing machine. So you get a virtual machine (in the black box) in your brain ). Then, when it comes to underlying difficulties, you can call out the virtual machine and think about how the problem is implemented at the underlying layer.


In this way, you can also run the assembly language, C language, operating system, and other advanced languages in the virtual machine.
However, pay attention to the need to focus on the computing workload of the brain, and regard unnecessary places as black boxes. If you want to find bugs in over 500 assembly languages, add them to Debug. Five-dimensional computation, analysis of problem solving problems all objects.

If the program is wrong, it must be your own.

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.