A super simple program that can be written only by using object-oriented programming. Cheer for Alexander

Source: Internet
Author: User
If you have made a mistake, change it.
The title should be:
A super simple program that reflects the characteristics of Object-oriented thinking. Cheer for Alexander

I read Comrade Alexander's article on cracking the window.
I still feel something.

However, Comrade Alexander has a strong learning atmosphere.

I am sorry to reveal my real identity here.
I am actually a lecturer in a training institution, and I often worry about my mistakes.

Fortunately, some interesting examples will always be summarized in teaching.

I would like to share with you today
Something that can be written only by using object-oriented methods. Of course, the process may be hard to write, but I don't necessarily have one of the one thousand programmers.

Program type: WinForm
Requirements:
Each time you double-click the Application Form interface, a Label is displayed at the double-click position.
The Label can automatically move in the form customer area at 45 degrees, and the mirror will rebound in the top, bottom, left, and right sides. For example, if you run it in the lower right corner of 45 degrees, you can run it in the upper right corner of 45 degrees. It's easy to say that it will float back and forth.

Optional higher requirements:
The motion angle of each Label is random when it appears. The movement speed of each Label is also determined randomly when it appears, and the line speed should be kept stable.

Haha

It is estimated that most of them will be able to solve the problem quickly within one hour.
The higher requirements are nothing more than trigonometric functions, but they are often returned to university teachers without common estimates.

PS: I think it is impossible to use process-oriented
Because the number of labels is not fixed, and when the number reaches a certain number, haha.

You can remember this question:
Each object should be responsible for its own affairs
The master program should not interfere with the internal affairs of the object too much.

2007/9/20
PS: title changed
Naturally, I will talk more about some ideas.
Why is object-oriented? Is Object-Oriented encapsulation? To inherit from object orientation?
No
IsEnable programmers to work at a higher abstraction levelThis is my understanding of the development of Coding Technology

I can write everything in C. Isn't C's strict structure-oriented?

It is much more comfortable for programmers to use the object idea to direct a bunch of dynamic objects than to directly direct the programmer to control the memory.
In addition, when constructing a complex environment, object-oriented code writes N lines less than direct control memory.

Why is there a software crisis?
Because the system is too big

Even if there are strong people in the process to implement my program
However, some attributes are encapsulated in the implementation process.
Even if the structure is not used, you can use arrays and linked lists.
But let's think about it. At this time, do you really want to have something to do?
In fact, this is the most direct origin of object-oriented
Otherwise, why should we be object-oriented?

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.