Closed
Description
Why do you use so much duplicate code?
- For example, you always use each table name as a string, and not the
tableName()
function of each record. Why not calling this function instead of writing the same table name over and over again? Beside the mirgrations, you calltableName()
only on 5 different places. You could reusetableName()
from the record classes at least at over 90 places in the code. - Why do you not use traits? For example, you have properties in Product Record, the same properties in Product Element and the same properties in the Product Query.
- For example, in ProductQuery, function
beforePrepare()
, you have at least 20'commerce_products'
strings in 20 lines. Even more. You could just reuse one string for all places.
And those are just some parts I looked at. I could probably write here another 90 examples..
When writing code you shouldn't repeat yourself (DRY). It seems like your main business is not programming. I don't want to teach you programming, but this code looks like it's written by some interns and you even sell this product.
Metadata
Metadata
Assignees
Labels
No labels