Designing robust interfaces is a challenge in distributed systems and solutions and care needs to be taken specially when interfaces span application boundaries. So what do i mean by robust interfaces?
- They encapsulate underlying technology details well - i.e. do not have vendor or platform specific semantics, attributes, and data structures to be part of interface contracts unless absolutely necessary
- They are driven by business constructs and not by technical implementation. Interfaces should reflect business operations and not force a class or object to drive the business operation. This is also referred to as contract-first development.
- They minimize or eliminate calls that are unsafe or leave a system in an invalid state. The interface shouldn't let the caller invoke an operation assuming a previous call has been made to initialize sessions/variables. Why not provide a cleaner operation that performs the right sequence of steps?
- They return meaningful error details - including error code, options for rectification, or even time to retry etc. Simply returning an underlying stack trace ins't always good enough!
This isn't an exhaustive list but the intent is to provide a sense of characteristics associated with well designed interfaces.
Leave a comment