Day 7

Andrew
1 min readApr 21, 2021

DRY, ETC.

Don’t Repeat Yourself, and make stuff Easier To Change.

Two very simple principles that were mentioned in today’s pages that I can now keep in mind when writing any code.

Well designed and thought-out systems have a “single, unambiguous representation” of knowledge or logic, and are built up of components that can be modified or replaced easily.

An interesting example of this was given with “The Law of Demeter”, a principle that can be summarised as “don’t talk to strangers!”.

This ties in with DRY: every object/module/component of a system should only contain the knowledge it needs, and only request the knowledge it requires.

By doing this, code is more modular, efficient, and much easier to maintain: it’s literally as simple as it can get. The book recommended that upon saving a project, you should ask yourself if DRY and ETC were applied in that session, something which I’ll be doing from now on.

That concludes day 7. See you tomorrow!
#PathToSWE

--

--