Skip to content

Code guidelines

Alex Hofsteede edited this page Apr 10, 2014 · 1 revision

Some general comments

  1. Try to keep the public interfaces to classes as simple as possible—​anything that can be private should be

  2. Have very strict validation as part of constructors, then you can proceed confidently elsewhere.

  3. Be consistent in the naming of things. e.g., it looks like "mini" and "takeover" are the names for notif types. Use those names everywhere, not "overapp", "small", "modal", etc.

  4. Please always use . notation when accessing @properties on other objects, and [] when using methods

  5. Internally, always use _property instead of ., unless the functionality (e.g., atomic, strong) of the property is intended

  6. Please alphabetize imports and don’t put random newlines between them. Have a section for non-Mixpanel stuff, then a single, blank line, then a section for Mixpanel stuff.

Before final review

  1. The lib should build with both Base SDK 6 and Base SDK 7. In either case, the tests should run without errors in iPhone and iPad simulators in both iOS 6 and iOS 7.

  2. The tests should include tests for garbage responses from the server

    1. timeout

    2. 500 errors (503, 502)

    3. empty, HTML and plain text response bodies

    4. 400 errors

    5. invalid json

  3. It should pass Analyze with no warnings/errors.

  4. It should pass QA with Leaks running and show no signs of leaking.

Clone this wiki locally