Better Programming

Advice for programmers.

Follow publication

Member-only story

Risks and Benefits of The 9 Popular Software Design Principles

Martin Thoma
Better Programming
Published in
9 min readJan 3, 2022

Photo by Tim Mossholder on Unsplash

Every software developer with a little bit of experience knows that keeping things simple and stupid (KISS) makes sense. Once you have learned to use classes and functions, you don’t want to repeat yourself — keep things DRY.

The goal of all of those principles is to make software easy to maintain by reducing mental complexity.

№1: Don’t repeat yourself (DRY)

Source: Generated by Martin Thoma via https://imgflip.com/i/5zpvee

DRY is the core of software development. We structure our code in packages and modules. We factor out functions. We try to make the code reusable so that we hopefully have an easier time maintaining it.

Benefit: Complexity reduction. The more code you have, the more you need to maintain. DRY typically leads to less code. This especially means that you only need to adjust once place for typical changes.

Risk: If you do it too much, the code typically gets more complex.

Tooling support: There are programs to find duplicated code. For Python, there is pylint --disable=all --enable=similarities src

№2: You Ain’t Gonna Need It (YAGNI)

Photo by Patrick on Unsplash

YAGNI is the realization that too much abstraction actually harms maintainability. Java devs, I’m looking at you!

Benefit: Complexity reduction. Removing abstractions makes it clearer how the code works.

Risk: If you apply YAGNI too much and thus make too few abstractions, you will have a hard time extending your software. And junior devs might mess with the code in a bad way.

Tooling support: None (maybe once could count references to classes throughout the codebase?)

№3: Keep it Simple and Stupid (KISS)

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Martin Thoma
Martin Thoma

Written by Martin Thoma

I’m a Software Engineer with over 10 years of Python experience (Backend/ML/AI). Support me via https://martinthoma.medium.com/membership

Responses (3)

Write a response