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 Resposta
0
Resposta aceita
royb
respondido há 2 anos
profile picture
ESPECIALISTA
avaliado há um mês

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas