DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Thomas Reggi
Thomas Reggi

Posted on • Updated on

Intentional Design with Maintainability in Mind

A couple years back I posted this tweet:

I think about this idea every time I'm cleaning my shower with a bucket rather then a hose nozzle, or when I'm writing unit tests for a piece of some legacy code not-optimized for testing. How can we make better decisions when it comes to maintainability?

Case in Architecture

I think about this same principle when I see beautiful elaborate industrial or architectural design.

Here's a random picture of a house I found, these top windows near the peak of the roof are solid glass they don't open like a normal window.

beautiful home, with hard to clean windows

How difficult is it to clean the outside of these windows? Is there a specialized window cleaner this homeowner needs to hire? Was there a consideration for cleaning in the design of this house. Now I know this may not be the best example, people with enough money to own beautiful expensive things tend not to clean of those things. But it seems like an absence of thoughtful design.

Case in Code

I'm trying to think of a simple example where this is apparent, but also not trite. One easy trap when writing code is global variables, they can seem an easy fix when your in a pinch. This goes against purely functional principles when it comes to creating a function with a nondeterministic outcome.

let globalState = false

function modifyGlobalState (update: boolean) {
  globalState = update;
}

function useGlobalState () {
  if (x === true) return 'a'
  return 'b'
}
Enter fullscreen mode Exit fullscreen mode

This kind of code is hard to test because of its use of globals. The writer of this code may not be thinking about the ramifications and pain points of testing it.

Luxury Items are Hard to Maintain

I am very sceptical when I see something expensive and beautiful that it will be difficult to maintain, the same with code and apps in a way.

There isn't anything more luxurious than a Bugatti.

Picture of a Bugatti, a $3 million dollar car.

When I think of what it must cost to maintain a Bugatti I think of a chart where cost and maintainability are trade-offs. The thought of caring for a Bugatti, reminds me of a chart like this.

Bell Chart where "cost" is on the bottom and "maintainability" is on the left, with a bell curve rising in the middle then falling back down.

Cheap things are hard to maintain, because they aren't designed for maintainability. Cheap things are designed to minimize cost. Expensive things on the other hand, aren't designed for the owner to maintain, because of the premium on the product people do not prioritize maintainability, the prioritize luxury. There is a sweet spot in the middle, where a products and design can prioritize both.

The Analogue and Digital Connection

When I clean my home I think about what type of dining room chairs would make it easier to clean under the dining room table. I factor that into the decision making process when buying something. Other people may prioritize aesthetic and style, but I'm thinking if all of the chairs will fit upside down on the table top, and how heavy they are.

It's these types of considerations when purchasing a product for your home, or adding a new dependency to your project. It's all the same. Will this thing not only serve its purpose, but will it also be easy to use and maintain over time.

Designer / Maintainer Principle

If the person who is designing the house had to live in it, would they make better decisions about maintainability? I think so. The same goes for testing code. Are there differences in code written with testing in mind then code without?

I think there is a certain empathy and humility involved when the author or designer of something considers maintaining that thing. If was designing a bathroom toilet for instance, I believe it would be valuable to get plumbers to test out fixing it and hear what they have to say. I also think it would be valuable to down and clean the darn thing. Certain problems with a design don't pop up until regular use, I'm looking at you Apple, when the iPhone 4 has signal issues, a bumper-case was released, but the original response was "you're holding the phone the wrong way".

Conclusion

Whether you're writing a new piece of code, or buying a new bathroom toilet brush consider how easy it is to use, and consider how you will maintain and clean it over time.

Top comments (3)

Collapse
 
coryetzkorn profile image
Cory Etzkorn

I really enjoyed this! My favorite part is the cost <> maintainability chart and your thinking around that.

While it's certainly best to aim for "easy to maintain", I don't think we should dismiss the value of the other two sides of the spectrum. It's ok to buy a paper cup as long as you understand it won't last. And it's ok to build a beautiful cabin if you're willing to pay someone extra to climb up to the inaccessible windows.

Some of the most beautiful things are also the least practical. It's incredbily hard to make things that are beautiful, practical, and maintainable.

You'd like these stools.
Stools

Collapse
 
perpetual_education profile image
perpetual . education

That house is so beautiful that it totally shatters any reason for logic... but your point is taken! ;)

Collapse
 
reggi profile image
Thomas Reggi

Hahaha! Yes it is! I was googling around for something absolutely beautiful with nice big windows.

Why You Need to Study Javascript Fundamentals

The harsh reality for JS Developers: If you don't study the fundamentals, you'll be just another β€œCoder”. Top learnings on how to get to the mid/senior level faster as a JavaScript developer by Dragos Nedelcu.