Bill Scott has a great article on designing a component that is worth a read. He talks about his rules of thumb when building something that should be reusable (and nearly everything should):

  • Make the component specific in purpose, yet flexible in use.
  • Avoid the do-everything component. Instead make it do the main thing well. But make it pragmatic by keeping it flexible.

  • Separate the concerns of interface, interaction, and content.
  • Avoid hard-coding visual style, give flexibility in the interaction model and provide flexible ways to manage data content. Keep these three areas independent to allow them to be customized separately.

  • Document the interface and use the component before releasing it.
  • You know the experience. You think you have a great idea. Then when you go to explain it to another person you immediately see the holes in your logic. Documentation provides a way to explain your interface; writing demos allow you to exercise the component to test its ease of use and flexibility.

There’s a lot more detail and examples in the full article.

This kind of thinking has had a big influence on my work on CNET’s global framework and stumbling across this article just recently made me refocus my thoughts on the topic.

a.n.