About object-oriented and Design Patterns

Source: Internet
Author: User
At the beginning, we did not have anything. Later, the technical staff developed object-oriented, design patterns, and more frameworks to facilitate development, maintenance, expansion, and management, tools, software, etc. This is all for better development and development of better products.

All of these should not be tied to technology development. Programmers should use all available resources and factors to achieve optimal development. (For the optimal development, refer to the advertisement word "no best, only better)

Some time ago, a supplier's drop-down list control was required for the company's ERP project. By default, common suppliers were displayed. If you select more options, you can view all the items and return them. The list of suppliers used previously is implemented using a dropdownlist. databind of datasource is implemented in Aspx. CS, which is very primitive. Even sourceid is the default dropdownlist1. Now we need to develop this control for reuse. How to develop? (In. net, using C #)

1. Write an ascx to bind the Supplier List data in this control? 2. Give the control a data source, a binding method databind, and an event onselect, which is triggered after selection, and add several attributes such as text, value, and disable, it can be used not only as a supplier drop-down list, but also as a list of other types. It looks good...

In the end, I added a dropdownlist. CS file under the namespace of an existing project, derived from the dropdownlist Of the. NET class library, and bound the Supplier List data in databind automatically. In this way, data and performance appear to be out of pattern and rules. But in this way, 1 is easy to use and can be dragged down from the toolbar directly like the label in use. You can use dropdownlist1.selectedtext to directly set the value. 2. For old code, use <XXX: dropdownlist id = "dropdownlist1" runat = "server"> </XXX: dropdownlist>

Replace original <Asp: dropdownlist id = "dropdownlist1" runat = "server"> </ASP: dropdownlist>

You do not need to change the sourceid. The code of the dropdownlist1.selectvalue and dropdownlist1.selecteditem. Text values in the original code does not need to be modified, and the code is compatible before and after the code. 3. Because it is a compiled control, the response speed is significantly better than ascx. 4. the development time is greatly shortened and the implementation is simple. 5. If it is modified later, it does not affect the Old Code or the development in the row.

Of course, ascx also has many advantages. It is easier to develop like Aspx. The control layout and CSS style are easy to control and can easily process complicated logical business relationships. I believe that the so-called solutions and solutions are the most appropriate under certain conditions. It may be inappropriate to change a company project. This example is just to express my views on how to face the design patterns and how to use them.

The birth of a computer is not long enough for someone to say that the three generations of his generation are computers. Now, especially in China, we may need to be fast and agile when the revolutionary predecessors fought the war for eight years. What we need is to adapt to local conditions and adapt to emergencies.

Language and tools are secondary, and the most important is the way of thinking and thinking. Languages, such as C #, Java, and Perl, are interconnected. As a programmer, object-oriented learning is required. It is recommended that all beginners start from flash and from ActionScript.

----------------------
Supplement:
1. The original requirement is as follows: a list control is required. By default, the name of the first 10 frequently-used suppliers is displayed. There is a "more..." at the end... ", click to change to" return... ", suppliers that are not displayed are also displayed in the list. This design aims to make the drop-down list not too long. By default, only common options are loaded and displayed.

2. If I want to learn flash5, I don't think it will work. 5.0 of The ActionScript is not complete yet. In MX version, the as has become decent. In the later versions of as2.0, and now the 8.0 preview version of as3.0, we can say that it is well-developed and does not know how Adobe will improve it in the next step, we can see the features of many advanced languages such as C # and Java. I don't even want to include it in advanced languages, especially after the flex2 trial.

Learning Object-oriented, I suggest learning it from ActionScript, mainly because I think the development method of Flash is easier to cultivate object-oriented sentiment. In flash, video editing and buttons are an object. We can write logic code, edit special effects, and use it in scenarios to reuse it. This development method is originally object-oriented. Also, Flash is hierarchical. Each layer is actually an object, and the timeline is also an object. In the timeline, variables or objects declared by the first Trojan can be accessed in the second Trojan, but the second Trojan cannot be accessed in the first Trojan, which is like in reality, we can know about yesterday today, but we cannot eat the bread that was baked today. Flash has a strong concept of "Scope". If the variable A in _ root. mov1_1 is accessed in _ root. mov1_2, the following method can be used: _ root. mov1_1.a. And so on.

Flex is based on ipvs and can also be used in Linux. It is said that Adobe intends to open it source again. From this point on, it makes programmers who like flash more like it.

We recommend that anyone who reads this log experience flex2 (an advertisement for Adobe for free). You can download the trial from the Adobe official website for free. A foreign website publicly provides flex2's serial

Sban's. Net blog (cnblogs)
Sban's Flex blog (flex5 Blog system)
 

Http://www.cnblogs.com/sban/archive/2007/05/27/761211.html

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.