Composition Over Inheritance
"Composition over Inheritance" (also known as "favor composition over inheritance") is a design principle in object-oriented programming that suggests that classes should achieve new functionality by composing objects of existing classes (i.e., by containing instances of other classes) rather than by inheriting from them. This principle promotes greater flexibility, reduced coupling, and better code reusability.
Extensible AI Chat Structure
For an extensible chat application where users can choose different AI models (e.g., Gemini, OpenAI, and more in the future), a structured approach using Abstract Base Classes (ABCs) and the Factory Pattern is highly effective. This allows you to define a common interface for all AI providers and easily plug in new ones without modifying existing core logic.
SOLID Principles
The SOLID principles are a set of five design principles in object-oriented programming intended to make software designs more understandable, flexible, and maintainable. They were promoted by Robert C. Martin (Uncle Bob) and are widely considered best practices for writing clean, robust, and scalable code.