DEV Community

loading...

Discussion on: What is the worst advice for the newbie?

Collapse
ludamillion profile image
Luke Inglis

I always think of there being two kinds of DRY: abstracting DRY and deduplicating DRY.

The first is the more classical DRY that people often think of in OOP extracting shared behavior into reusable objects etc. This is something that can be learned along the way but needn't be focused on as a beginner.

The second is DRYing things up on a more local level like moving multiple instances of the same basic logic within a method that can be called in place of those lines. This I think it is worth learning from the start.

Collapse
cullophid profile image
Andreas Møller

Yeah that makes sense. The problem with the DRY principle is that most of the time you should repeat your self.