Loading...

Computational Frameworks for Political and Social Research with Python by Josh Cutler & Matt Dickenson

Computational Frameworks for Political and Social Research with Python by Josh Cutler & Matt Dickenson

Author:Josh Cutler & Matt Dickenson
Language: eng
Format: epub
ISBN: 9783030368265
Publisher: Springer International Publishing


7.1 Application Programming Interfaces (APIs)

You already knew about APIs before reading this chapter, even if you did not realize it. If we relax the formal definition for a moment and just think of APIs as contracts for message passing, you have already done this when implementing functions. For example, in Python the code:

has a contract to accept the argument bar and print its representation.

Building on this, what should a good API do besides take input and return output? First, it should let the customer know when an error has occurred (and, ideally, how to fix it). Second, an API should only throw documented exceptions. Third, APIs should be self-documenting, meaning that variable and method names are clear and human-readable.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.