Elf M. Sternberg

Full Stack Web Developer

Where one teaches, two learn.

Tag: #engineering notebook

To all tags

If you're a senior developer, you have to accept some WET code.

In some programming languages there is an essential, powerful tension between two common pieces of advice: Don’t Repeat Yourself and Meaningful Names over Code Comments. Both are really good pieces of advice.

“Don’t Repeat Yourself” (DRY) means that if you can find an abstraction that allows you to avoid repetition in your code, you can remove the need to debug multiple code blocks if you find an error, and you can test the abstraction more reliably and more efficiently. The opposite of DRY is, of course, WET, “Written-out Every Time.”

“Meaningful Names over Code Comments” means that if you have strong, descriptive names for classes, functions, and variables, then code comments are often not merely unnecessary but possibly harmful as they drift out-of-date with the actual content of the code.

At my ${DAY_JOB}, I ran into this conflict in a big way. This example is in Python, but it applies to any language with metalanguage capabilities, which includes Ruby, Lisp, Rust, and even C++.

What I've been reading this past week or so... SICP, Parsing, and Build Tools

Engineering Notebook March 22: OpenAPI/Swagger Stuff!

Engineering Notebook March 20th: GoLang Stuff

Engineering Notebook: Learning Rusts With Too Many Linked Lists!