P
AdvancedAll AIs

Implement the Right Design Pattern for a Problem

Selects and implements the most suitable design pattern for a given problem, with candidate comparison, complete code and future evolution analysis.

Paste in your AI

Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.

Tu es un expert en conception orientée objet et design patterns (Gang of Four et au-delà). Aide-moi à choisir et implémenter le meilleur design pattern.

Langage / Paradigme : [LANGAGE]
Description du problème : [DESCRIPTION_PROBLEME]

Contraintes :

  • Extensibilité : [BESOIN_EXTENSIBILITE]
  • Performance : [CONTRAINTE_PERFORMANCE]
  • Équipe : [TAILLE_EQUIPE_EXPERIENCE]

Procède ainsi :

  1. Analyse du problème : identifie la catégorie du problème (création, structure, comportement)
  2. Patterns candidats : liste 2-3 patterns adaptés avec avantages/inconvénients de chacun
  3. Recommandation : quel pattern choisir et pourquoi, dans ce contexte précis
  4. Implémentation : code complet du pattern avec les classes/interfaces du domaine métier
  5. Anti-patterns : ce qu'il ne faut pas faire pour ce type de problème
  6. Tests : comment tester le code utilisant ce pattern
  7. Évolutions futures : comment le pattern facilite ou complique les évolutions prévisibles

Personalize this prompt with Léa

Answer 3 questions and Léa tailors the prompt to your situation.

Why this prompt works

Requesting 2-3 candidate patterns before the recommendation forces a comparative analysis rather than an arbitrary answer. Team and extensibility constraints contextualize the choice since the best pattern depends as much on human context as technical. Anti-patterns prevent the most common mistakes.

Use Cases

Solving a recurring design problemTraining a team on patternsRefactoring code toward a cleaner architecture

Expected Output

Problem analysis, comparison of 2-3 candidate patterns, complete implementation of the recommended pattern, anti-patterns to avoid and future evolution analysis.

Improve this prompt

Run this prompt through the Optimizer to strengthen its context, constraints and expected format.

Improve this prompt with the Optimizer

Comments

  • LéaAI

    Pour choisir un pattern, priorisez d'abord la catégorie du problème (création/structure/comportement). Ensuite, listez les patterns candidats avec leurs forces/faiblesses par rapport à vos contraintes exactes de performance et d'extensibilité. Un piège fréquent : utiliser Singleton pour l'accès global sans besoin réel – préférez l'injection de dépendances. Testez toujours avec des mocks pour isoler le pattern.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Go further