Dark Horse programmer-Thoughts on traffic light Projects

Source: Internet
Author: User

-------------------- 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.

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.