4 ms·
Creating good APIs is about developing a good taste and not surprise the user. In your case, the first job of designing the API is done for you by the app. So
by halayli 6y ago
Creating good APIs is about developing a good taste and not surprise the user.
In your case, the first job of designing the API is done for you by the app.
So as a first step, create the foundation layer by mapping the app's API to simple objects that represent the app's API.
Then you can build a layer above to simplify certain operations and build some logic on top.
Think in terms of responsibilities, relationships and who should know about what. That's how you achieve code reuse. When you find yourself reusing your own constructs, it means you've done something right. I find it's often that developers aim for code reusability, but IMHO code reusability is just a natural outcome to good design decisions.
Use your API by writing pseudo code and see if it makes sense.
Keep iterating. Avoid trying to nail it from the first go. IMO, building functionality is more useful than designing a perfect API.