Dr. Jaime Niño of the University of New Orleans has produced teaching materials to support his class on API development. This 6-page document covers a lot of the important API topics, from specification, documentation, design, implementation, and testing. These principles are illustrated with reference to the task of creating an API for data containers. Some of the words of advice include:
- Make the specification of the data type for the container as generic as possible
- Specify data containers via interfaces
- The data container interface must provide a cohesive abstraction
- Be consistent
- Be minimal
- Methods names matter
- Favor queries
- Minimize the number of commands
- Favor parameters’ type specified via interface types
- Use appropriate parameters and return types
- Avoid long parameter lists
You can view a PDF of the document here: API Design Principles in CS2.
Comments are closed.