What makes a good reusable module?

In the previous section, we looked at the minimum requirements for a reusable module. Let's now examine the ideal requirements for reusability. What would a perfect reusable module look like?

There are three things that distinguish an excellent reusable module from a poor one:

  • It attempts to solve a general problem (or range of problems), rather than just performing a specific task
  • It follows standard conventions that make it easier to use the module elsewhere
  • The module is clearly documented so that other people can easily understand and use it

Let's take a closer look at each of these points.

Solving a general problem

Often when you are programming, you will find that you need a specific task performed, and so you ...

Get Modular Programming with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.