There are as many ways to approach a programming problem as there are programmers, and creating your own components is just another programming task. With that in mind, the following steps represent a fairly comprehensive approach.
To author a component
- Determine what you want your component to accomplish, or what part it will play in your application.
- If you have a more complex component and need an object model, outline the model. For more information, see Component Object-Model Recommendations
- If necessary, divide up functionality between the component and any subobjects or structures in its object model. For more information, see Nested Classes in Components.
- Determine the best class or component to use as a base class for your component. Generally speaking, your base class will already implement many of the properties and methods that your class will need.
- If you have subobjects, determine the best class or component to use as a base class for them.
- Determine what functionality your component can provide by incorporating components from the .NET Framework classes.
- If you need to factor out subsets of your component's functionality as interfaces, determine which classes need to implement them.
- Express functionality as properties, methods, and events of the component and its subobjects or subsidiary structures. For more information, see Implementing Properties, Methods, Members, and Events in Components.
- Assign appropriate access levels (Public, Private, and so on). For more information, see Ways to Implement Component Functionality.
- Test and debug your component. As you add each feature, add features to your test project to exercise the new functionality.
- Repeat, refining the design.