CUPID - Code with Love
Have you already heard about SOLID? Probably yes, but how about CUPID? I’m not talking about the god of desire 😆
Let’s see how CUPID can help us to improve our code.
PS: If you do not know about SOLID yet, I do recommend you to read this article:
Composable
The system or component should integrate well with other components or systems, promoting reusability. It encourages designing software in a way that small, independent modules can be composed together, making it easier to adapt and scale.
Unix Philosophy
This principle borrows from the Unix philosophy, emphasizing that a component should do one thing and do it well. Each part of the software should have a focused responsibility, contributing to simplicity and clarity.
Predictable
The software should behave in an expected manner, making it easier to reason about and work with. When developers or users interact with the system, they should be able to predict its outcomes based on its inputs, avoiding surprises.
Idiomatic
Code should feel natural and conform to the conventions of the programming language or framework being used. It helps improve readability and maintainability by following established best practices and patterns.
Domain-Based
The structure and language of the solution should closely match the problem domain. This means the software should be modeled in a way that mirrors real-world entities and interactions, making it intuitive for developers familiar with the domain.
Conclusion
CUPID is a set of software design principles intended to guide developers in creating clean, maintainable, and effective code. It's an alternative or complement to the more traditional SOLID principles, and emphasizes qualities that make software easier to understand, compose, and evolve.