I'm currently working on an online shop, and I receive from the server objects with a rather complex structure (product, user objects).
What is the best to work with objects with different structure? Is there any design Patterns, or other methods?
Now I reading refactoring guru book and my look is on Facade pattern.
Sometimes in my code there are rows like this
this.product?.masterData.current.masterVariant.prices[0];
or
this.product?.masterData.current.masterVariant.images[0].url || ''
How to properly correct such long lines of code, should I create a separate class for this? And if so, which one?
Aucun commentaire:
Enregistrer un commentaire