DEV Community

loading...

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

Collapse
cullophid profile image
Andreas Møller

Read clean code.
Keep it DRY.
Don't write comments.

Collapse
mattwaler profile image
Matt Waler

SO MUCH THIS.

Tired of trying to convince people that creating things as abstractions the first time just leads to very confusing code. A lot of people take DRY way too far, and end up cross-pollenating elements that barely have any resemblance to one another just for the sake of dryness.

Collapse
cullophid profile image
Andreas Møller

Abstractions can be incredibly expensive and should only be created if you are absolutely sure it's the right thing to do

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.