Good Framework Rely on Good Api — — Six API Design principles

walterlv
walterlv
Jun 30, 2018 · 6 min read


API design principles

Easier to understand

Easier to find

Simple task have simple implementation

<InkCanvas x:Name="inkCanvas" />
// The code below is from https://docs.microsoft.com/en-us/windows/uwp/design/input/pen-and-stylus-interactions
// Set supported inking device types.inkCanvas.InkPresenter.InputDeviceTypes =Windows.UI.Core.CoreInputDeviceTypes.Mouse |Windows.UI.Core.CoreInputDeviceTypes.Pen;
// Set initial ink stroke attributes.InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();drawingAttributes.Color = Windows.UI.Colors.Black;drawingAttributes.IgnorePressure = false;drawingAttributes.FitToCurve = true;inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);

Easier to test and to be tested

Easier to keep compatibility even if upgrading frequently

Framework design

References


walterlv

Written by

walterlv

Windows 10 App Developer

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade