API design na iOS
Matt Gemmell sepsal pravidla, která doporučuje pro tvorbu API komponent na iOS. Jedná se o těchto 25 pravidel (podrobně je najdete vysvětlená v Mattově článku):
- Use the local dialect
- Design decoupled
- Required settings should be initializer parameters
- Allow access to initializer parameters
- Comment your header files (including defaults)
- Get up and running in 3 lines
- A fat demo usually means a broken component
- Anticipate customisation scenarios
- More properties, fewer actions
- Use controls in your controls
- Convenient for you is convenient for me
- Magic is OK. Numbers aren’t.
- Limit ‘required’ delegate methods
- Design for accessibility
- Use semantic objects for parameters
- Enhance the API if semantics don’t fit
- Highlighting is interesting
- Optional methods aren’t a commitment
- Always say who’s talking
- Put distinguishing params first in query methods
- Put the sender first in notification methods
- If a convention is broken, throw it away
- Notifications follow delegate methods
- Be generous with notifications’ userInfo
- Test the hell out of it