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

royb
gefragt vor 2 Jahren871 Aufrufe
1 Antwort
0
Akzeptierte Antwort
royb
beantwortet vor 2 Jahren
profile picture
EXPERTE
überprüft vor einem Monat

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen