In ASP programming, classes can play a very good role in encapsulation. Although the class in ASP can not be true object-oriented, it is only object-based, however, the class in the development of ASP still can play a good role, it is still very necessary to use it well.
The function of a class can also be implemented purely with a sub or function, but the class provides a more comfortable way of interfacing. There is no concept of "namespace" in the ASP, with sub, many function, in order to distinguish these sub and function, often use long and bad name, and sub, function interface is very inflexible, But the use of class words can be greatly improved.
Classes don't help you improve the efficiency of your programs, but classes can improve your development efficiency and improve your programming habits.
When it comes to encapsulation, it involves good encapsulation and bad encapsulation. How to design your class's properties, methods, that is, how to design the interface of this class, determines how much your class will assist you in your development. If you are not well packaged, the class may not be able to bring you much practical convenience. But if you're good at encapsulation, classes can actually give you a quality boost in your development.
When should you use a class? Basically, the more complex the input and output interfaces of a modular function, the more appropriate it is to encapsulate it into a class. But this is obviously not necessary, you use function, sub also can achieve. If you have tasted the sweetness of a class, you will inevitably be inclined to write these interfaces into a class of complex and functionally independent modules.
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.