Building A Wrapper API: The case for abstraction
Aaron Mildenstein
- 対象レベル:
- 中級
- カテゴリ:
- Useful libraries
説明
Suppose that an API already exists for a service you use. Now suppose that you want to make a tool that only uses a subset of that API to make it easier to perform certain tasks in that API. This is a wrapper API: A way to simplify or abstract API functions in a way that your tool doesn't have a lot of repetitive code, and that makes it easy for others to build on or contribute to your tool.
概要
In this talk I'll describe how I got started creating wrapper APIs for Zabbix and Elasticsearch, and how the latter led to the tool called Elasticsearch Curator. I'll cover topics such as:
* Design: Am I reinventing the wheel, or is this really going to be a useful endeavor?
* Classes: When to use them, or whether it makes sense to just stick with a function.
* Keep moving forward: Your code will always evolve, and your skills improve with use. How to make usable code now, and allow yourself space to improve over time, rather than be stuck in "impostor syndrome" purgatory.
* Documentation: How to ensure that others will know how to find your documentation, and be able to understand it so they can use your API
* Project layout and file separation
* Testing: Why you need both unit and integration tests. How to use Travis CI and GitHub to accomplish this
* Publication: PyPI, RPM/DEB and other concerns.