The foundation principles are the principles that must be followed at all the times. The principles are:
- Dell EMC Principle
- OA-AO Principle
- Ease of Use Principle
- Repeatable Principle
- Consistency Principle
- SPORTS Principle
APIs must always be consistent with Dell EMC Systems Management Strategy and Best Practices of the relevant Product lines.
An Operation is a task, job or action that results in a desired end state of the system.
- Do not create multiple APIs for the same operation.
- Do not combine two independent tasks into an API (for example, do not combine Server Configuration and Operating System Deployment into one API)
- For operations taking long time, the API must allow for both synchronous and asynchronous options.
- In synchronous case, the API will wait till the operation completes
- In case of asynchronous case, the API will return immediately with an handle. The user can poll for status using that handle.
- A variant of asynchronous option is to allow the user to specify a callback.
- Have an timeout variable. The API must exit when that timeout occurs. Timeout should be the maximum time that the API will wait altogether in that API (including all loops, waits, retries and internal timeouts). This definition brings confidence to API users that the API will not take more than a fixed time.
- When a timeout occurs, return failure from the API.
- Keep all the APIs modular
- APIs must be transparent to protocol and other internals.
- Remember, the user intent is to perform an action with your system. The user intent is not to achieve the same via a specific protocol
- Protocols just provide you a way to achieve that operation. Just because the system supports multiple protocols, it does not mean you should expose that to user.
- Sometimes a user may want to control the protocol. Provide the users with a concept on preferences - so that users can specify their own protocol choice if they want.
- Design should always assume that users first choice is to do it Dell's way.
- Design should also assume that user may want to try all feasible ways to execute the action as is possible.
- APIs should be easy to use.
- Ease of use is from user point of view.
- If it becomes easier for you if user passes the same parameters multiple times, that is not ease of use. You should provide a way to encapsuate those parameters in a structure.
- Return as much information as possible to user. Leave him to make the choice
- Use simpler and well known datastructures. Don't create you own variant of datastructures. For example, OMSDK uses JSONs everywhere
- Use language constructs to make the life of user easy
- User should be able to catch logical errors as early as possible. Use language constructs as much as possible. Example: OMSDK typemgr code
- APIs must hide complexity and tribal knowledge. Example: Liason Share and Update Share simplify configuration and update use cases
Repeatablility means the ability to call the same API multiple times, resulting in the same end state of the system.
- All APIs that treat multiple entities (users, NICs, Virtual Drives) when called twice should not create duplicate instances.
- An API called twice should not result in different state of the system. For example, calling "Clear Config" any number of times should result in the same behavior: the configuration is cleared
Consistency is the conformity to standard principles all the time.
- APIs must be consistent in naming - function names, API arguments, enumerations etc.
- APIs belonging to similar function must be consistent in return values -
- APIs must be consistent with CRUD and ACID principles.
- APIs must cover well-rounded use cases. Don't just add a Create API. Instead add a Create, Modify, Delete and List APIs. If an API is irrelevant, simply make it as not_implemented.
- APIs must use consistent arguments for the APIs.
- For example, if parameters are passed as individual arguments to Create function, they should be passed as individual arguments to list, modify and delete functions
- On the other hand, if you pass a structure, you should pass a structure to all.
SPORTS is an acronym for Simple, Portable, Optimal, Reliable, Transparent and Scalable
- APIs must be simple. APIs must hide complexity and tribal knowledge from the consumer.
- APIs must be transparent to the platform on which it is executed.
- Avoid C/C++/Native or Platform dependent code.
- If you have plan to write a python wrapper on a C-based tool, how would you support custom Linux installations? Your C-based tool need to be also supported for those Linux Installations as well - is that feasible.
- Instead go with pure-python implementation.
- In that case, as long as python community supports the python in that custom installation, we are good.
- API implementations must be written optimally. Don't write voluminous code which can be written in fewer lines
- APIs must use only reliable dependencies - stable and supported dependent components
- APIs must be transparent to the protocol being used
- APIs must be thread-safe and scalable
- APIs should not allow user to specify parameters if it does not make sense.