In ASP programming, classes can play a very good role in encapsulation. Although the classes in ASP cannot be truly object-oriented, they are only object-based. However, classes can play a very good role in ASP development, it is still necessary to make good use of it.
Only sub and function can be used to implement class functions, but classes provide more comfortable interface methods. ASP does not have the concept of "namespace". When sub and function are used in many cases, to distinguish these sub and function, long and hard-to-remember names are often used, in addition, sub and function interfaces are rigid, but classes can be greatly improved.
Class cannot help you improve ProgramBut the class can improve your development efficiency and your programming habits.
When it comes to encapsulation, it involves both good encapsulation and bad encapsulation. How to Design the attributes and methods of your class, that is, how to design the interface of this class determines how much your class can assist your development. If your encapsulation is poor, I am afraid the class will not bring much practical convenience to you. But If You encapsulate it well, the class can indeed improve your development quality.
When should classes be used? Basically, the more complex the input and output interfaces of a modular function are, the more appropriate it is to encapsulate it into a class. But this is obviously not necessary. You can implement it using functions and sub. If you have already tasted the sweetness of the class, you will inevitably tend to write the complex interfaces and modules with relatively independent functions into the class.
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