CDK code refactoring - best practices regarding constructs vs simple classes - logical IDs and stateful resources

0

Hi, regarding CDK code refactoring - sometimes I would like to create parent classes which will instantiate some child resources. usually I am create a construct - inheriting from Construct e.g. class Parent(Construct)

This has the benefit of adding the parent id to the children ids/names. but also this can cause resources to change logical id when moved around (and thus recreated).

On the other hand, I could use simple classes without inheriting Construct. this will have all the refactoring value, but without the logical id changes, but also without the naming hierarchy.

Are there any other reasons to favor one over the other?

After researching this, i'm adding my take on this below as the answer

1 réponse
0
Réponse acceptée
royb
répondu il y a 2 ans
profile picture
EXPERT
vérifié il y a un mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions