CompSci 307
Spring 2019
Software Design and Implementation

Simulation API Exercise

An Application Programming Interface, API, is simply all the public classes and their public methods in your program. However, thinking about the public methods together as an interface to your program has the power to change how you perceive those methods from just something necessary to make the program functional to providing a service to other programmers (even those on your own team!). An API, then, essentially becomes a contract and developers, now clients, are enticed to use the API because they know they can rely on that contract (even if the underlying implementation changes). Thus, many see API design as the most critical part of designing a program, because it affects the design of other components dependent on them.

Although the concept is inherently subjective, most developers seem to agree on the main desirable characteristics of an API:

This exercise asks you to start the process of changing your thinking from simply programming to API design.

To work on today's exercise, create a file, called doc/API_DISCUSSION.md, using Gitlab's markdown format, within your Simulation team's repository to capture the results of your team's discussion.

API Discovery

Typically there are two kinds of programmers that are interested in your code:

Examine the effective API, all the public methods, from your project and categorize each method from following perspectives (where each sub-module, Simulation, Configuration, and Visualization, within the overall project can be seen as a potential external client of the other's API):

A simplified view of just the public methods for each team is available here.

API Documentation

Most APIs are documented using a standard technique like Javadoc to automatically generate nice looking documentation (like Java's Collections or JavaFX). For this exercise, since you are just starting the process of thinking about APIs, we are not requiring this style of documentation but it will be required for later projects.

Now that you have classified the public methods in the project, describe how to use your discovered APIs (external and internal for the Simulation module) to do the following tasks:

Your written explanation should include both English and Java descriptions of the task:

API Vision

Now that you have a sense of the kind of service your project currently provides to programmers, think about the kind of service you wish it provided. In other words, spend this time designing the API instead of just having it happen.

Think about what classes and methods you can provide that, in addition to upholding the APIE principles of Object-Oriented Design, create a more useful and flexible experience for other programmers. For example, does adding something new require adding new method(s) to class(es) (not closed or easy to discover) or adding a new subclass (more conventional and flexible)?

Using the desirable characteristics of an API listed above, think about the following questions as you design:

Solve the same tasks from the previous section with your new API:

Again, writing both English and Java descriptions of the task as well as a justification for each as to why you think this version is better using your answers to the questions above in this section.

Note, feel free to make as extensive changes as you want because this is a thought exercise — you are not expected to implement this new vision this week.

Submission

At the end of class, use Gitlab's Merge Request to submit your group's doc/API_DISCUSSION.md file to your team's repository. Make sure everyone's NetIDs that worked on it are in the title of your Merge Request.