• @[email protected]OP
    link
    fedilink
    11 day ago

    Well it’s in the name, they are code smells, not hard rules.

    Regarding the specific example you cited, I think that with practice it becomes gradually more natural to write reusable functions and methods on the first iteration, removing the need for later DRY-related refactorings.

    PS : I love how your quote for the Rule of Three is getting syntax highlighted xD (You can use markdown quotes by starting quoted lines with > )

    • Scratch
      link
      fedilink
      English
      219 hours ago

      The site doesn’t define what a code smell is, though. It’s just a list of Don’t Do’s.

      That’s kind of the nuance I would be hoping for.

      Something like:

      Code Smells are clues that something is amiss. They are not things that always must be ‘fixed’. You as an engineer will, through experience in your own codebase and reading of others, develop a sense of the harm imparted by and the cost of fixing Code Smells. It is up to you and your team to decide what is best for your codebase and project.

      (The rule of 3 formatting was intentional, given the community we’re in)