Skip to content

Duplicate Code #623

Closed
Closed
@TheFox

Description

@TheFox

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 call tableName() only on 5 different places. You could reuse tableName() 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions