Provable APIs

Speaker: Michael L Perry
Level: 100
Track: None
Time: 10:30 AM - 11:45 AM
Day: 1
Room: DevExpress

Tool vendors like Microsoft are not the only ones who publish APIs. When we create layered software, each layer has an API that is consumed by the next one up. To ensure the quality of our software, we should try to create provable APIs. These are interfaces that guide the caller to the correct usage patterns. They help the compiler help us to verify the correctness of our code.

An unhelpful API throws exceptions whenever we get something wrong. These kinds of APIs can cause stress and lead to bugs that are difficult to correct. There is a right way to call them, but there is also a wrong way. The wrong way still compiles, but it contains bugs nonetheless.

We will look at a set of language features and patterns that help us to prove that our API is being used correctly. Then we'll walk through some examples of unhelpful APIs to see which of these language features we can apply. We will be in Visual Studio during most of this talk.

* Language features and patterns
o Parameters
o Callbacks
o Foreign keys
o Factories
o Constructors
* Examples
o Shopping service
o Cache
o Phone number
o Connection
o Shopping service revisited
o Practice management system