# Convention: Coding minimal/required API stubs

**URL:** https://discourse.julialang.org/t/convention-coding-minimal-required-api-stubs/23794
**Category:** General Usage
**Created:** [May 2, 2019, 8:59pm UTC](https://discourse.julialang.org/t/convention-coding-minimal-required-api-stubs/23794 "2019-05-02T20:59:36Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![taqtiqa-mark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/taqtiqa-mark/32/4383_2.png) [@taqtiqa-mark](https://discourse.julialang.org/u/taqtiqa-mark)
#### Post date: [May 2, 2019, 8:59pm UTC](https://discourse.julialang.org/t/convention-coding-minimal-required-api-stubs/23794/1 "2019-05-02T20:59:36Z")

</div>

Hi,  
Is there a convention around implementing/testing a minimal API for a package?

Take [StatsBase.jl/src/statsmodels.jl](https://github.com/JuliaStats/StatsBase.jl/blob/master/src/statmodels.jl) as the example.  
I have read (misread?) that file as indicating: The minimal API functions that a subtype of `StatisticalModel` should implement, to be a (first-class citizen) StatsBase statistical model.

Is that file an example of the Julia convention for setting out a minimal API?

Related is the call to [stop using `error(...)`](https://discourse.julialang.org/t/please-stop-using-error-and-errorexception-in-packages-and-base/12096/1).

Is there a agreed or emerging convention about how to implement such stubs indicating the functions a developer is left to implement?  
Is there an agreed or emerging convention that such minimal API’s should/should-not have tests?

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [May 3, 2019, 4:42am UTC](https://discourse.julialang.org/t/convention-coding-minimal-required-api-stubs/23794/2 "2019-05-03T04:42:25Z")

</div>

When there is no fallback method that makes sense, packages usually just define the generic function, eg

```julia
function coef end

```

which introduces it to the namespace and also allows a docstring. This was introduced in Julia 0.4, and code predating this version may just have a method that throws an error.

Julia has no language facilities for formal description of interfaces, but it is prudent to _document_ them somewhere, either in the package docs, the docstring of an absract type, or a function that serves a trait.
