-------------------- Android training, Java training, and hope to communicate with you! ----------------------
When I learned about the traffic light project step by step with instructor Zhang's ideas, I realized a problem. I felt that my thoughts were sometimes more important than my knowledge, if you have good ideas, you can write a good one.ProgramFor example, we can understand enumeration, but it cannot be as good as what Mr. Zhang uses. When I first saw the question of the traffic light, to be honest, I did not really think that the original car was running in a status of 12, and I thought of eight, in addition, when instructor Zhang starts to set s2n ("N2s", "s2w", false) in the south to the north, I am also thinking that the twelve types of data should be set, however, the result is only set to the first four types, which I do not understand at the beginning. Why should we set the four types?
When using the voidlight () method, one of the statements is if (opposite! = NULL) lamp. valueof (opposite ). light (); I realized that the lights in the north to the south can be expressed by the opposite state of the South to the North, and the opposite state of the north to the south is set to null, by making judgments, you can avoid repeated calls to each other and enter an endless loop. I think this idea is clever, but why did we not think of it? In the end, there is still a lack of ideas. It is undeniable that Mr. Zhang has a wealth of project development experience, this is why he was able to think of the problem solution as soon as possible. At the same time, we also need to consider a problem. As a programmer, in fact, in the development process, many projects are implemented in life. Being good at discovering the running rules of some things in life can easily help us solve a problem, for example, if you do not know how traffic lights work in your life, it is impossible to complete this project. In addition, to solve a complicated problem, if you can draw a picture, this will greatly help us simplify and understand, and greatly improve efficiency.
-------------------- Android training, Java training, and hope to communicate with you! ----------------------
For details, see edu.csdn.net/heima.