Skip to content
Vít Mazín edited this page Jan 18, 2020 · 7 revisions

CRCE API creation principles

To create good, maintainable and understandful API in CRCE it has to be build by these principles:

  • Always build API against interface so it could be used as OSGi bundle and other implementations could be provided
  • Whenever it is possible, use design patterns if some pattern is suitable for given problem (for example creating CRCE metadata in MetadataFactory - factory design pattern)
  • Create API so it would be self explain
  • Document API's methods and attributes
  • Let API do one thing properly rather than many things badly - it should be easy to explain its functionality
  • API should minimize exposing informations about implementation
  • If API is exposed outside of CRCE it should be prepared for versioning (for examle like REST API: http://localhost:8080/rest/v2/ where v2 means second version)

One of good example of good program API is Plugin.

Principles are based on book Martin Reddy - API Design for C++ and on presentation from Google developer Joshua Bloch - How to Design a Good API and Why it Matters

Clone this wiki locally