Interface Design

Jump to: navigation, search


Resource Management and Error Handling

C Programming Language

Resources I Haven't Read

Random Thoughts

  • A Google search on "API Design" returns mostly Java focused links in 2009. Users of other programming languages need to actively compensate while reading the materials.
    • Many languages still have namespace pollution problems, e.g. C, Javascript, PHP, GNU octave(?)
  • The solutions to interface design problems are often programming language specific (e.g. error handling) but the problems are similar (e.g. make interface hard to misuse).
  • Work with the standard library and idioms of the language. Especially important if you don't personally know the language well. e.g. many Python bindings to C libraries are problematic in this area.
  • Maintaining an interface with many implementations has a very real cost. If there's only ever going to be one useful implementation of a plugin interface, don't bother having a plugin architecture at all.
  • Concurrency adds other issues, e.g. what functions can I call from the callback I just registered? (c.f. async signal safe functions and signal handlers in POSIX)
    • Documenting concurrency contracts like lock ordering is often omitted.
    • Lock based software are not composable.
    • Examples involving concurrency, resource management and API design: pthread_atfork, thread cancellation.

See Also


blog comments powered by Disqus