top of page
Writer's pictureRay Christian

DRY- Don't repeat yourself

Any bit of code that you have written (or copy-pasted) twice, whether a single number or an entire method, should be subject to abstraction into a common symbol such that it is only defined or described in one place.


Obvious examples are “magic numbers” that might be reused repeatedly throughout the code; they should be placed in aptly named, discoverable constants.


Less obvious examples are routines, classes, or large passages of code that are only trivially different, usually spawned by a sweeping copy-paste with only tiny modifications being made to the new copy. These can often be abstracted or parametrized in a meaningful way to reduce the amount of code to maintain and reduce the chance for code divergence.

Recent Posts

See All

How we onboarded devs at Psoirée

Developer Onboarding Guide: Onboarding and unblocking new developers RC and EH — 1/25/24 Table of contents Goals Overview Agenda Assets...

Comentarios


bottom of page