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
asked 2 years ago854 views
1 Answer
0
Accepted Answer
royb
answered 2 years ago
profile picture
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions