Page

16.2.0- Writing Our Own Components

  by NT Community Manager.
Last Updated  by Joel Bush.  

PublicCategorized as 16. Building Script Components for ASP.

Not tagged.
<< 16.1.3- How Components WorkChapter1616.2.1- Using Windows Script Components >>

Writing Our Own Components

We've talked about how components work, and why we want to use components – and hopefully you're now fired up and keen to start writing components of your own! In this chapter, we're going to write some script-based components, each of which provides pieces of related functionality and information (in the form of methods and properties), and we'll write ASP pages that demonstrate our components in action.

 

The good news is that you don't need to learn a new language, such as Visual Basic or C++, in order to write components – because, as I hinted in the previous paragraph, the components in this chapter are script-based components. In order to do this, we will use a technology call Windows Script Components (WSC). A component written using WSC has a file extension .wsc.

 

Components written using WSC work in a similar way to pre-compiled components, but they're a lot easier to use. There is one important difference to note:

 

  • A pre-compiled component is already compiled into binary format before it can be used (like the Ad Rotator component we discussed above).
  • A WSC component is not pre-compiled, and therefore must be compiled at runtime before it can be used.

 

The fact that a WSC component must be compiled at runtime means that it's not as efficient as a pre-compiled component, and also that the code contained in the .wsc file isn't protected from prying eyes (because it's not in a binary format). But for our purposes, this is no problem – because WSC is still very easy to use and is a great way of learning the basics of componentization.

<< 16.1.3- How Components WorkChapter1616.2.1- Using Windows Script Components >>

Copyright © 2003 by Wiley Publishing, Inc.

Powered by Near-TimeTerms of Services | Privacy Policy | Security Policy |