Dan North’s CUPID principles properties are a set of five guiding principles for creating software that is easy to understand, modify, and maintain. The acronym “CUPID” stands for:
- Composable – “plays well with others”: Composable code has classes and functions that are easily combined, assembled in different combinations, to address specific requirements. It is also intention-revealing, requires minimal dependencies and small surface area.
- Unix philosophy – “does one thing well”: Unix is a longstanding operating system (or family of systems) that led to today’s Linux. The Unix philosophy encourages coding components that work well together, each doing one thing and doing it well. Again, a call for simplicity.
- Predictable – “does what you expect”: The goal here is code that is robust, reliable, and resilient. It should also behave as expected. If it looks like X then X is what is should be and do. No unpleasant surprises is the idea here.
- Idiomatic – “feels natural”: Quirky code is out! With CUPID, the code should be understandable by someone else, not just you, the original coder. (To be clear, that “someone else” is an experienced developer who understands the language in use, including its libraries and so on).
- Domain-based – “the solution domain models the problem domain in language and structure”: The code should be compatible with its domain, using the problem domain’s language to avoid the need for future developers to ‘translations’ or cognitive leaps in order to understand it.
Arguably, these properties are designed to complement and build upon the SOLID principles, with a particular focus on the human side of software development. Dan North, however, seems to strongly believe that the SOLID principles are dated and may not apply anymore, and has proposed CUPID as an alternative. By applying the CUPID properties, developers can create software that is not only technically sound and maintainable, but that also aligns with the needs and goals of the people who will be using it.
It is worth referring to Dan North’s original material on the CUPID properties, the back story, and the comparisons with SOLID to make your own judgement.